EntDangerCatMapper.xml 6.0 KB

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