|
@@ -6,11 +6,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
<select id="getGasCylinderList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">
|
|
|
select
|
|
|
- sum(case when state='state_4' then 1 else 0 end) inUse,
|
|
|
- sum(case when state!='state_4' then 1 else 0 end) toUse
|
|
|
+ IFNULL(sum( CASE WHEN state = 'state_4' THEN 1 ELSE 0 END ),0) inUse,
|
|
|
+ IFNULL(sum( CASE WHEN state != 'state_4' THEN 1 ELSE 0 END ),0) toUse
|
|
|
from centerdata_t_housingconstruction_steelcylinder a
|
|
|
LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
- WHERE 1=1 ${params.dataScope}
|
|
|
+ <where>
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''">
|
|
|
+ and a.enterprise_id = #{enterpriseId}
|
|
|
+ </if>
|
|
|
+ ${params.dataScope}
|
|
|
+ </where>
|
|
|
</select>
|
|
|
|
|
|
<select id="getOrderList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">
|
|
@@ -221,31 +226,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</select>
|
|
|
|
|
|
<select id="getStoragetankList" parameterType="CenterdataTHousingconstructionStoragetank" resultType="map">
|
|
|
- SELECT
|
|
|
+ select
|
|
|
a.dept_id enterpriseId,
|
|
|
a.dept_name enterpriseName,
|
|
|
- a.storagetank_id storagetankId,
|
|
|
- a.storagetank_name storagetankName,
|
|
|
- a.level,
|
|
|
- a.heat,
|
|
|
- a.pressure,
|
|
|
- a.gas_leak gasLeak,
|
|
|
- a.security_state securityState,
|
|
|
- a.run_state runState
|
|
|
- FROM
|
|
|
- centerdata_t_housingconstruction_storagetank_log a
|
|
|
- left join centerdata_t_housingconstruction_storagetank b on a.storagetank_id = b.id
|
|
|
- left join ${database_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
|
|
|
- GROUP BY storagetank_id
|
|
|
- ) b ON a.storagetank_id = b.storagetank_id AND a.create_time = b.max_time
|
|
|
+ a.id storagetankId,
|
|
|
+ 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
|
|
|
+ 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
|
|
|
<where>
|
|
|
- <if test="enterpriseId != null and enterpriseId != ''"> and b.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>
|
|
|
${params.dataScope}
|
|
|
</where>
|
|
|
+ GROUP BY a.id
|
|
|
</select>
|
|
|
|
|
|
<select id="getSteelcylinderStateList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">
|