123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ruoyi.syzy.mapper.BBusiWishScoreGroupsMapper">
- <resultMap type="BBusiWishScoreGroups" id="BBusiWishScoreGroupsResult">
- <result property="id" column="id" />
- <result property="location" column="location" />
- <result property="year" column="year" />
- <result property="mode" column="mode" />
- <result property="modeName" column="modeName" />
- <result property="score" column="score" />
- <result property="num" column="num" />
- <result property="numTotal" column="numTotal" />
- <result property="createTime" column="createTime" />
- <result property="status" column="status" />
- <result property="maxScore" column="max_score" />
- <result property="lowestRank" column="lowest_rank" />
- <result property="highestRank" column="highest_rank" />
- </resultMap>
- <sql id="selectBBusiWishScoreGroupsVo">
- select id, location, year, mode, score, num, numTotal, createTime, status,
- max_score,lowest_rank,highest_rank
- from b_busi_wish_score_groups
- </sql>
- <select id="selectBBusiWishScoreGroupsList" parameterType="BBusiWishScoreGroups" resultMap="BBusiWishScoreGroupsResult">
- <include refid="selectBBusiWishScoreGroupsVo" />
- where 1=1
- <if test="location != null and location != ''"> and location = #{location}</if>
- <if test="year != null"> and year = #{year}</if>
- <if test="mode != null and mode != ''"> and mode = #{mode}</if>
- <if test="score != null "> and score = #{score}</if>
- <if test="num != null "> and num = #{num}</if>
- <if test="numTotal != null "> and numTotal = #{numTotal}</if>
- <if test="maxScore != null "> and max_score = #{maxScore}</if>
- <if test="lowestRank != null "> and lowest_rank = #{lowestRank}</if>
- <if test="highestRank != null "> and highest_rank = #{highestRank}</if>
- <if test="createTime != null "> and createTime = #{createTime}</if>
- <if test="status != null "> and status = #{status}</if>
- <choose>
- <when test="scoreRank != null and type != null and type == 1"><!-- 分数 -->
- and ((score <= #{scoreRank} and #{scoreRank} <= max_score ) )
- </when>
- <when test="scoreRank != null and type != null and type == 2"><!-- 位次 -->
- and ((highest_rank <= #{scoreRank} and #{scoreRank} <= lowest_rank))
- </when>
- <when test="scoreRank != null">
- and ((score <= #{scoreRank} and #{scoreRank} <= max_score ) or (highest_rank <= #{scoreRank} and #{scoreRank} <= lowest_rank))
- </when>
- </choose>
- order by year,score desc
- </select>
- <select id="selectBusiWishScoreGroupsByScore" parameterType="map" resultMap="BBusiWishScoreGroupsResult">
- <include refid="selectBBusiWishScoreGroupsVo" />
- <where>
- <if test="location != null and location != ''"> and location = #{location}</if>
- <if test="year != null "> and year = #{year}</if>
- <if test="mode != null and mode != ''"> and mode = #{mode}</if>
- <if test="modes != null"> and mode in <foreach item="o" collection="modes" open="(" separator="," close=")">#{o}</foreach></if>
- <if test="rank != null ">
- and (highest_rank <= #{rank} and #{rank} <= lowest_rank)
- </if>
- <if test="score != null ">
- and (score <= #{score} and #{score} <= max_score)
- </if>
- </where>
- order by year desc
- </select>
- <select id="selectRangeByLocation" parameterType="BBusiWishScoreGroups" resultMap="BBusiWishScoreGroupsResult">
- 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}
- </select>
- <select id="selectBBusiWishScoreGroupsById" parameterType="Long" resultMap="BBusiWishScoreGroupsResult">
- <include refid="selectBBusiWishScoreGroupsVo" />
- where id = #{id}
- </select>
- <select id="selectBBusiWishScoreGroupsByLocation" resultType="Integer">
- 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
- </select>
- <select id="locations" resultType="String">
- select distinct location from b_busi_wish_score_groups where status > 0
- </select>
- <select id="years" parameterType="String" resultType="Integer">
- select distinct year from b_busi_wish_score_groups where status > 0
- <if test="location!=null and location!=''">
- and location = #{location}
- </if>
- order by year desc
- </select>
- <select id="yearsNoStatus" parameterType="String" resultType="Integer">
- select distinct year from b_busi_wish_score_groups where 1=1
- <if test="location!=null and location!=''">
- and location = #{location}
- </if>
- order by year desc
- </select>
- <select id="modes" resultType="String">
- select distinct mode from b_busi_wish_score_groups where status > 0
- <if test="location!=null and location!=''">
- and location = #{location}
- </if>
- <if test="year!=null and year!=''">
- and year = #{year}
- </if>
- </select>
- <select id="modesNoStatus" resultMap="BBusiWishScoreGroupsResult">
- select distinct mode, modeName from b_busi_wish_score_groups where 1=1
- <if test="location!=null and location!=''">
- and location = #{location}
- </if>
- <if test="year!=null and year!=''">
- and year = #{year}
- </if>
- </select>
- <insert id="insertBBusiWishScoreGroups" parameterType="BBusiWishScoreGroups" useGeneratedKeys="true" keyProperty="id">
- insert into b_busi_wish_score_groups
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="location != null">location,</if>
- <if test="year != null">year,</if>
- <if test="mode != null">mode,</if>
- <if test="score != null">score,</if>
- <if test="num != null">num,</if>
- <if test="numTotal != null">numTotal,</if>
- <if test="createTime != null">createTime,</if>
- <if test="status != null">status,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="location != null">#{location},</if>
- <if test="year != null">#{year},</if>
- <if test="mode != null">#{mode},</if>
- <if test="score != null">#{score},</if>
- <if test="num != null">#{num},</if>
- <if test="numTotal != null">#{numTotal},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="status != null">#{status},</if>
- </trim>
- </insert>
- <update id="updateBBusiWishScoreGroups" parameterType="BBusiWishScoreGroups">
- update b_busi_wish_score_groups
- <trim prefix="SET" suffixOverrides=",">
- <if test="location != null">location = #{location},</if>
- <if test="year != null">year = #{year},</if>
- <if test="mode != null">mode = #{mode},</if>
- <if test="score != null">score = #{score},</if>
- <if test="num != null">num = #{num},</if>
- <if test="numTotal != null">numTotal = #{numTotal},</if>
- <if test="createTime != null">createTime = #{createTime},</if>
- <if test="status != null">status = #{status},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteBBusiWishScoreGroupsById" parameterType="Long">
- delete from b_busi_wish_score_groups where id = #{id}
- </delete>
- <delete id="deleteBBusiWishScoreGroupsByIds" parameterType="String">
- delete from b_busi_wish_score_groups where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|