This commit is contained in:
mashuai 2025-07-18 16:32:42 +08:00
parent 81b31449dc
commit 96e2cb49e5
3 changed files with 32 additions and 106 deletions

View File

@ -81,9 +81,9 @@ public class BackReceiveServiceImpl implements BackReceiveService {
} }
} }
} }
List<BackApplyInfo> resultList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(backApplyInfos)) { if (CollectionUtils.isNotEmpty(backApplyInfos)) {
for (BackApplyInfo backApplyInfo : backApplyInfos) { for (BackApplyInfo backApplyInfo : backApplyInfos) {
List<BackApplyInfo> resultList = new ArrayList<>();
BackApplyInfo info = new BackApplyInfo(); BackApplyInfo info = new BackApplyInfo();
info.setId(backApplyInfo.getId()); info.setId(backApplyInfo.getId());
List<BackApplyInfo> allApplyInfos = backReceiveMapper.receiveView(info); List<BackApplyInfo> allApplyInfos = backReceiveMapper.receiveView(info);

View File

@ -84,13 +84,13 @@ public class StorageStatusController extends BaseController {
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
// 首先根据typeId查询managerType区分编码和数量设备 // 首先根据typeId查询managerType区分编码和数量设备
List<MaType> list = new ArrayList<>(); List<MaType> list = storageStatusMapper.getUserRecords(bean);
String managerType = storageStatusMapper.getMaType(bean.getTypeId()); /*String managerType = storageStatusMapper.getMaType(bean.getTypeId());
if ("0".equals(managerType)) { if ("0".equals(managerType)) {
list = storageStatusMapper.getUserRecords(bean); list = storageStatusMapper.getUserRecords(bean);
} else { } else {
list = storageStatusMapper.getUserRecordsNum(bean); list = storageStatusMapper.getUserRecordsNum(bean);
} }*/
// 针对于预报废驳回数据进行数据追加,待定 // 针对于预报废驳回数据进行数据追加,待定
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
} }

View File

@ -50,64 +50,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) AS subquery0 ON subquery0.type_id = mt.type_id ) AS subquery0 ON subquery0.type_id = mt.type_id
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
subquery1.type_id,
subquery1.typeName,
subquery1.typeModelName,
IFNULL( subquery1.outNum, 0 ) AS outNum,
IFNULL( subquery2.backNum, 0 ) AS backNum,
CASE
WHEN IFNULL( subquery1.outNum, 0 ) - IFNULL( subquery2.backNum, 0 ) > 0 THEN
IFNULL( subquery1.outNum, 0 ) - IFNULL( subquery2.backNum, 0 ) ELSE 0
END AS usNum
FROM
(
SELECT
mt.type_id, mt.type_id,
mt2.type_name AS typeName, mt2.type_name AS typeName,
mt.type_name AS typeModelName, mt.type_name AS typeModelName,
SUM( SUM(IFNULL( sai.num, 0 )) AS usNum
IFNULL( lod.out_num, 0 )) AS outNum
FROM FROM
lease_out_details lod slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = lod.type_id LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
GROUP BY LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
mt.type_id LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
) AS subquery1 WHERE
LEFT JOIN ( sai.`status` = '0'
SELECT AND sai.end_time IS NULL
mt.type_id, AND sai.back_id IS NULL
mt2.type_name AS typeName, GROUP BY mt.type_id
mt.type_name AS typeModelName,
SUM(
IFNULL( bcd.back_num, 0 )) backNum
FROM
back_check_details bcd
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_machine mm ON mm.ma_id = bcd.ma_id
LEFT JOIN back_apply_info ba ON bcd.parent_id = ba.id
-- WHERE bcd.is_finished IS NOT NULL and bcd.is_finished = '1'
GROUP BY
mt.type_id
) AS subquery2 ON subquery1.type_id = subquery2.type_id
/*LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(
IFNULL( bcd.pre_num, 0 )) backNum
FROM
back_apply_details bcd
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN back_apply_info ba ON bcd.parent_id = ba.id
WHERE ba.back_source = '1'
GROUP BY
mt.type_id
) AS subquery3 ON subquery3.type_id = subquery2.type_id*/
) AS subquery1 ON mt.type_id = subquery1.type_id ) AS subquery1 ON mt.type_id = subquery1.type_id
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
@ -205,58 +162,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="getUserRecords" resultType="com.bonus.sgzb.base.api.domain.MaType"> <select id="getUserRecords" resultType="com.bonus.sgzb.base.api.domain.MaType">
SELECT SELECT
mm.ma_id as maId, bpl.lot_name proName,
subquery1.proName as proName, mt.type_name modelName,
mm.ma_code as maCode, mt2.type_name typeName,
mt.type_name as modelName, SUM(IFNULL( sai.num, 0 )) AS num,
mt2.type_name as typeName, mm.ma_code maCode
IFNULL(subquery1.outNum, 0) - IFNULL(subquery2.backNum, 0) as num
FROM FROM
( slt_agreement_info sai
SELECT LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
lod.ma_id AS maId,
mt.type_id AS typeId,
SUM(IFNULL(lod.out_num, 0)) AS outNum,
bpl.lot_name proName
FROM
lease_out_details lod
LEFT JOIN ma_type mt ON mt.type_id = lod.type_id
LEFT JOIN lease_apply_info lai ON lod.parent_id = lai.id
LEFT JOIN tm_task_agreement tta on lai.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
LEFT JOIN bm_project_lot bpl ON bai.project_id = bpl.lot_id LEFT JOIN bm_project_lot bpl ON bai.project_id = bpl.lot_id
WHERE LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
mt.type_id = #{typeId}
GROUP BY
lod.ma_id, mt.type_id, bpl.lot_name
) AS subquery1
LEFT JOIN
(
SELECT
bcd.ma_id AS maId,
mt.type_id AS typeId,
SUM(IFNULL(bcd.back_num, 0)) AS backNum,
bpl.lot_name proName
FROM
back_check_details bcd
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
LEFT JOIN back_apply_info ba ON bcd.parent_id = ba.id
LEFT JOIN tm_task_agreement tta on ba.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
LEFT JOIN bm_project_lot bpl ON bai.project_id = bpl.lot_id
WHERE
mt.type_id = #{typeId}
GROUP BY
bcd.ma_id, mt.type_id,bpl.lot_name
) AS subquery2 ON subquery1.maId = subquery2.maId
AND subquery1.typeId = subquery2.typeId
AND subquery1.proName = subquery2.proName
LEFT JOIN ma_type mt ON mt.type_id = subquery1.typeId
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_machine mm ON mm.ma_id = subquery1.maId LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
WHERE WHERE
mt.del_flag = 0 sai.type_id = #{typeId}
AND IFNULL(subquery1.outNum, 0) - IFNULL(subquery2.backNum, 0) > 0 AND sai.end_time IS NULL
AND sai.back_id IS NULL
GROUP BY
bpl.lot_name,
mt.type_name,
mt2.type_name,
mm.ma_code
</select> </select>
<select id="getzk" resultType="java.lang.Integer"> <select id="getzk" resultType="java.lang.Integer">
SELECT SELECT