| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <?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.live.mapper.LiveUserFirstEntryMapper">
- <resultMap type="LiveUserFirstEntry" id="LiveUserFirstEntryResult">
- <result property="id" column="id" />
- <result property="userId" column="user_id" />
- <result property="liveId" column="live_id" />
- <result property="entryDate" column="entry_date" />
- <result property="firstEntryTime" column="first_entry_time" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="companyId" column="company_id" />
- <result property="companyUserId" column="company_user_id" />
- <result property="qwUserId" column="qw_user_id" />
- <result property="externalContactId" column="external_contact_id" />
- </resultMap>
- <sql id="selectLiveUserFirstEntryVo">
- select id, user_id, live_id, entry_date, first_entry_time,company_id,company_user_id, create_time, update_time,qw_user_id,external_contact_id from live_user_first_entry
- </sql>
- <select id="selectLiveUserFirstEntryList" parameterType="LiveUserFirstEntry" resultMap="LiveUserFirstEntryResult">
- <include refid="selectLiveUserFirstEntryVo"/>
- <where>
- <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
- <if test="liveId != null and liveId != ''"> and live_id = #{liveId}</if>
- <if test="entryDate != null "> and entry_date = #{entryDate}</if>
- <if test="firstEntryTime != null "> and first_entry_time = #{firstEntryTime}</if>
- <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
- <if test="companyId != null "> and company_id = #{companyId}</if>
- <if test="qwUserId != null "> and qw_user_id = #{qwUserId}</if>
- <if test="externalContactId != null "> and external_contact_id = #{externalContactId}</if>
- </where>
- </select>
- <select id="selectLiveUserFirstEntryById" parameterType="Long" resultMap="LiveUserFirstEntryResult">
- <include refid="selectLiveUserFirstEntryVo"/>
- where id = #{id}
- </select>
- <insert id="insertLiveUserFirstEntry" parameterType="LiveUserFirstEntry" useGeneratedKeys="true" keyProperty="id">
- insert into live_user_first_entry
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="userId != null and userId != ''">user_id,</if>
- <if test="liveId != null and liveId != ''">live_id,</if>
- <if test="entryDate != null">entry_date,</if>
- <if test="firstEntryTime != null">first_entry_time,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="companyUserId != null">company_user_id,</if>
- <if test="companyId != null">company_id,</if>
- <if test="qwUserId != null">qw_user_id,</if>
- <if test="externalContactId != null">external_contact_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="userId != null and userId != ''">#{userId},</if>
- <if test="liveId != null and liveId != ''">#{liveId},</if>
- <if test="entryDate != null">#{entryDate},</if>
- <if test="firstEntryTime != null">#{firstEntryTime},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="companyUserId != null">#{companyUserId},</if>
- <if test="companyId != null">#{companyId},</if>
- <if test="qwUserId != null">#{qwUserId},</if>
- <if test="externalContactId != null">#{externalContactId},</if>
- </trim>
- </insert>
- <update id="updateLiveUserFirstEntry" parameterType="LiveUserFirstEntry">
- update live_user_first_entry
- <trim prefix="SET" suffixOverrides=",">
- <if test="userId != null and userId != ''">user_id = #{userId},</if>
- <if test="liveId != null and liveId != ''">live_id = #{liveId},</if>
- <if test="entryDate != null">entry_date = #{entryDate},</if>
- <if test="firstEntryTime != null">first_entry_time = #{firstEntryTime},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
- <if test="externalContactId != null">external_contact_id = #{externalContactId},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteLiveUserFirstEntryById" parameterType="Long">
- delete from live_user_first_entry where id = #{id}
- </delete>
- <delete id="deleteLiveUserFirstEntryByIds" parameterType="String">
- delete from live_user_first_entry where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="selectLiveProfitList" resultType="com.fs.live.vo.LiveUserFirstProfit">
- SELECT
- lo.order_id,lo.order_code,lo.user_name,lo.user_phone,lo.total_price,lo.pay_price,lo.is_pay,lo.status,
- cu.user_id AS company_user_id,
- cu.nick_name AS company_user_name,
- c.company_name
- FROM
- live_order lo
- LEFT JOIN
- live_user_first_entry lufe
- ON lo.user_id = lufe.user_id
- AND DATE(lo.create_time) = lufe.entry_date
- LEFT JOIN
- company_user cu
- ON lufe.company_user_id = cu.user_id
- left join company c on cu.company_id = c.company_id
- ORDER BY
- lo.create_time DESC
- </select>
- </mapper>
|