ChecklistCatMapper.xml 5.9 KB

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