This commit is contained in:
mashuai 2025-11-16 15:25:17 +08:00
parent c456eb6ce3
commit b3967f7e24
3 changed files with 56 additions and 1 deletions

View File

@ -83,4 +83,10 @@ public class BackCsDeviceDetails {
@ApiModelProperty(value = "设备状态")
private String maStatus;
@ApiModelProperty(value = "项目编号")
private String proCode;
@ApiModelProperty(value = "使用项目")
private String proName;
}

View File

@ -42,6 +42,9 @@ public class BackChangeServiceImpl implements BackChangeService {
@Override
public List<BackCsDeviceDetails> getDevDetailsInfo(BackCsDeviceDetails dto) {
try {
if (StringUtils.isBlank(dto.getProCode())) {
return new ArrayList<>();
}
Long thisLoginUserDeptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
dto.setCompanyId(thisLoginUserDeptId);
return mapper.getDevDetailsInfo(dto);

View File

@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.material.back.mapper.BackChangeMapper">
<insert id="addChangeInfoNew">
<insert id="addChangeInfoNew" keyProperty="id" useGeneratedKeys="true">
insert into cs_device_change(change_status, type, lease_type, pro_code, pro_name,
pro_type, voltage_level, use_unit, pro_province, pro_city,
pro_county, create_time, create_user, del_flag, change_unit, code, use_time,review_status)
@ -148,6 +148,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mdi.type_id AS typeId,
mdi.ma_id AS id
FROM ma_dev_info mdi
LEFT JOIN cs_device_change_details cdc ON mdi.code = cdc.dev_code
LEFT JOIN cs_device_change cd ON cd.id = cdc.change_id
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
@ -171,6 +173,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="companyId != null">
AND mdi.on_company = #{companyId}
</if>
<if test="proCode!=null and proCode!=''">
AND cd.pro_code = #{proCode}
</if>
</where>
UNION ALL
@ -185,12 +190,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
tl.type_id as typeId,
tl.id as id
FROM tool_ledger tl
LEFT JOIN cs_device_change_details cdc ON tl.tool_code = cdc.dev_code
LEFT JOIN cs_device_change cd ON cd.id = cdc.change_id
LEFT JOIN tool_type tt ON tl.type_id = tt.type_id
LEFT JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
LEFT JOIN tool_type tt2 ON tt1.parent_id = tt2.type_id
LEFT JOIN tool_type tt3 ON tt2.parent_id = tt3.type_id
LEFT JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
<where>
tl.manage_mode = '0'
<if test="typeName!=null and typeName!=''">
AND tt1.type_name like concat('%',#{typeName},'%')
</if>
@ -203,6 +211,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="companyId!=null">
AND tl.company_id = #{companyId}
</if>
<if test="proCode!=null and proCode!=''">
AND cd.pro_code = #{proCode}
</if>
</where>
UNION ALL
SELECT CONCAT(tt4.type_name, '>', tt3.type_name, '>', tt2.type_name) as category,
tt1.type_name as typeName,
tt.type_name as typeModelName,
tl.manage_mode as manageType,
IFNULL(tl.tool_code,'/') as devCode,
IFNULL(tl.in_num, 0) as useNum,
2 as devType,
tl.type_id as typeId,
tl.id as id
FROM tool_ledger tl
LEFT JOIN cs_device_change_details cdc ON tl.type_id = cdc.dev_type_id
LEFT JOIN cs_device_change cd ON cd.id = cdc.change_id
LEFT JOIN tool_type tt ON tl.type_id = tt.type_id
LEFT JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
LEFT JOIN tool_type tt2 ON tt1.parent_id = tt2.type_id
LEFT JOIN tool_type tt3 ON tt2.parent_id = tt3.type_id
LEFT JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
<where>
tl.manage_mode = '1'
<if test="typeName!=null and typeName!=''">
AND tt1.type_name like concat('%',#{typeName},'%')
</if>
<if test="typeModelName!=null and typeModelName!=''">
AND tt.type_name like concat('%',#{typeModelName},'%')
</if>
<if test="companyId!=null">
AND tl.company_id = #{companyId}
</if>
<if test="proCode!=null and proCode!=''">
AND cd.pro_code = #{proCode}
</if>
</where>
</select>