BBusiWishUniversitiesDepartmentMapper.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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.BBusiWishUniversitiesDepartmentMapper">
  6. <resultMap type="BBusiWishUniversitiesDepartment" id="BBusiWishUniversitiesDepartmentResult">
  7. <result property="departmentId" column="departmentId" />
  8. <result property="collegeCode" column="collegeCode" />
  9. <result property="majorCount" column="majorCount" />
  10. <result property="name" column="name" />
  11. <result property="website" column="website" />
  12. <result property="createTime" column="createTime" />
  13. <result property="updateTime" column="updateTime" />
  14. <collection property="departmentMajor" column="departmentId" javaType="java.util.List" resultMap="departmentMajorResult" />
  15. </resultMap>
  16. <resultMap type="BBusiWishUniversitiesDepartmentMajor" id="departmentMajorResult">
  17. <result property="id" column="id" />
  18. <result property="code" column="code" />
  19. <result property="name" column="nameMajor" />
  20. <result property="departmentId" column="departmentId" />
  21. <result property="level" column="level" />
  22. <result property="levelText" column="levelText" />
  23. <result property="collegeCode" column="collegeCode" />
  24. <result property="createTime" column="createTime" />
  25. <result property="updateTime" column="updateTime" />
  26. </resultMap>
  27. <sql id="selectBBusiWishUniversitiesDepartmentVo">
  28. select t1.departmentId, t1.collegeCode, t1.majorCount, t1.name, t1.website, t1.createTime, t1.updateTime,
  29. t2.id, t2.code, t2.name nameMajor, t2.departmentId, t2.level, t2.levelText, t2.collegeCode, t2.createTime, t2.updateTime
  30. from b_busi_wish_universities_department t1
  31. left join b_busi_wish_universities_department_major t2 on t1.departmentId=t2.departmentId
  32. </sql>
  33. <select id="selectBBusiWishUniversitiesDepartmentList" parameterType="BBusiWishUniversitiesDepartment" resultMap="BBusiWishUniversitiesDepartmentResult">
  34. <include refid="selectBBusiWishUniversitiesDepartmentVo"/>
  35. <where>
  36. <if test="departmentId != null and departmentId != ''"> and t1.departmentId = #{departmentId}</if>
  37. <if test="collegeCode != null and collegeCode != ''"> and t1.collegeCode = #{collegeCode}</if>
  38. <if test="majorCount != null "> and t1.majorCount = #{majorCount}</if>
  39. <if test="name != null and name != ''"> and t1.name like concat('%', #{name}, '%')</if>
  40. <if test="website != null and website != ''"> and t1.website = #{website}</if>
  41. <if test="createTime != null "> and t1.createTime = #{createTime}</if>
  42. <if test="updateTime != null "> and t1.updateTime = #{updateTime}</if>
  43. </where>
  44. </select>
  45. <select id="selectBBusiWishUniversitiesDepartmentById" parameterType="String" resultMap="BBusiWishUniversitiesDepartmentResult">
  46. <include refid="selectBBusiWishUniversitiesDepartmentVo"/>
  47. where t1.departmentId = #{departmentId}
  48. </select>
  49. <insert id="insertBBusiWishUniversitiesDepartment" parameterType="BBusiWishUniversitiesDepartment">
  50. insert into b_busi_wish_universities_department
  51. <trim prefix="(" suffix=")" suffixOverrides=",">
  52. <if test="departmentId != null">departmentId,</if>
  53. <if test="collegeCode != null and collegeCode != ''">collegeCode,</if>
  54. <if test="majorCount != null">majorCount,</if>
  55. <if test="name != null">name,</if>
  56. <if test="website != null">website,</if>
  57. <if test="createTime != null">createTime,</if>
  58. <if test="updateTime != null">updateTime,</if>
  59. </trim>
  60. <trim prefix="values (" suffix=")" suffixOverrides=",">
  61. <if test="departmentId != null">#{departmentId},</if>
  62. <if test="collegeCode != null and collegeCode != ''">#{collegeCode},</if>
  63. <if test="majorCount != null">#{majorCount},</if>
  64. <if test="name != null">#{name},</if>
  65. <if test="website != null">#{website},</if>
  66. <if test="createTime != null">#{createTime},</if>
  67. <if test="updateTime != null">#{updateTime},</if>
  68. </trim>
  69. </insert>
  70. <update id="updateBBusiWishUniversitiesDepartment" parameterType="BBusiWishUniversitiesDepartment">
  71. update b_busi_wish_universities_department
  72. <trim prefix="SET" suffixOverrides=",">
  73. <if test="collegeCode != null and collegeCode != ''">collegeCode = #{collegeCode},</if>
  74. <if test="majorCount != null">majorCount = #{majorCount},</if>
  75. <if test="name != null">name = #{name},</if>
  76. <if test="website != null">website = #{website},</if>
  77. <if test="createTime != null">createTime = #{createTime},</if>
  78. <if test="updateTime != null">updateTime = #{updateTime},</if>
  79. </trim>
  80. where departmentId = #{departmentId}
  81. </update>
  82. <delete id="deleteBBusiWishUniversitiesDepartmentById" parameterType="String">
  83. delete from b_busi_wish_universities_department where departmentId = #{departmentId}
  84. </delete>
  85. <delete id="deleteBBusiWishUniversitiesDepartmentByIds" parameterType="String">
  86. delete from b_busi_wish_universities_department where departmentId in
  87. <foreach item="departmentId" collection="array" open="(" separator="," close=")">
  88. #{departmentId}
  89. </foreach>
  90. </delete>
  91. </mapper>