This commit is contained in:
parent
f840b2820a
commit
094971b034
|
|
@ -399,7 +399,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||||
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||||
WHERE
|
WHERE
|
||||||
rad.status = '0'
|
rad.status = '0' and rad.is_ds = '1'
|
||||||
GROUP BY
|
GROUP BY
|
||||||
mt.type_id) AS subquery2 ON subquery2.type_id = mt.type_id
|
mt.type_id) AS subquery2 ON subquery2.type_id = mt.type_id
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
|
|
@ -896,7 +896,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN ma_machine mm ON mm.ma_id = rad.ma_id
|
LEFT JOIN ma_machine mm ON mm.ma_id = rad.ma_id
|
||||||
LEFT JOIN tm_task tt ON rad.task_id = tt.task_id
|
LEFT JOIN tm_task tt ON rad.task_id = tt.task_id
|
||||||
LEFT JOIN back_apply_info bai ON rad.back_id = bai.id
|
LEFT JOIN back_apply_info bai ON rad.back_id = bai.id
|
||||||
WHERE rad.`status` = '0'
|
WHERE rad.`status` = '0' and rad.is_ds = '1'
|
||||||
<if test="typeId != null">
|
<if test="typeId != null">
|
||||||
AND rad.type_id = #{typeId}
|
AND rad.type_id = #{typeId}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -911,7 +911,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
su.nick_name like concat('%',#{keyWord},'%')
|
su.nick_name like concat('%',#{keyWord},'%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
GROUP BY mm.ma_code,tt.`code`,mt.type_id
|
GROUP BY mm.ma_id,tt.`code`,mt.type_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getPurchaseRecordList" resultType="com.bonus.material.basic.domain.PurchaseInputInfo">
|
<select id="getPurchaseRecordList" resultType="com.bonus.material.basic.domain.PurchaseInputInfo">
|
||||||
|
|
@ -922,7 +922,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
mt.buy_price AS buyPrice,
|
mt.buy_price AS buyPrice,
|
||||||
IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 ) AS inputNum,
|
IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 ) AS inputNum,
|
||||||
tt.`code` AS code,
|
tt.`code` AS code,
|
||||||
GROUP_CONCAT( DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ' ) AS maKeeper,
|
keeper.maKeeper AS maKeeper,
|
||||||
pcd.check_time AS checkTime,
|
pcd.check_time AS checkTime,
|
||||||
mt.manage_type as manageType
|
mt.manage_type as manageType
|
||||||
FROM
|
FROM
|
||||||
|
|
@ -930,8 +930,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN ma_type mt ON mt.type_id = pcd.type_id
|
LEFT JOIN ma_type mt ON mt.type_id = pcd.type_id
|
||||||
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 tm_task tt ON pcd.task_id = tt.task_id
|
LEFT JOIN tm_task tt ON pcd.task_id = tt.task_id
|
||||||
LEFT JOIN ma_type_keeper mtk ON mtk.type_id = pcd.type_id
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
mtk.type_id,
|
||||||
|
GROUP_CONCAT(DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ') AS maKeeper
|
||||||
|
FROM ma_type_keeper mtk
|
||||||
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
|
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
|
||||||
|
GROUP BY mtk.type_id -- 按type_id聚合,每个type_id只返回一条记录
|
||||||
|
) keeper ON keeper.type_id = pcd.type_id
|
||||||
WHERE
|
WHERE
|
||||||
pcd.`status` IN ( 3, 4, 13, 14 )
|
pcd.`status` IN ( 3, 4, 13, 14 )
|
||||||
<if test="typeId != null">
|
<if test="typeId != null">
|
||||||
|
|
@ -946,10 +952,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
mt2.type_name AS typeName,
|
mt2.type_name AS typeName,
|
||||||
mt.type_name AS typeModelName,
|
mt.type_name AS typeModelName,
|
||||||
mt.buy_price AS buyPrice,
|
mt.buy_price AS buyPrice,
|
||||||
IFNULL(rid.repair_num, 0) - IFNULL(rid.input_num, 0) AS repairInputNum,
|
IFNULL(rid.repair_num, 0) - IFNULL(rid.input_num, 0) - IFNULL(rid.reject_num, 0) AS repairInputNum,
|
||||||
tt.`code` AS inputCode,
|
tt.`code` AS inputCode,
|
||||||
GROUP_CONCAT(DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ') AS maKeeper,
|
keeper.maKeeper AS maKeeper,
|
||||||
GROUP_CONCAT(DISTINCT su2.nick_name ORDER BY su2.nick_name SEPARATOR ', ') AS repairer,
|
repairer.repairer AS repairer,
|
||||||
rid.create_time as repairInputTime,
|
rid.create_time as repairInputTime,
|
||||||
mm.ma_code as maCode
|
mm.ma_code as maCode
|
||||||
FROM
|
FROM
|
||||||
|
|
@ -957,14 +963,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN ma_type mt ON mt.type_id = rid.type_id
|
LEFT JOIN ma_type mt ON mt.type_id = rid.type_id
|
||||||
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 tm_task tt ON rid.task_id = tt.task_id
|
LEFT JOIN tm_task tt ON rid.task_id = tt.task_id
|
||||||
LEFT JOIN ma_type_keeper mtk ON mtk.type_id = rid.type_id
|
|
||||||
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
|
|
||||||
LEFT JOIN ma_type_repair mtr ON mtr.type_id = rid.type_id
|
|
||||||
LEFT JOIN sys_user su2 ON mtr.user_id = su2.user_id
|
|
||||||
LEFT JOIN repair_apply_details rad ON rid.repair_id = rad.id
|
|
||||||
LEFT JOIN ma_machine mm ON mm.ma_id = rid.ma_id
|
LEFT JOIN ma_machine mm ON mm.ma_id = rid.ma_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
mtk.type_id,
|
||||||
|
GROUP_CONCAT(DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ') AS maKeeper
|
||||||
|
FROM ma_type_keeper mtk
|
||||||
|
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
|
||||||
|
GROUP BY mtk.type_id
|
||||||
|
) keeper ON keeper.type_id = rid.type_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
mtr.type_id,
|
||||||
|
GROUP_CONCAT(DISTINCT su2.nick_name ORDER BY su2.nick_name SEPARATOR ', ') AS repairer
|
||||||
|
FROM ma_type_repair mtr
|
||||||
|
LEFT JOIN sys_user su2 ON mtr.user_id = su2.user_id
|
||||||
|
GROUP BY mtr.type_id
|
||||||
|
) repairer ON repairer.type_id = rid.type_id
|
||||||
WHERE
|
WHERE
|
||||||
rid.`status` IN (0)
|
IFNULL(rid.repair_num, 0) - IFNULL(rid.input_num, 0) - IFNULL(rid.reject_num, 0) > 0
|
||||||
<if test="typeId != null">
|
<if test="typeId != null">
|
||||||
AND rid.type_id = #{typeId}
|
AND rid.type_id = #{typeId}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -973,12 +990,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
mt2.type_name like concat('%',#{keyWord},'%') or
|
mt2.type_name like concat('%',#{keyWord},'%') or
|
||||||
mt.type_name like concat('%',#{keyWord},'%') or
|
mt.type_name like concat('%',#{keyWord},'%') or
|
||||||
tt.`code` like concat('%',#{keyWord},'%') or
|
tt.`code` like concat('%',#{keyWord},'%') or
|
||||||
su.nick_name like concat('%',#{keyWord},'%') or
|
|
||||||
su2.nick_name like concat('%',#{keyWord},'%') or
|
|
||||||
mm.ma_code like concat('%',#{keyWord},'%')
|
mm.ma_code like concat('%',#{keyWord},'%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
GROUP BY mm.ma_code,tt.`code`,mt.type_id
|
GROUP BY mm.ma_id, tt.`code`, mt.type_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectMaCodeByTaskIdAndTypeId" resultType="com.bonus.material.basic.domain.PurchaseInputInfo">
|
<select id="selectMaCodeByTaskIdAndTypeId" resultType="com.bonus.material.basic.domain.PurchaseInputInfo">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue