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
)
DELETE FROM
house_house_user_sub
WHERE
house_user_sub_id IN
#{houseUserSubIds[${index}]}
UPDATE
house_house_user_sub
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
house_user_sub_id IN
#{houseUserSubIds[${index}]}
UPDATE
house_house_user_sub
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
house_user_id IN
#{houseUserIds[${index}]}
UPDATE
house_house_user_sub
SET
house_user_id = #{houseUserId},
population_id = #{populationId},
name = #{name},
sex = #{sex},
card_num = #{cardNum},
phone = #{phone},
relationship = #{relationship},
is_live = #{isLive},
remake = #{remake},
gmt_modified = #{gmtModified},
modifier = #{modifier},
house_user_sub_id = house_user_sub_id
WHERE
house_user_sub_id = #{houseUserSubId}