150 lines
8.3 KiB
XML
150 lines
8.3 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.stdiet.custom.mapper.SysCustomerMapper">
|
|
|
|
<resultMap type="SysCustomer" id="SysCustomerResult">
|
|
<result property="id" column="id" />
|
|
<result property="name" column="name" />
|
|
<result property="phone" column="phone" />
|
|
<result property="email" column="email" />
|
|
<result property="address" column="address" />
|
|
<result property="payDate" column="pay_date" />
|
|
<result property="startDate" column="start_date" />
|
|
<result property="fansTime" column="fans_time" />
|
|
<result property="fansChannel" column="fans_channel" />
|
|
<result property="purchaseNum" column="purchase_num" />
|
|
<result property="payTotal" column="pay_total" />
|
|
<result property="mainDietitian" column="main_dietitian" />
|
|
<result property="assistantDietitian" column="assistant_dietitian" />
|
|
<result property="afterDietitian" column="after_dietitian" />
|
|
<result property="salesman" column="salesman" />
|
|
<result property="chargePerson" column="charge_person" />
|
|
<result property="followStatus" column="follow_status" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
</resultMap>
|
|
|
|
<sql id="selectSysCustomerVo">
|
|
select id, name, phone, email, fans_time, fans_channel, address, pay_date, start_date, purchase_num, pay_total, main_dietitian, assistant_dietitian, after_dietitian, salesman, charge_person, follow_status, create_time, create_by, update_time, update_by from sys_customer
|
|
</sql>
|
|
|
|
<select id="selectSysCustomerList" parameterType="SysCustomer" resultMap="SysCustomerResult">
|
|
<include refid="selectSysCustomerVo"/>
|
|
where del_flag = 0
|
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%') or phone like concat('%', #{name}, '%')</if>
|
|
<if test="mainDietitian != null and mainDietitian != ''"> and main_dietitian = #{mainDietitian}</if>
|
|
<if test="mainDietitian == 0"> and isnull(main_dietitian) or main_dietitian=0</if>
|
|
<if test="salesman != null and salesman != ''"> and salesman = #{salesman}</if>
|
|
<if test="salesman == 0"> and isnull(salesman) or salesman=0</if>
|
|
<if test="afterDietitian != null and afterDietitian != ''"> and after_dietitian = #{afterDietitian}</if>
|
|
<if test="afterDietitian == 0"> and isnull(after_dietitian) or after_dietitian=0</if>
|
|
<if test="assistantDietitian != null and assistantDietitian != ''"> and assistant_dietitian = #{assistantDietitian}</if>
|
|
<if test="assistantDietitian == 0"> and isnull(assistant_dietitian) or assistant_dietitian=0</if>
|
|
<if test="fansChannel != null "> and fans_channel = #{fansChannel}</if>
|
|
order by create_time desc
|
|
</select>
|
|
|
|
<select id="selectSysCustomerById" parameterType="Long" resultMap="SysCustomerResult">
|
|
<include refid="selectSysCustomerVo"/>
|
|
where id = #{id} and del_flag = 0
|
|
</select>
|
|
|
|
<insert id="insertSysCustomer" parameterType="SysCustomer" useGeneratedKeys="true" keyProperty="id">
|
|
insert into sys_customer
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="name != null">name,</if>
|
|
<if test="phone != null">phone,</if>
|
|
<if test="fansTime != null">fans_time,</if>
|
|
<if test="fansChannel != null">fans_channel,</if>
|
|
<if test="email != null">email,</if>
|
|
<if test="address != null">address,</if>
|
|
<if test="payDate != null">pay_date,</if>
|
|
<if test="startDate != null">start_date,</if>
|
|
<if test="purchaseNum != null">purchase_num,</if>
|
|
<if test="payTotal != null">pay_total,</if>
|
|
<if test="mainDietitian != null">main_dietitian,</if>
|
|
<if test="assistantDietitian != null">assistant_dietitian,</if>
|
|
<if test="afterDietitian != null">after_dietitian,</if>
|
|
<if test="salesman != null">salesman,</if>
|
|
<if test="chargePerson != null">charge_person,</if>
|
|
<if test="followStatus != null">follow_status,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="name != null">#{name},</if>
|
|
<if test="phone != null">#{phone},</if>
|
|
<if test="fansTime != null">#{fansTime},</if>
|
|
<if test="fansChannel != null">#{fansChannel},</if>
|
|
<if test="email != null">#{email},</if>
|
|
<if test="address != null">#{address},</if>
|
|
<if test="payDate != null">#{payDate},</if>
|
|
<if test="startDate != null">#{startDate},</if>
|
|
<if test="purchaseNum != null">#{purchaseNum},</if>
|
|
<if test="payTotal != null">#{payTotal},</if>
|
|
<if test="mainDietitian != null">#{mainDietitian},</if>
|
|
<if test="assistantDietitian != null">#{assistantDietitian},</if>
|
|
<if test="afterDietitian != null">#{afterDietitian},</if>
|
|
<if test="salesman != null">#{salesman},</if>
|
|
<if test="chargePerson != null">#{chargePerson},</if>
|
|
<if test="followStatus != null">#{followStatus},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateSysCustomer" parameterType="SysCustomer">
|
|
update sys_customer
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="name != null">name = #{name},</if>
|
|
<if test="phone != null">phone = #{phone},</if>
|
|
<if test="fansTime != null">fans_time = #{fansTime},</if>
|
|
<if test="fansChannel != null">fans_channel = #{fansChannel},</if>
|
|
<if test="email != null">email = #{email},</if>
|
|
<if test="address != null">address = #{address},</if>
|
|
<if test="payDate != null">pay_date = #{payDate},</if>
|
|
<if test="startDate != null">start_date = #{startDate},</if>
|
|
<if test="purchaseNum != null">purchase_num = #{purchaseNum},</if>
|
|
<if test="payTotal != null">pay_total = #{payTotal},</if>
|
|
<if test="mainDietitian != null">main_dietitian = #{mainDietitian},</if>
|
|
<if test="assistantDietitian != null">assistant_dietitian = #{assistantDietitian},</if>
|
|
<if test="afterDietitian != null">after_dietitian = #{afterDietitian},</if>
|
|
<if test="salesman != null">salesman = #{salesman},</if>
|
|
<if test="chargePerson != null">charge_person = #{chargePerson},</if>
|
|
<if test="followStatus != null">follow_status = #{followStatus},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteSysCustomerById" parameterType="Long">
|
|
update sys_customer set del_flag = 1 where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteSysCustomerByIds" parameterType="String">
|
|
update sys_customer set del_flag = 1 where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 根据手机号查询客户 -->
|
|
<select id="getCustomerByPhone" parameterType="String" resultMap="SysCustomerResult">
|
|
<include refid="selectSysCustomerVo"/>
|
|
where phone = #{phone} and del_flag = 0
|
|
</select>
|
|
|
|
|
|
|
|
</mapper> |