AppCatMapper.xml 4.8 KB

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