EntCatMapper.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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.zhyc.xps.sys.mapper.EntCatMapper">
  4. <resultMap id="EntCatDtoResultMap" type="com.zhyc.xps.sys.dto.EntCatDto">
  5. <result column="ent_cat_id" property="entCatId" jdbcType="BIGINT"/>
  6. <result column="ent_cat_title" property="entCatTitle" jdbcType="VARCHAR"/>
  7. <result column="ent_cat_desc" property="entCatDesc" jdbcType="VARCHAR"/>
  8. </resultMap>
  9. <sql id="EntCatDto_Cols">
  10. ent_cat_id,
  11. ent_cat_title,
  12. ent_cat_desc
  13. </sql>
  14. <!--基于ID查询-->
  15. <select id="getById" resultMap="EntCatDtoResultMap">
  16. SELECT
  17. <include refid="EntCatDto_Cols"/>
  18. FROM ent_cat
  19. WHERE ent_cat_id = #{entCatId ,jdbcType=BIGINT}
  20. </select>
  21. <!--分页查询-->
  22. <select id="getByPage" parameterType="java.util.Map" resultMap="EntCatDtoResultMap">
  23. SELECT
  24. <include refid="EntCatDto_Cols"/>
  25. FROM ent_cat
  26. WHERE deleted_flag = 0
  27. <if test="keywords != null and keywords != ''">
  28. AND ent_cat_title like "%"#{keywords}"%"
  29. </if>
  30. ORDER BY ent_cat_id ASC
  31. </select>
  32. <!--列表查询-->
  33. <select id="getByList" parameterType="java.util.Map" resultMap="EntCatDtoResultMap" >
  34. SELECT
  35. <include refid="EntCatDto_Cols"/>
  36. FROM ent_cat
  37. WHERE deleted_flag = 0
  38. <if test="keywords != null and keywords != ''">
  39. AND ent_cat_title like "%"#{keywords}"%"
  40. </if>
  41. </select>
  42. <insert id="create" parameterType="com.zhyc.xps.sys.entity.GroupCat">
  43. INSERT INTO ent_cat
  44. <trim prefix="(" suffix=")" suffixOverrides=",">
  45. <if test="entCatId != null">
  46. ent_cat_id,
  47. </if>
  48. <if test="entCatTitle != null and entCatTitle != ''">
  49. ent_cat_title,
  50. </if>
  51. <if test="entCatDesc != null and entCatDesc != ''">
  52. ent_cat_desc,
  53. </if>
  54. <if test="createdBy != null">
  55. created_by,
  56. </if>
  57. <if test="createdAt != null">
  58. created_at,
  59. </if>
  60. </trim>
  61. <trim prefix="values (" suffix=")" suffixOverrides=",">
  62. <if test="entCatId != null and entCatId !=''">
  63. #{entCatId ,jdbcType=BIGINT},
  64. </if>
  65. <if test="entCatTitle != null and entCatTitle != ''">
  66. #{entCatTitle ,jdbcType=VARCHAR},
  67. </if>
  68. <if test="entCatDesc != null and entCatDesc != ''">
  69. #{entCatDesc ,jdbcType=VARCHAR},
  70. </if>
  71. <if test="createdBy != null">
  72. #{createdBy ,jdbcType=BIGINT},
  73. </if>
  74. <if test="createdAt != null">
  75. #{createdAt ,jdbcType=TIMESTAMP},
  76. </if>
  77. </trim>
  78. </insert>
  79. <!--更新-->
  80. <update id="update" parameterType="com.zhyc.xps.sys.entity.GroupCat">
  81. UPDATE ent_cat
  82. <trim suffixOverrides=",">
  83. <set>
  84. <if test="entCatTitle != null and entCatTitle != ''">
  85. ent_cat_title = #{entCatTitle, jdbcType=VARCHAR},
  86. </if>
  87. <if test="entCatDesc != null and entCatDesc != ''">
  88. ent_cat_desc = #{entCatDesc, jdbcType=VARCHAR},
  89. </if>
  90. <if test="updatedBy != null ">
  91. updated_by = #{updatedBy ,jdbcType=BIGINT},
  92. </if>
  93. <if test="updatedAt != null">
  94. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  95. </if>
  96. </set>
  97. </trim>
  98. WHERE ent_cat_id = #{entCatId ,jdbcType=BIGINT}
  99. </update>
  100. <!--删除-->
  101. <update id="delete" parameterType="java.util.Map">
  102. UPDATE ent_cat
  103. <trim suffixOverrides=",">
  104. <set>
  105. <if test="deletedFlag != null">
  106. deleted_flag = #{deletedFlag,jdbcType=BIGINT},
  107. </if>
  108. <if test="deletedTime != null">
  109. deleted_time = #{deletedTime,jdbcType=TIMESTAMP},
  110. </if>
  111. <if test="deletedBy != null">
  112. deleted_by = #{deletedBy,jdbcType=BIGINT},
  113. </if>
  114. </set>
  115. </trim>
  116. WHERE ent_cat_id = #{entCatId ,jdbcType=BIGINT}
  117. </update>
  118. </mapper>