DocCatMapper.xml 5.6 KB

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