|
|
@@ -0,0 +1,125 @@
|
|
|
+<?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.fs.hisStore.mapper.FsStoreProductUserRecordMapper">
|
|
|
+
|
|
|
+ <resultMap type="FsStoreProductUserRecord" id="FsStoreProductUserRecordResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="tempId" column="temp_id" />
|
|
|
+ <result property="productId" column="product_id" />
|
|
|
+ <result property="userId" column="user_id" />
|
|
|
+ <result property="remark" column="remark" />
|
|
|
+ <result property="isDel" column="is_del" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectFsStoreProductUserRecordVo">
|
|
|
+ select id, temp_id, product_id, user_id, remark, is_del, create_time, update_time from fs_store_product_user_record
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <sql id="selectFsStoreProductUserRecordJoinVo">
|
|
|
+ SELECT
|
|
|
+ r.id AS id,
|
|
|
+ r.temp_id AS tempId,
|
|
|
+ r.product_id AS productId,
|
|
|
+ r.user_id AS userId,
|
|
|
+ r.remark AS remark,
|
|
|
+ r.is_del AS isDel,
|
|
|
+ r.create_time AS createTime,
|
|
|
+ r.update_time AS updateTime,
|
|
|
+ u.nick_name AS nickName,
|
|
|
+ u.phone AS phone,
|
|
|
+ u.name AS name,
|
|
|
+ t.name AS tempName,
|
|
|
+ t.name AS templateTitle,
|
|
|
+ p.product_name AS productName
|
|
|
+ FROM fs_store_product_user_record r
|
|
|
+ LEFT JOIN fs_user u ON r.user_id = u.user_id
|
|
|
+ LEFT JOIN fs_store_product_user_temp t ON r.temp_id = t.id
|
|
|
+ LEFT JOIN fs_store_product_scrm p ON r.product_id = p.product_id
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectFsStoreProductUserRecordList" parameterType="FsStoreProductUserRecord" resultMap="FsStoreProductUserRecordResult">
|
|
|
+ <include refid="selectFsStoreProductUserRecordVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="tempId != null "> and temp_id = #{tempId}</if>
|
|
|
+ <if test="productId != null "> and product_id = #{productId}</if>
|
|
|
+ <if test="userId != null "> and user_id = #{userId}</if>
|
|
|
+ <if test="isDel != null "> and is_del = #{isDel}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectFsStoreProductUserRecordListVO" parameterType="com.fs.hisStore.vo.FsStoreProductUserRecordVO" resultType="com.fs.hisStore.vo.FsStoreProductUserRecordVO">
|
|
|
+ <include refid="selectFsStoreProductUserRecordJoinVo"/>
|
|
|
+ <where>
|
|
|
+ and r.is_del = 0
|
|
|
+ <if test="tempId != null "> and r.temp_id = #{tempId}</if>
|
|
|
+ <if test="productId != null "> and r.product_id = #{productId}</if>
|
|
|
+ <if test="userId != null "> and r.user_id = #{userId}</if>
|
|
|
+ <if test="isDel != null "> and r.is_del = #{isDel}</if>
|
|
|
+ <if test="nickName != null and nickName != ''"> and u.nick_name like concat('%', #{nickName}, '%')</if>
|
|
|
+ <if test="phone != null and phone != ''"> and u.phone like concat('%', #{phone}, '%')</if>
|
|
|
+ <if test="name != null and name != ''"> and u.name like concat('%', #{name}, '%')</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectFsStoreProductUserRecordById" parameterType="Long" resultMap="FsStoreProductUserRecordResult">
|
|
|
+ <include refid="selectFsStoreProductUserRecordVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectFsStoreProductUserRecordDetailById" parameterType="Long" resultType="com.fs.hisStore.vo.FsStoreProductUserRecordVO">
|
|
|
+ <include refid="selectFsStoreProductUserRecordJoinVo"/>
|
|
|
+ where r.id = #{id}
|
|
|
+ and r.is_del = 0
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertFsStoreProductUserRecord" parameterType="FsStoreProductUserRecord" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into fs_store_product_user_record
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="tempId != null">temp_id,</if>
|
|
|
+ <if test="productId != null">product_id,</if>
|
|
|
+ <if test="userId != null">user_id,</if>
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
+ <if test="isDel != null">is_del,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="tempId != null">#{tempId},</if>
|
|
|
+ <if test="productId != null">#{productId},</if>
|
|
|
+ <if test="userId != null">#{userId},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ <if test="isDel != null">#{isDel},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateFsStoreProductUserRecord" parameterType="FsStoreProductUserRecord">
|
|
|
+ update fs_store_product_user_record
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="tempId != null">temp_id = #{tempId},</if>
|
|
|
+ <if test="productId != null">product_id = #{productId},</if>
|
|
|
+ <if test="userId != null">user_id = #{userId},</if>
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
+ <if test="isDel != null">is_del = #{isDel},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteFsStoreProductUserRecordById" parameterType="Long">
|
|
|
+ delete from fs_store_product_user_record where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteFsStoreProductUserRecordByIds" parameterType="String">
|
|
|
+ delete from fs_store_product_user_record where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|