2020-03-26 00:00:48 +08:00
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.cm.inspection.dao.enterpriseofgridoperator.IEnterpriseOfGridOperatorDao">
|
|
|
|
|
|
|
|
|
|
<resultMap id="enterpriseOfGridOperatorDTO" type="com.cm.inspection.pojo.dtos.enterpriseofgridoperator.EnterpriseOfGridOperatorDTO">
|
|
|
|
|
<id column="enterprise_of_grid_operator_id" property="enterpriseOfGridOperatorId"/>
|
|
|
|
|
<result column="user_id" property="userId"/>
|
|
|
|
|
<result column="enterprise_id" property="enterpriseId"/>
|
|
|
|
|
<result column="name_join_by_enterprise_id" property="nameJoinByEnterpriseId"/>
|
|
|
|
|
<result column="type_join_by_enterprise_id" property="typeJoinByEnterpriseId"/>
|
2020-03-28 23:13:59 +08:00
|
|
|
|
<result column="type_dictionary_name" property="typeDictionaryName"/>
|
2020-03-26 00:00:48 +08:00
|
|
|
|
<result column="area1_join_by_enterprise_id" property="area1JoinByEnterpriseId"/>
|
2020-03-28 23:13:59 +08:00
|
|
|
|
<result column="area1_dictionary_name" property="area1DictionaryName"/>
|
2020-03-26 00:00:48 +08:00
|
|
|
|
<result column="area2_join_by_enterprise_id" property="area2JoinByEnterpriseId"/>
|
2020-03-28 23:13:59 +08:00
|
|
|
|
<result column="area2_dictionary_name" property="area2DictionaryName"/>
|
2020-03-26 00:00:48 +08:00
|
|
|
|
<result column="area3_join_by_enterprise_id" property="area3JoinByEnterpriseId"/>
|
2020-03-28 23:13:59 +08:00
|
|
|
|
<result column="area3_dictionary_name" property="area3DictionaryName"/>
|
2020-03-26 00:00:48 +08:00
|
|
|
|
<result column="area4_join_by_enterprise_id" property="area4JoinByEnterpriseId"/>
|
2020-03-28 23:13:59 +08:00
|
|
|
|
<result column="area4_dictionary_name" property="area4DictionaryName"/>
|
2020-03-26 00:00:48 +08:00
|
|
|
|
<result column="area5_join_by_enterprise_id" property="area5JoinByEnterpriseId"/>
|
2020-03-28 23:13:59 +08:00
|
|
|
|
<result column="area5_dictionary_name" property="area5DictionaryName"/>
|
2020-03-26 00:00:48 +08:00
|
|
|
|
<result column="address_join_by_enterprise_id" property="addressJoinByEnterpriseId"/>
|
|
|
|
|
<result column="industry_join_by_enterprise_id" property="industryJoinByEnterpriseId"/>
|
|
|
|
|
<result column="engaged_count_join_by_enterprise_id" property="engagedCountJoinByEnterpriseId"/>
|
|
|
|
|
<result column="risk_operation_join_by_enterprise_id" property="riskOperationJoinByEnterpriseId"/>
|
|
|
|
|
<result column="master_join_by_enterprise_id" property="masterJoinByEnterpriseId"/>
|
|
|
|
|
<result column="phone_join_by_enterprise_id" property="phoneJoinByEnterpriseId"/>
|
2020-03-28 23:13:59 +08:00
|
|
|
|
<result column="industry_dictionary_name" property="industryDictionaryName"/>
|
|
|
|
|
<result column="risk_operation_dictionary_name" property="riskOperationDictionaryName"/>
|
2020-03-26 00:00:48 +08:00
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<!-- 新增网格员的企业 -->
|
|
|
|
|
<insert id="saveEnterpriseOfGridOperator" parameterType="map">
|
|
|
|
|
INSERT INTO gen_enterprise_of_grid_operator(
|
|
|
|
|
enterprise_of_grid_operator_id,
|
|
|
|
|
user_id,
|
|
|
|
|
enterprise_id,
|
|
|
|
|
creator,
|
|
|
|
|
gmt_create,
|
|
|
|
|
modifier,
|
|
|
|
|
gmt_modified,
|
|
|
|
|
is_delete
|
|
|
|
|
) VALUES(
|
|
|
|
|
#{enterpriseOfGridOperatorId},
|
|
|
|
|
#{userId},
|
|
|
|
|
#{enterpriseId},
|
|
|
|
|
#{creator},
|
|
|
|
|
#{gmtCreate},
|
|
|
|
|
#{modifier},
|
|
|
|
|
#{gmtModified},
|
|
|
|
|
#{isDelete}
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<!-- 删除网格员的企业 -->
|
|
|
|
|
<update id="removeEnterpriseOfGridOperator" parameterType="map">
|
|
|
|
|
UPDATE
|
|
|
|
|
gen_enterprise_of_grid_operator
|
|
|
|
|
SET
|
|
|
|
|
is_delete = 1,
|
|
|
|
|
modifier = #{modifier},
|
|
|
|
|
gmt_modified = #{gmtModified}
|
|
|
|
|
WHERE
|
|
|
|
|
enterprise_of_grid_operator_id IN
|
|
|
|
|
<foreach collection="enterpriseOfGridOperatorIds" index="index" open="(" separator="," close=")">
|
|
|
|
|
#{enterpriseOfGridOperatorIds[${index}]}
|
|
|
|
|
</foreach>
|
|
|
|
|
</update>
|
|
|
|
|
|
2020-03-28 23:13:59 +08:00
|
|
|
|
<!-- 删除网格员的企业(物理删除) -->
|
|
|
|
|
<delete id="deleteEnterpriseOfGridOperator">
|
|
|
|
|
DELETE FROM
|
|
|
|
|
gen_enterprise_of_grid_operator
|
|
|
|
|
WHERE
|
|
|
|
|
enterprise_of_grid_operator_id IN
|
|
|
|
|
<foreach collection="enterpriseOfGridOperatorIds" index="index" open="(" separator="," close=")">
|
|
|
|
|
#{enterpriseOfGridOperatorIds[${index}]}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
2020-03-26 00:00:48 +08:00
|
|
|
|
<!-- 修改网格员的企业 -->
|
|
|
|
|
<update id="updateEnterpriseOfGridOperator" parameterType="map">
|
|
|
|
|
UPDATE
|
|
|
|
|
gen_enterprise_of_grid_operator
|
|
|
|
|
SET
|
|
|
|
|
<if test="userId != null and userId != ''">
|
|
|
|
|
user_id = #{userId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="enterpriseId != null and enterpriseId != ''">
|
|
|
|
|
enterprise_id = #{enterpriseId},
|
|
|
|
|
</if>
|
|
|
|
|
modifier = #{modifier},
|
|
|
|
|
gmt_modified = #{gmtModified}
|
|
|
|
|
WHERE
|
|
|
|
|
enterprise_of_grid_operator_id = #{enterpriseOfGridOperatorId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<!-- 网格员的企业详情 -->
|
|
|
|
|
<select id="getEnterpriseOfGridOperator" parameterType="map" resultMap="enterpriseOfGridOperatorDTO">
|
|
|
|
|
SELECT
|
|
|
|
|
t1.user_id,
|
|
|
|
|
t1.enterprise_id,
|
|
|
|
|
t1.enterprise_of_grid_operator_id
|
|
|
|
|
FROM
|
|
|
|
|
gen_enterprise_of_grid_operator t1
|
|
|
|
|
WHERE
|
|
|
|
|
t1.is_delete = 0
|
|
|
|
|
<if test="enterpriseOfGridOperatorId != null and enterpriseOfGridOperatorId != ''">
|
|
|
|
|
AND
|
|
|
|
|
t1.enterprise_of_grid_operator_id = #{enterpriseOfGridOperatorId}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 网格员的企业列表 -->
|
|
|
|
|
<select id="listEnterpriseOfGridOperator" parameterType="map" resultMap="enterpriseOfGridOperatorDTO">
|
|
|
|
|
SELECT
|
|
|
|
|
t1.user_id,
|
|
|
|
|
t1.enterprise_id,
|
|
|
|
|
jt1.name name_join_by_enterprise_id,
|
|
|
|
|
jt1.type type_join_by_enterprise_id,
|
|
|
|
|
jt1.address address_join_by_enterprise_id,
|
|
|
|
|
jt1.master master_join_by_enterprise_id,
|
|
|
|
|
jt1.phone phone_join_by_enterprise_id,
|
|
|
|
|
t1.enterprise_of_grid_operator_id
|
|
|
|
|
FROM
|
|
|
|
|
gen_enterprise_of_grid_operator t1
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
gen_enterprise jt1
|
|
|
|
|
ON
|
|
|
|
|
t1.enterprise_id = jt1.enterprise_id
|
|
|
|
|
AND
|
|
|
|
|
jt1.is_delete = 0
|
|
|
|
|
WHERE
|
|
|
|
|
t1.is_delete = 0
|
|
|
|
|
<if test="keywords != null and keywords != ''">
|
2020-03-30 08:23:38 +08:00
|
|
|
|
AND
|
|
|
|
|
jt1.name LIKE CONCAT('%', #{keywords}, '%')
|
2020-03-26 00:00:48 +08:00
|
|
|
|
</if>
|
|
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
|
|
AND
|
|
|
|
|
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
|
|
AND
|
|
|
|
|
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="enterpriseOfGridOperatorIds != null and enterpriseOfGridOperatorIds.size > 0">
|
|
|
|
|
AND
|
|
|
|
|
t1.enterprise_of_grid_operator_id IN
|
|
|
|
|
<foreach collection="enterpriseOfGridOperatorIds" index="index" open="(" separator="," close=")">
|
|
|
|
|
#{enterpriseOfGridOperatorIds[${index}]}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
2020-03-30 08:23:38 +08:00
|
|
|
|
<if test="userId != null and userId != ''">
|
|
|
|
|
AND
|
|
|
|
|
t1.user_id = #{userId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="area1 != null and area1 != ''">
|
|
|
|
|
AND
|
|
|
|
|
jt1.area1 = #{area1}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="area2 != null and area2 != ''">
|
|
|
|
|
AND
|
|
|
|
|
jt1.area2 = #{area2}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="area3 != null and area3 != ''">
|
|
|
|
|
AND
|
|
|
|
|
jt1.area3 = #{area3}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="area4 != null and area4 != ''">
|
|
|
|
|
AND
|
|
|
|
|
jt1.area4 = #{area4}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="area5 != null and area5 != ''">
|
|
|
|
|
AND
|
|
|
|
|
jt1.area5 = #{area5}
|
|
|
|
|
</if>
|
2020-03-28 23:13:59 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 网格员的企业列表(通过用户ID) -->
|
|
|
|
|
<select id="listEnterpriseOfGridOperatorByUserId" resultMap="enterpriseOfGridOperatorDTO">
|
|
|
|
|
SELECT
|
2020-03-26 00:00:48 +08:00
|
|
|
|
t1.enterprise_id,
|
2020-03-28 23:13:59 +08:00
|
|
|
|
t1.name name_join_by_enterprise_id,
|
|
|
|
|
t1.type type_join_by_enterprise_id,
|
|
|
|
|
dt8.dictionary_name type_dictionary_name,
|
|
|
|
|
t1.area1 area1_join_by_enterprise_id,
|
|
|
|
|
dt1.dictionary_name area1_dictionary_name,
|
|
|
|
|
t1.area2 area2_join_by_enterprise_id,
|
|
|
|
|
dt2.dictionary_name area2_dictionary_name,
|
|
|
|
|
t1.area3 area3_join_by_enterprise_id,
|
|
|
|
|
dt3.dictionary_name area3_dictionary_name,
|
|
|
|
|
t1.area4 area4_join_by_enterprise_id,
|
|
|
|
|
dt4.dictionary_name area4_dictionary_name,
|
|
|
|
|
t1.area5 area5_join_by_enterprise_id,
|
|
|
|
|
dt5.dictionary_name area5_dictionary_name,
|
|
|
|
|
t1.address address_join_by_enterprise_id,
|
|
|
|
|
t1.industry industry_join_by_enterprise_id,
|
|
|
|
|
dt6.dictionary_name industry_dictionary_name,
|
|
|
|
|
t1.engaged_count engaged_count_join_by_enterprise_id,
|
|
|
|
|
t1.risk_operation risk_operation_join_by_enterprise_id,
|
|
|
|
|
dt7.dictionary_name risk_operation_dictionary_name,
|
|
|
|
|
t1.master master_join_by_enterprise_id,
|
|
|
|
|
t1.phone phone_join_by_enterprise_id,
|
|
|
|
|
jt1.user_id,
|
|
|
|
|
jt1.enterprise_of_grid_operator_id
|
|
|
|
|
FROM
|
|
|
|
|
gen_enterprise t1
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
gen_enterprise_of_grid_operator jt1
|
|
|
|
|
ON
|
|
|
|
|
t1.enterprise_id = jt1.enterprise_id
|
|
|
|
|
AND (
|
|
|
|
|
jt1.is_delete = 0
|
|
|
|
|
AND
|
|
|
|
|
jt1.user_id = #{userId}
|
|
|
|
|
)
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
data_dictionary dt1
|
|
|
|
|
ON
|
|
|
|
|
dt1.dictionary_id = t1.area1
|
|
|
|
|
AND
|
|
|
|
|
dt1.is_delete = 0
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
data_dictionary dt2
|
|
|
|
|
ON
|
|
|
|
|
dt2.dictionary_id = t1.area2
|
|
|
|
|
AND
|
|
|
|
|
dt2.is_delete = 0
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
data_dictionary dt3
|
|
|
|
|
ON
|
|
|
|
|
dt3.dictionary_id = t1.area3
|
|
|
|
|
AND
|
|
|
|
|
dt3.is_delete = 0
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
data_dictionary dt4
|
|
|
|
|
ON
|
|
|
|
|
dt4.dictionary_id = t1.area4
|
|
|
|
|
AND
|
|
|
|
|
dt4.is_delete = 0
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
data_dictionary dt5
|
|
|
|
|
ON
|
|
|
|
|
dt5.dictionary_id = t1.area5
|
|
|
|
|
AND
|
|
|
|
|
dt5.is_delete = 0
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
data_dictionary dt6
|
|
|
|
|
ON
|
|
|
|
|
dt6.dictionary_id = t1.industry
|
|
|
|
|
AND
|
|
|
|
|
dt6.is_delete = 0
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
data_dictionary dt7
|
|
|
|
|
ON
|
|
|
|
|
dt7.dictionary_id = t1.risk_operation
|
|
|
|
|
AND
|
|
|
|
|
dt7.is_delete = 0
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
data_dictionary dt8
|
|
|
|
|
ON
|
|
|
|
|
dt8.dictionary_id = t1.type
|
|
|
|
|
AND
|
|
|
|
|
dt8.is_delete = 0
|
|
|
|
|
WHERE
|
|
|
|
|
t1.is_delete = 0
|
|
|
|
|
<if test="area1 != null and area1 != ''">
|
|
|
|
|
AND
|
|
|
|
|
t1.area1 = #{area1}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="area2 != null and area2 != ''">
|
|
|
|
|
AND
|
|
|
|
|
t1.area2 = #{area2}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="area3 != null and area3 != ''">
|
|
|
|
|
AND
|
|
|
|
|
t1.area3 = #{area3}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="area4 != null and area4 != ''">
|
|
|
|
|
AND
|
|
|
|
|
t1.area4 = #{area4}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="area5 != null and area5 != ''">
|
|
|
|
|
AND
|
|
|
|
|
t1.area5 = #{area5}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="keywords != null and keywords != ''">
|
|
|
|
|
AND
|
|
|
|
|
t1.name LIKE CONCAT('%', #{keywords}, '%')
|
|
|
|
|
</if>
|
2020-03-26 00:00:48 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
</mapper>
|