bug修复
This commit is contained in:
parent
722af680d4
commit
40e6661688
|
|
@ -27,7 +27,7 @@ public class DeviceExportVo {
|
|||
@Excel(name = "设备状态", width = 20.0,height = 15.0,orderNum = "4")
|
||||
private String deviceStatus;
|
||||
|
||||
@Excel(name = "领用人", width = 20.0,height = 15.0,orderNum = "5")
|
||||
@Excel(name = "设备使用人", width = 20.0,height = 15.0,orderNum = "5")
|
||||
private String lyName;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,16 @@ public interface DeviceMapper {
|
|||
*/
|
||||
DeviceVo isExist(DeviceVo vo);
|
||||
|
||||
/**
|
||||
* 判断设备编码是否存在
|
||||
*
|
||||
* @param vo
|
||||
* @return int
|
||||
* @author cwchen
|
||||
* @date 2024/7/17 14:41
|
||||
*/
|
||||
DeviceVo isExistCode(DeviceVo vo);
|
||||
|
||||
/**
|
||||
* 新增时设备名称是否重复
|
||||
* @param vo
|
||||
|
|
@ -59,6 +69,13 @@ public interface DeviceMapper {
|
|||
*/
|
||||
DeviceVo isNameExist(DeviceVo vo);
|
||||
|
||||
/**
|
||||
* 新增时设备编码是否重复
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
DeviceVo isCodeExist(DeviceVo vo);
|
||||
|
||||
/**
|
||||
* 新增时级联编码是否重复
|
||||
* @param vo
|
||||
|
|
|
|||
|
|
@ -48,25 +48,12 @@ public class BraceletServiceImpl implements IBraceletService {
|
|||
@Override
|
||||
public List<BraceletVo> getBraceletLists(BraceletVo data) {
|
||||
List<BraceletVo> list = new ArrayList<>();
|
||||
List<BraceletVo> listFilter = new ArrayList<>();
|
||||
try {
|
||||
list = braceletMapper.getBraceletLists(data);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(list.get(i).getShPersonName()==null || list.get(i).getShPersonName().equals("")){
|
||||
list.get(i).setShStatus(1);
|
||||
}else{
|
||||
list.get(i).setShStatus(0);
|
||||
}
|
||||
}
|
||||
if(data.getShStatus()!=null){
|
||||
listFilter = list.stream().filter(bracelet -> data.getShStatus()==(bracelet.getShStatus())).collect(Collectors.toList());
|
||||
}else{
|
||||
listFilter = list;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return listFilter;
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -120,27 +107,12 @@ public class BraceletServiceImpl implements IBraceletService {
|
|||
@Override
|
||||
public List<ShboxVo> getShboxallLists(ShboxVo data) {
|
||||
List<ShboxVo> list = new ArrayList<>();
|
||||
List<ShboxVo> listFilter = new ArrayList<>();
|
||||
try {
|
||||
list = braceletMapper.getShboxallLists(data);
|
||||
if(data.getShboxStatus()==null){
|
||||
listFilter = list;
|
||||
}else if(data.getShboxStatus()==0){
|
||||
listFilter = list.stream().filter(bracelet -> (bracelet.getLyName()!=null && (!bracelet.getLyName().equals("")))).collect(Collectors.toList());
|
||||
}else {
|
||||
listFilter = list.stream().filter(bracelet -> (bracelet.getLyName()==null || bracelet.getLyName().equals(""))).collect(Collectors.toList());
|
||||
}
|
||||
for (int i = 0; i < listFilter.size(); i++) {
|
||||
if(listFilter.get(i).getLyName()==null || listFilter.get(i).getLyName().equals("")){
|
||||
listFilter.get(i).setShboxStatus(1);
|
||||
}else{
|
||||
listFilter.get(i).setShboxStatus(0);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return listFilter;
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -51,25 +51,13 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||
@Override
|
||||
public List<DeviceVo> getDeviceLists(DeviceVo data) {
|
||||
List<DeviceVo> list = new ArrayList<>();
|
||||
List<DeviceVo> listFilter = new ArrayList<>();
|
||||
try {
|
||||
list = deviceMapper.getDeviceLists(data);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(list.get(i).getLyName()==null || list.get(i).getLyName().equals("")){
|
||||
list.get(i).setDeviceStatus(1);
|
||||
}else{
|
||||
list.get(i).setDeviceStatus(0);
|
||||
}
|
||||
}
|
||||
if(data.getDeviceStatus()!=null){
|
||||
listFilter = list.stream().filter(device -> data.getDeviceStatus()==(device.getDeviceStatus())).collect(Collectors.toList());
|
||||
}else{
|
||||
listFilter = list;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return listFilter;
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -102,6 +90,10 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||
if (result != null) {
|
||||
return AjaxResult.error("设备名称已存在");
|
||||
}
|
||||
DeviceVo resultTwo = deviceMapper.isCodeExist(vo);
|
||||
if (resultTwo != null) {
|
||||
return AjaxResult.error("设备编码已存在");
|
||||
}
|
||||
int num = deviceMapper.addDevice(vo);
|
||||
int numly = deviceMapper.getDeviceLy(vo.getDeviceId());
|
||||
if(numly==0){
|
||||
|
|
@ -224,6 +216,11 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||
return AjaxResult.error("设备名称已存在");
|
||||
}
|
||||
|
||||
DeviceVo resultTwo = deviceMapper.isExistCode(vo);
|
||||
if (resultTwo != null) {
|
||||
return AjaxResult.error("设备编码已存在");
|
||||
}
|
||||
|
||||
int num = deviceMapper.updateDevice(vo);
|
||||
if(num==1){
|
||||
return AjaxResult.success();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<mapper namespace="com.bonus.bracelet.mapper.BraceletMapper">
|
||||
<!--手环列表-->
|
||||
<select id="getBraceletLists" resultType="com.bonus.common.entity.bracelet.vo.BraceletVo">
|
||||
select * from (
|
||||
select tb.id as shId,tb.sh_code as shCode,
|
||||
case
|
||||
WHEN tb.peopel_type=0 then tpe.name
|
||||
|
|
@ -12,6 +13,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ELSE ''
|
||||
END AS shPersonName,
|
||||
case
|
||||
WHEN (tb.peopel_type=0 and (tpe.name is not null and tpe.name!='')) then tb.sh_status=0 and tb.sh_status
|
||||
WHEN (tb.peopel_type=1 and (tlu.name is not null and tlu.name!='')) then tb.sh_status=0 and tb.sh_status
|
||||
ELSE 1
|
||||
END AS shStatus,
|
||||
case
|
||||
WHEN (tsb.box_name is null or tsb.box_name='') then '未绑定'
|
||||
WHEN (tsb.box_name is not null and tsb.box_name!='') then tsb.box_name
|
||||
ELSE '未绑定'
|
||||
|
|
@ -22,19 +28,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join tb_people tpe on tb.bid_id=tpe.id and tb.peopel_type=0
|
||||
left join tb_ls_user tlu on tb.bid_id=tlu.id and tb.peopel_type=1
|
||||
where tb.del_flag = 0
|
||||
<if test="shCode != null and shCode!=''">
|
||||
AND INSTR(tb.sh_code,#{shCode}) > 0
|
||||
</if>
|
||||
<if test="shboxName != null and shboxName!='' and shboxName != '未绑定'">
|
||||
AND INSTR(tsb.box_name,#{shboxName}) > 0
|
||||
</if>
|
||||
<if test="shboxName == '未绑定'">
|
||||
AND (tsb.box_name is null or tsb.box_name='')
|
||||
</if>
|
||||
<if test="shPersonName != null and shPersonName!=''">
|
||||
AND (tpe.name=#{shPersonName} or tlu.name=#{shPersonName})
|
||||
</if>
|
||||
order by tb.id ASC
|
||||
) a
|
||||
<where>
|
||||
<if test="shCode != null and shCode!=''">
|
||||
AND INSTR(a.shCode,#{shCode}) > 0
|
||||
</if>
|
||||
<if test="shboxName != null and shboxName!='' and shboxName != '未绑定'">
|
||||
AND INSTR(a.shboxName,#{shboxName}) > 0
|
||||
</if>
|
||||
<if test="shboxName == '未绑定'">
|
||||
AND (a.shboxName is null or a.shboxName='')
|
||||
</if>
|
||||
<if test="shStatus != null">
|
||||
AND a.shStatus = #{shStatus}
|
||||
</if>
|
||||
</where>
|
||||
order by a.shId ASC
|
||||
</select>
|
||||
|
||||
<!--手环箱绑定手环列表-->
|
||||
|
|
@ -95,20 +107,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<!--手环箱管理页面手环箱列表-->
|
||||
<select id="getShboxallLists" resultType="com.bonus.common.entity.bracelet.vo.ShboxVo">
|
||||
select * from (
|
||||
select tsb.id as shboxId,tsb.box_code as shboxCode,tsb.box_name as shboxName,count(tb.id) as shboxBindNum,
|
||||
tsb.box_capacity as shboxCapacity,twt.team_leader as lyName
|
||||
tsb.box_capacity as shboxCapacity,twt.team_leader as lyName,
|
||||
case
|
||||
when twt.team_leader is not null and twt.team_leader != '' then tsb.team_id = 0 and tsb.team_id
|
||||
else 1
|
||||
end as shboxStatus
|
||||
from tb_sh_box tsb
|
||||
left join t_work_team twt on tsb.team_id = twt.team_id and twt.del_flag = 0
|
||||
left join tb_bracelet tb on tsb.id = tb.box_id and tb.del_flag = 0
|
||||
where tsb.del_flag = 0
|
||||
<if test="shboxName != null and shboxName!=''">
|
||||
AND INSTR(tsb.box_name,#{shboxName}) > 0
|
||||
</if>
|
||||
<if test="shboxCode != null and shboxCode!=''">
|
||||
AND INSTR(tsb.box_code,#{shboxCode}) > 0
|
||||
</if>
|
||||
group by tsb.id
|
||||
order by tsb.id ASC
|
||||
) a
|
||||
<where>
|
||||
<if test="shboxName != null and shboxName!=''">
|
||||
AND INSTR(a.shboxName,#{shboxName}) > 0
|
||||
</if>
|
||||
<if test="shboxCode != null and shboxCode!=''">
|
||||
AND INSTR(a.shboxCode,#{shboxCode}) > 0
|
||||
</if>
|
||||
<if test="shboxStatus != null">
|
||||
AND a.shboxStatus = #{shboxStatus}
|
||||
</if>
|
||||
</where>
|
||||
order by a.shboxId ASC
|
||||
</select>
|
||||
|
||||
<!--手环绑定选择列表-->
|
||||
|
|
|
|||
|
|
@ -5,29 +5,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<mapper namespace="com.bonus.bracelet.mapper.DeviceMapper">
|
||||
<!--设备列表-->
|
||||
<select id="getDeviceLists" resultType="com.bonus.common.entity.bracelet.vo.DeviceVo">
|
||||
select * from (
|
||||
select td.id as deviceId,td.dev_type as deviceType,td.dev_name as deviceName,td.dev_code as deviceCode,
|
||||
tdl.ly_user as lyId,tdl.user_type as lyType,tdd.dict_label AS deviceTypeName,td.dev_index as deviceIndex,
|
||||
case
|
||||
WHEN tdl.user_type=0 then tpe.name
|
||||
WHEN tdl.user_type=1 then tlu.name
|
||||
ELSE ''
|
||||
END AS lyName
|
||||
END AS lyName,
|
||||
case
|
||||
WHEN (tdl.user_type=0 and (tpe.name is not null and tpe.name!='')) then td.dev_status=0 and td.dev_status
|
||||
WHEN (tdl.user_type=1 and (tlu.name is not null and tlu.name!='')) then td.dev_status=0 and td.dev_status
|
||||
ELSE 1
|
||||
END AS deviceStatus
|
||||
from tb_device td
|
||||
left join sys_dict_data tdd on tdd.dict_value=td.dev_type AND tdd.dict_type='sys_device_type'
|
||||
left join tb_dev_ly tdl on td.id = tdl.dev_id
|
||||
left join tb_people tpe on tdl.ly_user=tpe.id and tdl.user_type=0
|
||||
left join tb_ls_user tlu on tdl.ly_user=tlu.id and tdl.user_type=1
|
||||
where td.del_flag = 0
|
||||
) a
|
||||
<where>
|
||||
<if test="deviceType != null and deviceType!=''">
|
||||
AND INSTR(td.dev_type,#{deviceType}) > 0
|
||||
AND INSTR(a.deviceType,#{deviceType}) > 0
|
||||
</if>
|
||||
<if test="deviceName != null and deviceName!=''">
|
||||
AND INSTR(td.dev_name,#{deviceName}) > 0
|
||||
AND INSTR(a.deviceName,#{deviceName}) > 0
|
||||
</if>
|
||||
<if test="deviceCode != null and deviceCode!=''">
|
||||
AND INSTR(td.dev_code,#{deviceCode}) > 0
|
||||
AND INSTR(a.deviceCode,#{deviceCode}) > 0
|
||||
</if>
|
||||
order by td.id ASC
|
||||
<if test="deviceStatus != null ">
|
||||
AND a.deviceStatus = #{deviceStatus}
|
||||
</if>
|
||||
</where>
|
||||
order by a.deviceId ASC
|
||||
</select>
|
||||
|
||||
<!--获取人员管理表中领用人名称-->
|
||||
|
|
@ -60,6 +72,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where td.dev_name = #{deviceName} and td.id != #{deviceId} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<!--判断设备编码是否存在-->
|
||||
<select id="isExistCode" resultType="com.bonus.common.entity.bracelet.vo.DeviceVo">
|
||||
select td.id as deviceId,td.dev_type as deviceType,td.dev_name as deviceName,td.dev_code as deviceCode,td.dev_status as deviceStatus
|
||||
from tb_device td
|
||||
where td.dev_code = #{deviceCode} and td.id != #{deviceId} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<update id="updateDevice">
|
||||
UPDATE tb_device td
|
||||
SET dev_type = #{deviceType},dev_name = #{deviceName},dev_code = #{deviceCode},dev_index = #{deviceIndex},update_time = #{updateTime},update_user = #{updateUser}
|
||||
|
|
@ -73,6 +92,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where td.dev_name = #{deviceName} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<!--判断新增时设备编码是否存在-->
|
||||
<select id="isCodeExist" resultType="com.bonus.common.entity.bracelet.vo.DeviceVo">
|
||||
select td.id as deviceId,td.dev_type as deviceType,td.dev_name as deviceName,td.dev_code as deviceCode,td.dev_status as deviceStatus
|
||||
from tb_device td
|
||||
where td.dev_code = #{deviceCode} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<!--判断新增时设备领用表是否存在-->
|
||||
<select id="getDeviceLy" resultType="java.lang.Integer">
|
||||
select count(dev_id) as count
|
||||
|
|
|
|||
Loading…
Reference in New Issue