StarMapper.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.goafanti.common.dao.StarMapper" >
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.Star" >
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="uid" property="uid" jdbcType="VARCHAR" />
  7. <result column="hot" property="hot" jdbcType="INTEGER" />
  8. <result column="star" property="star" jdbcType="INTEGER" />
  9. <result column="portal_url" property="portalUrl" jdbcType="VARCHAR" />
  10. </resultMap>
  11. <sql id="Base_Column_List" >
  12. id, uid, hot, star, portal_url
  13. </sql>
  14. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  15. select
  16. <include refid="Base_Column_List" />
  17. from star
  18. where id = #{id,jdbcType=VARCHAR}
  19. </select>
  20. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  21. delete from star
  22. where id = #{id,jdbcType=VARCHAR}
  23. </delete>
  24. <insert id="insert" parameterType="com.goafanti.common.model.Star" >
  25. insert into star (id, uid, hot,
  26. star, portal_url)
  27. values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{hot,jdbcType=INTEGER},
  28. #{star,jdbcType=INTEGER}, #{portalUrl,jdbcType=VARCHAR})
  29. </insert>
  30. <insert id="insertSelective" parameterType="com.goafanti.common.model.Star" >
  31. insert into star
  32. <trim prefix="(" suffix=")" suffixOverrides="," >
  33. <if test="id != null" >
  34. id,
  35. </if>
  36. <if test="uid != null" >
  37. uid,
  38. </if>
  39. <if test="hot != null" >
  40. hot,
  41. </if>
  42. <if test="star != null" >
  43. star,
  44. </if>
  45. <if test="portalUrl != null" >
  46. portal_url,
  47. </if>
  48. </trim>
  49. <trim prefix="values (" suffix=")" suffixOverrides="," >
  50. <if test="id != null" >
  51. #{id,jdbcType=VARCHAR},
  52. </if>
  53. <if test="uid != null" >
  54. #{uid,jdbcType=VARCHAR},
  55. </if>
  56. <if test="hot != null" >
  57. #{hot,jdbcType=INTEGER},
  58. </if>
  59. <if test="star != null" >
  60. #{star,jdbcType=INTEGER},
  61. </if>
  62. <if test="portalUrl != null" >
  63. #{portalUrl,jdbcType=VARCHAR},
  64. </if>
  65. </trim>
  66. </insert>
  67. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Star" >
  68. update star
  69. <set >
  70. <if test="uid != null" >
  71. uid = #{uid,jdbcType=VARCHAR},
  72. </if>
  73. <if test="hot != null" >
  74. hot = #{hot,jdbcType=INTEGER},
  75. </if>
  76. <if test="star != null" >
  77. star = #{star,jdbcType=INTEGER},
  78. </if>
  79. <if test="portalUrl != null" >
  80. portal_url = #{portalUrl,jdbcType=VARCHAR},
  81. </if>
  82. </set>
  83. where id = #{id,jdbcType=VARCHAR}
  84. </update>
  85. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Star" >
  86. update star
  87. set uid = #{uid,jdbcType=VARCHAR},
  88. hot = #{hot,jdbcType=INTEGER},
  89. star = #{star,jdbcType=INTEGER},
  90. portal_url = #{portalUrl,jdbcType=VARCHAR}
  91. where id = #{id,jdbcType=VARCHAR}
  92. </update>
  93. <select id="listHostStar" resultType="com.goafanti.star.bo.HotStarListBo">
  94. select
  95. u.id as uid,
  96. u.number,
  97. ui.username,
  98. uc.engaged_field as engagedField,
  99. uc.professional_title as professionalTitle,
  100. uc.work_unit as workUnit,
  101. adc.achievement_count as achievementNum
  102. from star s
  103. left join user u on u.id = s.uid
  104. left join user_identity ui on ui.uid = s.uid
  105. left join user_career uc on uc.uid = s.uid
  106. left join achievement_demand_count adc on adc.uid = s.uid
  107. where s.hot = 1 and ui.celebrity = 1
  108. order by adc.achievement_count desc
  109. </select>
  110. <select id="listStarList" parameterType="java.lang.String" resultType="com.goafanti.star.bo.HotStarListBo">
  111. select
  112. u.id as uid,
  113. u.number,
  114. ui.username,
  115. uc.engaged_field as engagedField,
  116. uc.professional_title as professionalTitle,
  117. uc.work_unit as workUnit,
  118. adc.achievement_count as achievementNum,
  119. u.head_portrait_url as personPortraitUrl
  120. from star s
  121. left join user u on u.id = s.uid
  122. left join user_identity ui on ui.uid = s.uid
  123. left join user_career uc on uc.uid = s.uid
  124. left join achievement_demand_count adc on adc.uid = s.uid
  125. <!-- left join user_info info on info.uid = s.uid -->
  126. left join user_interest interest on interest.to_uid = s.uid and interest.from_uid = #{uid,jdbcType=VARCHAR}
  127. where s.star = 1 and ui.celebrity = 1
  128. order by adc.achievement_count desc
  129. </select>
  130. <delete id="deleteAll">
  131. delete from star
  132. </delete>
  133. <insert id="insertBatch" parameterType="com.goafanti.common.model.Star">
  134. insert into star (id, uid, hot, star, portal_url)
  135. values
  136. <foreach item="item" index="index" collection="list" separator=",">
  137. (
  138. #{item.id,jdbcType=VARCHAR}, #{item.uid,jdbcType=VARCHAR}, #{item.hot,jdbcType=INTEGER},
  139. #{item.star,jdbcType=INTEGER}, #{item.portalUrl,jdbcType=VARCHAR}
  140. )
  141. </foreach>
  142. </insert>
  143. <select id="listBigShotStar" parameterType="java.lang.String" resultType="com.goafanti.star.bo.BigShotStarListBo">
  144. select
  145. u.id as uid,
  146. u.number,
  147. ui.username,
  148. uc.engaged_field as engagedField,
  149. uc.professional_title as professionalTitle,
  150. uc.work_unit as workUnit,
  151. adc.achievement_count as achievementNum,
  152. u.head_portrait_url as personPortraitUrl,
  153. interest.id as interestId
  154. from star s
  155. left join user u on u.id = s.uid
  156. left join user_info info on info.uid = s.uid
  157. left join user_identity ui on ui.uid = s.uid
  158. left join user_career uc on uc.uid = s.uid
  159. left join achievement_demand_count adc on adc.uid = s.uid
  160. left join user_interest interest on interest.to_uid = s.uid and interest.from_uid = #{uid,jdbcType=VARCHAR}
  161. where s.hot = 1
  162. order by adc.achievement_count desc
  163. </select>
  164. <select id="findBigShotInterestStatus" parameterType="java.lang.String" resultType="com.goafanti.star.bo.BigShotStarInterest">
  165. select
  166. ui.id as interestId,
  167. s.uid as fromUid,
  168. ui.to_uid as toUid
  169. from star s
  170. left join user_interest ui on s.uid = ui.to_uid and ui.from_uid = #{uid,jdbcType=VARCHAR}
  171. where s.hot = 1
  172. </select>
  173. <select id="findStarInterestStatus" parameterType="java.lang.String" resultType="com.goafanti.star.bo.BigShotStarInterest">
  174. select
  175. ui.id as interestId,
  176. s.uid as fromUid,
  177. ui.to_uid as toUid
  178. from star s
  179. left join user_interest ui on s.uid = ui.to_uid and ui.from_uid = #{uid,jdbcType=VARCHAR}
  180. where s.star = 1
  181. </select>
  182. </mapper>