代码提交
This commit is contained in:
parent
3fe0fe901d
commit
3f42f95b41
|
|
@ -635,6 +635,7 @@
|
|||
|
||||
LEFT JOIN v_mtp_status vs on mm.ID = vs.maId
|
||||
WHERE 30> to_days(ifnull(mm.NEXT_CHECK_TIME,now())) - to_days(now())
|
||||
group by mm.ID
|
||||
|
||||
|
||||
</select>
|
||||
|
|
@ -692,19 +693,23 @@
|
|||
<select id="getTotalChangeWarn" parameterType="com.bonus.index.beans.IndexTotalWarnBean" resultType="com.bonus.index.beans.IndexTotalWarnBean">
|
||||
SELECT
|
||||
mt.ID,
|
||||
mt2.`NAME` as maType,
|
||||
mt.`NAME` as maName,
|
||||
mt.UNIT as maUnit,
|
||||
mt.is_count as isCount,
|
||||
t1.TIME as time,
|
||||
mt2.`NAME` AS maType,
|
||||
mt.`NAME` AS maName,
|
||||
mt.UNIT AS maUnit,
|
||||
mt.is_count AS isCount,
|
||||
t1.TIME AS time,
|
||||
t1.content
|
||||
FROM ma_total_change t1
|
||||
LEFT JOIN mm_type mt on mt.ID = t1.type_id
|
||||
LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID
|
||||
WHERE NOT EXISTS (
|
||||
LEFT JOIN mm_type mt ON mt.ID = t1.type_id
|
||||
LEFT JOIN mm_type mt2 ON mt.PARENT_ID = mt2.ID
|
||||
WHERE
|
||||
DATEDIFF(NOW(), t1.time) < 30
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM ma_total_change t2
|
||||
WHERE t2.type_id = t1.type_id AND t2.time > t1.time
|
||||
WHERE
|
||||
t2.type_id = t1.type_id
|
||||
AND t2.time > t1.time
|
||||
)
|
||||
<if test="maType != null and maType != ''">
|
||||
and mt2.`NAME` like concat('%', #{maType}, '%')
|
||||
|
|
@ -1387,7 +1392,9 @@
|
|||
LEFT JOIN bm_project bp ON cpa.pro_id = bp.ID
|
||||
LEFT JOIN car_ma_type_info cmti ON cpd.model_id = cmti.id
|
||||
WHERE bp.`NAME` IS NOT NULL
|
||||
and cpa.status = 1
|
||||
and cpa.status = 2
|
||||
and cpa.dispatch_num = 0
|
||||
and cpa.status_type = 1
|
||||
<if test="projectName != null and projectName != ''">
|
||||
and bp.`NAME` like concat('%', #{projectName}, '%')
|
||||
</if>
|
||||
|
|
@ -1414,7 +1421,9 @@
|
|||
LEFT JOIN st_plan_apply spa ON spd.apply_id = spa.id
|
||||
LEFT JOIN bm_project bp ON spa.project_id = bp.ID
|
||||
WHERE bp.`NAME` IS NOT NULL
|
||||
and spa.status = 1
|
||||
and spa.status = 2
|
||||
and spa.ck_num = 0
|
||||
and spa.status_type = 1
|
||||
<if test="projectName != null and projectName != ''">
|
||||
and bp.`NAME` like concat('%', #{projectName}, '%')
|
||||
</if>
|
||||
|
|
@ -1442,7 +1451,8 @@
|
|||
LEFT JOIN t_plan_apply tpa on tpa.id=tpd.apply_id
|
||||
LEFT JOIN bm_project pro on tpa.project_id=pro.ID
|
||||
WHERE pro.`NAME` is not null
|
||||
and tpa.status = 1
|
||||
and tpa.status = 2
|
||||
and tpa.status_type = 1
|
||||
<if test="maName != null and maName != ''">
|
||||
and tpd.`NAME` like concat('%', #{maName}, '%')
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -198,21 +198,30 @@
|
|||
SELECT
|
||||
0 AS storageNum,
|
||||
0 AS checkNum,
|
||||
COUNT(DISTINCT maId) as useNum,
|
||||
0 as changeNum
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
DISTINCT ps.machine as maId,
|
||||
to_days(now()) -to_days(ps.start_date) as days
|
||||
COUNT(*) AS useNum,
|
||||
0 AS changeNum
|
||||
FROM (
|
||||
SELECT 1
|
||||
FROM
|
||||
ma_type_project_storage ps
|
||||
LEFT JOIN mm_machines mm on ps.machine = mm.ID
|
||||
WHERE ps.`status` =1 and ps.is_count = 0
|
||||
and mm.BATCH_STATUS = 6
|
||||
GROUP BY ps.machine
|
||||
) rs
|
||||
WHERE rs.days> 180
|
||||
INNER JOIN mm_machines mm ON ps.machine = mm.ID
|
||||
INNER JOIN mm_type mt ON mm.TYPE = mt.ID
|
||||
LEFT JOIN mm_type mt2 ON mt.PARENT_ID = mt2.ID
|
||||
LEFT JOIN wf_lease_agreement wla ON ps.agreement_id = wla.ID
|
||||
LEFT JOIN bm_project bp ON wla.PROJECT = bp.ID
|
||||
LEFT JOIN bm_company bc ON bp.COMPANY_ID = bc.ID
|
||||
WHERE
|
||||
ps.status = 1
|
||||
AND ps.end_date IS NULL
|
||||
AND mm.BATCH_STATUS = 6
|
||||
AND DATEDIFF(NOW(), ps.start_date) > 180
|
||||
GROUP BY
|
||||
mt.ID,
|
||||
mt2.ID,
|
||||
wla.ID,
|
||||
bp.ID,
|
||||
bc.ID
|
||||
) AS t
|
||||
UNION
|
||||
|
||||
SELECT
|
||||
|
|
|
|||
Loading…
Reference in New Issue