FsBlackTalentMapper.xml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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.course.mapper.FsBlackTalentMapper">
  6. <resultMap type="FsBlackTalent" id="FsBlackTalentResult">
  7. <result property="id" column="id" />
  8. <result property="userId" column="user_id" />
  9. <result property="talentId" column="talent_id" />
  10. <result property="type" column="type" />
  11. <result property="reportDesc" column="report_desc" />
  12. <result property="isAudit" column="is_audit" />
  13. <result property="auditTime" column="audit_time" />
  14. <result property="auditUser" column="audit_user" />
  15. <result property="auditDesc" column="audit_desc" />
  16. <result property="creatTime" column="creat_time" />
  17. <result property="videoId" column="video_id" />
  18. <result property="style" column="style" />
  19. <result property="phone" column="phone" />
  20. <result property="urls" column="urls" />
  21. <result property="templateId" column="template_id" />
  22. <result property="tradeImage" column="trade_image" />
  23. </resultMap>
  24. <sql id="selectFsBlackTalentVo">
  25. select id, user_id, talent_id, type, report_desc, is_audit, audit_time, audit_user, audit_desc, creat_time, video_id, style,template_id,urls,phone,trade_image from fs_black_talent
  26. </sql>
  27. <select id="selectFsBlackTalentList" parameterType="FsBlackTalent" resultMap="FsBlackTalentResult">
  28. <include refid="selectFsBlackTalentVo"/>
  29. <where>
  30. <if test="userId != null "> and user_id = #{userId}</if>
  31. <if test="talentId != null "> and talent_id = #{talentId}</if>
  32. <if test="type != null and type != ''"> and type = #{type}</if>
  33. <if test="reportDesc != null and reportDesc != ''"> and report_desc = #{reportDesc}</if>
  34. <if test="isAudit != null and isAudit != ''"> and is_audit = #{isAudit}</if>
  35. <if test="auditTime != null "> and audit_time = #{auditTime}</if>
  36. <if test="auditUser != null "> and audit_user = #{auditUser}</if>
  37. <if test="auditDesc != null and auditDesc != ''"> and audit_desc = #{auditDesc}</if>
  38. <if test="creatTime != null "> and creat_time = #{creatTime}</if>
  39. <if test="videoId != null "> and video_id = #{videoId}</if>
  40. <if test="style != null and style != ''"> and style = #{style}</if>
  41. <if test="phone != null and phone != ''"> and phone = #{phone}</if>
  42. <if test="urls != null and urls != ''"> and urls = #{urls}</if>
  43. <if test="templateId != null and templateId != ''"> and template_id = #{templateId}</if>
  44. <if test="tradeImage != null and tradeImage != ''"> and trade_image = #{tradeImage}</if>
  45. </where>
  46. </select>
  47. <select id="selectFsBlackTalentPVOList" parameterType="FsBlackTalent" resultType="com.fs.course.vo.FsBlackTalentPVO">
  48. select fbt.*,u.nick_name as audit_user_name,t.nick_name as talent_name from fs_black_talent fbt
  49. left join sys_user u on u.user_id = fbt.audit_user
  50. left join fs_user_talent t on t.talent_id = fbt.talent_id
  51. <where>
  52. <if test="userId != null "> and fbt.user_id = #{userId}</if>
  53. <if test="talentId != null "> and fbt.talent_id = #{talentId}</if>
  54. <if test="type != null and type != ''"> and fbt.type = #{type}</if>
  55. <if test="reportDesc != null and reportDesc != ''"> and fbt.eport_desc = #{reportDesc}</if>
  56. <if test="isAudit != null and isAudit != ''"> and fbt.is_audit = #{isAudit}</if>
  57. <if test="auditTime != null "> and fbt.audit_time = #{auditTime}</if>
  58. <if test="auditUser != null "> and fbt.audit_user = #{auditUser}</if>
  59. <if test="auditDesc != null and auditDesc != ''"> and fbt.audit_desc = #{auditDesc}</if>
  60. <if test="creatTime != null "> and fbt.creat_time = #{creatTime}</if>
  61. <if test="videoId != null "> and fbt.video_id = #{videoId}</if>
  62. <if test="style != null and style != ''"> and fbt.style = #{style}</if>
  63. <if test="phone != null and phone != ''"> and fbt.phone = #{phone}</if>
  64. <if test="urls != null and urls != ''"> and fbt.urls = #{urls}</if>
  65. <if test="templateId != null and templateId != ''"> and fbt.template_id = #{templateId}</if>
  66. <if test="tradeImage != null and tradeImage != ''"> and fbt.trade_image = #{tradeImage}</if>
  67. </where>
  68. </select>
  69. <select id="selectFsBlackTalentById" parameterType="Long" resultMap="FsBlackTalentResult">
  70. <include refid="selectFsBlackTalentVo"/>
  71. where id = #{id}
  72. </select>
  73. <select id="selectBlackAndReportVideoIdsByUserId" resultMap="FsBlackTalentResult">
  74. select video_id , talent_id from fs_black_talent where user_id = #{userId}
  75. </select>
  76. <select id="selectBlackTalent" resultType="java.lang.Integer">
  77. select count(id) from fs_black_talent where user_id = #{loginUserId} and talent_id = #{talentId} and type = 1
  78. </select>
  79. <insert id="insertFsBlackTalent" parameterType="FsBlackTalent" useGeneratedKeys="true" keyProperty="id">
  80. insert into fs_black_talent
  81. <trim prefix="(" suffix=")" suffixOverrides=",">
  82. <if test="userId != null">user_id,</if>
  83. <if test="talentId != null">talent_id,</if>
  84. <if test="type != null">type,</if>
  85. <if test="reportDesc != null">report_desc,</if>
  86. <if test="isAudit != null">is_audit,</if>
  87. <if test="auditTime != null">audit_time,</if>
  88. <if test="auditUser != null">audit_user,</if>
  89. <if test="auditDesc != null">audit_desc,</if>
  90. <if test="creatTime != null">creat_time,</if>
  91. <if test="videoId != null">video_id,</if>
  92. <if test="style != null">style,</if>
  93. <if test="phone != null">phone,</if>
  94. <if test="urls != null">urls,</if>
  95. <if test="templateId != null">template_id,</if>
  96. <if test="tradeImage != null">trade_image,</if>
  97. </trim>
  98. <trim prefix="values (" suffix=")" suffixOverrides=",">
  99. <if test="userId != null">#{userId},</if>
  100. <if test="talentId != null">#{talentId},</if>
  101. <if test="type != null">#{type},</if>
  102. <if test="reportDesc != null">#{reportDesc},</if>
  103. <if test="isAudit != null">#{isAudit},</if>
  104. <if test="auditTime != null">#{auditTime},</if>
  105. <if test="auditUser != null">#{auditUser},</if>
  106. <if test="auditDesc != null">#{auditDesc},</if>
  107. <if test="creatTime != null">#{creatTime},</if>
  108. <if test="videoId != null">#{videoId},</if>
  109. <if test="style != null">#{style},</if>
  110. <if test="phone != null">#{phone},</if>
  111. <if test="urls != null">#{urls},</if>
  112. <if test="templateId != null">#{templateId},</if>
  113. <if test="tradeImage != null">#{tradeImage},</if>
  114. </trim>
  115. </insert>
  116. <update id="updateFsBlackTalent" parameterType="FsBlackTalent">
  117. update fs_black_talent
  118. <trim prefix="SET" suffixOverrides=",">
  119. <if test="userId != null">user_id = #{userId},</if>
  120. <if test="talentId != null">talent_id = #{talentId},</if>
  121. <if test="type != null">type = #{type},</if>
  122. <if test="reportDesc != null">report_desc = #{reportDesc},</if>
  123. <if test="isAudit != null">is_audit = #{isAudit},</if>
  124. <if test="auditTime != null">audit_time = #{auditTime},</if>
  125. <if test="auditUser != null">audit_user = #{auditUser},</if>
  126. <if test="auditDesc != null">audit_desc = #{auditDesc},</if>
  127. <if test="creatTime != null">creat_time = #{creatTime},</if>
  128. <if test="videoId != null">video_id = #{videoId},</if>
  129. <if test="style != null">style = #{style},</if>
  130. <if test="phone != null">phone = #{phone},</if>
  131. <if test="urls != null">urls = #{urls},</if>
  132. <if test="templateId != null">template_id = #{templateId},</if>
  133. <if test="tradeImage != null">trade_image = #{tradeImage},</if>
  134. </trim>
  135. where id = #{id}
  136. </update>
  137. <update id="audit">
  138. update fs_black_talent
  139. <trim prefix="SET" suffixOverrides=",">
  140. <if test="map.isAudit != null">is_audit = #{map.isAudit},</if>
  141. <if test="map.auditTime != null">audit_time = #{map.auditTime},</if>
  142. <if test="map.auditUser != null">audit_user = #{map.auditUser},</if>
  143. <if test="map.auditDesc != null">audit_desc = #{map.auditDesc},</if>
  144. </trim>
  145. where id = #{map.id}
  146. </update>
  147. <delete id="deleteFsBlackTalentById" parameterType="Long">
  148. delete from fs_black_talent where id = #{id}
  149. </delete>
  150. <delete id="deleteFsBlackTalentByIds" parameterType="String">
  151. delete from fs_black_talent where id in
  152. <foreach item="id" collection="array" open="(" separator="," close=")">
  153. #{id}
  154. </foreach>
  155. </delete>
  156. <delete id="deleteFsBlackVideo">
  157. delete from fs_black_talent where user_id = #{userId} and video_id = #{videoId} and type = '1'
  158. </delete>
  159. <delete id="deleteFsBlackTalent">
  160. delete from fs_black_talent where user_id = #{userId} and talent_id = #{talentId} and type = '1'
  161. </delete>
  162. </mapper>