|
|
|
<?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.IcResiUserDao">
|
|
|
|
|
|
|
|
<insert id="add">
|
|
|
|
insert into ${tableName}
|
|
|
|
(
|
|
|
|
<foreach collection="map.entrySet()" index="key" item="value" separator=",">
|
|
|
|
${key}
|
|
|
|
</foreach>
|
|
|
|
,DEL_FLAG
|
|
|
|
,REVISION
|
|
|
|
,CREATED_TIME
|
|
|
|
,UPDATED_TIME
|
|
|
|
) values
|
|
|
|
(
|
|
|
|
<foreach collection="map.entrySet()" index="key" item="value" separator=",">
|
|
|
|
#{value}
|
|
|
|
</foreach>
|
|
|
|
,'0'
|
|
|
|
,'0'
|
|
|
|
,NOW()
|
|
|
|
,NOW()
|
|
|
|
)
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="upTable">
|
|
|
|
UPDATE ${tableName}
|
|
|
|
SET
|
|
|
|
<foreach collection="map.entrySet()" index="key" item="value" separator=",">
|
|
|
|
${key} = #{value}
|
|
|
|
</foreach>
|
|
|
|
,UPDATED_TIME = NOW()
|
|
|
|
WHERE id = #{id}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectListMapById" parameterType="map" resultType="map">
|
|
|
|
select * from ic_resi_user where del_flag='0' and id=#{icResiUserId} and customer_id=#{customerId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectSubTableRecords" parameterType="map" resultType="map">
|
|
|
|
select * from ${subTableName} where del_flag='0' and IC_RESI_USER=#{icResiUserId} and customer_id=#{customerId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 列表查询 -->
|
|
|
|
<sql id="listWhereForPage">
|
|
|
|
ic_resi_user.DEL_FLAG = '0'
|
|
|
|
and ic_resi_user.customer_id=#{customerId}
|
|
|
|
and (ic_resi_user.AGENCY_ID =#{currentStaffAgencyId} or ic_resi_user.pids like concat(#{staffOrgPath},'%'))
|
|
|
|
<if test="null != conditions and conditions.size() > 0">
|
|
|
|
<foreach item="subCondition" collection="conditions" open="" separator="" close="">
|
|
|
|
<if test="null != subCondition.columnValue and subCondition.columnValue.size() > 0">
|
|
|
|
|
|
|
|
<if test="subCondition.queryType!= null and subCondition.queryType == 'equal' ">
|
|
|
|
<if test="null!=subCondition.columnValue[0] and ''!=subCondition.columnValue[0]">
|
|
|
|
and ${subCondition.tableName}.${subCondition.columnName} = #{subCondition.columnValue[0]}
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="subCondition.queryType!= null and subCondition.queryType == 'like' ">
|
|
|
|
<if test="null!=subCondition.columnValue[0] and ''!=subCondition.columnValue[0]">
|
|
|
|
and ${subCondition.tableName}.${subCondition.columnName} like concat('%',#{subCondition.columnValue[0]},'%')
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="subCondition.queryType!= null and subCondition.queryType == 'daterange' ">
|
|
|
|
and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]}
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
<!-- 导出公用where条件 -->
|
|
|
|
<sql id="listWhere">
|
|
|
|
ic_resi_user.DEL_FLAG = '0'
|
|
|
|
and ic_resi_user.customer_id=#{customerId}
|
|
|
|
<if test="null != conditions and conditions.size() > 0">
|
|
|
|
<foreach item="subCondition" collection="conditions" open="" separator="" close="">
|
|
|
|
<if test="null != subCondition.columnValue and subCondition.columnValue.size() > 0">
|
|
|
|
|
|
|
|
<if test="subCondition.queryType!= null and subCondition.queryType == 'equal' ">
|
|
|
|
<if test="null!=subCondition.columnValue[0] and ''!=subCondition.columnValue[0]">
|
|
|
|
and ${subCondition.tableName}.${subCondition.columnName} = #{subCondition.columnValue[0]}
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="subCondition.queryType!= null and subCondition.queryType == 'like' ">
|
|
|
|
<if test="null!=subCondition.columnValue[0] and ''!=subCondition.columnValue[0]">
|
|
|
|
and ${subCondition.tableName}.${subCondition.columnName} like concat('%',#{subCondition.columnValue[0]},'%')
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="subCondition.queryType!= null and subCondition.queryType == 'daterange' ">
|
|
|
|
and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]}
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
<!-- 查询列表用 -->
|
|
|
|
<select id="selectListResiMap" parameterType="map" resultType="map">
|
|
|
|
select
|
|
|
|
ic_resi_user.id as icResiUserId,
|
|
|
|
ic_resi_user.AGENCY_ID as ORG_ID,
|
|
|
|
<foreach item="column" collection="resultColumns" open="" separator="," close="">
|
|
|
|
${column.columnName}
|
|
|
|
</foreach>
|
|
|
|
FROM
|
|
|
|
ic_resi_user
|
|
|
|
<if test="null != subTables and subTables.size() > 0">
|
|
|
|
<foreach item="subTableName" collection="subTables" open="" separator="" close="">
|
|
|
|
${subTableName}
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
<where>
|
|
|
|
<include refid="listWhereForPage"></include>
|
|
|
|
</where>
|
|
|
|
group by IC_RESI_USER.id
|
|
|
|
order by ic_resi_user.CREATED_TIME desc
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<update id="updateToDel" parameterType="java.lang.String">
|
|
|
|
update ic_resi_user set del_flag='1' where id=#{icResiUserId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<update id="updateSubTableToDel" parameterType="map">
|
|
|
|
update ${subTalbeName} set del_flag='1' where IC_RESI_USER=#{icResiUserId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<select id="dynamicQuery" parameterType="map" resultType="map">
|
|
|
|
select
|
|
|
|
${resultTableName}.*
|
|
|
|
FROM
|
|
|
|
ic_resi_user
|
|
|
|
<if test="null != subTables and subTables.size() > 0">
|
|
|
|
<foreach item="subTableName" collection="subTables" open="" separator="" close="">
|
|
|
|
${subTableName}
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<where>
|
|
|
|
<include refid="listWhere"></include>
|
|
|
|
</where>
|
|
|
|
group by IC_RESI_USER.id
|
|
|
|
order by ic_resi_user.CREATED_TIME desc
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 查询个人信息 -->
|
|
|
|
<resultMap id="selectPersonData" type="com.epmet.dto.result.PersonDataResultDTO">
|
|
|
|
<result column="GZDW" property="workUnit"/>
|
|
|
|
<result column="ID_CARD" property="idCard"/>
|
|
|
|
<result column="name" property="name"/>
|
|
|
|
<result column="isVolunteer" property="isVolunteer"/>
|
|
|
|
<result column="CUSTOMER_ID" property="customerId"/>
|
|
|
|
<result column="GRID_ID" property="gridId"/>
|
|
|
|
<collection property="financialSituation" ofType="com.epmet.dto.FinancialSituationDTO">
|
|
|
|
<result column="YSR" property="monthlyIncome"/>
|
|
|
|
<result column="TXJE" property="retirementAmount"/>
|
|
|
|
</collection>
|
|
|
|
</resultMap>
|
|
|
|
<select id="personData" resultMap="selectPersonData">
|
|
|
|
SELECT
|
|
|
|
GZDW,
|
|
|
|
name,
|
|
|
|
YSR,
|
|
|
|
TXJE,
|
|
|
|
ID_CARD,
|
|
|
|
IFNULL(IS_VOLUNTEER,'0') AS isVolunteer,
|
|
|
|
CUSTOMER_ID,
|
|
|
|
GRID_ID
|
|
|
|
FROM ic_resi_user
|
|
|
|
WHERE DEL_FLAG = '0'
|
|
|
|
AND ID = #{userId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 根据名字,组织查询人 -->
|
|
|
|
<select id="searchByName" resultType="com.epmet.dto.result.SearchByNameResultDTO">
|
|
|
|
SET @curRank = #{pageNo};
|
|
|
|
SELECT
|
|
|
|
@curRank := @curRank + 1 AS sort,
|
|
|
|
ID AS userId,
|
|
|
|
`NAME`,
|
|
|
|
VILLAGE_ID AS neighborHoodId,
|
|
|
|
BUILD_ID,
|
|
|
|
GRID_ID
|
|
|
|
FROM ic_resi_user
|
|
|
|
WHERE DEL_FLAG = '0'
|
|
|
|
AND PIDS LIKE CONCAT('%',#{agencyId},'%')
|
|
|
|
AND `NAME` LIKE CONCAT('%',#{name},'%')
|
|
|
|
ORDER BY `NAME`
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectUserDemandCode" parameterType="java.lang.String" resultType="java.lang.String">
|
|
|
|
SELECT DISTINCT
|
|
|
|
m.CATEGORY_CODE
|
|
|
|
FROM
|
|
|
|
ic_resi_demand m
|
|
|
|
WHERE
|
|
|
|
m.DEL_FLAG = '0'
|
|
|
|
AND m.IC_RESI_USER = #{icResiUserId}
|
|
|
|
ORDER BY
|
|
|
|
m.CREATED_TIME ASC
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectCategoryNames" parameterType="map" resultType="java.lang.String">
|
|
|
|
SELECT
|
|
|
|
GROUP_CONCAT(m.CATEGORY_NAME)
|
|
|
|
FROM
|
|
|
|
ic_resi_demand_dict m
|
|
|
|
WHERE
|
|
|
|
m.DEL_FLAG = '0'
|
|
|
|
AND m.CUSTOMER_ID = #{customerId}
|
|
|
|
<if test="null != codeSet and codeSet.size() > 0">
|
|
|
|
AND m.CATEGORY_CODE IN
|
|
|
|
<foreach item="code" collection="codeSet" open="(" separator="," close=")">
|
|
|
|
#{code}
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
<select id="getHomeUserCategoryCount" resultType="java.util.Map">
|
|
|
|
SELECT
|
|
|
|
HOME_ID,
|
|
|
|
SUM(IF('1' = IS_PARTY, 1, 0)) AS IS_PARTY,
|
|
|
|
SUM(IF('1' = IS_DBH, 1, 0)) AS IS_DBH,
|
|
|
|
SUM(IF('1' = IS_ENSURE_HOUSE, 1, 0)) AS IS_ENSURE_HOUSE,
|
|
|
|
SUM(IF('1' = IS_UNEMPLOYED, 1, 0)) AS IS_UNEMPLOYED,
|
|
|
|
SUM(IF('1' = IS_YLFN, 1, 0)) AS IS_YLFN,
|
|
|
|
SUM(IF('1' = IS_VETERANS, 1, 0)) AS IS_VETERANS,
|
|
|
|
SUM(IF('1' = IS_UNITED_FRONT, 1, 0)) AS IS_UNITED_FRONT,
|
|
|
|
SUM(IF('1' = IS_XFRY, 1, 0)) AS IS_XFRY,
|
|
|
|
SUM(IF('1' = IS_VOLUNTEER, 1, 0)) AS IS_VOLUNTEER,
|
|
|
|
SUM(IF('1' = IS_OLD_PEOPLE, 1, 0)) AS IS_OLD_PEOPLE,
|
|
|
|
SUM(IF('1' = IS_KC, 1, 0)) AS IS_KC,
|
|
|
|
SUM(IF('1' = IS_SD, 1, 0)) AS IS_SD,
|
|
|
|
SUM(IF('1' = IS_SN, 1, 0)) AS IS_SN,
|
|
|
|
SUM(IF('1' = IS_SZ, 1, 0)) AS IS_SZ,
|
|
|
|
SUM(IF('1' = IS_CJ, 1, 0)) AS IS_CJ,
|
|
|
|
SUM(IF('1' = IS_DB, 1, 0)) AS IS_DB,
|
|
|
|
SUM(IF('1' = IS_MB, 1, 0)) AS IS_MB,
|
|
|
|
SUM(IF('1' = IS_SPECIAL, 1, 0)) AS IS_SPECIAL
|
|
|
|
FROM ic_resi_user
|
|
|
|
WHERE DEL_FLAG = 0
|
|
|
|
AND BUILD_ID = #{buildId}
|
|
|
|
GROUP BY HOME_ID
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 根据userId查询志愿者 -->
|
|
|
|
<select id="selectVolunteerByUserId" resultType="java.lang.String">
|
|
|
|
SELECT VOLUNTEER_CATEGORY FROM ic_volunteer WHERE DEL_FLAG = '0' AND ic_resi_user = #{userId}
|
|
|
|
</select>
|
|
|
|
</mapper>
|