OrgCatMapper.xml 4.7 KB

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