LiveTrafficLogMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.live.mapper.LiveTrafficLogMapper">
  6. <resultMap type="LiveTrafficLog" id="LiveTrafficLogResult">
  7. <result property="logId" column="log_id" />
  8. <result property="userId" column="user_id" />
  9. <result property="liveId" column="live_id" />
  10. <result property="createTime" column="create_time" />
  11. <result property="qwExternalContactId" column="qw_external_contact_id" />
  12. <result property="internetTraffic" column="internet_traffic" />
  13. <result property="qwUserId" column="qw_user_id" />
  14. <result property="companyUserId" column="company_user_id" />
  15. <result property="companyId" column="company_id" />
  16. <result property="videoId" column="video_id" />
  17. <result property="uuId" column="uu_id" />
  18. </resultMap>
  19. <sql id="selectLiveTrafficLogVo">
  20. select log_id, user_id, live_id, create_time, qw_external_contact_id, internet_traffic, qw_user_id, company_user_id, company_id, video_id, uu_id from live_traffic_log
  21. </sql>
  22. <select id="selectLiveTrafficLogList" parameterType="LiveTrafficLog" resultMap="LiveTrafficLogResult">
  23. <include refid="selectLiveTrafficLogVo"/>
  24. <where>
  25. <if test="userId != null "> and user_id = #{userId}</if>
  26. <if test="liveId != null "> and live_id = #{liveId}</if>
  27. <if test="qwExternalContactId != null "> and qw_external_contact_id = #{qwExternalContactId}</if>
  28. <if test="internetTraffic != null "> and internet_traffic = #{internetTraffic}</if>
  29. <if test="qwUserId != null and qwUserId != ''"> and qw_user_id = #{qwUserId}</if>
  30. <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
  31. <if test="companyId != null "> and company_id = #{companyId}</if>
  32. <if test="videoId != null "> and video_id = #{videoId}</if>
  33. <if test="uuId != null and uuId != ''"> and uu_id = #{uuId}</if>
  34. </where>
  35. </select>
  36. <select id="selectLiveTrafficLogById" parameterType="Long" resultMap="LiveTrafficLogResult">
  37. <include refid="selectLiveTrafficLogVo"/>
  38. where log_id = #{logId}
  39. </select>
  40. <insert id="insertLiveTrafficLog" parameterType="LiveTrafficLog" useGeneratedKeys="true" keyProperty="logId">
  41. insert into live_traffic_log
  42. <trim prefix="(" suffix=")" suffixOverrides=",">
  43. <if test="userId != null">user_id,</if>
  44. <if test="liveId != null">live_id,</if>
  45. <if test="createTime != null">create_time,</if>
  46. <if test="qwExternalContactId != null">qw_external_contact_id,</if>
  47. <if test="internetTraffic != null">internet_traffic,</if>
  48. <if test="qwUserId != null">qw_user_id,</if>
  49. <if test="companyUserId != null">company_user_id,</if>
  50. <if test="companyId != null">company_id,</if>
  51. <if test="videoId != null">video_id,</if>
  52. <if test="uuId != null">uu_id,</if>
  53. </trim>
  54. <trim prefix="values (" suffix=")" suffixOverrides=",">
  55. <if test="userId != null">#{userId},</if>
  56. <if test="liveId != null">#{liveId},</if>
  57. <if test="createTime != null">#{createTime},</if>
  58. <if test="qwExternalContactId != null">#{qwExternalContactId},</if>
  59. <if test="internetTraffic != null">#{internetTraffic},</if>
  60. <if test="qwUserId != null">#{qwUserId},</if>
  61. <if test="companyUserId != null">#{companyUserId},</if>
  62. <if test="companyId != null">#{companyId},</if>
  63. <if test="videoId != null">#{videoId},</if>
  64. <if test="uuId != null">#{uuId},</if>
  65. </trim>
  66. </insert>
  67. <update id="updateLiveTrafficLog" parameterType="LiveTrafficLog">
  68. update live_traffic_log
  69. <trim prefix="SET" suffixOverrides=",">
  70. <if test="userId != null">user_id = #{userId},</if>
  71. <if test="liveId != null">live_id = #{liveId},</if>
  72. <if test="createTime != null">create_time = #{createTime},</if>
  73. <if test="qwExternalContactId != null">qw_external_contact_id = #{qwExternalContactId},</if>
  74. <if test="internetTraffic != null">internet_traffic = #{internetTraffic},</if>
  75. <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
  76. <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
  77. <if test="companyId != null">company_id = #{companyId},</if>
  78. <if test="videoId != null">video_id = #{videoId},</if>
  79. <if test="uuId != null">uu_id = #{uuId},</if>
  80. </trim>
  81. where log_id = #{logId}
  82. </update>
  83. <delete id="deleteLiveTrafficLogById" parameterType="Long">
  84. delete from live_traffic_log where log_id = #{logId}
  85. </delete>
  86. <delete id="deleteLiveTrafficLogByIds" parameterType="String">
  87. delete from live_traffic_log where log_id in
  88. <foreach item="logId" collection="array" open="(" separator="," close=")">
  89. #{logId}
  90. </foreach>
  91. </delete>
  92. <insert id="insertOrUpdateLiveTrafficLog" parameterType="com.fs.live.domain.LiveTrafficLog">
  93. INSERT INTO live_traffic_log (
  94. user_id,
  95. live_id,
  96. create_time,
  97. qw_external_contact_id,
  98. internet_traffic,
  99. qw_user_id,
  100. company_user_id,
  101. company_id,
  102. video_id,
  103. uu_id
  104. ) VALUES (
  105. #{userId},
  106. #{liveId},
  107. #{createTime},
  108. #{qwExternalContactId},
  109. #{internetTraffic},
  110. #{qwUserId},
  111. #{companyUserId},
  112. #{companyId},
  113. #{videoId},
  114. #{uuId}
  115. ) ON DUPLICATE KEY UPDATE
  116. user_id = VALUES(user_id),
  117. live_id = VALUES(live_id),
  118. create_time = VALUES(create_time),
  119. qw_external_contact_id = VALUES(qw_external_contact_id),
  120. internet_traffic = VALUES(internet_traffic),
  121. qw_user_id = VALUES(qw_user_id),
  122. company_user_id = VALUES(company_user_id),
  123. company_id = VALUES(company_id),
  124. video_id = VALUES(video_id)
  125. </insert>
  126. </mapper>