BBusiWishUniversitiesRankingMapper.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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.BBusiWishUniversitiesRankingMapper">
  6. <resultMap type="BBusiWishUniversitiesRanking" id="BBusiWishUniversitiesRankingResult">
  7. <result property="id" column="id" />
  8. <result property="type" column="type" />
  9. <result property="collegeCode" column="collegeCode" />
  10. <result property="collegeName" column="collegeName" />
  11. <result property="ranking" column="ranking" />
  12. <result property="year" column="year" />
  13. <result property="collegeNumId" column="collegeNumId" />
  14. <result property="createTime" column="createTime" />
  15. <result property="updateTime" column="updateTime" />
  16. <association property="universities" column="code" javaType="BBusiWishUniversities" resultMap="universitiesResult" />
  17. </resultMap>
  18. <resultMap type="BBusiWishUniversities" id="universitiesResult">
  19. <result property="id" column="idU" />
  20. <result property="code" column="codeU" />
  21. <result property="name" column="nameU" />
  22. <result property="logo" column="logoU" />
  23. <result property="location" column="locationU" />
  24. <result property="managerType" column="managerTypeU" />
  25. <result property="type" column="typeU" />
  26. <result property="level" column="levelU" />
  27. <result property="comScore" column="comScoreU" />
  28. <result property="rankingOfEdu" column="rankingOfEduU" />
  29. <result property="ranking" column="rankingU" />
  30. <result property="cityName" column="cityNameU" />
  31. <result property="bxLevel" column="bxLevelU" />
  32. <result property="features" column="featuresU" />
  33. <result property="hits" column="hitsU" />
  34. <result property="natureTypeCN" column="natureTypeCNU" />
  35. </resultMap>
  36. <sql id="selectBBusiWishUniversitiesRankingVo">
  37. select t1.id, t1.type, t1.collegeCode, t1.collegeName, t1.ranking, t1.year, t1.collegeNumId, t1.createTime, t1.updateTime,
  38. t2.id idU, t2.code codeU, t2.name nameU, t2.logo logoU, t2.location locationU, t2.managerType managerTypeU, t2.type typeU, t2.level levelU,
  39. t2.comScore comScoreU,t2.rankingOfEdu rankingOfEduU,t2.ranking rankingU,t2.cityName cityNameU,
  40. t2.bxLevel bxLevelU,t2.features featuresU,t2.hits hitsU,t2.natureTypeCN natureTypeCNU
  41. from b_busi_wish_universities_ranking t1
  42. LEFT JOIN b_busi_wish_universities t2 on t1.collegeCode=t2.code
  43. </sql>
  44. <select id="selectBBusiWishUniversitiesRankingList" parameterType="BBusiWishUniversitiesRanking" resultMap="BBusiWishUniversitiesRankingResult">
  45. <include refid="selectBBusiWishUniversitiesRankingVo"/>
  46. <where>
  47. <if test="type != null and type != ''"> and t1.type = #{type}</if>
  48. <if test="collegeCodes != null"> and collegeCode in <foreach item="o" collection="collegeCodes" open="(" separator="," close=")">#{o}</foreach></if>
  49. <if test="collegeCode != null and collegeCode != ''"> and t1.collegeCode = #{collegeCode}</if>
  50. <if test="collegeName != null and collegeName != ''"> and t1.collegeName like concat('%', #{collegeName}, '%')</if>
  51. <if test="ranking != null "> and t1.ranking = #{ranking}</if>
  52. <if test="year != null "> and t1.year = #{year}</if>
  53. <if test="collegeNumId != null "> and t1.collegeNumId = #{collegeNumId}</if>
  54. <if test="createTime != null "> and t1.createTime = #{createTime}</if>
  55. <if test="updateTime != null "> and t1.updateTime = #{updateTime}</if>
  56. <if test="params != null and params.minYear != null "> and t1.year &gt;= #{params.minYear} </if>
  57. <if test="params != null and params.maxYear != null "> and t1.year &lt;= #{params.maxYear} </if>
  58. </where>
  59. order by ranking
  60. <if test="params.orderBy!=null and params.orderBy != ''"> order by #{params.orderBy} </if>
  61. </select>
  62. <select id="selectUniversitiesRankingMaxYearByType" parameterType="String" resultType="java.lang.Integer">
  63. select max(year) from b_busi_wish_universities_ranking
  64. where type = #{type}
  65. </select>
  66. <select id="selectBBusiWishUniversitiesRankingById" parameterType="String" resultMap="BBusiWishUniversitiesRankingResult">
  67. <include refid="selectBBusiWishUniversitiesRankingVo"/>
  68. where t1.id = #{id}
  69. </select>
  70. <select id="selectBBusiWishUniversitiesRankingTypes" resultType="String">
  71. SELECT DISTINCT `type` from b_busi_wish_universities_ranking order by type asc
  72. </select>
  73. <select id="selectBBusiWishUniversitiesRankingYears" parameterType="String" resultType="Integer">
  74. SELECT DISTINCT `year` from b_busi_wish_universities_ranking
  75. where 1=1
  76. <if test="type != null and type != ''">type = #{type},</if>
  77. order by year desc
  78. </select>
  79. <insert id="insertBBusiWishUniversitiesRanking" parameterType="BBusiWishUniversitiesRanking">
  80. insert into b_busi_wish_universities_ranking
  81. <trim prefix="(" suffix=")" suffixOverrides=",">
  82. <if test="id != null">id,</if>
  83. <if test="type != null and type != ''">type,</if>
  84. <if test="collegeCode != null and collegeCode != ''">collegeCode,</if>
  85. <if test="collegeName != null and collegeName != ''">collegeName,</if>
  86. <if test="ranking != null">ranking,</if>
  87. <if test="year != null">year,</if>
  88. <if test="collegeNumId != null">collegeNumId,</if>
  89. <if test="createTime != null">createTime,</if>
  90. <if test="updateTime != null">updateTime,</if>
  91. </trim>
  92. <trim prefix="values (" suffix=")" suffixOverrides=",">
  93. <if test="id != null">#{id},</if>
  94. <if test="type != null and type != ''">#{type},</if>
  95. <if test="collegeCode != null and collegeCode != ''">#{collegeCode},</if>
  96. <if test="collegeName != null and collegeName != ''">#{collegeName},</if>
  97. <if test="ranking != null">#{ranking},</if>
  98. <if test="year != null">#{year},</if>
  99. <if test="collegeNumId != null">#{collegeNumId},</if>
  100. <if test="createTime != null">#{createTime},</if>
  101. <if test="updateTime != null">#{updateTime},</if>
  102. </trim>
  103. </insert>
  104. <update id="updateBBusiWishUniversitiesRanking" parameterType="BBusiWishUniversitiesRanking">
  105. update b_busi_wish_universities_ranking
  106. <trim prefix="SET" suffixOverrides=",">
  107. <if test="type != null and type != ''">type = #{type},</if>
  108. <if test="collegeCode != null and collegeCode != ''">collegeCode = #{collegeCode},</if>
  109. <if test="collegeName != null and collegeName != ''">collegeName = #{collegeName},</if>
  110. <if test="ranking != null">ranking = #{ranking},</if>
  111. <if test="year != null">year = #{year},</if>
  112. <if test="collegeNumId != null">collegeNumId = #{collegeNumId},</if>
  113. <if test="createTime != null">createTime = #{createTime},</if>
  114. <if test="updateTime != null">updateTime = #{updateTime},</if>
  115. </trim>
  116. where id = #{id}
  117. </update>
  118. <delete id="deleteBBusiWishUniversitiesRankingById" parameterType="String">
  119. delete from b_busi_wish_universities_ranking where id = #{id}
  120. </delete>
  121. <delete id="deleteBBusiWishUniversitiesRankingByIds" parameterType="String">
  122. delete from b_busi_wish_universities_ranking where id in
  123. <foreach item="id" collection="array" open="(" separator="," close=")">
  124. #{id}
  125. </foreach>
  126. </delete>
  127. </mapper>