|
|
@@ -104,6 +104,14 @@ public class TauvEquipmentServiceImpl extends BaseServiceImpl<TauvEquipmentMappe |
|
|
|
if (equipment == null || equipment.getId() == null) { |
|
|
|
return response.failure("实体对象不能为空"); |
|
|
|
} |
|
|
|
// 产品需要唯一性验证 |
|
|
|
QueryWrapper<TauvEquipment> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("product_sn", equipment.getProductSn()); |
|
|
|
queryWrapper.eq("mark", 1); |
|
|
|
Integer count = equipmentMapper.selectCount(queryWrapper); |
|
|
|
if (count > 0) { |
|
|
|
return response.failure("产品序号已存在"); |
|
|
|
} |
|
|
|
boolean result = this.editData(equipment); |
|
|
|
if (!result) { |
|
|
|
return response.failure("编辑失败"); |
|
|
@@ -122,6 +130,14 @@ public class TauvEquipmentServiceImpl extends BaseServiceImpl<TauvEquipmentMappe |
|
|
|
if (equipment == null) { |
|
|
|
return response.failure("实体对象不能为空"); |
|
|
|
} |
|
|
|
// 产品需要唯一性验证 |
|
|
|
QueryWrapper<TauvEquipment> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("product_sn", equipment.getProductSn()); |
|
|
|
queryWrapper.eq("mark", 1); |
|
|
|
Integer count = equipmentMapper.selectCount(queryWrapper); |
|
|
|
if (count > 0) { |
|
|
|
return response.failure("产品序号已存在"); |
|
|
|
} |
|
|
|
boolean result = this.addData(equipment); |
|
|
|
if (!result) { |
|
|
|
return response.failure("添加失败"); |