CheckCatMapper.xml 5.7 KB

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