161 lines
6.4 KiB
XML
161 lines
6.4 KiB
XML
|
<?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"/>
|
||
|
<result column="area1_join_by_enterprise_id" property="area1JoinByEnterpriseId"/>
|
||
|
<result column="area2_join_by_enterprise_id" property="area2JoinByEnterpriseId"/>
|
||
|
<result column="area3_join_by_enterprise_id" property="area3JoinByEnterpriseId"/>
|
||
|
<result column="area4_join_by_enterprise_id" property="area4JoinByEnterpriseId"/>
|
||
|
<result column="area5_join_by_enterprise_id" property="area5JoinByEnterpriseId"/>
|
||
|
<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"/>
|
||
|
</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>
|
||
|
|
||
|
<!-- 修改网格员的企业 -->
|
||
|
<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.area1 area1_join_by_enterprise_id,
|
||
|
jt1.area2 area2_join_by_enterprise_id,
|
||
|
jt1.area3 area3_join_by_enterprise_id,
|
||
|
jt1.area4 area4_join_by_enterprise_id,
|
||
|
jt1.area5 area5_join_by_enterprise_id,
|
||
|
jt1.address address_join_by_enterprise_id,
|
||
|
jt1.industry industry_join_by_enterprise_id,
|
||
|
jt1.engaged_count engaged_count_join_by_enterprise_id,
|
||
|
jt1.risk_operation risk_operation_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 != ''">
|
||
|
<!-- 这里添加检索关键字 -->
|
||
|
</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>
|
||
|
GROUP BY
|
||
|
t1.user_id,
|
||
|
t1.enterprise_id,
|
||
|
jt1.name,
|
||
|
jt1.type,
|
||
|
jt1.area1,
|
||
|
jt1.area2,
|
||
|
jt1.area3,
|
||
|
jt1.area4,
|
||
|
jt1.area5,
|
||
|
jt1.address,
|
||
|
jt1.industry,
|
||
|
jt1.engaged_count,
|
||
|
jt1.risk_operation,
|
||
|
jt1.master,
|
||
|
jt1.phone,
|
||
|
t1.enterprise_of_grid_operator_id
|
||
|
</select>
|
||
|
|
||
|
</mapper>
|