调解系统后端服务

SysPostMapper.xml 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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.system.mapper.SysPostMapper">
  6. <resultMap type="com.ruoyi.system.domain.SysPost" id="SysPostResult">
  7. <id property="postId" column="post_id" />
  8. <result property="postCode" column="post_code" />
  9. <result property="postName" column="post_name" />
  10. <result property="postSort" column="post_sort" />
  11. <result property="status" column="status" />
  12. <result property="createBy" column="create_by" />
  13. <result property="createTime" column="create_time" />
  14. <result property="updateBy" column="update_by" />
  15. <result property="updateTime" column="update_time" />
  16. <result property="remark" column="remark" />
  17. </resultMap>
  18. <sql id="selectPostVo">
  19. select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
  20. from ms_sys_post
  21. </sql>
  22. <select id="selectPostList" parameterType="com.ruoyi.system.domain.SysPost" resultMap="SysPostResult">
  23. <include refid="selectPostVo"/>
  24. <where>
  25. <if test="postCode != null and postCode != ''">
  26. AND post_code like concat('%', #{postCode}, '%')
  27. </if>
  28. <if test="status != null and status != ''">
  29. AND status = #{status}
  30. </if>
  31. <if test="postName != null and postName != ''">
  32. AND post_name like concat('%', #{postName}, '%')
  33. </if>
  34. </where>
  35. </select>
  36. <select id="selectPostAll" resultMap="SysPostResult">
  37. <include refid="selectPostVo"/>
  38. </select>
  39. <select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
  40. <include refid="selectPostVo"/>
  41. where post_id = #{postId}
  42. </select>
  43. <select id="selectPostByPostCode" parameterType="String" resultMap="SysPostResult">
  44. <include refid="selectPostVo"/>
  45. where post_code = #{postCode}
  46. </select>
  47. <select id="selectPostListByUserId" parameterType="Long" resultType="Long">
  48. select p.post_id
  49. from ms_sys_post p
  50. left join ms_ms_sys_user_post up on up.post_id = p.post_id
  51. left join ms_sys_user u on u.user_id = up.user_id
  52. where u.user_id = #{userId}
  53. </select>
  54. <select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
  55. select p.post_id, p.post_name, p.post_code
  56. from ms_sys_post p
  57. left join ms_ms_sys_user_post up on up.post_id = p.post_id
  58. left join ms_sys_user u on u.user_id = up.user_id
  59. where u.user_name = #{userName}
  60. </select>
  61. <select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
  62. <include refid="selectPostVo"/>
  63. where post_name=#{postName} limit 1
  64. </select>
  65. <select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
  66. <include refid="selectPostVo"/>
  67. where post_code=#{postCode} limit 1
  68. </select>
  69. <update id="updatePost" parameterType="com.ruoyi.system.domain.SysPost">
  70. update ms_sys_post
  71. <set>
  72. <if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
  73. <if test="postName != null and postName != ''">post_name = #{postName},</if>
  74. <if test="postSort != null">post_sort = #{postSort},</if>
  75. <if test="status != null and status != ''">status = #{status},</if>
  76. <if test="remark != null">remark = #{remark},</if>
  77. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  78. update_time = sysdate()
  79. </set>
  80. where post_id = #{postId}
  81. </update>
  82. <insert id="insertPost" parameterType="com.ruoyi.system.domain.SysPost" useGeneratedKeys="true" keyProperty="postId">
  83. insert into ms_sys_post(
  84. <if test="postId != null and postId != 0">post_id,</if>
  85. <if test="postCode != null and postCode != ''">post_code,</if>
  86. <if test="postName != null and postName != ''">post_name,</if>
  87. <if test="postSort != null">post_sort,</if>
  88. <if test="status != null and status != ''">status,</if>
  89. <if test="remark != null and remark != ''">remark,</if>
  90. <if test="createBy != null and createBy != ''">create_by,</if>
  91. create_time
  92. )values(
  93. <if test="postId != null and postId != 0">#{postId},</if>
  94. <if test="postCode != null and postCode != ''">#{postCode},</if>
  95. <if test="postName != null and postName != ''">#{postName},</if>
  96. <if test="postSort != null">#{postSort},</if>
  97. <if test="status != null and status != ''">#{status},</if>
  98. <if test="remark != null and remark != ''">#{remark},</if>
  99. <if test="createBy != null and createBy != ''">#{createBy},</if>
  100. sysdate()
  101. )
  102. </insert>
  103. <delete id="deletePostById" parameterType="Long">
  104. delete from ms_sys_post where post_id = #{postId}
  105. </delete>
  106. <delete id="deletePostByIds" parameterType="Long">
  107. delete from ms_sys_post where post_id in
  108. <foreach collection="array" item="postId" open="(" separator="," close=")">
  109. #{postId}
  110. </foreach>
  111. </delete>
  112. </mapper>