KuaishouProjectMapper.xml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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.ruixuan.jinniu.mapper.KuaishouProjectMapper">
  6. <resultMap type="com.ruixuan.jinniu.entity.KuaishouProject" id="KuaishouProjectResult">
  7. <result property="id" column="id"/>
  8. <result property="projectName" column="project_name"/>
  9. <result property="mediaCode" column="media_code"/>
  10. <result property="supplierCode" column="supplier_code"/>
  11. <result property="saleId" column="sale_id"/>
  12. <result property="saleName" column="sale_name"/>
  13. <result property="operatorId" column="operator_id"/>
  14. <result property="operatorName" column="operator_name"/>
  15. <result property="designResponsibleId" column="design_responsible_id"/>
  16. <result property="designResponsibleName" column="design_responsible_name"/>
  17. <result property="ocpxActionType" column="ocpx_action_type"/>
  18. <result property="advertiserName" column="advertiser_name"/>
  19. <result property="advertiserId" column="advertiser_id"/>
  20. <result property="createTime" column="create_time"/>
  21. <result property="updateTime" column="update_time"/>
  22. </resultMap>
  23. <sql id="selectKuaishouProjectVo">
  24. select id,
  25. project_name,
  26. media_code,
  27. supplier_code,
  28. sale_id,
  29. sale_name,
  30. operator_id,
  31. operator_name,
  32. design_responsible_id,
  33. design_responsible_name,
  34. ocpx_action_type,
  35. advertiser_name,
  36. advertiser_id,
  37. create_time,
  38. update_time
  39. from kuaishou_project
  40. </sql>
  41. <select id="selectKuaishouProjectList" parameterType="com.ruixuan.jinniu.entity.KuaishouProject"
  42. resultMap="KuaishouProjectResult">
  43. <include refid="selectKuaishouProjectVo"/>
  44. <where>
  45. <if test="projectName != null and projectName != ''">
  46. and project_name like concat('%', #{projectName}, '%')
  47. </if>
  48. <if test="mediaCode != null and mediaCode != ''">
  49. and media_code = #{mediaCode}
  50. </if>
  51. <if test="supplierCode != null and supplierCode != ''">
  52. and supplier_code = #{supplierCode}
  53. </if>
  54. <if test="saleIdList != null and saleIdList.size() >0 ">
  55. and sale_id in
  56. <foreach collection="saleIdList" item="userId" open="(" separator="," close=")">
  57. #{userId}
  58. </foreach>
  59. </if>
  60. <if test="saleName != null and saleName != ''">
  61. and sale_name like concat('%', #{saleName}, '%')
  62. </if>
  63. <if test="operatorIdList != null and operatorIdList.size() >0 ">
  64. and operator_id in
  65. <foreach collection="operatorIdList" item="userId" open="(" separator="," close=")">
  66. #{userId}
  67. </foreach>
  68. </if>
  69. <if test="operatorName != null and operatorName != ''">
  70. and operator_name like concat('%', #{operatorName}, '%')
  71. </if>
  72. <if test="designIdList != null and designIdList.size() >0 ">
  73. and design_responsible_id in
  74. <foreach collection="designIdList" item="userId" open="(" separator="," close=")">
  75. #{userId}
  76. </foreach>
  77. </if>
  78. <if test="designResponsibleName != null and designResponsibleName != ''">
  79. and design_responsible_name like concat('%', #{designResponsibleName}, '%')
  80. </if>
  81. <if test="ocpxActionType != null and ocpxActionType != ''">
  82. and ocpx_action_type = #{ocpxActionType}
  83. </if>
  84. <if test="advertiserName != null and advertiserName != ''">
  85. and advertiser_name like concat('%', #{advertiserName}, '%')
  86. </if>
  87. <if test="advertiserId != null and advertiserId != ''">
  88. and advertiser_id = #{advertiserId}
  89. </if>
  90. </where>
  91. </select>
  92. <select id="getMyProjects" parameterType="com.ruixuan.jinniu.entity.KuaishouProject"
  93. resultMap="KuaishouProjectResult">
  94. SELECT
  95. t1.id,
  96. t1.project_name,
  97. t1.media_code,
  98. t1.supplier_code,
  99. t1.sale_id,
  100. t1.sale_name,
  101. t1.operator_id,
  102. t1.operator_name,
  103. t1.design_responsible_id,
  104. t1.design_responsible_name,
  105. t1.ocpx_action_type,
  106. t1.advertiser_name,
  107. t1.advertiser_id,
  108. t1.create_time,
  109. t1.update_time
  110. from kuaishou_project t1
  111. LEFT JOIN kuaishou_project_member t2 ON t1.id = t2.project_id
  112. WHERE t2.user_id =#{userId}
  113. <if test="projectName != null and projectName != ''">
  114. and t1.project_name like concat('%', #{projectName}, '%')
  115. </if>
  116. </select>
  117. <select id="selectKuaishouProjectById" parameterType="Long" resultMap="KuaishouProjectResult">
  118. <include refid="selectKuaishouProjectVo"/>
  119. where id = #{id}
  120. </select>
  121. <insert id="insertKuaishouProject" parameterType="com.ruixuan.jinniu.entity.KuaishouProject" useGeneratedKeys="true"
  122. keyProperty="id">
  123. insert into kuaishou_project
  124. <trim prefix="(" suffix=")" suffixOverrides=",">
  125. <if test="projectName != null">project_name,</if>
  126. <if test="mediaCode != null">media_code,</if>
  127. <if test="supplierCode != null">supplier_code,</if>
  128. <if test="saleId != null">sale_id,</if>
  129. <if test="saleName != null">sale_name,</if>
  130. <if test="operatorId != null">operator_id,</if>
  131. <if test="operatorName != null">operator_name,</if>
  132. <if test="designResponsibleId != null">design_responsible_id,</if>
  133. <if test="designResponsibleName != null">design_responsible_name,</if>
  134. <if test="ocpxActionType != null">ocpx_action_type,</if>
  135. <if test="advertiserName != null">advertiser_name,</if>
  136. <if test="advertiserId != null">advertiser_id,</if>
  137. <if test="createTime != null">create_time,</if>
  138. <if test="updateTime != null">update_time,</if>
  139. </trim>
  140. <trim prefix="values (" suffix=")" suffixOverrides=",">
  141. <if test="projectName != null">#{projectName},</if>
  142. <if test="mediaCode != null">#{mediaCode},</if>
  143. <if test="supplierCode != null">#{supplierCode},</if>
  144. <if test="saleId != null">#{saleId},</if>
  145. <if test="saleName != null">#{saleName},</if>
  146. <if test="operatorId != null">#{operatorId},</if>
  147. <if test="operatorName != null">#{operatorName},</if>
  148. <if test="designResponsibleId != null">#{designResponsibleId},</if>
  149. <if test="designResponsibleName != null">#{designResponsibleName},</if>
  150. <if test="ocpxActionType != null">#{ocpxActionType},</if>
  151. <if test="advertiserName != null">#{advertiserName},</if>
  152. <if test="advertiserId != null">#{advertiserId},</if>
  153. <if test="createTime != null">#{createTime},</if>
  154. <if test="updateTime != null">#{updateTime},</if>
  155. </trim>
  156. </insert>
  157. <update id="updateKuaishouProject" parameterType="com.ruixuan.jinniu.entity.KuaishouProject">
  158. update kuaishou_project
  159. <trim prefix="SET" suffixOverrides=",">
  160. <if test="projectName != null">project_name = #{projectName},</if>
  161. <if test="mediaCode != null">media_code = #{mediaCode},</if>
  162. <if test="supplierCode != null">supplier_code = #{supplierCode},</if>
  163. <if test="saleId != null">sale_id = #{saleId},</if>
  164. <if test="saleName != null">sale_name = #{saleName},</if>
  165. <if test="operatorId != null">operator_id = #{operatorId},</if>
  166. <if test="operatorName != null">operator_name = #{operatorName},</if>
  167. <if test="designResponsibleId != null">design_responsible_id = #{designResponsibleId},</if>
  168. <if test="designResponsibleName != null">design_responsible_name = #{designResponsibleName},</if>
  169. <if test="ocpxActionType != null">ocpx_action_type = #{ocpxActionType},</if>
  170. <if test="advertiserName != null">advertiser_name = #{advertiserName},</if>
  171. <if test="advertiserId != null">advertiser_id = #{advertiserId},</if>
  172. <if test="createTime != null">create_time = #{createTime},</if>
  173. <if test="updateTime != null">update_time = #{updateTime},</if>
  174. </trim>
  175. where id = #{id}
  176. </update>
  177. <delete id="deleteKuaishouProjectById" parameterType="Long">
  178. delete
  179. from kuaishou_project
  180. where id = #{id}
  181. </delete>
  182. <select id="getOcpxActionType" resultType="com.alibaba.fastjson.JSONObject">
  183. SELECT ocpx_action_type AS 'code', ocpx_action_name AS 'name'
  184. FROM kuaishou_ocpx_action_type
  185. ORDER BY create_time
  186. </select>
  187. </mapper>