|
@@ -241,17 +241,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
b.security_state securityState,
|
|
|
b.run_state runState
|
|
|
from centerdata_t_housingconstruction_storagetank a
|
|
|
- left join centerdata_t_housingconstruction_storagetank_log b on b.storagetank_id = a.id
|
|
|
+ left join (SELECT
|
|
|
+ b.storagetank_id,
|
|
|
+ b.level,
|
|
|
+ b.heat,
|
|
|
+ b.pressure,
|
|
|
+ b.gas_leak,
|
|
|
+ b.security_state,
|
|
|
+ b.run_state
|
|
|
+ from centerdata_t_housingconstruction_storagetank_log b
|
|
|
+ jOIN (
|
|
|
+ SELECT storagetank_id,MAX(create_time) AS max_time
|
|
|
+ FROM centerdata_t_housingconstruction_storagetank_log
|
|
|
+ <if test="state != null and state != ''">
|
|
|
+ where DATE_FORMAT(create_time, '%Y_%m_%d') = CURDATE()
|
|
|
+ </if>
|
|
|
+ GROUP BY storagetank_id
|
|
|
+ ) c ON b.storagetank_id = c.storagetank_id AND b.create_time = c.max_time) b on b.storagetank_id = a.id
|
|
|
left join onest_system.sys_dept d on a.dept_id = d.dept_id
|
|
|
- JOIN (
|
|
|
- SELECT storagetank_id,MAX(create_time) AS max_time
|
|
|
- FROM centerdata_t_housingconstruction_storagetank_log
|
|
|
- <if test="state != null and state != ''">
|
|
|
- where
|
|
|
- DATE_FORMAT(create_time, '%Y_%m_%d') = CURDATE()
|
|
|
- </if>
|
|
|
- GROUP BY storagetank_id
|
|
|
- ) c ON b.storagetank_id = c.storagetank_id AND b.create_time = c.max_time
|
|
|
<where>
|
|
|
<if test="enterpriseId != null and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
|
|
|
<if test="state != null and state != ''"> and b.security_state !=''</if>
|