GroupCatMapper.xml 5.4 KB

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