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