日照智慧社区接口服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

195 lines
6.7 KiB

<?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.epmet.dao.DataSyncConfigDao">
<!-- 【数据配置】配置开关 -->
<update id="configSwitch">
UPDATE data_sync_config
SET UPDATED_TIME = NOW(),
UPDATED_BY = #{updatedBy},
SWITCH_STATUS = CASE WHEN SWITCH_STATUS = 'open' THEN 'closed' ELSE 'open' END
WHERE id = #{dataSyncConfigId}
AND DEPT_CODE = #{deptCode}
</update>
<!-- 删除范围 -->
<delete id="delScope">
DELETE FROM data_sync_scope WHERE DATA_SYNC_CONFIG_ID = #{dataSyncConfigId}
</delete>
<!-- 【数据配置】列表 -->
<resultMap id="dataConfigList" type="com.epmet.dto.DataSyncConfigDTO">
<result property="id" column="id"/>
<result property="deptName" column="deptName"/>
<result property="deptCode" column="deptCode"/>
<result property="dataName" column="dataName"/>
<result property="switchStatus" column="switchStatus"/>
<result property="sort" column="sort"/>
<result property="dataCode" column="dataCode"/>
<collection property="scopeList" column="id" ofType="com.epmet.dto.DataSyncScopeDTO" select="scopeList"/>
</resultMap>
<select id="list" resultMap="dataConfigList">
SELECT
c.ID AS id,
c.DEPT_CODE AS deptCode,
c.DEPT_NAME AS deptName,
c.DATA_NAME AS dataName,
c.switch_status AS switchStatus,
c.sort AS sort,
c.data_code AS dataCode,
c.customer_id as customerId
FROM data_sync_config c
WHERE c.DEL_FLAG = 0
<if test="switchStatus != null and switchStatus != ''">
AND c.switch_status = #{switchStatus}
</if>
<if test='null != customerId and customerId != "" '>
AND c.CUSTOMER_ID = #{customerId}
</if>
<if test="dataCode != null and dataCode != ''">
AND c.data_code = #{dataCode}
</if>
order by CONVERT(c.DEPT_NAME USING gbk),c.sort asc
</select>
<!-- 范围查询 -->
<select id="scopeList" resultType="com.epmet.dto.DataSyncScopeDTO">
SELECT id, customer_id, data_sync_config_id, org_type, org_id, pid, org_id_path, del_flag FROM data_sync_scope WHERE DEL_FLAG = '0' AND DATA_SYNC_CONFIG_ID = #{id};
</select>
<!-- 根据范围查询居民证件号 -->
<select id="getIdCardsByScope" resultType="com.epmet.dto.result.NatUserInfoResultDTO">
SELECT
DISTINCT ID_CARD AS idCard,
CUSTOMER_ID,
ID AS userId,
`NAME`,
AGENCY_ID AS agencyId,
GRID_ID,
<if test="categoryColumn != null and categoryColumn != ''">
${categoryColumn} AS categoryColumn,
</if>
pids,
mobile
FROM ic_resi_user
WHERE DEL_FLAG = '0'
AND `STATUS` =
<choose>
<when test="resiStatus != null and resiStatus != ''">
#{resiStatus}
</when>
<otherwise>
'0'
</otherwise>
</choose>
<if test="idCards != null and idCards.size() != 0">
AND id_card in
<foreach collection="idCards" item="idCard" separator="," close=")" open="(" >
#{idCard}
</foreach>
</if>
<choose>
<when test='null == agencyId'>
AND (
<foreach collection="orgList" item="l" separator="OR">
<choose>
<when test='"grid" == l.orgType'>GRID_ID = #{l.orgId}</when>
<otherwise>PIDS LIKE CONCAT(#{l.orgIdPath},'%')</otherwise>
</choose>
</foreach>
)
</when>
<otherwise>
AND PIDS LIKE CONCAT(#{agencyId},'%')
</otherwise>
</choose>
ORDER BY CREATED_TIME
</select>
<!-- 根据范围查询居民证件号 -->
<select id="getIdCardsByScopeLimit" resultType="com.epmet.dto.result.NatUserInfoResultDTO">
SELECT
DISTINCT ID_CARD AS idCard,
CUSTOMER_ID,
ID AS userId,
`NAME`,
AGENCY_ID AS agencyId,
GRID_ID,
<if test="categoryColumn != null and categoryColumn != ''">
${categoryColumn} AS categoryColumn,
</if>
pids,
mobile
FROM ic_resi_user
WHERE DEL_FLAG = '0'
AND `STATUS` =
<choose>
<when test="resiStatus != null and resiStatus != ''">
#{resiStatus}
</when>
<otherwise>
'0'
</otherwise>
</choose>
<if test="idCards != null and idCards.size() != 0">
AND id_card in
<foreach collection="idCards" item="idCard" separator="," close=")" open="(" >
#{idCard}
</foreach>
</if>
<choose>
<when test='null == agencyId'>
AND (
<foreach collection="orgList" item="l" separator="OR">
<choose>
<when test='"grid" == l.orgType'>GRID_ID = #{l.orgId}</when>
<otherwise>PIDS LIKE CONCAT(#{l.orgIdPath},'%')</otherwise>
</choose>
</foreach>
)
</when>
<otherwise>
AND PIDS LIKE CONCAT(#{agencyId},'%')
</otherwise>
</choose>
ORDER BY CREATED_TIME
limit #{start} , #{end}
</select>
<!-- 根据范围查询居民证件号 -->
<select id="getIdCardsForSiWang" resultType="com.epmet.dto.result.NatUserInfoResultDTO">
SELECT
DISTINCT ID_CARD AS idCard,
CUSTOMER_ID,
ID AS userId,
`NAME`,
AGENCY_ID AS agencyId,
GRID_ID,
pids,
mobile
FROM ic_resi_user
WHERE DEL_FLAG = '0'
AND
(PIDS LIKE CONCAT('%','1580109539564904450','%')
OR
PIDS LIKE CONCAT('%','1536259086301294593','%')
OR
PIDS LIKE CONCAT('%','1536259195479027714','%')
OR
PIDS LIKE CONCAT('%','1580099893898829826','%'))
ORDER BY CREATED_TIME
limit #{start} , #{end}
</select>
<select id="getConfigInfoByType" resultType="com.epmet.dto.DataSyncConfigDTO">
select * FROM data_sync_config
WHERE DEL_FLAG = 0
AND switch_status = #{switchStatus}
AND CUSTOMER_ID = #{customerId}
AND data_code = #{dataCode}
</select>
</mapper>