SysTableSetMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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.SysTableSetMapper">
  6. <resultMap type="SysTableSet" id="SysTableSetResult">
  7. <result property="id" column="id"/>
  8. <result property="tableName" column="table_name"/>
  9. <result property="userId" column="user_id"/>
  10. <result property="surface" column="surface"/>
  11. <result property="label" column="label"/>
  12. <result property="name" column="name"/>
  13. <result property="checked" column="checked"/>
  14. <result property="width" column="width"/>
  15. <result property="fixed" column="fixed"/>
  16. </resultMap>
  17. <sql id="selectSysTableSetVo">
  18. select id, table_name, user_id, surface, label, fixed, name, checked, width from sys_table_set
  19. </sql>
  20. <select id="selectSysTableSetList" parameterType="SysTableSet" resultMap="SysTableSetResult">
  21. <include refid="selectSysTableSetVo"/>
  22. <where>
  23. <if test="tableName != null and tableName != ''">and table_name = #{tableName}</if>
  24. <if test="userId != null ">and user_id = #{userId}</if>
  25. <if test="surface != null ">and surface = #{surface}</if>
  26. <if test="label != null and label != ''">and label = #{label}</if>
  27. <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
  28. <if test="checked != null ">and checked = #{checked}</if>
  29. <if test="width != null ">and width = #{width}</if>
  30. <if test="fixed != null ">and fixed = #{fixed}</if>
  31. </where>
  32. </select>
  33. <select id="selectSysTableSetById" parameterType="Long" resultMap="SysTableSetResult">
  34. <include refid="selectSysTableSetVo"/>
  35. where id = #{id}
  36. </select>
  37. <select id="selectMaxId" resultType="long">
  38. SELECT if(MAX(table_id) IS NULL,0,table_id) AS a FROM sys_table_set
  39. </select>
  40. <select id="selectMessage" resultType="com.ruoyi.system.domain.SysTableSet">
  41. SELECT
  42. id,surface,label,name,checked,width
  43. FROM
  44. `sys_table_set`
  45. WHERE
  46. user_id = #{userId}
  47. AND table_name = #{tableName}
  48. </select>
  49. <insert id="insertSysTableSet" parameterType="SysTableSet" useGeneratedKeys="true" keyProperty="id">
  50. insert into sys_table_set
  51. <trim prefix="(" suffix=")" suffixOverrides=",">
  52. <if test="tableName != null">table_name,</if>
  53. <if test="userId != null">user_id,</if>
  54. <if test="surface != null">surface,</if>
  55. <if test="label != null">label,</if>
  56. <if test="name != null">name,</if>
  57. <if test="checked != null">checked,</if>
  58. <if test="width != null">width,</if>
  59. <if test="fixed != null">fixed,</if>
  60. </trim>
  61. <trim prefix="values (" suffix=")" suffixOverrides=",">
  62. <if test="tableName != null">#{tableName},</if>
  63. <if test="userId != null">#{userId},</if>
  64. <if test="surface != null">#{surface},</if>
  65. <if test="label != null">#{label},</if>
  66. <if test="name != null">#{name},</if>
  67. <if test="checked != null">#{checked},</if>
  68. <if test="width != null">#{width},</if>
  69. <if test="fixed != null">#{fixed},</if>
  70. </trim>
  71. </insert>
  72. <update id="updateSysTableSet" parameterType="SysTableSet">
  73. update sys_table_set
  74. <trim prefix="SET" suffixOverrides=",">
  75. <if test="tableName != null">table_name = #{tableName},</if>
  76. <if test="userId != null">user_id = #{userId},</if>
  77. <if test="surface != null">surface = #{surface},</if>
  78. <if test="label != null">label = #{label},</if>
  79. <if test="name != null">name = #{name},</if>
  80. <if test="checked != null">checked = #{checked},</if>
  81. <if test="width != null">width = #{width},</if>
  82. <if test="fixed != null">width = #{fixed},</if>
  83. </trim>
  84. where id = #{id}
  85. </update>
  86. <update id="updateTableSetMessage" parameterType="object">
  87. UPDATE sys_table_set
  88. <set>
  89. <if test="table.surface != null">
  90. surface = #{table.surface},
  91. </if>
  92. <if test="table.label != '' || table.label != null">
  93. label = #{table.label},
  94. </if>
  95. <if test="table.name != '' || table.name != null">
  96. name = #{table.name},
  97. </if>
  98. <if test="table.checked != null">
  99. checked = #{table.checked},
  100. </if>
  101. <if test="table.width != null">
  102. width = #{table.width},
  103. </if>
  104. </set>
  105. WHERE
  106. user_id = #{table.userId}
  107. AND table_name = #{table.tableName}
  108. </update>
  109. <delete id="deleteSysTableSet" parameterType="SysTableSet">
  110. delete from sys_table_set where user_id = #{userId} and table_name = #{tableName}
  111. </delete>
  112. <delete id="deleteSysTableSetById" parameterType="Long">
  113. delete from sys_table_set where id = #{id}
  114. </delete>
  115. <delete id="deleteSysTableSetByIds" parameterType="String">
  116. delete from sys_table_set where id in
  117. <foreach item="id" collection="array" open="(" separator="," close=")">
  118. #{id}
  119. </foreach>
  120. </delete>
  121. </mapper>