问题修改

This commit is contained in:
hayu 2025-08-13 19:02:01 +08:00
parent 1fef75868b
commit aeb6f957e0
4 changed files with 117 additions and 21 deletions

View File

@ -321,4 +321,12 @@ public class Machine extends BaseEntity {
* 1-工器具2-安全工器具
*/
private int jiJuType;
/**
* 数据来源设备类型
* 1-工器具2-安全工器具
*/
private int devType;
private String type;
}

View File

@ -195,4 +195,13 @@ public interface MachineMapper
* @return
*/
List<Machine> getHisByCodeNew(Machine machine);
/**
* 根据数据
* @param machine
* @return
*/
List<Machine> getElectronicLabelByWsMaInfo(Machine machine);
List<Machine> getHisByCodeNewByWsMaInfo(Machine machine);
}

View File

@ -21,6 +21,7 @@ import com.bonus.material.purchase.config.RemoteConfig;
import com.bonus.material.scrap.domain.ScrapApplyDetails;
import com.bonus.material.scrap.mapper.ScrapApplyDetailsMapper;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.validator.internal.util.StringHelper;
import org.springframework.stereotype.Service;
import com.bonus.material.ma.mapper.MachineMapper;
import com.bonus.material.ma.domain.Machine;
@ -207,7 +208,16 @@ public class MachineServiceImpl implements IMachineService
*/
@Override
public List<Machine> getElectronicLabel(Machine machine) {
List<Machine> list = machineMapper.getElectronicLabel(machine);
List<Machine> list = new ArrayList<>();
try {
if (machine.getDevType()==1){
//查询ws_ma_info,工器具
list = machineMapper.getElectronicLabelByWsMaInfo(machine);
} else {
//查询ma_machine表安全工器具
list = machineMapper.getElectronicLabel(machine);
}
if (CollectionUtils.isNotEmpty(list)) {
for (Machine dto : list) {
// 根据typeId查询信息
@ -228,6 +238,9 @@ public class MachineServiceImpl implements IMachineService
}
}
return list;
} catch (Exception e){
return new ArrayList<>();
}
}
/**
@ -437,7 +450,15 @@ public class MachineServiceImpl implements IMachineService
public AjaxResult getHisByCodeNew(Machine machine) {
try {
List<Machine> result = new ArrayList<>();
List<Machine> maList = machineMapper.getHisByCodeNew(machine);
List<Machine> maList=new ArrayList<>();
if (machine.getDevType()==0){
maList = machineMapper.getHisByCodeNew(machine);
} else if (machine.getDevType()==1){
maList = machineMapper.getHisByCodeNewByWsMaInfo(machine);
} else if (machine.getDevType()==2){
maList = machineMapper.getListByCode(machine);
}
if (CollectionUtils.isNotEmpty(maList)){
if(maList.size() == 1){
Machine baseInfo = maList.get(0);

View File

@ -585,7 +585,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mm.check_man as checkMan,
mm.this_check_time as thisCheckTime,
mm.next_check_time as nextCheckTime,
mm.in_out_num as inOutNum
mm.in_out_num as inOutNum,
mt.jiju_type as devType
FROM
ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
@ -806,7 +807,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mm.next_check_time as nextCheckTime,
mm.in_out_num as inOutNum,
mt.jiju_type as jiJuType,
mt.is_check as isCheck
mt.is_check as isCheck,
'2' as devType
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
@ -836,7 +838,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wmi.next_check_time as nextCheckTime,
'' as inOutNum,
mt.jiju_type as jiJuType,
mt.is_check as isCheck
mt.is_check as isCheck,
'1' as devType
FROM ws_ma_info wmi
LEFT JOIN ma_type mt ON mt.type_id = wmi.model_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
@ -847,4 +850,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LIMIT 100
)
</select>
<select id="getElectronicLabelByWsMaInfo" resultType="com.bonus.material.ma.domain.Machine">
SELECT
wmi.id as maId,
mt2.type_name AS materialName,
mt.type_name AS materialModel,
wmi.ma_code as maCode,
wmi.this_check_time as thisCheckTime,
wmi.next_check_time as nextCheckTime,
wmi.check_man as inspectMan,
wmi.repair_man as checkMan,
wmi.phone,
'合格' AS inspectStatus,
wmi.supplier as maVender,
'0' as isJj,
wmi.model_id as typeId
FROM
ws_ma_info wmi
LEFT JOIN ma_type mt ON mt.type_id = wmi.model_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE
wmi.ma_code like concat('%', #{maCode}, '%')
<if test="maId != null">
and wmi.id = #{maId}
</if>
</select>
<select id="getHisByCodeNewByWsMaInfo" resultType="com.bonus.material.ma.domain.Machine">
SELECT
wmi.id as maId,
mt2.type_name as maName,
mt.type_name as maModel,
wmi.ma_code as maCode,
wmi.qr_code as qrCode,
wmi.model_id as typeId,
'' as maStatus,
wmi.supplier as maVender,
'' as outFacTime,
'' as outFacCode,
'' as assetsCode,
wmi.check_man as checkMan,
wmi.this_check_time as thisCheckTime,
wmi.next_check_time as nextCheckTime,
'' as inOutNum,
mt.jiju_type as jiJuType,
mt.is_check as isCheck,
'1' as devType
FROM ws_ma_info wmi
LEFT JOIN ma_type mt ON mt.type_id = wmi.model_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
WHERE
1=1
<if test="maCode != null"> and wmi.ma_code LIKE CONCAT('%',#{maCode}, '%')</if>
<if test="maId != null">and wmi.id = #{maId}</if>
LIMIT 100
</select>
</mapper>