354 lines
15 KiB
XML
354 lines
15 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.zhwl.resident.mapper.ZdyResidentInfoMapper">
|
|
|
|
<resultMap type="ZdyResidentInfo" id="ZdyResidentInfoResult">
|
|
<result property="id" column="id"/>
|
|
<result property="userName" column="user_name"/>
|
|
<result property="userCode" column="user_code"/>
|
|
<result property="sex" column="sex"/>
|
|
<result property="phone" column="phone"/>
|
|
<result property="idNo" column="id_no"/>
|
|
<result property="userAddress" column="user_address"/>
|
|
<result property="idCardImage" column="id_card_image"/>
|
|
<result property="hukouImage" column="hukou_image"/>
|
|
<result property="faceImage" column="face_image"/>
|
|
<result property="remark" column="remark"/>
|
|
<result property="userType" column="user_type"/>
|
|
<result property="groupType" column="group_type"/>
|
|
<result property="userStatus" column="user_status"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="groupTypeName" column="groupTypeName" />
|
|
<result property="userTypeName" column="userTypeName" />
|
|
<result property="userStatusName" column="userStatusName" />
|
|
<result property="syncTime" column="syncTime" />
|
|
<result property="deptId" column="dept_id"/>
|
|
<result property="scenicId" column="scenic_id"/>
|
|
<result property="scenicName" column="scenic_name"/>
|
|
</resultMap>
|
|
|
|
<!-- <sql id="selectZdyResidentInfoVo">-->
|
|
<!-- select id, user_name, user_code, phone, id_no, user_address, id_card_image, hukou_image, face_image, remark, user_type, group_type, user_status, create_by, create_time, update_by, update_time-->
|
|
<!-- from zdy_resident_info-->
|
|
<!-- </sql>-->
|
|
|
|
<sql id="selectZdyResidentInfoVo">
|
|
select tri.id, tri.user_name, tri.user_code,tri.sex, tri.phone, tri.id_no, tri.user_address, tri.id_card_image, tri.hukou_image, tri.face_image, tri.remark, tri.user_type, tri.group_type, tri.user_status, tri.create_by, tri.create_time, tri.update_by, tri.update_time, tri.sync_time,tri.dept_id
|
|
</sql>
|
|
|
|
|
|
<sql id="selectResidentInfoTuoMinVo">
|
|
select tri.id, tri.user_name, tri.user_code,tri.sex, tri.phone
|
|
, CONCAT( LEFT(tri.id_no, CHAR_LENGTH(tri.id_no) - 4), REPEAT('*', 4) ) as id_no , tri.user_address, tri.id_card_image, tri.hukou_image, tri.face_image, tri.remark, tri.user_type, tri.group_type, tri.user_status, tri.create_by, tri.create_time, tri.update_by, tri.update_time, tri.sync_time,tri.dept_id
|
|
</sql>
|
|
|
|
<select id="selectZdyResidentInfoList" parameterType="ZdyResidentInfo" resultMap="ZdyResidentInfoResult">
|
|
<include refid="selectResidentInfoTuoMinVo"/>
|
|
,sdd1.dict_label as groupTypeName
|
|
,sdd2.dict_label as userTypeName
|
|
,sdd3.dict_label as userStatusName,
|
|
tri.scenic_id,
|
|
zs.scenic_name
|
|
from zdy_resident_info tri
|
|
left join sys_dict_data sdd1 on sdd1.dict_value = tri.group_type and sdd1.dict_type = 'group_type'
|
|
left join sys_dict_data sdd2 on sdd2.dict_value = tri.user_type and sdd2.dict_type = 'user_type'
|
|
left join sys_dict_data sdd3 on sdd3.dict_value = tri.user_status and sdd3.dict_type = 'identity_status'
|
|
left join sys_dept d on tri.dept_id = d.dept_id
|
|
left join zdy_scenic zs on zs.id = tri.scenic_id
|
|
<where>
|
|
and tri.user_status not in (3)
|
|
<if test="sex != null and sex != ''"> and tri.sex = #{sex}</if>
|
|
<if test="userName != null and userName != ''"> and tri.user_name like concat('%', #{userName}, '%')</if>
|
|
<if test="userCode != null and userCode != ''"> and tri.user_code = #{userCode}</if>
|
|
<if test="phone != null and phone != ''"> and tri.phone like concat('%', #{phone}, '%')</if>
|
|
<if test="idNo != null and idNo != ''"> and tri.id_no like concat('%', #{idNo}, '%')</if>
|
|
<if test="userAddress != null and userAddress != ''"> and tri.user_address = #{userAddress}</if>
|
|
<if test="idCardImage != null and idCardImage != ''"> and tri.id_card_image = #{idCardImage}</if>
|
|
<if test="hukouImage != null and hukouImage != ''"> and tri.hukou_image = #{hukouImage}</if>
|
|
<if test="faceImage != null and faceImage != ''"> and tri.face_image = #{faceImage}</if>
|
|
<if test="userType != null and userType != ''"> and tri.user_type = #{userType}</if>
|
|
<if test="groupType != null and groupType != ''"> and tri.group_type = #{groupType}</if>
|
|
<if test="userStatus != null and userStatus != ''"> and tri.user_status = #{userStatus}</if>
|
|
<if test="startTime != null "> and date(tri.create_time) <![CDATA[ >= ]]> #{startTime}</if>
|
|
<if test="endTime != null "> and date(tri.create_time) <![CDATA[ <= ]]> #{endTime}</if>
|
|
<if test="scenicId != null "> and tri.scenic_id = #{scenicId}</if>
|
|
${params.dataScope}
|
|
</where>
|
|
order by tri.id desc
|
|
</select>
|
|
|
|
<select id="selectZdyResidentInfoById" parameterType="Long"
|
|
resultMap="ZdyResidentInfoResult">
|
|
<include refid="selectZdyResidentInfoVo"/>
|
|
,sdd1.dict_label as groupTypeName
|
|
,sdd2.dict_label as userTypeName
|
|
,sdd3.dict_label as userStatusName,
|
|
tri.scenic_id,
|
|
zs.scenic_name
|
|
from zdy_resident_info tri
|
|
left join sys_dict_data sdd1 on sdd1.dict_value = tri.group_type and sdd1.dict_type = 'group_type'
|
|
left join sys_dict_data sdd2 on sdd2.dict_value = tri.user_type and sdd2.dict_type = 'user_type'
|
|
left join sys_dict_data sdd3 on sdd3.dict_value = tri.user_status and sdd3.dict_type = 'identity_status'
|
|
left join zdy_scenic zs on zs.id = tri.scenic_id
|
|
where tri.id = #{id}
|
|
</select>
|
|
|
|
<select id="selectZdyResidentInfoByIdNo"
|
|
resultMap="ZdyResidentInfoResult">
|
|
<include refid="selectZdyResidentInfoVo"/>
|
|
from zdy_resident_info tri
|
|
where tri.user_status not in (3) and tri.id_no = #{idNo} and tri.dept_id = #{deptId}
|
|
</select>
|
|
|
|
|
|
<insert id="insertZdyResidentInfo" parameterType="ZdyResidentInfo" useGeneratedKeys="true"
|
|
keyProperty="id">
|
|
insert into zdy_resident_info
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="userName != null">user_name,
|
|
</if>
|
|
<if test="userCode != null">user_code,
|
|
</if>
|
|
<if test="sex != null">sex,</if>
|
|
<if test="phone != null">phone,
|
|
</if>
|
|
<if test="idNo != null and idNo != ''">id_no,
|
|
</if>
|
|
<if test="userAddress != null">user_address,
|
|
</if>
|
|
<if test="idCardImage != null">id_card_image,
|
|
</if>
|
|
<if test="hukouImage != null">hukou_image,
|
|
</if>
|
|
<if test="faceImage != null">face_image,
|
|
</if>
|
|
<if test="remark != null">remark,
|
|
</if>
|
|
<if test="userType != null">user_type,
|
|
</if>
|
|
<if test="groupType != null">group_type,
|
|
</if>
|
|
<if test="userStatus != null">user_status,
|
|
</if>
|
|
<if test="createBy != null">create_by,
|
|
</if>
|
|
<if test="createTime != null">create_time,
|
|
</if>
|
|
<if test="updateBy != null">update_by,
|
|
</if>
|
|
<if test="updateTime != null">update_time,
|
|
</if>
|
|
<if test="syncTime != null">sync_time,
|
|
</if>
|
|
<if test="deptId != null">dept_id,
|
|
</if>
|
|
<if test="scenicId != null">scenic_id,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="userName != null and userName != ''">#{userName},
|
|
</if>
|
|
<if test="userCode != null">#{userCode},
|
|
</if>
|
|
<if test="sex != null">#{sex},</if>
|
|
<if test="phone != null">#{phone},
|
|
</if>
|
|
<if test="idNo != null and idNo != ''">#{idNo},
|
|
</if>
|
|
<if test="userAddress != null">#{userAddress},
|
|
</if>
|
|
<if test="idCardImage != null">#{idCardImage},
|
|
</if>
|
|
<if test="hukouImage != null">#{hukouImage},
|
|
</if>
|
|
<if test="faceImage != null">#{faceImage},
|
|
</if>
|
|
<if test="remark != null">#{remark},
|
|
</if>
|
|
<if test="userType != null">#{userType},
|
|
</if>
|
|
<if test="groupType != null">#{groupType},
|
|
</if>
|
|
<if test="userStatus != null">#{userStatus},
|
|
</if>
|
|
<if test="createBy != null">#{createBy},
|
|
</if>
|
|
<if test="createTime != null">#{createTime},
|
|
</if>
|
|
<if test="updateBy != null">#{updateBy},
|
|
</if>
|
|
<if test="updateTime != null">#{updateTime},
|
|
</if>
|
|
<if test="syncTime != null">#{syncTime},
|
|
</if>
|
|
<if test="deptId != null">#{deptId},
|
|
</if>
|
|
<if test="scenicId != null">#{scenicId},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateZdyResidentInfo" parameterType="ZdyResidentInfo">
|
|
update zdy_resident_info
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="userName != null and userName != ''">user_name =
|
|
#{userName},
|
|
</if>
|
|
<if test="userCode != null">user_code =
|
|
#{userCode},
|
|
</if>
|
|
<if test="sex != null">sex = #{sex},</if>
|
|
<if test="phone != null">phone =
|
|
#{phone},
|
|
</if>
|
|
<if test="idNo != null and idNo != ''">id_no =
|
|
#{idNo},
|
|
</if>
|
|
<if test="userAddress != null">user_address =
|
|
#{userAddress},
|
|
</if>
|
|
<if test="idCardImage != null">id_card_image =
|
|
#{idCardImage},
|
|
</if>
|
|
<if test="hukouImage != null">hukou_image =
|
|
#{hukouImage},
|
|
</if>
|
|
<if test="faceImage != null">face_image =
|
|
#{faceImage},
|
|
</if>
|
|
<if test="remark != null">remark =
|
|
#{remark},
|
|
</if>
|
|
<if test="userType != null">user_type =
|
|
#{userType},
|
|
</if>
|
|
<if test="groupType != null">group_type =
|
|
#{groupType},
|
|
</if>
|
|
<if test="userStatus != null">user_status =
|
|
#{userStatus},
|
|
</if>
|
|
<if test="createBy != null">create_by =
|
|
#{createBy},
|
|
</if>
|
|
<if test="createTime != null">create_time =
|
|
#{createTime},
|
|
</if>
|
|
<if test="updateBy != null">update_by =
|
|
#{updateBy},
|
|
</if>
|
|
<if test="updateTime != null">update_time =
|
|
#{updateTime},
|
|
</if>
|
|
<if test="syncTime != null">sync_time =
|
|
#{syncTime},
|
|
</if>
|
|
<if test="deptId != null">dept_id =
|
|
#{deptId},
|
|
</if>
|
|
<if test="scenicId != null">scenic_id =
|
|
#{scenicId},
|
|
</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteZdyResidentInfoById" parameterType="Long">
|
|
update zdy_resident_info set user_status = 3,update_time = now(),update_by =#{currentUserId} where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteZdyResidentInfoByIds" parameterType="String">
|
|
update zdy_resident_info set user_status = 3,
|
|
update_time = now()
|
|
,update_by =#{currentUserId}
|
|
where id in
|
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<select id="selectMaxId" resultType="java.lang.Long">
|
|
select MAX(id) from zdy_resident_info where user_status not in (3)
|
|
</select>
|
|
|
|
<select id="selectIdNo" resultType="java.lang.Long">
|
|
select id from zdy_resident_info where user_status not in (3)
|
|
and id_no = #{idNo} and dept_id = #{deptId}
|
|
<if test="updateId != null">
|
|
and id <![CDATA[ <> ]]> #{updateId}
|
|
</if>
|
|
limit 1
|
|
</select>
|
|
|
|
<select id="selectInfoByIdNo" resultMap="ZdyResidentInfoResult">
|
|
<include refid="selectZdyResidentInfoVo"/>
|
|
from zdy_resident_info tri
|
|
where tri.user_status not in (3)
|
|
and tri.id_no = #{idNo}
|
|
<if test="updateId != null">
|
|
and tri.id <![CDATA[ <> ]]> #{updateId}
|
|
</if>
|
|
limit 1
|
|
</select>
|
|
|
|
<insert id="insertZdyResidentInfoList" parameterType="java.util.List">
|
|
insert into zdy_resident_info
|
|
(
|
|
id,
|
|
user_name,
|
|
user_code,
|
|
phone,
|
|
id_no,
|
|
user_address,
|
|
id_card_image,
|
|
hukou_image,
|
|
face_image,
|
|
remark,
|
|
user_type,
|
|
group_type,
|
|
user_status,
|
|
create_by,
|
|
create_time,
|
|
update_by,
|
|
update_time,
|
|
sync_time
|
|
)
|
|
values
|
|
<foreach item="item" index="index" collection="dataList" separator="," close=";">
|
|
(
|
|
#{item.id},
|
|
#{item.userName},
|
|
#{item.userCode},
|
|
#{item.phone},
|
|
#{item.idNo},
|
|
#{item.userAddress},
|
|
#{item.idCardImage},
|
|
#{item.hukouImage},
|
|
#{item.faceImage},
|
|
#{item.remark},
|
|
#{item.userType},
|
|
#{item.groupType},
|
|
#{item.userStatus},
|
|
#{item.createBy},
|
|
#{item.createTime},
|
|
#{item.updateBy},
|
|
#{item.updateTime},
|
|
#{item.syncTime}
|
|
)
|
|
</foreach>
|
|
|
|
</insert>
|
|
|
|
|
|
<select id="getExistingIds" resultType="Long">
|
|
-- select * from (select id from zdy_resident_info where user_status not in (3));
|
|
select id from zdy_resident_info
|
|
</select>
|
|
|
|
</mapper>
|