|
@@ -245,16 +245,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
<select id="getDeliverymanList" parameterType="CenterdataTHousingconstructionDeliveryPersonnel" resultType="map">
|
|
|
SELECT
|
|
|
- a.id,
|
|
|
+ a.id escortId,
|
|
|
a.staff_name staffName,
|
|
|
a.phone,
|
|
|
- '送货中' type
|
|
|
+ c.speed,
|
|
|
+ a.enterprise_name enterpriseName,
|
|
|
+ c.car_number carNumber,
|
|
|
+ CASE WHEN b.delivery_name IS NULL THEN '未送货' ELSE '送货中' END AS type
|
|
|
FROM
|
|
|
centerdata_t_housingconstruction_delivery_personnel a
|
|
|
- LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
+ left join (SELECT DISTINCT delivery_id,delivery_name,car_id from centerdata_t_housingconstruction_steelcylinder_log
|
|
|
+ where sign_time is null) b on a.id = b.delivery_id
|
|
|
+ left join centerdata_t_housingconstruction_car c on b.car_id = c.id
|
|
|
+ LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
WHERE a.post = 'personnel_psy'
|
|
|
<if test="enterpriseId != null and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
|
|
|
${params.dataScope}
|
|
|
+ ORDER BY type desc
|
|
|
</select>
|
|
|
|
|
|
<select id="getEnterpriseList" parameterType="CenterdataTHousingconstructionEnterprise" resultType="map">
|
|
@@ -615,4 +622,87 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
WHERE a.enterprise_id = #{enterpriseId}
|
|
|
and b.dict_type = 'enterprise_qualification_file'
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getCarShare" resultType="map">
|
|
|
+ SELECT
|
|
|
+ car_number carNumber,
|
|
|
+ COUNT( car_number ) num,
|
|
|
+ GROUP_CONCAT( enterprise_name ) `enterpriseName`
|
|
|
+ FROM
|
|
|
+ centerdata_t_housingconstruction_car
|
|
|
+ GROUP BY
|
|
|
+ car_number
|
|
|
+ HAVING
|
|
|
+ num > 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getSteelCylinderByCar" parameterType="CenterdataTHousingconstructionCar" resultType="map">
|
|
|
+ SELECT
|
|
|
+ SUBSTRING_INDEX( GROUP_CONCAT( l.steelcylinder_name ORDER BY sign_time DESC ), ',', 1 ) steelcylinderName,
|
|
|
+ u.longitude,
|
|
|
+ u.latitude,
|
|
|
+ u.user_name userName,
|
|
|
+ u.gas_address gasAddress,
|
|
|
+ b.address,
|
|
|
+ a.dept_name deptName,
|
|
|
+ a.id steelcylinderId
|
|
|
+ FROM centerdata_t_housingconstruction_steelcylinder_log l
|
|
|
+ left join centerdata_t_housingconstruction_steelcylinder a on a.id = l.steelcylinder_id
|
|
|
+ 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 = a.dept_id
|
|
|
+ LEFT JOIN (SELECT
|
|
|
+ a.steelcylinder_id,
|
|
|
+ GROUP_CONCAT( b.gas_address ORDER BY a.sign_time DESC SEPARATOR '@_@' ) address
|
|
|
+ FROM
|
|
|
+ centerdata_t_housingconstruction_steelcylinder_log a
|
|
|
+ LEFT JOIN centerdata_t_housingconstruction_realnameuser b ON a.join_house_id = b.id
|
|
|
+ GROUP BY
|
|
|
+ a.steelcylinder_id
|
|
|
+ ) b ON l.steelcylinder_id = b.steelcylinder_id
|
|
|
+ where l.car_id = #{id}
|
|
|
+ and DATE(l.sign_time) = CURDATE()
|
|
|
+ and l.recycling_time is null
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''"> and u.enterprise_id = #{enterpriseId}</if>
|
|
|
+ ${params.dataScope}
|
|
|
+ GROUP BY l.steelcylinder_id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getSteelcylinderArea" parameterType="CenterdataTHousingconstructionStoragetank" resultType="map">
|
|
|
+ SELECT
|
|
|
+ MAX(a.longitude) maxLongitude,
|
|
|
+ MAX(a.latitude) maxLatitude,
|
|
|
+ MIN(a.longitude) minLongitude,
|
|
|
+ MIN(a.latitude) minLatitude
|
|
|
+ FROM
|
|
|
+ (SELECT
|
|
|
+ SUBSTRING_INDEX( GROUP_CONCAT( l.steelcylinder_name ORDER BY sign_time DESC ), ',', 1 ) steelcylinderName,
|
|
|
+ u.longitude,
|
|
|
+ u.latitude
|
|
|
+ FROM
|
|
|
+ centerdata_t_housingconstruction_steelcylinder_log l
|
|
|
+ LEFT JOIN centerdata_t_housingconstruction_realnameuser u ON u.id = l.join_house_id
|
|
|
+ WHERE
|
|
|
+ l.recycling_time IS NULL
|
|
|
+ AND u.longitude IS NOT NULL
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''"> and u.enterprise_id = #{enterpriseId}</if>
|
|
|
+ GROUP BY
|
|
|
+ l.steelcylinder_id ) a
|
|
|
+ having maxLongitude is not null
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getRealnameuserArea" parameterType="CenterdataTHousingconstructionStoragetank" resultType="map">
|
|
|
+ SELECT
|
|
|
+ MAX( a.longitude ) maxLongitude,
|
|
|
+ MAX( a.latitude ) maxLatitude,
|
|
|
+ MIN( a.longitude ) minLongitude,
|
|
|
+ MIN( a.latitude ) minLatitude
|
|
|
+ FROM
|
|
|
+ centerdata_t_housingconstruction_realnameuser a
|
|
|
+ LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
+ WHERE
|
|
|
+ a.longitude IS NOT NULL
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''"> and enterprise_id = #{enterpriseId}</if>
|
|
|
+ ${params.dataScope}
|
|
|
+ having maxLongitude is not null
|
|
|
+ </select>
|
|
|
</mapper>
|