自测问题
This commit is contained in:
parent
f2ee4035bb
commit
f378e196a0
|
|
@ -76,7 +76,7 @@ public interface SidebandMapper {
|
|||
String queryProjectName(String name);
|
||||
|
||||
/**
|
||||
* 判断边带名称是否存在
|
||||
* 修改时判断边带名称是否存在
|
||||
*
|
||||
* @param vo
|
||||
* @return int
|
||||
|
|
@ -85,6 +85,16 @@ public interface SidebandMapper {
|
|||
*/
|
||||
SidebandVo isExist(SidebandVo vo);
|
||||
|
||||
/**
|
||||
* 修改时判断边带编码是否存在
|
||||
*
|
||||
* @param vo
|
||||
* @return int
|
||||
* @author cwchen
|
||||
* @date 2024/7/17 14:41
|
||||
*/
|
||||
SidebandVo isExistTwo(SidebandVo vo);
|
||||
|
||||
/**
|
||||
* 新增时边带名称是否重复
|
||||
* @param vo
|
||||
|
|
@ -92,6 +102,13 @@ public interface SidebandMapper {
|
|||
*/
|
||||
SidebandVo isNameExist(SidebandVo vo);
|
||||
|
||||
/**
|
||||
* 新增时边带编码是否重复
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
SidebandVo isCodeExist(SidebandVo vo);
|
||||
|
||||
/**
|
||||
* 修改边带信息
|
||||
* @param vo
|
||||
|
|
|
|||
|
|
@ -79,16 +79,14 @@ public class BraceletServiceImpl implements IBraceletService {
|
|||
try {
|
||||
list = braceletMapper.getShBindLists(data);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(list.get(i).getShPersonType()==0){
|
||||
String name = braceletMapper.getBraceletPersonName(list.get(i).getShPersonId());
|
||||
list.get(i).setShPersonName(name);
|
||||
}else if(list.get(i).getShPersonType()==1){
|
||||
String name = braceletMapper.getDeviceLyPersonNameTemp(list.get(i).getShPersonId());
|
||||
list.get(i).setShPersonName(name);
|
||||
if(list.get(i).getShPersonName()==null || list.get(i).getShPersonName().equals("")){
|
||||
list.get(i).setShStatus(1);
|
||||
}else{
|
||||
list.get(i).setShStatus(0);
|
||||
}
|
||||
}
|
||||
if(data.getShPersonName()!=null){
|
||||
listFilter = list.stream().filter(bracelet -> data.getShPersonName().equals(bracelet.getShPersonName())).collect(Collectors.toList());
|
||||
if(data.getShStatus()!=null){
|
||||
listFilter = list.stream().filter(bracelet -> data.getShStatus()==(bracelet.getShStatus())).collect(Collectors.toList());
|
||||
}else{
|
||||
listFilter = list;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* DeviceServiceImpl
|
||||
|
|
@ -50,12 +51,25 @@ 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 list;
|
||||
return listFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -56,16 +56,9 @@ public class SidebandServiceImpl implements ISidebandService {
|
|||
try {
|
||||
list = sidebandMapper.getDeviceLists(data);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(list.get(i).getLyType()==0 && !list.get(i).getDeviceTypeName().equals("手提箱")){
|
||||
String name = sidebandMapper.getDeviceLyName(list.get(i).getLyId());
|
||||
list.get(i).setLyName(name);
|
||||
}else if(list.get(i).getLyType()==1 && !list.get(i).getDeviceTypeName().equals("手提箱")){
|
||||
String name = sidebandMapper.getDeviceLyNameTemp(list.get(i).getLyId());
|
||||
list.get(i).setLyName(name);
|
||||
}
|
||||
if(list.get(i).getLyName()!=null && list.get(i).getDeviceTypeName().equals("手提箱")){
|
||||
if(list.get(i).getLyName()!=null && (!list.get(i).getLyName().equals(""))){
|
||||
list.get(i).setDeviceStatus(0);
|
||||
}else if(list.get(i).getLyName()==null && list.get(i).getDeviceTypeName().equals("手提箱")){
|
||||
}else{
|
||||
list.get(i).setDeviceStatus(1);
|
||||
}
|
||||
}
|
||||
|
|
@ -132,6 +125,10 @@ public class SidebandServiceImpl implements ISidebandService {
|
|||
if (result != null) {
|
||||
return AjaxResult.error("边带名称已存在");
|
||||
}
|
||||
SidebandVo resultTwo = sidebandMapper.isCodeExist(vo);
|
||||
if (resultTwo != null) {
|
||||
return AjaxResult.error("边带编码已存在");
|
||||
}
|
||||
int num = sidebandMapper.addSideband(vo);
|
||||
if(num==1){
|
||||
return AjaxResult.success();
|
||||
|
|
@ -151,7 +148,10 @@ public class SidebandServiceImpl implements ISidebandService {
|
|||
if (result != null) {
|
||||
return AjaxResult.error("边带名称已存在");
|
||||
}
|
||||
|
||||
SidebandVo resultTwo = sidebandMapper.isExistTwo(vo);
|
||||
if (resultTwo != null) {
|
||||
return AjaxResult.error("边带编码已存在");
|
||||
}
|
||||
int num = sidebandMapper.updateSideband(vo);
|
||||
if(num==1){
|
||||
return AjaxResult.success();
|
||||
|
|
|
|||
|
|
@ -39,17 +39,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<!--手环箱绑定手环列表-->
|
||||
<select id="getShBindLists" resultType="com.bonus.common.entity.bracelet.vo.BraceletVo">
|
||||
select id as shId,sh_code as shCode,box_id as shboxId,bid_id as shPersonId,
|
||||
peopel_type as shPersonType,sh_status as shStatus
|
||||
select tb.id as shId,tb.sh_code as shCode,
|
||||
case
|
||||
WHEN tb.peopel_type=0 then tpe.name
|
||||
WHEN tb.peopel_type=1 then tlu.name
|
||||
ELSE ''
|
||||
END AS shPersonName,
|
||||
tb.peopel_type as shPersonType,tb.bid_id as shPersonId
|
||||
from tb_bracelet tb
|
||||
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 and tb.box_id = #{shboxId}
|
||||
<if test="shCode != null and shCode!=''">
|
||||
AND INSTR(tb.sh_code,#{shCode}) > 0
|
||||
</if>
|
||||
<if test="shStatus != null">
|
||||
AND tb.sh_status = #{shStatus}
|
||||
<if test="shPersonName != null and shPersonName!=''">
|
||||
AND (tpe.name=#{shPersonName} or tlu.name=#{shPersonName})
|
||||
</if>
|
||||
order by id ASC
|
||||
order by tb.id ASC
|
||||
</select>
|
||||
|
||||
<!--未绑定手环列表-->
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ 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 td.id as deviceId,td.dev_type as deviceType,td.dev_name as deviceName,td.dev_code as deviceCode,td.dev_status as deviceStatus,
|
||||
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
|
||||
|
|
@ -27,9 +27,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="deviceCode != null and deviceCode!=''">
|
||||
AND INSTR(td.dev_code,#{deviceCode}) > 0
|
||||
</if>
|
||||
<if test="deviceStatus != null">
|
||||
AND td.dev_status = #{deviceStatus}
|
||||
</if>
|
||||
order by td.id ASC
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -32,20 +32,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<!--杆塔绑定设备列表-->
|
||||
<select id="getDeviceLists" resultType="com.bonus.common.entity.bracelet.vo.SidebandDeviceVo">
|
||||
select * from(
|
||||
select * from(
|
||||
select ss.id as sidebandId,ss.sideband_name as sidebandName,td.id as deviceId,td.dev_type as
|
||||
deviceType,td.dev_name as deviceName,
|
||||
td.dev_code as deviceCode,td.dev_status as deviceStatus,tdl.ly_user as lyId,tdl.user_type as lyType,null as
|
||||
lyName,tdd.dict_label AS deviceTypeName
|
||||
td.dev_code as deviceCode,tdl.ly_user as lyId,tdl.user_type as lyType,tdd.dict_label AS deviceTypeName,
|
||||
case
|
||||
WHEN user_type=0 then tpe.name
|
||||
WHEN user_type=1 then tlu.name
|
||||
ELSE ''
|
||||
END AS lyName
|
||||
from sys_sideband ss
|
||||
left join tb_device td on ss.id=td.bind_id and td.del_flag = 0
|
||||
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
|
||||
where ss.id = #{sidebandId} and ss.del_flag = 0 and (td.id is not null or td.id = '')
|
||||
left join tb_people tpe on tdl.ly_user=tpe.id and user_type=0 and tpe.id is not null
|
||||
left join tb_ls_user tlu on tdl.ly_user=tlu.id and user_type=1 and tlu.id is not null
|
||||
where ss.id = #{sidebandId} and ss.del_flag = 0 and (td.id is not null or td.id = '')
|
||||
union all
|
||||
select ss.id as sidebandId,ss.sideband_name as sidebandName,tsb.id as deviceId,'shx' as deviceType,tsb.box_name
|
||||
as deviceName,tsb.box_code as deviceCode,0 as deviceStatus,null as lyId,null as lyType, twt.team_leader as lyName,
|
||||
tdd.dict_label AS deviceTypeName
|
||||
as deviceName,tsb.box_code as deviceCode,null as lyId, null as lyType,
|
||||
tdd.dict_label AS deviceTypeName,twt.team_leader as lyName
|
||||
from sys_sideband ss
|
||||
left join tb_sh_box tsb on ss.id = tsb.bind_id and tsb.del_flag = 0
|
||||
left join sys_dict_data tdd on tdd.dict_value = 'shx' AND tdd .dict_type='sys_device_type'
|
||||
|
|
@ -122,7 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where id = #{name} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<!--判断边带名称是否存在-->
|
||||
<!--修改时判断边带名称是否存在-->
|
||||
<select id="isExist" resultType="com.bonus.common.entity.bracelet.vo.SidebandVo">
|
||||
select ss.id as sidebandId,ss.sideband_name as sidebandName,ss.sideband_code as sidebandCode,project_name as projectName,
|
||||
gt_code as gtCode,bind_time as bindTime,remarks as remarks
|
||||
|
|
@ -130,6 +136,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where ss.sideband_name = #{sidebandName} and ss.id != #{sidebandId} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<!--修改时判断边带编码是否存在-->
|
||||
<select id="isExistTwo" resultType="com.bonus.common.entity.bracelet.vo.SidebandVo">
|
||||
select ss.id as sidebandId,ss.sideband_name as sidebandName,ss.sideband_code as sidebandCode,project_name as projectName,
|
||||
gt_code as gtCode,bind_time as bindTime,remarks as remarks
|
||||
from sys_sideband ss
|
||||
where ss.sideband_code = #{sidebandCode} and ss.id != #{sidebandId} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<update id="updateSideband">
|
||||
UPDATE sys_sideband ss
|
||||
SET sideband_name = #{sidebandName},sideband_code = #{sidebandCode},project_name = #{projectName},
|
||||
|
|
@ -145,6 +159,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where ss.sideband_name = #{sidebandName} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<!--判断新增时边带编码是否存在-->
|
||||
<select id="isCodeExist" resultType="com.bonus.common.entity.bracelet.vo.SidebandVo">
|
||||
select ss.id as sidebandId,ss.sideband_name as sidebandName,ss.sideband_code as sidebandCode,project_name as projectName,
|
||||
gt_code as gtCode,bind_time as bindTime,remarks as remarks
|
||||
from sys_sideband ss
|
||||
where ss.sideband_code = #{sidebandCode} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<!--新增边带信息-->
|
||||
<insert id="addSideband" parameterType="com.bonus.common.entity.bracelet.vo.SidebandVo" >
|
||||
insert into sys_sideband(
|
||||
|
|
|
|||
Loading…
Reference in New Issue