CmmeSysDictMapper.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.cmme.modules.dict.dao.CmmeSysDictDao">
  4. <select id="get" resultType="CmmeSysDict">
  5. SELECT
  6. *
  7. FROM cmme_sys_dict
  8. WHERE id = #{id}
  9. </select>
  10. <select id="findList" resultType="CmmeSysDict">
  11. SELECT
  12. *
  13. FROM cmme_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 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. </if>
  24. ORDER BY type, sort, update_date DESC
  25. </select>
  26. <select id="findAllList" resultType="CmmeSysDict">
  27. SELECT
  28. *
  29. FROM cmme_sys_dict
  30. WHERE del_flag = #{DEL_FLAG_NORMAL}
  31. ORDER BY type, sort, update_date DESC
  32. </select>
  33. <select id="findTypeList" resultType="string">
  34. SELECT
  35. type
  36. FROM cmme_sys_dict
  37. WHERE del_flag = #{DEL_FLAG_NORMAL}
  38. GROUP BY type
  39. ORDER BY type
  40. </select>
  41. <insert id="insert" parameterType="CmmeSysDict" keyProperty="id" useGeneratedKeys="true">
  42. INSERT INTO cmme_sys_dict(
  43. value,
  44. label,
  45. type,
  46. description,
  47. sort,
  48. create_by,
  49. create_date,
  50. update_by,
  51. update_date,
  52. remarks,
  53. del_flag
  54. ) VALUES (
  55. #{value},
  56. #{label},
  57. #{type},
  58. #{description},
  59. #{sort},
  60. #{createBy.id},
  61. #{createDate},
  62. #{updateBy.id},
  63. #{updateDate},
  64. #{remarks},
  65. #{delFlag}
  66. )
  67. </insert>
  68. <update id="update">
  69. UPDATE cmme_sys_dict SET
  70. value = #{value},
  71. label = #{label},
  72. type = #{type},
  73. description = #{description},
  74. sort = #{sort},
  75. update_by = #{updateBy.id},
  76. update_date = #{updateDate},
  77. remarks = #{remarks}
  78. WHERE id = #{id}
  79. </update>
  80. <delete id="delete">
  81. DELETE FROM cmme_sys_dict
  82. WHERE id = #{id}
  83. </delete>
  84. </mapper>