354 lines
11 KiB
XML
354 lines
11 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="cn.com.tenlion.systemhouse.dao.houseusersub.IHouseUserSubDao">
|
|
|
|
<resultMap id="houseUserSubDTO" type="cn.com.tenlion.systemhouse.pojo.dtos.houseusersub.HouseUserSubDTO">
|
|
<result column="house_user_sub_id" property="houseUserSubId"/>
|
|
<result column="house_user_id" property="houseUserId"/>
|
|
<result column="population_id" property="populationId"/>
|
|
<result column="name" property="name"/>
|
|
<result column="sex" property="sex"/>
|
|
<result column="card_num" property="cardNum"/>
|
|
<result column="phone" property="phone"/>
|
|
<result column="relationship" property="relationship"/>
|
|
<result column="is_live" property="isLive"/>
|
|
<result column="remake" property="remake"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="houseUserSubBO" type="cn.com.tenlion.systemhouse.pojo.bos.houseusersub.HouseUserSubBO">
|
|
<result column="house_user_sub_id" property="houseUserSubId"/>
|
|
<result column="house_user_id" property="houseUserId"/>
|
|
<result column="population_id" property="populationId"/>
|
|
<result column="name" property="name"/>
|
|
<result column="sex" property="sex"/>
|
|
<result column="card_num" property="cardNum"/>
|
|
<result column="phone" property="phone"/>
|
|
<result column="relationship" property="relationship"/>
|
|
<result column="is_live" property="isLive"/>
|
|
<result column="remake" property="remake"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="houseUserSubPO" type="cn.com.tenlion.systemhouse.pojo.pos.houseusersub.HouseUserSubPO">
|
|
<result column="house_user_sub_id" property="houseUserSubId"/>
|
|
<result column="house_user_id" property="houseUserId"/>
|
|
<result column="population_id" property="populationId"/>
|
|
<result column="name" property="name"/>
|
|
<result column="sex" property="sex"/>
|
|
<result column="card_num" property="cardNum"/>
|
|
<result column="phone" property="phone"/>
|
|
<result column="relationship" property="relationship"/>
|
|
<result column="is_live" property="isLive"/>
|
|
<result column="remake" property="remake"/>
|
|
</resultMap>
|
|
|
|
<!-- 新增住户信息子表 -->
|
|
<insert id="save" parameterType="map">
|
|
INSERT INTO house_house_user_sub(
|
|
house_user_sub_id,
|
|
house_user_id,
|
|
population_id,
|
|
name,
|
|
sex,
|
|
card_num,
|
|
phone,
|
|
relationship,
|
|
is_live,
|
|
remake,
|
|
creator,
|
|
gmt_create,
|
|
modifier,
|
|
gmt_modified,
|
|
is_delete
|
|
) SELECT
|
|
#{houseUserSubId},
|
|
#{houseUserId},
|
|
#{populationId},
|
|
#{name},
|
|
#{sex},
|
|
#{cardNum},
|
|
#{phone},
|
|
#{relationship},
|
|
#{isLive},
|
|
#{remake},
|
|
#{creator},
|
|
#{gmtCreate},
|
|
#{modifier},
|
|
#{gmtModified},
|
|
#{isDelete}
|
|
FROM
|
|
DUAL
|
|
WHERE
|
|
NOT EXISTS (
|
|
SELECT
|
|
*
|
|
FROM
|
|
house_house_user_sub
|
|
WHERE
|
|
population_id = #{populationId}
|
|
AND is_delete = 0
|
|
)
|
|
</insert>
|
|
|
|
<!-- 删除住户信息子表(物理) -->
|
|
<update id="delete" parameterType="map">
|
|
DELETE FROM
|
|
house_house_user_sub
|
|
WHERE
|
|
house_user_sub_id IN
|
|
<foreach collection="houseUserSubIds" index="index" open="(" separator="," close=")">
|
|
#{houseUserSubIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 删除住户信息表 -->
|
|
<update id="remove" parameterType="map">
|
|
UPDATE
|
|
house_house_user_sub
|
|
SET
|
|
gmt_modified = #{gmtModified},
|
|
modifier = #{modifier},
|
|
is_delete = 1
|
|
WHERE
|
|
house_user_sub_id IN
|
|
<foreach collection="houseUserSubIds" index="index" open="(" separator="," close=")">
|
|
#{houseUserSubIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 通过户主(房主)ID删除其家庭成员信息 -->
|
|
<update id="removeSub" parameterType="map">
|
|
UPDATE
|
|
house_house_user_sub
|
|
SET
|
|
gmt_modified = #{gmtModified},
|
|
modifier = #{modifier},
|
|
is_delete = 1
|
|
WHERE
|
|
house_user_id IN
|
|
<foreach collection="houseUserIds" index="index" open="(" separator="," close=")">
|
|
#{houseUserIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 修改住户信息子表 -->
|
|
<update id="update" parameterType="map">
|
|
UPDATE
|
|
house_house_user_sub
|
|
SET
|
|
<if test="houseUserId != null and houseUserId != ''">
|
|
house_user_id = #{houseUserId},
|
|
</if>
|
|
<if test="populationId != null and populationId != ''">
|
|
population_id = #{populationId},
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
name = #{name},
|
|
</if>
|
|
<if test="sex != null and sex != ''">
|
|
sex = #{sex},
|
|
</if>
|
|
<if test="cardNum != null and cardNum != ''">
|
|
card_num = #{cardNum},
|
|
</if>
|
|
<if test="phone != null and phone != ''">
|
|
phone = #{phone},
|
|
</if>
|
|
<if test="relationship != null and relationship != ''">
|
|
relationship = #{relationship},
|
|
</if>
|
|
<if test="isLive != null and isLive != ''">
|
|
is_live = #{isLive},
|
|
</if>
|
|
<if test="remake != null and remake != ''">
|
|
remake = #{remake},
|
|
</if>
|
|
gmt_modified = #{gmtModified},
|
|
modifier = #{modifier},
|
|
house_user_sub_id = house_user_sub_id
|
|
WHERE
|
|
house_user_sub_id = #{houseUserSubId}
|
|
</update>
|
|
|
|
<!-- 住户信息子表详情 -->
|
|
<select id="get" parameterType="map" resultMap="houseUserSubDTO">
|
|
SELECT
|
|
t1.house_user_sub_id,
|
|
t1.house_user_id,
|
|
t1.population_id,
|
|
t1.name,
|
|
t1.sex,
|
|
t1.card_num,
|
|
t1.phone,
|
|
t1.relationship,
|
|
t1.is_live,
|
|
t1.remake,
|
|
t1.house_user_sub_id
|
|
FROM
|
|
house_house_user_sub t1
|
|
WHERE
|
|
1 = 1
|
|
<if test="houseUserSubId != null and houseUserSubId != ''">
|
|
AND
|
|
t1.house_user_sub_id = #{houseUserSubId}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 住户信息子表详情 -->
|
|
<select id="getBO" parameterType="map" resultMap="houseUserSubBO">
|
|
SELECT
|
|
t1.house_user_sub_id,
|
|
t1.house_user_id,
|
|
t1.population_id,
|
|
t1.name,
|
|
t1.sex,
|
|
t1.card_num,
|
|
t1.phone,
|
|
t1.relationship,
|
|
t1.is_live,
|
|
t1.remake
|
|
FROM
|
|
house_house_user_sub t1
|
|
WHERE
|
|
1 = 1
|
|
<if test="houseUserSubId != null and houseUserSubId != ''">
|
|
AND
|
|
t1.house_user_sub_id = #{houseUserSubId}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 住户信息子表详情 -->
|
|
<select id="getPO" parameterType="map" resultMap="houseUserSubPO">
|
|
SELECT
|
|
t1.house_user_sub_id,
|
|
t1.house_user_id,
|
|
t1.population_id,
|
|
t1.name,
|
|
t1.sex,
|
|
t1.card_num,
|
|
t1.phone,
|
|
t1.relationship,
|
|
t1.is_live,
|
|
t1.remake
|
|
FROM
|
|
house_house_user_sub t1
|
|
WHERE
|
|
1 = 1
|
|
<if test="houseUserSubId != null and houseUserSubId != ''">
|
|
AND
|
|
t1.house_user_sub_id = #{houseUserSubId}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 住户信息子表列表 -->
|
|
<select id="list" parameterType="map" resultMap="houseUserSubDTO">
|
|
SELECT
|
|
t1.house_user_sub_id,
|
|
t1.house_user_id,
|
|
t1.population_id,
|
|
t1.name,
|
|
t1.sex,
|
|
t1.card_num,
|
|
t1.phone,
|
|
t1.relationship,
|
|
t1.is_live,
|
|
t1.remake,
|
|
1
|
|
FROM
|
|
house_house_user_sub t1
|
|
WHERE
|
|
1 = 1
|
|
AND
|
|
t1.is_delete = 0
|
|
<if test="houseUserId != null and houseUserId != ''">
|
|
AND house_user_id = #{houseUserId}
|
|
</if>
|
|
<if test="keywords != null and keywords != ''">
|
|
AND (
|
|
t1.card_num LIKE CONCAT('%', #{keywords}, '%')
|
|
OR t1.name LIKE CONCAT('%', #{keywords}, '%')
|
|
)
|
|
</if>
|
|
<if test="houseUserSubIds != null and houseUserSubIds.size > 0">
|
|
AND
|
|
t1.house_user_sub_id IN
|
|
<foreach collection="houseUserSubIds" index="index" open="(" separator="," close=")">
|
|
#{houseUserSubIds[${index}]}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 住户信息子表列表 -->
|
|
<select id="listBO" parameterType="map" resultMap="houseUserSubBO">
|
|
SELECT
|
|
t1.house_user_sub_id,
|
|
t1.house_user_id,
|
|
t1.population_id,
|
|
t1.name,
|
|
t1.sex,
|
|
t1.card_num,
|
|
t1.phone,
|
|
t1.relationship,
|
|
t1.is_live,
|
|
t1.remake
|
|
FROM
|
|
house_house_user_sub t1
|
|
WHERE
|
|
1 = 1
|
|
<if test="keywords != null and keywords != ''">
|
|
AND (
|
|
<!-- 这里添加其他条件 -->
|
|
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
|
)
|
|
</if>
|
|
<if test="houseUserSubIds != null and houseUserSubIds.size > 0">
|
|
AND
|
|
t1.house_user_sub_id IN
|
|
<foreach collection="houseUserSubIds" index="index" open="(" separator="," close=")">
|
|
#{houseUserSubIds[${index}]}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 住户信息子表列表 -->
|
|
<select id="listPO" parameterType="map" resultMap="houseUserSubPO">
|
|
SELECT
|
|
t1.house_user_sub_id,
|
|
t1.house_user_id,
|
|
t1.population_id,
|
|
t1.name,
|
|
t1.sex,
|
|
t1.card_num,
|
|
t1.phone,
|
|
t1.relationship,
|
|
t1.is_live,
|
|
t1.remake
|
|
FROM
|
|
house_house_user_sub t1
|
|
WHERE
|
|
1 = 1
|
|
<if test="keywords != null and keywords != ''">
|
|
AND (
|
|
<!-- 这里添加其他条件 -->
|
|
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
|
)
|
|
</if>
|
|
<if test="houseUserSubIds != null and houseUserSubIds.size > 0">
|
|
AND
|
|
t1.house_user_sub_id IN
|
|
<foreach collection="houseUserSubIds" index="index" open="(" separator="," close=")">
|
|
#{houseUserSubIds[${index}]}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 住户信息子表统计 -->
|
|
<select id="count" parameterType="map" resultType="Integer">
|
|
SELECT
|
|
COUNT(*)
|
|
FROM
|
|
house_house_user_sub t1
|
|
WHERE
|
|
1 = 1
|
|
</select>
|
|
|
|
</mapper> |