Files
zxjp-web/coolstore-partner-dao/src/main/resources/mapper/HyPartnerUserInfoMapper.xml

231 lines
8.8 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.HyPartnerUserInfoMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyPartnerUserInfoDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="partner_id" jdbcType="VARCHAR" property="partnerId" />
<result column="mobile" jdbcType="VARCHAR" property="mobile" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="live_area" jdbcType="VARCHAR" property="liveArea" />
<result column="want_shop_area" jdbcType="VARCHAR" property="wantShopArea" />
<result column="accept_adjust_type" jdbcType="TINYINT" property="acceptAdjustType" />
<result column="invite_code" jdbcType="VARCHAR" property="inviteCode" />
<result column="is_write_partner_know" jdbcType="TINYINT" property="isWritePartnerKnow" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="shop_code" jdbcType="VARCHAR" property="shopCode" />
<result column="shop_name" jdbcType="VARCHAR" property="shopName" />
<result column="shop_id" jdbcType="VARCHAR" property="shopId" />
<result column="recommend_partner_id" jdbcType="VARCHAR" property="recommendPartnerId" />
<result column="recommend_partner_name" jdbcType="VARCHAR" property="recommendPartnerName" />
<result column="recommend_partner_mobile" jdbcType="VARCHAR" property="recommendPartnerMobile" />
</resultMap>
<sql id="Base_Column_List">
id, partner_id, mobile, username, live_area, want_shop_area, accept_adjust_type,
invite_code, is_write_partner_know, create_time, update_time, shop_code, shop_name, shop_id, recommend_partner_id, recommend_partner_name, recommend_partner_mobile
</sql>
<select id="selectByPartnerId" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"></include>
from hy_partner_user_info
where partner_id = #{partnerId}
</select>
<select id="selectByMobile" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"></include>
from hy_partner_user_info
where mobile = #{mobile}
</select>
<select id="selectByPartnerIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"></include>
from hy_partner_user_info
<where>
<if test="partnerIdList!=null and partnerIdList.size>0">
<foreach collection="partnerIdList" open="and partner_id in (" close=")" separator="," item="partnerId">
#{partnerId}
</foreach>
</if>
</where>
</select>
<select id="selectByHourDate" resultType="com.cool.store.entity.SyncEcCustomerDO" >
SELECT a.id as id, a.username as customername,a.mobile as customermobile,d.`name` as followname,d.mobile as followmobile ,c.channel_id as channelId FROM hy_partner_user_info a LEFT join hy_partner_line_info b on
a.partner_id=b.partner_id LEFT join hy_partner_user_channel c on b.user_channel_id=c.channel_id left join enterprise_user d on b.investment_manager=d.user_id
WHERE ( a.create_time BETWEEN #{selectTime} and #{now} or
a.update_time BETWEEN #{selectTime} and #{now} ) and a.username is not null order by a.id Limit #{limit1},#{limit2}
</select>
<select id="selectByHourDateCount" resultType="java.lang.Integer">
SELECT count(*) FROM hy_partner_user_info a LEFT join hy_partner_line_info b on
a.partner_id=b.partner_id LEFT join hy_partner_user_channel c on b.user_channel_id=c.channel_id left join enterprise_user d on b.investment_manager=d.user_id
WHERE (a.create_time BETWEEN #{selectTime} and #{now} or
a.update_time BETWEEN #{selectTime} and #{now} ) and a.username is not null
</select>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into hy_partner_user_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record.partnerId != null">
partner_id,
</if>
<if test="record.mobile != null">
mobile,
</if>
<if test="record.username != null">
username,
</if>
<if test="record.liveArea != null">
live_area,
</if>
<if test="record.wantShopArea != null">
want_shop_area,
</if>
<if test="record.acceptAdjustType != null">
accept_adjust_type,
</if>
<if test="record.inviteCode != null">
invite_code,
</if>
<if test="record.isWritePartnerKnow != null">
is_write_partner_know,
</if>
<if test="record.createTime != null">
create_time,
</if>
<if test="record.updateTime != null">
update_time,
</if>
<if test="record.shopCode != null">
shop_code,
</if>
<if test="record.shopName != null">
shop_name,
</if>
<if test="record.shopId != null">
shop_id,
</if>
<if test="record.recommendPartnerId != null">
recommend_partner_id,
</if>
<if test="record.recommendPartnerName != null">
recommend_partner_name,
</if>
<if test="record.recommendPartnerMobile != null">
recommend_partner_mobile,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.partnerId != null">
#{record.partnerId},
</if>
<if test="record.mobile != null">
#{record.mobile},
</if>
<if test="record.username != null">
#{record.username},
</if>
<if test="record.liveArea != null">
#{record.liveArea},
</if>
<if test="record.wantShopArea != null">
#{record.wantShopArea},
</if>
<if test="record.acceptAdjustType != null">
#{record.acceptAdjustType},
</if>
<if test="record.inviteCode != null">
#{record.inviteCode},
</if>
<if test="record.isWritePartnerKnow != null">
#{record.isWritePartnerKnow},
</if>
<if test="record.createTime != null">
#{record.createTime},
</if>
<if test="record.updateTime != null">
#{record.updateTime},
</if>
<if test="record.shopCode != null">
#{record.shopCode},
</if>
<if test="record.shopName != null">
#{record.shopName},
</if>
<if test="record.shopId != null">
#{record.shopId},
</if>
<if test="record.recommendPartnerId != null">
#{record.recommendPartnerId},
</if>
<if test="record.recommendPartnerName != null">
#{record.recommendPartnerName},
</if>
<if test="record.recommendPartnerMobile != null">
#{record.recommendPartnerMobile},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update hy_partner_user_info
<set>
<if test="record.partnerId != null">
partner_id = #{record.partnerId},
</if>
<if test="record.mobile != null">
mobile = #{record.mobile},
</if>
<if test="record.username != null">
username = #{record.username},
</if>
<if test="record.liveArea != null">
live_area = #{record.liveArea},
</if>
<if test="record.wantShopArea != null">
want_shop_area = #{record.wantShopArea},
</if>
<if test="record.acceptAdjustType != null">
accept_adjust_type = #{record.acceptAdjustType},
</if>
<if test="record.inviteCode != null">
invite_code = #{record.inviteCode},
</if>
<if test="record.isWritePartnerKnow != null">
is_write_partner_know = #{record.isWritePartnerKnow},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime},
</if>
<if test="record.shopCode != null">
shop_code = #{record.shopCode},
</if>
<if test="record.shopName != null">
shop_name = #{record.shopName},
</if>
<if test="record.shopId != null">
shop_id = #{record.shopId},
</if>
<if test="record.recommendPartnerId != null">
recommend_partner_id = #{record.recommendPartnerId},
</if>
<if test="record.recommendPartnerName != null">
recommend_partner_name = #{record.recommendPartnerName},
</if>
<if test="record.recommendPartnerMobile != null">
recommend_partner_mobile = #{record.recommendPartnerMobile},
</if>
</set>
where id = #{record.id}
</update>
<update id="updateJoinKnowById">
update hy_partner_user_info
set `is_write_partner_know`=#{isWritePartnerKnow,jdbcType=INTEGER}
where id=#{id,jdbcType=BIGINT}
</update>
</mapper>