代码提交

This commit is contained in:
itcast 2025-11-26 18:45:06 +08:00
parent 1cf620e929
commit 0635c72f1f
5 changed files with 108 additions and 2 deletions

View File

@ -100,6 +100,14 @@ public class DevChangeController extends BaseController {
util.exportExcel(response, list, "设备流转台账");
}
@ApiOperation(value = "导出设备流转台账")
@PostMapping("/exportR")
public void exportR(HttpServletResponse response, CsDeviceChange csDeviceChange) {
List<CsDeviceChange> list = service.getDevChangeRList(csDeviceChange);
ExcelUtil<CsDeviceChange> util = new ExcelUtil<CsDeviceChange>(CsDeviceChange.class);
util.exportExcel(response, list, "设备流转台账");
}
@ApiOperation(value = "设备流转台账记录")
@GetMapping("/getDevChangeList")

View File

@ -28,7 +28,7 @@ public class CsDeviceChangeVo {
/**
* 变更状前状态
*/
@Excel(name = "流转前状态", width = 20, sort = 4)
//@Excel(name = "流转前状态", width = 20, sort = 4)
private String changeStatusName;
private String changeStatus;
@ -73,7 +73,7 @@ public class CsDeviceChangeVo {
/**
* 使用单位
*/
@Excel(name = "使用单位", width = 25, sort = 6)
@Excel(name = "需求单位", width = 25, sort = 6)
private String useUint;
/**
*

View File

@ -270,4 +270,6 @@ public interface DevChangeMapper {
List<CsDeviceDetails> getDevDetailsInfoTool(CsDeviceDetails dto);
List<CsDeviceDetails> getDevDetailsInfoEquipment(CsDeviceDetails dto);
List<CsDeviceChange> getDevChangeRList(CsDeviceChange vo);
}

View File

@ -535,6 +535,16 @@ public class DevChangeServiceImpl implements DevChangeService {
}
}
@Override
public List<CsDeviceChange> getDevChangeRList(CsDeviceChange vo) {
try {
return mapper.getDevChangeRList(vo);
} catch (Exception e) {
log.error(e.getMessage());
}
return new ArrayList<>();
}
/**
* 获取待出库单子
*

View File

@ -766,6 +766,92 @@
ORDER BY CAST(voltage AS UNSIGNED); -- 将字符串转换为无符号整数
</select>
<select id="getDevChangeRList" resultType="com.bonus.material.devchange.domain.CsDeviceChange">
SELECT
cds.id,
cds.change_status AS changeStatus,
cds.type,
cds.lease_type,
cds.pro_code AS proCode,
cds.pro_name AS proName,
cds.pro_type AS proType,
cds.voltage_level AS voltageLevel,
cds.use_unit AS useUint,
cds.pro_province AS proProvince,
cds.pro_city AS proCity,
cds.pro_county AS proCounty,
cds.pro_location AS proLocation,
cds.create_time AS createTime,
cds.create_user AS createUser,
cds.del_flag,
cds.user_name AS userName,
cds.user_phone AS userPhone,
cds.change_unit AS changeUnit,
-- 修正点:使用 SUM 计算数量总和,并用 IFNULL 处理没有明细的情况
IFNULL(SUM(dcd.num), 0) AS devNum,
CASE
WHEN cds.change_status = 1 THEN '在库'
WHEN cds.change_status = 2 THEN '再用'
WHEN cds.change_status = 3 THEN '退役'
WHEN cds.change_status = 4 THEN '维修'
ELSE '未知'
END AS changeStatusName,
CASE
WHEN cds.type = 1 THEN '入库'
WHEN cds.type = 2 THEN '出库'
WHEN cds.type = 3 THEN '退役'
WHEN cds.type = 4 THEN '维修'
ELSE '未知'
END AS typeName
FROM
cs_device_change cds
LEFT JOIN cs_device_change_details dcd ON dcd.change_id = cds.id
WHERE
cds.del_flag = 0
<if test="keyWord!=null and keyWord!=''">
and (
cds.pro_name like concat('%',#{keyWord},'%') or
cds.voltage_level like concat('%',#{keyWord},'%') or
cds.use_unit like concat('%',#{keyWord},'%') or
cds.pro_province like concat('%',#{keyWord},'%') or
cds.pro_city like concat('%',#{keyWord},'%') or
cds.pro_county like concat('%',#{keyWord},'%') or
cds.create_user like concat('%',#{keyWord},'%') or
cds.pro_location like concat('%',#{keyWord},'%') or
cds.pro_code like concat('%',#{keyWord},'%')
)
</if>
<if test="type!=null and type!=''">
and cds.type=#{type}
</if>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!='' ">
and cds.create_time between #{startTime} and #{endTime}
</if>
GROUP BY
cds.id,
cds.change_status,
cds.type,
cds.lease_type,
cds.pro_code,
cds.pro_name,
cds.pro_type,
cds.voltage_level,
cds.use_unit,
cds.pro_province,
cds.pro_city,
cds.pro_county,
cds.pro_location,
cds.create_time,
cds.create_user,
cds.del_flag,
cds.user_name,
cds.user_phone,
cds.change_unit
ORDER BY
cds.create_time DESC
</select>
<insert id="addChangeInfoNew" keyProperty="id" useGeneratedKeys="true">