|
@@ -40,9 +40,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
LEFT JOIN centerdata_t_housingconstruction_steelcylinder_log b ON a.id = b.steelcylinder_id
|
|
LEFT JOIN centerdata_t_housingconstruction_steelcylinder_log b ON a.id = b.steelcylinder_id
|
|
WHERE
|
|
WHERE
|
|
YEAR( b.sign_time ) = YEAR( CURRENT_DATE )
|
|
YEAR( b.sign_time ) = YEAR( CURRENT_DATE )
|
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''">
|
|
|
|
+ and a.enterprise_id = #{enterpriseId}
|
|
|
|
+ </if>
|
|
${params.dataScope}
|
|
${params.dataScope}
|
|
- GROUP BY
|
|
|
|
- MONTH( b.sign_time )) b on a.`month` = b.`month`
|
|
|
|
|
|
+ GROUP BY MONTH( b.sign_time )) b on a.`month` = b.`month`
|
|
ORDER BY a.`month`
|
|
ORDER BY a.`month`
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -226,24 +228,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getStoragetankList" parameterType="CenterdataTHousingconstructionStoragetank" resultType="map">
|
|
<select id="getStoragetankList" parameterType="CenterdataTHousingconstructionStoragetank" resultType="map">
|
|
- select
|
|
|
|
- a.dept_id enterpriseId,
|
|
|
|
- a.dept_name enterpriseName,
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ a.enterprise_id enterpriseId,
|
|
|
|
+ a.enterprise_name enterpriseName,
|
|
a.id storagetankId,
|
|
a.id storagetankId,
|
|
a.name storagetankName,
|
|
a.name storagetankName,
|
|
- IFNULL(b.LEVEL, '-') level,
|
|
|
|
- IFNULL(b.heat,'-') heat,
|
|
|
|
- IFNULL(b.pressure,'-') pressure,
|
|
|
|
- IFNULL(b.gas_leak,'-') gasLeak,
|
|
|
|
- IFNULL(b.security_state,'-') securityState,
|
|
|
|
- IFNULL(b.run_state,'-') runState,
|
|
|
|
- MAX(b.create_time) as createTime
|
|
|
|
|
|
+ b.level,
|
|
|
|
+ b.heat,
|
|
|
|
+ b.pressure,
|
|
|
|
+ b.gas_leak gasLeak,
|
|
|
|
+ b.security_state securityState,
|
|
|
|
+ b.run_state runState
|
|
from centerdata_t_housingconstruction_storagetank a
|
|
from centerdata_t_housingconstruction_storagetank a
|
|
- LEFT JOIN centerdata_t_housingconstruction_storagetank_log b ON b.storagetank_id = a.id
|
|
|
|
- LEFT JOIN ${database_system}.sys_dept d on a.dept_id = d.dept_id
|
|
|
|
|
|
+ left join centerdata_t_housingconstruction_storagetank_log b on b.storagetank_id = a.id
|
|
|
|
+ left join onest_system.sys_dept d on a.dept_id = d.dept_id
|
|
|
|
+ <if test="state != null and state != ''">
|
|
|
|
+ JOIN (
|
|
|
|
+ SELECT storagetank_id,MAX(create_time) AS max_time
|
|
|
|
+ FROM centerdata_t_housingconstruction_storagetank_log
|
|
|
|
+ where
|
|
|
|
+ DATE_FORMAT(create_time, '%Y_%m_%d') = CURDATE()
|
|
|
|
+ GROUP BY storagetank_id
|
|
|
|
+ ) c ON b.storagetank_id = c.storagetank_id AND b.create_time = c.max_time
|
|
|
|
+ </if>
|
|
<where>
|
|
<where>
|
|
<if test="enterpriseId != null and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
|
|
<if test="enterpriseId != null and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
|
|
- <if test="state != null and state != ''"> and a.security_state is not null</if>
|
|
|
|
|
|
+ <if test="state != null and state != ''"> and a.security_state !=''</if>
|
|
${params.dataScope}
|
|
${params.dataScope}
|
|
</where>
|
|
</where>
|
|
GROUP BY a.id
|
|
GROUP BY a.id
|