| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- <?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.LiveWatchLogMapper">
- <resultMap type="LiveWatchLog" id="LiveWatchLogResult">
- <result property="logId" column="log_id" />
- <result property="userId" column="user_id" />
- <result property="liveId" column="live_id" />
- <result property="logType" column="log_type" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="externalContactId" column="external_contact_id" />
- <result property="companyUserId" column="company_user_id" />
- <result property="companyId" column="company_id" />
- <result property="finishTime" column="finish_time" />
- <result property="createBy" column="create_by" />
- <result property="sopCreateTime" column="sop_create_time" />
- <result property="sendAppId" column="send_app_id" />
- <result property="logSource" column="log_source" />
- <result property="qwUserId" column="qw_user_id" />
- <result property="watchType" column="watch_type" />
- <result property="corpId" column="corp_id" />
- <result property="liveBuy" column="live_buy" />
- <result property="replayBuy" column="replay_buy" />
- </resultMap>
- <sql id="selectLiveWatchLogVo">
- select log_id, user_id, live_id, log_type, create_time, update_time, external_contact_id, company_user_id, company_id, finish_time, create_by, sop_create_time,live_buy,replay_buy,
- send_app_id, log_source, qw_user_id,watch_type,corp_id from live_watch_log
- </sql>
- <select id="selectLiveWatchLogList" parameterType="LiveWatchLog" resultMap="LiveWatchLogResult">
- <include refid="selectLiveWatchLogVo"/>
- <where>
- <if test="userId != null "> and user_id = #{userId}</if>
- <if test="liveId != null "> and live_id = #{liveId}</if>
- <if test="logType != null "> and log_type = #{logType}</if>
- <if test="externalContactId != null "> and external_contact_id = #{externalContactId}</if>
- <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
- <if test="companyId != null "> and company_id = #{companyId}</if>
- <if test="finishTime != null "> and finish_time = #{finishTime}</if>
- <if test="sopCreateTime != null "> and sop_create_time = #{sopCreateTime}</if>
- <if test="sendAppId != null and sendAppId != ''"> and send_app_id = #{sendAppId}</if>
- <if test="logSource != null "> and log_source = #{logSource}</if>
- <if test="qwUserId != null and qwUserId != ''"> and qw_user_id = #{qwUserId}</if>
- <if test="watchType != null">and watch_type = #{watchType} </if>
- <if test="corpId != null">and corp_id = #{corpId} </if>
- <if test="liveBuy != null">and live_buy = #{liveBuy} </if>
- <if test="replayBuy != null">and replay_buy = #{replayBuy} </if>
- </where>
- </select>
- <select id="selectLiveWatchLogByLogId" parameterType="Long" resultMap="LiveWatchLogResult">
- <include refid="selectLiveWatchLogVo"/>
- where log_id = #{logId}
- </select>
- <insert id="insertLiveWatchLog" parameterType="LiveWatchLog" useGeneratedKeys="true" keyProperty="logId">
- insert into live_watch_log
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="userId != null">user_id,</if>
- <if test="liveId != null">live_id,</if>
- <if test="logType != null">log_type,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="externalContactId != null">external_contact_id,</if>
- <if test="companyUserId != null">company_user_id,</if>
- <if test="companyId != null">company_id,</if>
- <if test="finishTime != null">finish_time,</if>
- <if test="createBy != null">create_by,</if>
- <if test="sopCreateTime != null">sop_create_time,</if>
- <if test="sendAppId != null">send_app_id,</if>
- <if test="logSource != null">log_source,</if>
- <if test="qwUserId != null">qw_user_id,</if>
- <if test="watchType != null">watch_type,</if>
- <if test="corpId != null">corp_id,</if>
- <if test="liveBuy != null">live_buy,</if>
- <if test="replayBuy != null">replay_buy,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="userId != null">#{userId},</if>
- <if test="liveId != null">#{liveId},</if>
- <if test="logType != null">#{logType},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="externalContactId != null">#{externalContactId},</if>
- <if test="companyUserId != null">#{companyUserId},</if>
- <if test="companyId != null">#{companyId},</if>
- <if test="finishTime != null">#{finishTime},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="sopCreateTime != null">#{sopCreateTime},</if>
- <if test="sendAppId != null">#{sendAppId},</if>
- <if test="logSource != null">#{logSource},</if>
- <if test="qwUserId != null">#{qwUserId},</if>
- <if test="watchType != null">#{watchType},</if>
- <if test="corpId != null">#{corpId},</if>
- <if test="liveBuy != null">#{liveBuy},</if>
- <if test="replayBuy != null">#{replayBuy},</if>
- </trim>
- </insert>
- <update id="updateLiveWatchLog" parameterType="LiveWatchLog">
- update live_watch_log
- <trim prefix="SET" suffixOverrides=",">
- <if test="userId != null">user_id = #{userId},</if>
- <if test="liveId != null">live_id = #{liveId},</if>
- <if test="logType != null">log_type = #{logType},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="externalContactId != null">external_contact_id = #{externalContactId},</if>
- <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="finishTime != null">finish_time = #{finishTime},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="sopCreateTime != null">sop_create_time = #{sopCreateTime},</if>
- <if test="sendAppId != null">send_app_id = #{sendAppId},</if>
- <if test="logSource != null">log_source = #{logSource},</if>
- <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
- <if test="watchType != null">watch_type = #{watchType},</if>
- <if test="corpId != null">corp_id = #{corpId},</if>
- <if test="liveBuy != null">live_buy = #{liveBuy},</if>
- <if test="replayBuy != null">replay_buy = #{replayBuy},</if>
- </trim>
- where log_id = #{logId}
- </update>
- <delete id="deleteLiveWatchLogByLogId" parameterType="Long">
- delete from live_watch_log where log_id = #{logId}
- </delete>
- <delete id="deleteLiveWatchLogByLogIds" parameterType="String">
- delete from live_watch_log where log_id in
- <foreach item="logId" collection="array" open="(" separator="," close=")">
- #{logId}
- </foreach>
- </delete>
- <insert id="insertLiveWatchLogBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="logId">
- INSERT INTO live_watch_log
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="liveWatchLogs != null and liveWatchLogs.size() > 0">
- <foreach collection="liveWatchLogs" item="item" index="index" open="" close="" separator="">
- <if test="index == 0">
- <if test="item.userId != null">user_id,</if>
- <if test="item.liveId != null">live_id,</if>
- <if test="item.logType != null">log_type,</if>
- <if test="item.createTime != null">create_time,</if>
- <if test="item.updateTime != null">update_time,</if>
- <if test="item.externalContactId != null">external_contact_id,</if>
- <if test="item.companyUserId != null">company_user_id,</if>
- <if test="item.companyId != null">company_id,</if>
- <if test="item.finishTime != null">finish_time,</if>
- <if test="item.createBy != null">create_by,</if>
- <if test="item.sopCreateTime != null">sop_create_time,</if>
- <if test="item.sendAppId != null">send_app_id,</if>
- <if test="item.logSource != null">log_source,</if>
- <if test="item.qwUserId != null">qw_user_id,</if>
- <if test="item.watchType != null">watch_type,</if>
- <if test="item.corpId != null">corp_id,</if>
- <if test="item.liveBuy != null">live_buy,</if>
- <if test="item.replayBuy != null">replay_buy,</if>
- </if>
- </foreach>
- </if>
- </trim>
- <trim prefix="VALUES">
- <foreach collection="liveWatchLogs" item="item" separator=",">
- (<trim suffixOverrides=",">
- <if test="item.userId != null">#{item.userId},</if>
- <if test="item.liveId != null">#{item.liveId},</if>
- <if test="item.logType != null">#{item.logType},</if>
- <if test="item.createTime != null">#{item.createTime},</if>
- <if test="item.updateTime != null">#{item.updateTime},</if>
- <if test="item.externalContactId != null">#{item.externalContactId},</if>
- <if test="item.companyUserId != null">#{item.companyUserId},</if>
- <if test="item.companyId != null">#{item.companyId},</if>
- <if test="item.finishTime != null">#{item.finishTime},</if>
- <if test="item.createBy != null">#{item.createBy},</if>
- <if test="item.sopCreateTime != null">#{item.sopCreateTime},</if>
- <if test="item.sendAppId != null">#{item.sendAppId},</if>
- <if test="item.logSource != null">#{item.logSource},</if>
- <if test="item.qwUserId != null">#{item.qwUserId},</if>
- <if test="item.watchType != null">#{item.watchType},</if>
- <if test="item.corpId != null">#{item.corpId},</if>
- <if test="item.liveBuy != null">#{item.liveBuy},</if>
- <if test="item.replayBuy != null">#{item.replayBuy},</if>
- </trim>)
- </foreach>
- </trim>
- </insert>
- <update id="updateLiveWatchLogCondition" parameterType="com.fs.live.domain.LiveWatchLog" >
- update live_watch_log
- set update_time = NOW(),
- sop_create_time = NOW(),
- send_app_id = #{liveWatchLog.sendAppId},
- log_source = #{liveWatchLog.logSource}
- where external_contact_id = #{liveWatchLog.externalContactId}
- and live_id = #{liveWatchLog.liveId}
- and qw_user_id = #{liveWatchLog.qwUserId}
- </update>
- <select id="selectOneLogByLiveIdAndQwUserIdAndExternalId" resultType="com.fs.live.domain.LiveWatchLog">
- select * from live_watch_log where live_id = #{liveId} and qw_user_id = #{qwUserId} and external_contact_id = #{externalContactId}
- </select>
- </mapper>
|