|
@@ -17,6 +17,7 @@
|
|
|
LEFT JOIN isc_workstation w ON w.id = c.workstation_id
|
|
LEFT JOIN isc_workstation w ON w.id = c.workstation_id
|
|
|
LEFT JOIN ( SELECT o.cabinet_id, count( o.id ) AS open_count FROM isc_cabinet_open_record o
|
|
LEFT JOIN ( SELECT o.cabinet_id, count( o.id ) AS open_count FROM isc_cabinet_open_record o
|
|
|
<where>
|
|
<where>
|
|
|
|
|
+ c.deleted = 0
|
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
|
and o.open_time >= #{startTime}
|
|
and o.open_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
@@ -60,10 +61,11 @@
|
|
|
( CASE WHEN d.bad_count IS NULL THEN 0 ELSE d.bad_count END ) AS bad_count
|
|
( CASE WHEN d.bad_count IS NULL THEN 0 ELSE d.bad_count END ) AS bad_count
|
|
|
FROM
|
|
FROM
|
|
|
isc_materials_type t
|
|
isc_materials_type t
|
|
|
- LEFT JOIN ( SELECT m.materials_type_id, count( m.id ) AS all_count FROM isc_materials m WHERE m.materials_cabinet_id is not null GROUP BY m.materials_type_id ) a ON a.materials_type_id = t.id
|
|
|
|
|
- LEFT JOIN (SELECT m.materials_type_id, count( m.id ) AS will_expire_count FROM isc_materials m WHERE m.materials_cabinet_id is not null and DATE_ADD( NOW(), INTERVAL 30 DAY ) > m.expiration_date AND NOW() < m.expiration_date GROUP BY m.materials_type_id) b ON b.materials_type_id = t.id
|
|
|
|
|
- LEFT JOIN (SELECT m.materials_type_id, count( m.id ) AS expired_count FROM isc_materials m WHERE m.materials_cabinet_id is not null and m.STATUS = '2' GROUP BY m.materials_type_id ) c ON c.materials_type_id = t.id
|
|
|
|
|
- LEFT JOIN (SELECT m.materials_type_id, count( m.id ) AS bad_count FROM isc_materials m WHERE m.materials_cabinet_id is not null and m.STATUS = '1' GROUP BY m.materials_type_id) d ON d.materials_type_id = t.id
|
|
|
|
|
|
|
+ LEFT JOIN ( SELECT m.materials_type_id, count( m.id ) AS all_count FROM isc_materials m WHERE m.deleted = 0 and m.materials_cabinet_id is not null GROUP BY m.materials_type_id ) a ON a.materials_type_id = t.id
|
|
|
|
|
+ LEFT JOIN (SELECT m.materials_type_id, count( m.id ) AS will_expire_count FROM isc_materials m WHERE m.deleted = 0 and m.materials_cabinet_id is not null and DATE_ADD( NOW(), INTERVAL 30 DAY ) > m.expiration_date AND NOW() < m.expiration_date GROUP BY m.materials_type_id) b ON b.materials_type_id = t.id
|
|
|
|
|
+ LEFT JOIN (SELECT m.materials_type_id, count( m.id ) AS expired_count FROM isc_materials m WHERE m.deleted = 0 and m.materials_cabinet_id is not null and m.STATUS = '2' GROUP BY m.materials_type_id ) c ON c.materials_type_id = t.id
|
|
|
|
|
+ LEFT JOIN (SELECT m.materials_type_id, count( m.id ) AS bad_count FROM isc_materials m WHERE m.deleted = 0 and m.materials_cabinet_id is not null and m.STATUS = '1' GROUP BY m.materials_type_id) d ON d.materials_type_id = t.id
|
|
|
|
|
+ where t.deleted = 0
|
|
|
order by t.id asc
|
|
order by t.id asc
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
@@ -82,6 +84,7 @@
|
|
|
LEFT JOIN ( SELECT ma.materials_type_id, count( m.materials_id ) AS all_count FROM
|
|
LEFT JOIN ( SELECT ma.materials_type_id, count( m.materials_id ) AS all_count FROM
|
|
|
isc_materials_loan m LEFT JOIN isc_materials ma on ma.id = m.materials_id
|
|
isc_materials_loan m LEFT JOIN isc_materials ma on ma.id = m.materials_id
|
|
|
<where>
|
|
<where>
|
|
|
|
|
+ m.deleted = 0
|
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
|
and m.create_time >= #{startTime}
|
|
and m.create_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
@@ -94,7 +97,7 @@
|
|
|
LEFT JOIN ( SELECT ma.materials_type_id, count( m.materials_id ) AS return_count FROM
|
|
LEFT JOIN ( SELECT ma.materials_type_id, count( m.materials_id ) AS return_count FROM
|
|
|
isc_materials_loan m LEFT JOIN isc_materials ma on ma.id = m.materials_id
|
|
isc_materials_loan m LEFT JOIN isc_materials ma on ma.id = m.materials_id
|
|
|
<where>
|
|
<where>
|
|
|
- m.actual_restitution_time <= m.reminder_time
|
|
|
|
|
|
|
+ m.deleted = 0 and m.actual_restitution_time <= m.reminder_time
|
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
|
and m.create_time >= #{startTime}
|
|
and m.create_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
@@ -107,7 +110,7 @@
|
|
|
LEFT JOIN ( SELECT ma.materials_type_id, count( m.materials_id ) AS timeout_count FROM
|
|
LEFT JOIN ( SELECT ma.materials_type_id, count( m.materials_id ) AS timeout_count FROM
|
|
|
isc_materials_loan m LEFT JOIN isc_materials ma on ma.id = m.materials_id
|
|
isc_materials_loan m LEFT JOIN isc_materials ma on ma.id = m.materials_id
|
|
|
<where>
|
|
<where>
|
|
|
- m.actual_restitution_time > m.reminder_time
|
|
|
|
|
|
|
+ m.deleted = 0 and m.actual_restitution_time > m.reminder_time
|
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
|
and m.create_time >= #{startTime}
|
|
and m.create_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
@@ -120,6 +123,7 @@
|
|
|
LEFT JOIN ( SELECT ma.materials_type_id, AVG(TIMESTAMPDIFF(SECOND, m.loan_time, m.actual_restitution_time)) AS average_time FROM
|
|
LEFT JOIN ( SELECT ma.materials_type_id, AVG(TIMESTAMPDIFF(SECOND, m.loan_time, m.actual_restitution_time)) AS average_time FROM
|
|
|
isc_materials_loan m LEFT JOIN isc_materials ma on ma.id = m.materials_id
|
|
isc_materials_loan m LEFT JOIN isc_materials ma on ma.id = m.materials_id
|
|
|
<where>
|
|
<where>
|
|
|
|
|
+ m.deleted = 0
|
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
|
and m.create_time >= #{startTime}
|
|
and m.create_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
@@ -128,6 +132,7 @@
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
GROUP BY ma.materials_type_id ) d ON d.materials_type_id = t.id
|
|
GROUP BY ma.materials_type_id ) d ON d.materials_type_id = t.id
|
|
|
|
|
+ where t.deleted = 0
|
|
|
order by t.id asc
|
|
order by t.id asc
|
|
|
</select>
|
|
</select>
|
|
|
<select id="getMaterialsChangeStatistics"
|
|
<select id="getMaterialsChangeStatistics"
|
|
@@ -144,7 +149,7 @@
|
|
|
isc_materials_change_record m
|
|
isc_materials_change_record m
|
|
|
LEFT JOIN isc_materials ma on ma.id = m.old_materials_id
|
|
LEFT JOIN isc_materials ma on ma.id = m.old_materials_id
|
|
|
<where>
|
|
<where>
|
|
|
- (m.check_record_id = null or m.check_record_id = 0)
|
|
|
|
|
|
|
+ m.deleted = 0 and (m.check_record_id = null or m.check_record_id = 0)
|
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
|
and m.create_time >= #{startTime}
|
|
and m.create_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
@@ -160,7 +165,7 @@
|
|
|
LEFT JOIN isc_materials ma on ma.id = m.old_materials_id
|
|
LEFT JOIN isc_materials ma on ma.id = m.old_materials_id
|
|
|
LEFT JOIN isc_materials_check_record mc on mc.id = m.check_record_id
|
|
LEFT JOIN isc_materials_check_record mc on mc.id = m.check_record_id
|
|
|
<where>
|
|
<where>
|
|
|
- mc.reason = '2'
|
|
|
|
|
|
|
+ m.deleted = 0 and mc.reason = '2'
|
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
|
and m.create_time >= #{startTime}
|
|
and m.create_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
@@ -176,7 +181,7 @@
|
|
|
LEFT JOIN isc_materials ma on ma.id = m.old_materials_id
|
|
LEFT JOIN isc_materials ma on ma.id = m.old_materials_id
|
|
|
LEFT JOIN isc_materials_check_record mc on mc.id = m.check_record_id
|
|
LEFT JOIN isc_materials_check_record mc on mc.id = m.check_record_id
|
|
|
<where>
|
|
<where>
|
|
|
- mc.reason = '1'
|
|
|
|
|
|
|
+ m.deleted = 0 and mc.reason = '1'
|
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
|
and m.create_time >= #{startTime}
|
|
and m.create_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
@@ -185,6 +190,7 @@
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
GROUP BY ma.materials_type_id ) c ON c.materials_type_id = t.id
|
|
GROUP BY ma.materials_type_id ) c ON c.materials_type_id = t.id
|
|
|
|
|
+ where t.deleted = 0
|
|
|
order by t.id asc
|
|
order by t.id asc
|
|
|
</select>
|
|
</select>
|
|
|
<select id="getUserLoanStatistics" resultType="cn.iocoder.yudao.module.iscs.controller.admin.statistics.vo.UserLoanStatisticsVO">
|
|
<select id="getUserLoanStatistics" resultType="cn.iocoder.yudao.module.iscs.controller.admin.statistics.vo.UserLoanStatisticsVO">
|
|
@@ -197,9 +203,10 @@
|
|
|
u.id as user_id,
|
|
u.id as user_id,
|
|
|
u.username as user_name,
|
|
u.username as user_name,
|
|
|
u.nickname as nick_name
|
|
u.nickname as nick_name
|
|
|
- FROM isc_materials_loan l LEFT JOIN system_users u ON u.id = l.loan_user_id GROUP BY u.id) a
|
|
|
|
|
|
|
+ FROM isc_materials_loan l LEFT JOIN system_users u ON u.id = l.loan_user_id where l.deleted = 0 GROUP BY u.id) a
|
|
|
LEFT JOIN (SELECT l.loan_user_id, count(l.id) as all_count from isc_materials_loan l
|
|
LEFT JOIN (SELECT l.loan_user_id, count(l.id) as all_count from isc_materials_loan l
|
|
|
<where>
|
|
<where>
|
|
|
|
|
+ l.deleted = 0
|
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
|
and l.create_time >= #{startTime}
|
|
and l.create_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
@@ -210,7 +217,7 @@
|
|
|
GROUP BY l.loan_user_id) b on b.loan_user_id = a.user_id
|
|
GROUP BY l.loan_user_id) b on b.loan_user_id = a.user_id
|
|
|
LEFT JOIN (SELECT l.loan_user_id, count(l.id) as normal_count from isc_materials_loan l
|
|
LEFT JOIN (SELECT l.loan_user_id, count(l.id) as normal_count from isc_materials_loan l
|
|
|
<where>
|
|
<where>
|
|
|
- l.actual_restitution_time <= l.reminder_time
|
|
|
|
|
|
|
+ l.deleted = 0 and l.actual_restitution_time <= l.reminder_time
|
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
|
and l.create_time >= #{startTime}
|
|
and l.create_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
@@ -221,7 +228,7 @@
|
|
|
GROUP BY l.loan_user_id) c on b.loan_user_id = a.user_id
|
|
GROUP BY l.loan_user_id) c on b.loan_user_id = a.user_id
|
|
|
LEFT JOIN (SELECT l.loan_user_id, count(l.id) as timeout_count from isc_materials_loan l
|
|
LEFT JOIN (SELECT l.loan_user_id, count(l.id) as timeout_count from isc_materials_loan l
|
|
|
<where>
|
|
<where>
|
|
|
- l.actual_restitution_time > l.reminder_time
|
|
|
|
|
|
|
+ l.deleted = 0 and l.actual_restitution_time > l.reminder_time
|
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
<if test="startTime != null and startTime.trim != ''">
|
|
|
and l.create_time >= #{startTime}
|
|
and l.create_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
@@ -244,9 +251,9 @@
|
|
|
cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as c
|
|
cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as c
|
|
|
cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as d
|
|
cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as d
|
|
|
) a where a.Date between #{startTime} and #{endTime}) a
|
|
) a where a.Date between #{startTime} and #{endTime}) a
|
|
|
- left join (select count(l.id) as all_count, DATE_FORMAT(l.loan_time, '%Y-%m-%d') as date from isc_materials_loan l group by date) b on b.date = a.Date
|
|
|
|
|
- left join (select count(l.id) as return_count, DATE_FORMAT(l.loan_time, '%Y-%m-%d') as date from isc_materials_loan l where DATE_FORMAT(l.loan_time, '%Y-%m-%d') between #{startTime} and #{endTime} and l.actual_restitution_time <= l.reminder_time group by date) c on c.date = a.Date
|
|
|
|
|
- left join (select count(l.id) as timeout_count, DATE_FORMAT(l.loan_time, '%Y-%m-%d') as date from isc_materials_loan l where DATE_FORMAT(l.loan_time, '%Y-%m-%d') between #{startTime} and #{endTime} and l.actual_restitution_time > l.reminder_time group by date) d on d.date = a.Date
|
|
|
|
|
|
|
+ left join (select count(l.id) as all_count, DATE_FORMAT(l.loan_time, '%Y-%m-%d') as date from isc_materials_loan l where l.deleted = 0 group by date) b on b.date = a.Date
|
|
|
|
|
+ left join (select count(l.id) as return_count, DATE_FORMAT(l.loan_time, '%Y-%m-%d') as date from isc_materials_loan l where l.deleted = 0 and DATE_FORMAT(l.loan_time, '%Y-%m-%d') between #{startTime} and #{endTime} and l.actual_restitution_time <= l.reminder_time group by date) c on c.date = a.Date
|
|
|
|
|
+ left join (select count(l.id) as timeout_count, DATE_FORMAT(l.loan_time, '%Y-%m-%d') as date from isc_materials_loan l where l.deleted = 0 and DATE_FORMAT(l.loan_time, '%Y-%m-%d') between #{startTime} and #{endTime} and l.actual_restitution_time > l.reminder_time group by date) d on d.date = a.Date
|
|
|
ORDER BY a.date DESC
|
|
ORDER BY a.date DESC
|
|
|
</select>
|
|
</select>
|
|
|
<select id="getOngoingJobList" resultType="cn.iocoder.yudao.module.iscs.controller.admin.statistics.vo.OngoingJobVO">
|
|
<select id="getOngoingJobList" resultType="cn.iocoder.yudao.module.iscs.controller.admin.statistics.vo.OngoingJobVO">
|
|
@@ -263,6 +270,7 @@
|
|
|
isc_job_ticket j
|
|
isc_job_ticket j
|
|
|
LEFT JOIN isc_workstation w ON w.id = j.workstation_id
|
|
LEFT JOIN isc_workstation w ON w.id = j.workstation_id
|
|
|
LEFT JOIN isc_machinery ma ON ma.id = j.machinery_id
|
|
LEFT JOIN isc_machinery ma ON ma.id = j.machinery_id
|
|
|
|
|
+ where j.deleted = 0
|
|
|
ORDER BY j.id DESC
|
|
ORDER BY j.id DESC
|
|
|
</select>
|
|
</select>
|
|
|
<select id="getLoanList" resultType="cn.iocoder.yudao.module.iscs.controller.admin.statistics.vo.HomePageLoanVO">
|
|
<select id="getLoanList" resultType="cn.iocoder.yudao.module.iscs.controller.admin.statistics.vo.HomePageLoanVO">
|
|
@@ -277,8 +285,8 @@
|
|
|
cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as c
|
|
cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as c
|
|
|
cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as d
|
|
cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as d
|
|
|
) a where a.Date between #{startTime} and #{endTime}) a
|
|
) a where a.Date between #{startTime} and #{endTime}) a
|
|
|
- left join (select count(l.id) as loan_count, DATE_FORMAT(l.loan_time, '%Y-%m-%d') as date from isc_materials_loan l where DATE_FORMAT(l.loan_time, '%Y-%m-%d') between #{startTime} and #{endTime} group by date) b on b.date = a.Date
|
|
|
|
|
- left join (select count(l.id) as return_count, DATE_FORMAT(l.loan_time, '%Y-%m-%d') as date from isc_materials_loan l where DATE_FORMAT(l.loan_time, '%Y-%m-%d') between #{startTime} and #{endTime} and l.status = "1" group by date) c on c.date = a.Date
|
|
|
|
|
|
|
+ left join (select count(l.id) as loan_count, DATE_FORMAT(l.loan_time, '%Y-%m-%d') as date from isc_materials_loan l where l.deleted = 0 and DATE_FORMAT(l.loan_time, '%Y-%m-%d') between #{startTime} and #{endTime} group by date) b on b.date = a.Date
|
|
|
|
|
+ left join (select count(l.id) as return_count, DATE_FORMAT(l.loan_time, '%Y-%m-%d') as date from isc_materials_loan l where l.deleted = 0 and DATE_FORMAT(l.loan_time, '%Y-%m-%d') between #{startTime} and #{endTime} and l.status = "1" group by date) c on c.date = a.Date
|
|
|
ORDER BY a.date DESC
|
|
ORDER BY a.date DESC
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|