DictDataMapper.xml 6.0 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="cn.gov.customs.wxjy.system.dao.DictDataDao">
  6. <resultMap type="cn.gov.customs.wxjy.system.pojo.DictData" id="DictDataResult">
  7. <result 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="createUser" column="CREATE_USER"/>
  17. <result property="createTime" column="CREATE_TIME"/>
  18. <result property="updateUser" column="UPDATE_USER"/>
  19. <result property="updateTime" column="UPDATE_TIME"/>
  20. <result property="remark" column="REMARK"/>
  21. </resultMap>
  22. <sql id="baseVo">
  23. select DICT_CODE, DICT_SORT, DICT_LABEL, DICT_VALUE, DICT_TYPE, CSS_CLASS, LIST_CLASS, IS_DEFAULT, STATUS, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK
  24. from WXJY_DICT_DATA
  25. </sql>
  26. <select id="selectDictDataList" parameterType="cn.gov.customs.wxjy.system.pojo.DictDataQuery" resultMap="DictDataResult">
  27. <include refid="baseVo"/>
  28. <where>
  29. <if test="dictType != null and dictType != ''">
  30. AND dict_type = #{dictType}
  31. </if>
  32. <if test="dictLabel != null and dictLabel != ''">
  33. AND dict_label like concat('%', #{dictLabel}, '%')
  34. </if>
  35. <if test="status != null and status != ''">
  36. AND status = #{status}
  37. </if>
  38. </where>
  39. order by dict_sort asc
  40. </select>
  41. <select id="selectDictDataByType" parameterType="String" resultMap="DictDataResult">
  42. <include refid="baseVo"/>
  43. where status = '0' and dict_type = #{dictType} order by dict_sort asc
  44. </select>
  45. <select id="selectDictLabel" resultType="String">
  46. select dict_label from wxjy_dict_data
  47. where dict_type = #{dictType} and dict_value = #{dictValue}
  48. </select>
  49. <select id="selectDictDataById" parameterType="Long" resultMap="DictDataResult">
  50. <include refid="baseVo"/>
  51. where dict_code = #{dictCode}
  52. </select>
  53. <select id="countDictDataByType" resultType="Integer">
  54. select count(1) from wxjy_dict_data where dict_type=#{dictType}
  55. </select>
  56. <delete id="deleteDictDataById" parameterType="Long">
  57. delete from wxjy_dict_data where dict_code = #{dictCode}
  58. </delete>
  59. <delete id="deleteDictDataByIds" parameterType="Long">
  60. delete from wxjy_dict_data where dict_code in
  61. <foreach collection="array" item="dictCode" open="(" separator="," close=")">
  62. #{dictCode}
  63. </foreach>
  64. </delete>
  65. <update id="updateDictData" parameterType="cn.gov.customs.wxjy.system.pojo.DictData">
  66. update wxjy_dict_data
  67. <set>
  68. <if test="dictSort != null">dict_sort = #{dictSort},</if>
  69. <if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
  70. <if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
  71. <if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
  72. <if test="cssClass != null">css_class = #{cssClass},</if>
  73. <if test="listClass != null">list_class = #{listClass},</if>
  74. <if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
  75. <if test="status != null">status = #{status},</if>
  76. <if test="remark != null">remark = #{remark},</if>
  77. <if test="updateUser != null and updateUser != ''">UPDATE_USER = #{updateUser},</if>
  78. update_time = sysdate()
  79. </set>
  80. where dict_code = #{dictCode}
  81. </update>
  82. <update id="updateDictDataType" parameterType="String">
  83. update wxjy_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
  84. </update>
  85. <insert id="insertDictData" parameterType="cn.gov.customs.wxjy.system.pojo.DictData">
  86. insert into wxjy_dict_data(
  87. <if test="dictSort != null">dict_sort,</if>
  88. <if test="dictLabel != null and dictLabel != ''">dict_label,</if>
  89. <if test="dictValue != null and dictValue != ''">dict_value,</if>
  90. <if test="dictType != null and dictType != ''">dict_type,</if>
  91. <if test="cssClass != null and cssClass != ''">css_class,</if>
  92. <if test="listClass != null and listClass != ''">list_class,</if>
  93. <if test="isDefault != null and isDefault != ''">is_default,</if>
  94. <if test="status != null">status,</if>
  95. <if test="remark != null and remark != ''">remark,</if>
  96. <if test="createUser != null and createUser != ''">CREATE_USER,</if>
  97. create_time
  98. )values(
  99. <if test="dictSort != null">#{dictSort},</if>
  100. <if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
  101. <if test="dictValue != null and dictValue != ''">#{dictValue},</if>
  102. <if test="dictType != null and dictType != ''">#{dictType},</if>
  103. <if test="cssClass != null and cssClass != ''">#{cssClass},</if>
  104. <if test="listClass != null and listClass != ''">#{listClass},</if>
  105. <if test="isDefault != null and isDefault != ''">#{isDefault},</if>
  106. <if test="status != null">#{status},</if>
  107. <if test="remark != null and remark != ''">#{remark},</if>
  108. <if test="createUser != null and createUser != ''">#{createUser},</if>
  109. sysdate()
  110. )
  111. </insert>
  112. <select id="checkDictDataUnique" parameterType="String" resultMap="DictDataResult">
  113. <include refid="baseVo"/>
  114. where dict_type = #{dictType} and dict_value = #{dictValue} limit 1
  115. </select>
  116. </mapper>