feat(sip): 添加产品序列号重复校验功能
- 在 DeliveryListMapper 中新增 listBySerialNumberList 方法,用于查询指定序列号列表的产品 - 在 DeliveryListServiceImpl 中实现产品序列号重复校验逻辑 - 如果存在重复序列号,抛出异常并提示用户重新确认master
parent
776b09f886
commit
57d38720d7
|
@ -59,4 +59,6 @@ public interface DeliveryListMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDeliveryListByIds(String[] ids);
|
public int deleteDeliveryListByIds(String[] ids);
|
||||||
|
|
||||||
|
List<DeliveryList> listBySerialNumberList(List<DeliveryList> deliveryList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,11 @@ public class DeliveryListServiceImpl implements IDeliveryListService {
|
||||||
for (DeliveryList list : deliveryList) {
|
for (DeliveryList list : deliveryList) {
|
||||||
list.setDeliveryId(deliveryId);
|
list.setDeliveryId(deliveryId);
|
||||||
}
|
}
|
||||||
|
List<DeliveryList> deliveryLists = deliveryListMapper.listBySerialNumberList(deliveryList);
|
||||||
|
if (!deliveryLists.isEmpty()){
|
||||||
|
throw new ServiceException("产品序列号为[" + deliveryLists.stream().map(DeliveryList::getSerialNumber).collect(Collectors.joining(",")) + "]的产品已存在,请确认后重试;");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
deliveryListMapper.insertBatch(deliveryList);
|
deliveryListMapper.insertBatch(deliveryList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<include refid="selectDeliveryListVo"/>
|
<include refid="selectDeliveryListVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="listBySerialNumberList" resultType="com.ruoyi.sip.domain.DeliveryList">
|
||||||
|
<include refid="selectDeliveryListVo"/>
|
||||||
|
where serial_number in
|
||||||
|
<foreach item="item" index="index" collection="list"
|
||||||
|
open="(" separator="," close=")">
|
||||||
|
#{item.serialNumber}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertDeliveryList" parameterType="DeliveryList" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertDeliveryList" parameterType="DeliveryList" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into delivery_list
|
insert into delivery_list
|
||||||
|
|
Loading…
Reference in New Issue