DictDao.xml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.thinkgem.jeesite.modules.sys.dao.DictDao">
  4. <select id="get" resultType="Dict">
  5. SELECT
  6. *
  7. FROM sys_dict
  8. WHERE id = #{id}
  9. </select>
  10. <select id="findList" resultType="Dict">
  11. SELECT
  12. *
  13. FROM sys_dict
  14. WHERE del_flag = #{DEL_FLAG_NORMAL}
  15. <if test="type != null and type != ''">
  16. AND type = #{type}
  17. </if>
  18. <if test="description != null and description != ''">
  19. AND (type LIKE concat('%',#{description},'%') or description LIKE
  20. <if test="dbName == 'oracle'">'%'||#{description}||'%'</if>
  21. <if test="dbName == 'mssql'">'%'+#{description}+'%'</if>
  22. <if test="dbName == 'mysql'">CONCAT('%', #{description}, '%')</if>
  23. )
  24. </if>
  25. ORDER BY type, sort, update_date DESC
  26. </select>
  27. <select id="findAllList" resultType="Dict">
  28. SELECT
  29. *
  30. FROM sys_dict
  31. WHERE del_flag = #{DEL_FLAG_NORMAL}
  32. ORDER BY type, sort, update_date DESC
  33. </select>
  34. <select id="findTypeList" resultType="string">
  35. SELECT
  36. type
  37. FROM sys_dict
  38. WHERE del_flag = #{DEL_FLAG_NORMAL}
  39. GROUP BY type
  40. ORDER BY type
  41. </select>
  42. <insert id="insert" parameterType="dict" keyProperty="id" useGeneratedKeys="true">
  43. INSERT INTO sys_dict(
  44. value,
  45. label,
  46. type,
  47. description,
  48. sort,
  49. create_by,
  50. create_date,
  51. update_by,
  52. update_date,
  53. remarks,
  54. del_flag
  55. ) VALUES (
  56. #{value},
  57. #{label},
  58. #{type},
  59. #{description},
  60. #{sort},
  61. #{createBy.id},
  62. #{createDate},
  63. #{updateBy.id},
  64. #{updateDate},
  65. #{remarks},
  66. #{delFlag}
  67. )
  68. </insert>
  69. <update id="update">
  70. UPDATE sys_dict SET
  71. value = #{value},
  72. label = #{label},
  73. type = #{type},
  74. description = #{description},
  75. sort = #{sort},
  76. update_by = #{updateBy.id},
  77. update_date = #{updateDate},
  78. remarks = #{remarks}
  79. WHERE id = #{id}
  80. </update>
  81. <update id="delete">
  82. DELETE FROM sys_dict
  83. WHERE id = #{id}
  84. </update>
  85. </mapper>