InstitutionMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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.project.VRdemo.mapper.InstitutionMapper">
  6. <resultMap type="Institution" id="InstitutionResult">
  7. <result property="id" column="id" />
  8. <result property="affiliation" column="affiliation"/>
  9. <result property="location" column="location"/>
  10. <result property="chineseName" column="chinese_name" />
  11. <result property="englishName" column="english_name" />
  12. <result property="link" column="link" />
  13. <result property="introduce" column="introduce" />
  14. <result property="sort" column="sort" />
  15. <result property="createTime" column="create_time" />
  16. <result property="createBy" column="create_by" />
  17. <result property="updateTime" column="update_time" />
  18. <result property="updateBy" column="update_by" />
  19. </resultMap>
  20. <sql id="selectInstitutionVo">
  21. select id, affiliation, location, chinese_name, english_name, link, introduce, sort, create_time, create_by, update_time, update_by from vr_institution
  22. </sql>
  23. <select id="selectInstitutionList" parameterType="Institution" resultMap="InstitutionResult">
  24. <include refid="selectInstitutionVo"/>
  25. <where>
  26. <if test="affiliation != null and affiliation != ''"> and affiliation like concat('%', #{affiliation}, '%')</if>
  27. <if test="location != null and location != ''"> and location like concat('%', #{location}, '%')</if>
  28. <if test="chineseName != null and chineseName != ''"> and chinese_name like concat('%', #{chineseName}, '%')</if>
  29. <if test="englishName != null and englishName != ''"> and english_name like concat('%', #{englishName}, '%')</if>
  30. <if test="link != null and link != ''"> and link like concat('%', #{link}, '%')</if>
  31. <if test="introduce != null and introduce != ''"> and introduce like concat('%', #{introduce}, '%')</if>
  32. <if test="sort != null and sort != ''"> and sort = #{sort}</if>
  33. </where>
  34. ORDER BY sort
  35. </select>
  36. <select id="selectInstitutionById" parameterType="Long" resultMap="InstitutionResult">
  37. <include refid="selectInstitutionVo"/>
  38. where id = #{id}
  39. </select>
  40. <select id="selectInstitutionByTitle" resultType="com.ruoyi.project.VRdemo.domain.Institution">
  41. <include refid="selectInstitutionVo"/>
  42. WHERE chinese_name = #{chineseName} and english_name = #{englishName}
  43. </select>
  44. <insert id="insertInstitution" parameterType="Institution" useGeneratedKeys="true" keyProperty="id">
  45. insert into vr_institution
  46. <trim prefix="(" suffix=")" suffixOverrides=",">
  47. <if test="affiliation != null and affiliation != ''">affiliation,</if>
  48. <if test="location != null and location != ''">location,</if>
  49. <if test="englishName != null and englishName != ''">english_name,</if>
  50. <if test="chineseName != null and chineseName != ''">chinese_name,</if>
  51. <if test="introduce != null and introduce != ''">introduce,</if>
  52. <if test="link != null and link != ''">link,</if>
  53. <if test="sort != null and sort != ''">sort,</if>
  54. <if test="createBy != null and createBy != ''">create_by,</if>
  55. <if test="createTime != null ">create_time,</if>
  56. <if test="updateBy != null and updateBy != ''">update_by,</if>
  57. <if test="updateTime != null ">update_time,</if>
  58. </trim>
  59. <trim prefix="values (" suffix=")" suffixOverrides=",">
  60. <if test="affiliation != null and affiliation != ''">#{affiliation},</if>
  61. <if test="location != null and location != ''">#{location},</if>
  62. <if test="englishName != null and englishName != ''">#{englishName},</if>
  63. <if test="chineseName != null and chineseName != ''">#{chineseName},</if>
  64. <if test="introduce != null and introduce != ''">#{introduce},</if>
  65. <if test="link != null and link != ''">#{link},</if>
  66. <if test="sort != null and sort != ''">#{sort},</if>
  67. <if test="createBy != null and createBy != ''">#{createBy},</if>
  68. <if test="createTime != null ">#{createTime},</if>
  69. <if test="updateBy != null and updateBy != ''">#{updateBy},</if>
  70. <if test="updateTime != null ">#{updateTime},</if>
  71. </trim>
  72. </insert>
  73. <insert id="insertInstitutionDataList" parameterType="java.util.List">
  74. INSERT INTO vr_institution (affiliation, location, chinese_name, english_name, link, introduce, sort, create_by,create_time)
  75. VALUES
  76. <foreach collection="list" item="item" separator=",">
  77. (#{item.affiliation}, #{item.location}, #{item.chineseName}, #{item.englishName}, #{item.link}, #{item.introduce}, #{item.sort}, #{item.createBy}, #{item.createTime})
  78. </foreach>
  79. </insert>
  80. <update id="updateInstitution" parameterType="Institution">
  81. update vr_institution
  82. <trim prefix="SET" suffixOverrides=",">
  83. <if test="affiliation != null and affiliation != ''">affiliation = #{affiliation},</if>
  84. <if test="location != null and location != ''">location = #{location},</if>
  85. <if test="englishName != null and englishName != ''">english_name = #{englishName},</if>
  86. <if test="chineseName != null and chineseName != ''">chinese_name = #{chineseName},</if>
  87. <if test="introduce != null and introduce != ''">introduce = #{introduce},</if>
  88. <if test="link != null and link != ''">link = #{link},</if>
  89. <if test="sort != null and sort != ''">sort = #{sort},</if>
  90. <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
  91. <if test="createTime != null ">create_time = #{createTime},</if>
  92. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  93. <if test="updateTime != null ">update_time = #{updateTime},</if>
  94. </trim>
  95. where id = #{id}
  96. </update>
  97. <delete id="deleteInstitutionById" parameterType="Long">
  98. delete from vr_institution where id = #{id}
  99. </delete>
  100. <delete id="deleteInstitutionByIds" parameterType="String">
  101. delete from vr_institution where id in
  102. <foreach item="id" collection="array" open="(" separator="," close=")">
  103. #{id}
  104. </foreach>
  105. </delete>
  106. </mapper>