|
@@ -124,7 +124,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
FROM
|
|
|
centerdata_t_housingconstruction_realnameuser a
|
|
|
LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
- where 1=1 ${params.dataScope}
|
|
|
+ where 1=1
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''"> and enterprise_id = #{enterpriseId}</if>
|
|
|
+ ${params.dataScope}
|
|
|
UNION ALL
|
|
|
SELECT
|
|
|
'add' type,
|
|
@@ -132,7 +134,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
FROM
|
|
|
centerdata_t_housingconstruction_realnameuser a
|
|
|
LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
- WHERE a.create_time >= DATE_SUB( CURRENT_DATE, INTERVAL 30 DAY )
|
|
|
+ WHERE 1=1
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''"> and enterprise_id = #{enterpriseId}</if>
|
|
|
+ and DATE_FORMAT(a.account_open_time, '%Y-%m-%d') >= DATE_SUB( CURRENT_DATE, INTERVAL 30 DAY )
|
|
|
${params.dataScope}
|
|
|
</select>
|
|
|
|
|
@@ -363,11 +367,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
count( a.id ) num
|
|
|
FROM
|
|
|
centerdata_t_housingconstruction_inspect a
|
|
|
- JOIN ( SELECT steelcylinder_id, MAX( create_time ) max_time
|
|
|
+ JOIN ( SELECT steelcylinder_id, MAX( next_inspect_time ) max_time
|
|
|
FROM centerdata_t_housingconstruction_inspect GROUP BY steelcylinder_id ) b
|
|
|
- ON a.steelcylinder_id = b.steelcylinder_id AND a.create_time = b.max_time
|
|
|
+ ON a.steelcylinder_id = b.steelcylinder_id AND a.next_inspect_time = b.max_time
|
|
|
WHERE
|
|
|
- a.next_inspect_time < DATE( NOW( ) )
|
|
|
+ a.next_inspect_time <= DATE_FORMAT(NOW(),'%Y-%m-%d %h:%m:%s')
|
|
|
<if test="enterpriseId != null and enterpriseId != ''"> and a.dept_id = #{enterpriseId}</if>
|
|
|
</select>
|
|
|
|
|
@@ -393,46 +397,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="state != null and state != ''"> and DATE( b.delivery_time ) = DATE( NOW( ) )</if>
|
|
|
${params.dataScope}-->
|
|
|
<select id="getJoinHouseUserList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">
|
|
|
- SELECT b.gas_address as gasAddress,
|
|
|
- a.steelcylinder_name as steelcylinderName,
|
|
|
- a.join_house_id as joinHouseId,
|
|
|
- a.join_house_name as joinHouseName,
|
|
|
- b.dept_id as id,
|
|
|
- b.dept_name as name,
|
|
|
- a.delivery_time deliveryTime,
|
|
|
- a.delivery_name deliveryName
|
|
|
- FROM (
|
|
|
- SELECT steelcylinder_name, join_house_id, join_house_name, delivery_time, delivery_name FROM centerdata_t_housingconstruction_steelcylinder_log
|
|
|
- <where>
|
|
|
- steelcylinder_id in (
|
|
|
- select id FROM centerdata_t_housingconstruction_steelcylinder
|
|
|
- <where>
|
|
|
- AND state = 'state_4'
|
|
|
- <if test="enterpriseId != null and enterpriseId != ''">
|
|
|
- and enterprise_id = #{enterpriseId}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- )
|
|
|
- <if test="state != null and state != ''">
|
|
|
- and DATE(sign_time) = CURDATE()
|
|
|
- </if>
|
|
|
- <if test="name != null and name != ''">
|
|
|
- and steelcylinder_name like concat('%', #{name}, '%')
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- ) a
|
|
|
- LEFT JOIN (
|
|
|
- SELECT gas_address, id, dept_id, dept_name FROM centerdata_t_housingconstruction_realnameuser
|
|
|
- <where>
|
|
|
- <if test="enterpriseId != null and enterpriseId != ''">
|
|
|
- and enterprise_id = #{enterpriseId}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- ) b on a.join_house_id = b.id
|
|
|
- LEFT JOIN ${database_system}.sys_dept d ON b.dept_id = d.dept_id
|
|
|
+ SELECT
|
|
|
+ SUBSTRING_INDEX( GROUP_CONCAT( l.steelcylinder_name ORDER BY sign_time DESC ), ',', 1 ) steelcylinderName,
|
|
|
+ u.longitude,
|
|
|
+ u.latitude,
|
|
|
+ u.gas_address gasAddress,
|
|
|
+ l.join_house_id as joinHouseId,
|
|
|
+ l.join_house_name as joinHouseName,
|
|
|
+ u.dept_id as id,
|
|
|
+ u.dept_name as name,
|
|
|
+ l.sign_time deliveryTime,
|
|
|
+ l.delivery_name deliveryName
|
|
|
+ FROM
|
|
|
+ centerdata_t_housingconstruction_steelcylinder_log l
|
|
|
+ LEFT JOIN centerdata_t_housingconstruction_realnameuser u ON u.id = l.join_house_id
|
|
|
+ LEFT JOIN ${database_system}.sys_dept d ON d.dept_id = u.dept_id
|
|
|
<where>
|
|
|
- ${params.dataScope}
|
|
|
+ <if test="state != null and state != ''">
|
|
|
+ and DATE(l.sign_time) = CURDATE()
|
|
|
+ </if>
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''"> and u.enterprise_id = #{enterpriseId}</if>
|
|
|
+ <if test="name != null and name != ''"> and l.steelcylinder_name like concat('%', #{name}, '%')</if>
|
|
|
</where>
|
|
|
+ GROUP BY join_house_id
|
|
|
</select>
|
|
|
|
|
|
<select id="getGassourceList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">
|
|
@@ -448,6 +435,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="enterpriseId != null and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
|
|
|
${params.dataScope}
|
|
|
</where>
|
|
|
+ ORDER BY a.join_instation_time desc
|
|
|
</select>
|
|
|
|
|
|
<select id="getSteelcylinderPointList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">
|