SysTableSetMapper.xml 6.7 KB

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