Files
zxjp-web/coolstore-partner-dao/src/main/resources/mapper/HyPartnerBaseInfoMapper.xml
2023-09-07 15:03:29 +08:00

326 lines
10 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.cool.store.mapper.HyPartnerBaseInfoMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyPartnerBaseInfoDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="partner_id" jdbcType="VARCHAR" property="partnerId" />
<result column="partner_line_id" jdbcType="BIGINT" property="partnerLineId" />
<result column="mobile" jdbcType="VARCHAR" property="mobile" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="sex" jdbcType="BIT" property="sex" />
<result column="nation" jdbcType="VARCHAR" property="nation" />
<result column="birthdate" jdbcType="DATE" property="birthdate" />
<result column="id_card" jdbcType="VARCHAR" property="idCard" />
<result column="id_card_photo_front" jdbcType="VARCHAR" property="idCardPhotoFront" />
<result column="id_card_photo_black" jdbcType="VARCHAR" property="idCardPhotoBlack" />
<result column="live_address" jdbcType="VARCHAR" property="liveAddress" />
<result column="user_portrait" jdbcType="VARCHAR" property="userPortrait" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="latest_log_message" jdbcType="VARCHAR" property="latestLogMessage" />
<result column="pass_reason" jdbcType="VARCHAR" property="passReason" />
<result column="certify_file" jdbcType="VARCHAR" property="certifyFile" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
id, partner_id, partner_line_id, mobile, username, sex, nation, birthdate, id_card,
id_card_photo_front, id_card_photo_black, live_address, user_portrait, status, latest_log_message,
pass_reason, certify_file, create_time, update_time
</sql>
<select id="selectById" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from hy_partner_base_info
where
id = #{id}
</select>
<insert id="batchInsert">
insert into
hy_partner_base_info
(
partner_id,
partner_line_id
)
values
<foreach collection="records" item="record" separator=",">
(#{record.partnerId},
#{record.partnerLineId})
</foreach>
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into hy_partner_base_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record.partnerId != null">
partner_id,
</if>
<if test="record.partnerLineId != null">
partner_line_id,
</if>
<if test="record.mobile != null">
mobile,
</if>
<if test="record.username != null">
username,
</if>
<if test="record.sex != null">
sex,
</if>
<if test="record.nation != null">
nation,
</if>
<if test="record.birthdate != null">
birthdate,
</if>
<if test="record.idCard != null">
id_card,
</if>
<if test="record.idCardPhotoFront != null">
id_card_photo_front,
</if>
<if test="record.idCardPhotoBlack != null">
id_card_photo_black,
</if>
<if test="record.liveAddress != null">
live_address,
</if>
<if test="record.userPortrait != null">
user_portrait,
</if>
<if test="record.status != null">
status,
</if>
<if test="record.latestLogMessage != null">
latest_log_message,
</if>
<if test="record.passReason != null">
pass_reason,
</if>
<if test="record.certifyFile != null">
certify_file,
</if>
<if test="record.createTime != null">
create_time,
</if>
<if test="record.updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.partnerId != null">
#{record.partnerId},
</if>
<if test="record.partnerLineId != null">
#{record.partnerLineId},
</if>
<if test="record.mobile != null">
#{record.mobile},
</if>
<if test="record.username != null">
#{record.username},
</if>
<if test="record.sex != null">
#{record.sex},
</if>
<if test="record.nation != null">
#{record.nation},
</if>
<if test="record.birthdate != null">
#{record.birthdate},
</if>
<if test="record.idCard != null">
#{record.idCard},
</if>
<if test="record.idCardPhotoFront != null">
#{record.idCardPhotoFront},
</if>
<if test="record.idCardPhotoBlack != null">
#{record.idCardPhotoBlack},
</if>
<if test="record.liveAddress != null">
#{record.liveAddress},
</if>
<if test="record.userPortrait != null">
#{record.userPortrait},
</if>
<if test="record.status != null">
#{record.status},
</if>
<if test="record.latestLogMessage != null">
#{record.latestLogMessage},
</if>
<if test="record.passReason != null">
#{record.passReason},
</if>
<if test="record.certifyFile != null">
#{record.certifyFile},
</if>
<if test="record.createTime != null">
#{record.createTime},
</if>
<if test="record.updateTime != null">
#{record.updateTime},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update hy_partner_base_info
<set>
<if test="record.partnerId != null">
partner_id = #{record.partnerId},
</if>
<if test="record.partnerLineId != null">
partner_line_id = #{record.partnerLineId},
</if>
<if test="record.mobile != null">
mobile = #{record.mobile},
</if>
<if test="record.username != null">
username = #{record.username},
</if>
<if test="record.sex != null">
sex = #{record.sex},
</if>
<if test="record.nation != null">
nation = #{record.nation},
</if>
<if test="record.birthdate != null">
birthdate = #{record.birthdate},
</if>
<if test="record.idCard != null">
id_card = #{record.idCard},
</if>
<if test="record.idCardPhotoFront != null">
id_card_photo_front = #{record.idCardPhotoFront},
</if>
<if test="record.idCardPhotoBlack != null">
id_card_photo_black = #{record.idCardPhotoBlack},
</if>
<if test="record.liveAddress != null">
live_address = #{record.liveAddress},
</if>
<if test="record.userPortrait != null">
user_portrait = #{record.userPortrait},
</if>
<if test="record.status != null">
status = #{record.status},
</if>
<if test="record.latestLogMessage != null">
latest_log_message = #{record.latestLogMessage},
</if>
<if test="record.passReason != null">
pass_reason = #{record.passReason},
</if>
<if test="record.certifyFile != null">
certify_file = #{record.certifyFile},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime},
</if>
<if test="record.passTime != null">
pass_time = #{record.passTime},
</if>
<if test="record.passUserId != null">
pass_user_id = #{record.passUserId},
</if>
</set>
where id = #{record.id}
</update>
<update id="updateByPrimaryKey">
update hy_partner_base_info
set
nation = #{record.nation},
birthdate = #{record.birthdate},
id_card = #{record.idCard},
user_portrait = #{record.userPortrait},
id_card_photo_front = #{record.idCardPhotoFront},
id_card_photo_black = #{record.idCardPhotoBlack},
live_address = #{record.liveAddress},
status = #{record.status}
where id = #{record.id}
</update>
<update id="updateByPartnerId">
update hy_partner_base_info
<set>
update_time=now(),
<if test="userName != null and userName!=''">
username = #{userName},
</if>
<if test="mobile != null and mobile!=''">
mobile = #{mobile},
</if>
</set>
where partner_id = #{partnerId}
</update>
<select id="getByPartnerIdAndLineId" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"></include>
from hy_partner_base_info
where partner_id = #{partnerId} and partner_line_id = #{partnerLineId}
</select>
<select id="getByPartnerLineId" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"></include>
from hy_partner_base_info
where partner_line_id = #{partnerLineId}
</select>
<select id="getByPartnerLineIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"></include>
from hy_partner_base_info
<where>
<if test="partnerLineIds !=null and partnerLineIds.size>0">
<foreach collection="partnerLineIds" item="lineId" open="and partner_line_id in (" close=")" separator=",">
#{lineId}
</foreach>
</if>
</where>
</select>
<select id="getByIdCard" resultMap="BaseResultMap">
select
*
from hy_partner_base_info a
left join hy_partner_line_info b on a.partner_line_id = b.id
where a.id_card = #{idCard} and ( b.line_status != 3 and b.deleted = 0 )
</select>
<select id="selectAllList" resultType="java.lang.Integer">
SELECT count(*) FROM hy_partner_base_info where mobile is not null and user_portrait is null
</select>
<select id="selectListByLimit" resultType="com.cool.store.entity.SyncEcCustomerLabelDO">
SELECT id,mobile,user_portrait as userPortrait FROM hy_partner_base_info where mobile is not null and user_portrait is null LIMIT #{limit1},#{limit2}
</select>
<update id="cleanIdCardInfoByPartnerLineId">
update hy_partner_base_info
set
id_card = #{idCard},
id_card_photo_front = #{idCardPhotoFront},
id_card_photo_black = #{idCardPhotoBlack}
where partner_line_id = #{partnerLineId}
</update>
<update id="updateByMobile">
update hy_partner_base_info
<set>
update_time=now(),
<if test="userPortrait != null and userPortrait!=''">
user_portrait = concat(",",#{userPortrait},","),
</if>
</set>
where mobile = #{mobile}
</update>
</mapper>