TaskCatMapper.xml 5.0 KB

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