SysDictDataMapper.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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.slibra.system.mapper.SysDictDataMapper">
  6. <resultMap type="SysDictData" id="SysDictDataResult">
  7. <id property="dictCode" column="dict_code" />
  8. <result property="dictSort" column="dict_sort" />
  9. <result property="dictLabel" column="dict_label" />
  10. <result property="dictValue" column="dict_value" />
  11. <result property="dictType" column="dict_type" />
  12. <result property="cssClass" column="css_class" />
  13. <result property="listClass" column="list_class" />
  14. <result property="isDefault" column="is_default" />
  15. <result property="status" column="status" />
  16. <result property="createBy" column="create_by" />
  17. <result property="createTime" column="create_time" />
  18. <result property="updateBy" column="update_by" />
  19. <result property="updateTime" column="update_time" />
  20. </resultMap>
  21. <sql id="selectDictDataVo">
  22. select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
  23. from sys_dict_data
  24. </sql>
  25. <select id="selectDictDataList" parameterType="SysDictData" resultMap="SysDictDataResult">
  26. <include refid="selectDictDataVo"/>
  27. <where>
  28. <if test="dictType != null and dictType != ''">
  29. AND dict_type = #{dictType}
  30. </if>
  31. <if test="dictLabel != null and dictLabel != ''">
  32. AND dict_label like concat('%', #{dictLabel}, '%')
  33. </if>
  34. <if test="status != null and status != ''">
  35. AND status = #{status}
  36. </if>
  37. </where>
  38. order by dict_sort asc
  39. </select>
  40. <select id="selectDictDataByType" parameterType="SysDictData" resultMap="SysDictDataResult">
  41. <include refid="selectDictDataVo"/>
  42. where status = '0' and dict_type = #{dictType} order by dict_sort asc
  43. </select>
  44. <select id="selectDictLabel" resultType="String">
  45. select dict_label from sys_dict_data
  46. where dict_type = #{dictType} and dict_value = #{dictValue}
  47. </select>
  48. <select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult">
  49. <include refid="selectDictDataVo"/>
  50. where dict_code = #{dictCode}
  51. </select>
  52. <select id="countDictDataByType" resultType="Integer">
  53. select count(1) from sys_dict_data where dict_type=#{dictType}
  54. </select>
  55. <delete id="deleteDictDataById" parameterType="Long">
  56. delete from sys_dict_data where dict_code = #{dictCode}
  57. </delete>
  58. <delete id="deleteDictDataByIds" parameterType="Long">
  59. delete from sys_dict_data where dict_code in
  60. <foreach collection="array" item="dictCode" open="(" separator="," close=")">
  61. #{dictCode}
  62. </foreach>
  63. </delete>
  64. <update id="updateDictData" parameterType="SysDictData">
  65. update sys_dict_data
  66. <set>
  67. <if test="dictSort != null">dict_sort = #{dictSort},</if>
  68. <if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
  69. <if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
  70. <if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
  71. <if test="cssClass != null">css_class = #{cssClass},</if>
  72. <if test="listClass != null">list_class = #{listClass},</if>
  73. <if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
  74. <if test="status != null">status = #{status},</if>
  75. <if test="remark != null">remark = #{remark},</if>
  76. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  77. update_time = sysdate()
  78. </set>
  79. where dict_code = #{dictCode}
  80. </update>
  81. <update id="updateDictDataType" parameterType="String">
  82. update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
  83. </update>
  84. <insert id="insertDictData" parameterType="SysDictData">
  85. insert into sys_dict_data(
  86. <if test="dictSort != null">dict_sort,</if>
  87. <if test="dictLabel != null and dictLabel != ''">dict_label,</if>
  88. <if test="dictValue != null and dictValue != ''">dict_value,</if>
  89. <if test="dictType != null and dictType != ''">dict_type,</if>
  90. <if test="cssClass != null and cssClass != ''">css_class,</if>
  91. <if test="listClass != null and listClass != ''">list_class,</if>
  92. <if test="isDefault != null and isDefault != ''">is_default,</if>
  93. <if test="status != null">status,</if>
  94. <if test="remark != null and remark != ''">remark,</if>
  95. <if test="createBy != null and createBy != ''">create_by,</if>
  96. create_time
  97. )values(
  98. <if test="dictSort != null">#{dictSort},</if>
  99. <if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
  100. <if test="dictValue != null and dictValue != ''">#{dictValue},</if>
  101. <if test="dictType != null and dictType != ''">#{dictType},</if>
  102. <if test="cssClass != null and cssClass != ''">#{cssClass},</if>
  103. <if test="listClass != null and listClass != ''">#{listClass},</if>
  104. <if test="isDefault != null and isDefault != ''">#{isDefault},</if>
  105. <if test="status != null">#{status},</if>
  106. <if test="remark != null and remark != ''">#{remark},</if>
  107. <if test="createBy != null and createBy != ''">#{createBy},</if>
  108. sysdate()
  109. )
  110. </insert>
  111. </mapper>