BBusiWishScoreGroupsMapper.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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.ruoyi.syzy.mapper.BBusiWishScoreGroupsMapper">
  6. <resultMap type="BBusiWishScoreGroups" id="BBusiWishScoreGroupsResult">
  7. <result property="id" column="id" />
  8. <result property="location" column="location" />
  9. <result property="year" column="year" />
  10. <result property="mode" column="mode" />
  11. <result property="modeName" column="modeName" />
  12. <result property="score" column="score" />
  13. <result property="num" column="num" />
  14. <result property="numTotal" column="numTotal" />
  15. <result property="createTime" column="createTime" />
  16. <result property="status" column="status" />
  17. <result property="maxScore" column="max_score" />
  18. <result property="lowestRank" column="lowest_rank" />
  19. <result property="highestRank" column="highest_rank" />
  20. </resultMap>
  21. <sql id="selectBBusiWishScoreGroupsVo">
  22. select id, location, year, mode, score, num, numTotal, createTime, status,
  23. max_score,lowest_rank,highest_rank
  24. from b_busi_wish_score_groups
  25. </sql>
  26. <select id="selectBBusiWishScoreGroupsList" parameterType="BBusiWishScoreGroups" resultMap="BBusiWishScoreGroupsResult">
  27. <include refid="selectBBusiWishScoreGroupsVo" />
  28. where 1=1
  29. <if test="location != null and location != ''"> and location = #{location}</if>
  30. <if test="year != null"> and year = #{year}</if>
  31. <if test="mode != null and mode != ''"> and mode = #{mode}</if>
  32. <if test="score != null "> and score = #{score}</if>
  33. <if test="num != null "> and num = #{num}</if>
  34. <if test="numTotal != null "> and numTotal = #{numTotal}</if>
  35. <if test="maxScore != null "> and max_score = #{maxScore}</if>
  36. <if test="lowestRank != null "> and lowest_rank = #{lowestRank}</if>
  37. <if test="highestRank != null "> and highest_rank = #{highestRank}</if>
  38. <if test="createTime != null "> and createTime = #{createTime}</if>
  39. <if test="status != null "> and status = #{status}</if>
  40. <choose>
  41. <when test="scoreRank != null and type != null and type == 1"><!-- 分数 -->
  42. and ((score &lt;= #{scoreRank} and #{scoreRank} &lt;= max_score ) )
  43. </when>
  44. <when test="scoreRank != null and type != null and type == 2"><!-- 位次 -->
  45. and ((highest_rank &lt;= #{scoreRank} and #{scoreRank} &lt;= lowest_rank))
  46. </when>
  47. <when test="scoreRank != null">
  48. and ((score &lt;= #{scoreRank} and #{scoreRank} &lt;= max_score ) or (highest_rank &lt;= #{scoreRank} and #{scoreRank} &lt;= lowest_rank))
  49. </when>
  50. </choose>
  51. order by year,score desc
  52. </select>
  53. <select id="selectBusiWishScoreGroupsByScore" parameterType="map" resultMap="BBusiWishScoreGroupsResult">
  54. <include refid="selectBBusiWishScoreGroupsVo" />
  55. <where>
  56. <if test="location != null and location != ''"> and location = #{location}</if>
  57. <if test="year != null "> and year = #{year}</if>
  58. <if test="mode != null and mode != ''"> and mode = #{mode}</if>
  59. <if test="modes != null"> and mode in <foreach item="o" collection="modes" open="(" separator="," close=")">#{o}</foreach></if>
  60. <if test="rank != null ">
  61. and (highest_rank &lt;= #{rank} and #{rank} &lt;= lowest_rank)
  62. </if>
  63. <if test="score != null ">
  64. and (score &lt;= #{score} and #{score} &lt;= max_score)
  65. </if>
  66. </where>
  67. order by year desc
  68. </select>
  69. <select id="selectRangeByLocation" parameterType="BBusiWishScoreGroups" resultMap="BBusiWishScoreGroupsResult">
  70. SELECT max(max_score) max_score, min(score) score, max(lowest_rank) lowest_rank, min(highest_rank) highest_rank from b_busi_wish_score_groups where location = #{location} and year = #{year}
  71. </select>
  72. <select id="selectBBusiWishScoreGroupsById" parameterType="Long" resultMap="BBusiWishScoreGroupsResult">
  73. <include refid="selectBBusiWishScoreGroupsVo" />
  74. where id = #{id}
  75. </select>
  76. <select id="selectBBusiWishScoreGroupsByLocation" resultType="Integer">
  77. SELECT max_score from b_busi_wish_score_groups where 1=1 and location = #{location} and mode = #{mode} and status>0 order by year desc, max_score desc limit 1
  78. </select>
  79. <select id="locations" resultType="String">
  80. select distinct location from b_busi_wish_score_groups where status &gt; 0
  81. </select>
  82. <select id="years" parameterType="String" resultType="Integer">
  83. select distinct year from b_busi_wish_score_groups where status &gt; 0
  84. <if test="location!=null and location!=''">
  85. and location = #{location}
  86. </if>
  87. order by year desc
  88. </select>
  89. <select id="yearsNoStatus" parameterType="String" resultType="Integer">
  90. select distinct year from b_busi_wish_score_groups where 1=1
  91. <if test="location!=null and location!=''">
  92. and location = #{location}
  93. </if>
  94. order by year desc
  95. </select>
  96. <select id="modes" resultType="String">
  97. select distinct mode from b_busi_wish_score_groups where status &gt; 0
  98. <if test="location!=null and location!=''">
  99. and location = #{location}
  100. </if>
  101. <if test="year!=null and year!=''">
  102. and year = #{year}
  103. </if>
  104. </select>
  105. <select id="modesNoStatus" resultMap="BBusiWishScoreGroupsResult">
  106. select distinct mode, modeName from b_busi_wish_score_groups where 1=1
  107. <if test="location!=null and location!=''">
  108. and location = #{location}
  109. </if>
  110. <if test="year!=null and year!=''">
  111. and year = #{year}
  112. </if>
  113. </select>
  114. <insert id="insertBBusiWishScoreGroups" parameterType="BBusiWishScoreGroups" useGeneratedKeys="true" keyProperty="id">
  115. insert into b_busi_wish_score_groups
  116. <trim prefix="(" suffix=")" suffixOverrides=",">
  117. <if test="location != null">location,</if>
  118. <if test="year != null">year,</if>
  119. <if test="mode != null">mode,</if>
  120. <if test="score != null">score,</if>
  121. <if test="num != null">num,</if>
  122. <if test="numTotal != null">numTotal,</if>
  123. <if test="createTime != null">createTime,</if>
  124. <if test="status != null">status,</if>
  125. </trim>
  126. <trim prefix="values (" suffix=")" suffixOverrides=",">
  127. <if test="location != null">#{location},</if>
  128. <if test="year != null">#{year},</if>
  129. <if test="mode != null">#{mode},</if>
  130. <if test="score != null">#{score},</if>
  131. <if test="num != null">#{num},</if>
  132. <if test="numTotal != null">#{numTotal},</if>
  133. <if test="createTime != null">#{createTime},</if>
  134. <if test="status != null">#{status},</if>
  135. </trim>
  136. </insert>
  137. <update id="updateBBusiWishScoreGroups" parameterType="BBusiWishScoreGroups">
  138. update b_busi_wish_score_groups
  139. <trim prefix="SET" suffixOverrides=",">
  140. <if test="location != null">location = #{location},</if>
  141. <if test="year != null">year = #{year},</if>
  142. <if test="mode != null">mode = #{mode},</if>
  143. <if test="score != null">score = #{score},</if>
  144. <if test="num != null">num = #{num},</if>
  145. <if test="numTotal != null">numTotal = #{numTotal},</if>
  146. <if test="createTime != null">createTime = #{createTime},</if>
  147. <if test="status != null">status = #{status},</if>
  148. </trim>
  149. where id = #{id}
  150. </update>
  151. <delete id="deleteBBusiWishScoreGroupsById" parameterType="Long">
  152. delete from b_busi_wish_score_groups where id = #{id}
  153. </delete>
  154. <delete id="deleteBBusiWishScoreGroupsByIds" parameterType="String">
  155. delete from b_busi_wish_score_groups where id in
  156. <foreach item="id" collection="array" open="(" separator="," close=")">
  157. #{id}
  158. </foreach>
  159. </delete>
  160. </mapper>