SysDictDataMapper.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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.yijia.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="selectDictValue" resultType="String">
  49. select dict_value from sys_dict_data
  50. where dict_type = #{dictType} and dict_label = #{dictLabel}
  51. </select>
  52. <select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult">
  53. <include refid="selectDictDataVo"/>
  54. where dict_code = #{dictCode}
  55. </select>
  56. <select id="countDictDataByType" resultType="Integer">
  57. select count(1) from sys_dict_data where dict_type=#{dictType}
  58. </select>
  59. <delete id="deleteDictDataById" parameterType="Long">
  60. delete from sys_dict_data where dict_code = #{dictCode}
  61. </delete>
  62. <delete id="deleteDictDataByIds" parameterType="Long">
  63. delete from sys_dict_data where dict_code in
  64. <foreach collection="array" item="dictCode" open="(" separator="," close=")">
  65. #{dictCode}
  66. </foreach>
  67. </delete>
  68. <update id="updateDictData" parameterType="SysDictData">
  69. update sys_dict_data
  70. <set>
  71. <if test="dictSort != null">dict_sort = #{dictSort},</if>
  72. <if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
  73. <if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
  74. <if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
  75. <if test="cssClass != null">css_class = #{cssClass},</if>
  76. <if test="listClass != null">list_class = #{listClass},</if>
  77. <if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
  78. <if test="status != null">status = #{status},</if>
  79. <if test="remark != null">remark = #{remark},</if>
  80. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  81. update_time = sysdate()
  82. </set>
  83. where dict_code = #{dictCode}
  84. </update>
  85. <update id="updateDictDataType" parameterType="String">
  86. update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
  87. </update>
  88. <insert id="insertDictData" parameterType="SysDictData">
  89. insert into sys_dict_data(
  90. <if test="dictSort != null">dict_sort,</if>
  91. <if test="dictLabel != null and dictLabel != ''">dict_label,</if>
  92. <if test="dictValue != null and dictValue != ''">dict_value,</if>
  93. <if test="dictType != null and dictType != ''">dict_type,</if>
  94. <if test="cssClass != null and cssClass != ''">css_class,</if>
  95. <if test="listClass != null and listClass != ''">list_class,</if>
  96. <if test="isDefault != null and isDefault != ''">is_default,</if>
  97. <if test="status != null">status,</if>
  98. <if test="remark != null and remark != ''">remark,</if>
  99. <if test="createBy != null and createBy != ''">create_by,</if>
  100. create_time
  101. )values(
  102. <if test="dictSort != null">#{dictSort},</if>
  103. <if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
  104. <if test="dictValue != null and dictValue != ''">#{dictValue},</if>
  105. <if test="dictType != null and dictType != ''">#{dictType},</if>
  106. <if test="cssClass != null and cssClass != ''">#{cssClass},</if>
  107. <if test="listClass != null and listClass != ''">#{listClass},</if>
  108. <if test="isDefault != null and isDefault != ''">#{isDefault},</if>
  109. <if test="status != null">#{status},</if>
  110. <if test="remark != null and remark != ''">#{remark},</if>
  111. <if test="createBy != null and createBy != ''">#{createBy},</if>
  112. sysdate()
  113. )
  114. </insert>
  115. </mapper>