Commit f04c907f authored by 竹天卫's avatar 竹天卫

设备品牌筛选 模糊筛选

设备添加时  保证设备编号的唯一性
parent 8053c30b
......@@ -5,7 +5,7 @@
<where>
and t.status != 3
<if test="params.brand != null and params.brand != ''">
and t.brand = #{params.brand}
and t.brand like concat('%', #{params.brand}, '%')
</if>
<if test="params.supplierId != null">
and t.supplier_id = #{params.supplierId}
......@@ -16,7 +16,6 @@
<if test="params.type != null">
and t.type = #{params.type}
</if>
</where>
</sql>
......
......@@ -221,10 +221,10 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
return BaseResponse.errorMsg("设备名称不能为空!");
}
QueryWrapper<Equipment> qw = new QueryWrapper<>();
qw.eq("name", query.getName());
qw.eq("code", query.getCode());
int count = equipmentMapper.selectCount(qw);
if (count > 0) {
return BaseResponse.errorMsg(query.getName() + "已存在");
return BaseResponse.errorMsg(query.getCode() + "已存在");
}
Equipment equipment = new Equipment();
BeanUtils.copyProperties(query, equipment);
......@@ -248,11 +248,11 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
return BaseResponse.errorMsg("设备名称不能为空!");
}
QueryWrapper<Equipment> qw = new QueryWrapper<>();
qw.eq("name", query.getName());
qw.eq("code", query.getCode());
qw.ne("id", query.getId());
int count = equipmentMapper.selectCount(qw);
if (count > 0) {
return BaseResponse.errorMsg(query.getName() + "已存在");
return BaseResponse.errorMsg(query.getCode() + "已存在");
}
Equipment equipmentOld = equipmentMapper.selectById(query.getId());
equipmentOld.setType(query.getType())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment