InstitutionMapper.xml 5.6 KB

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