TBranchPlanMapper.xml 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.branch.mapper.TBranchPlanMapper">
  6. <resultMap type="TBranchPlan" id="TBranchPlanResult">
  7. <result property="planId" column="plan_id" />
  8. <result property="planTitle" column="plan_title" />
  9. <result property="delFlag" column="del_flag" />
  10. <result property="createBy" column="create_by" />
  11. <result property="createTime" column="create_time" />
  12. <result property="updateBy" column="update_by" />
  13. <result property="updateTime" column="update_time" />
  14. <result property="deptId" column="dept_id" />
  15. </resultMap>
  16. <sql id="selectTBranchPlanVo">
  17. select u.plan_id, u.plan_title, u.del_flag, u.create_by, u.create_time, u.update_by, u.update_time, u.dept_id from t_branch_plan u left join sys_dept d on u.dept_id = d.dept_id
  18. </sql>
  19. <select id="selectTBranchPlanList" parameterType="TBranchPlan" resultMap="TBranchPlanResult">
  20. <include refid="selectTBranchPlanVo"/>
  21. <where>
  22. <if test="planId != null "> and u.plan_id = #{planId}</if>
  23. <if test="planTitle != null and planTitle != ''"> and u.plan_title like concat('%', #{planTitle}, '%')</if>
  24. <if test="deptId != null "> and u.dept_id = #{deptId}</if>
  25. and u.del_flag = 0
  26. </where>
  27. <!-- 数据范围过滤 -->
  28. ${params.dataScope}
  29. </select>
  30. <select id="selectTBranchPlanByPlanId" parameterType="Long" resultMap="TBranchPlanResult">
  31. <include refid="selectTBranchPlanVo"/>
  32. where u.plan_id = #{planId}
  33. and u.del_flag = 0
  34. </select>
  35. <insert id="insertTBranchPlan" parameterType="TBranchPlan">
  36. <selectKey keyProperty="planId" resultType="long" order="BEFORE">
  37. SELECT seq_t_branch_plan.NEXTVAL as planId FROM DUAL
  38. </selectKey>
  39. insert into t_branch_plan
  40. <trim prefix="(" suffix=")" suffixOverrides=",">
  41. <if test="planId != null">plan_id,</if>
  42. <if test="planTitle != null">plan_title,</if>
  43. <if test="delFlag != null">del_flag,</if>
  44. <if test="createBy != null">create_by,</if>
  45. <if test="createTime != null">create_time,</if>
  46. <if test="updateBy != null">update_by,</if>
  47. <if test="updateTime != null">update_time,</if>
  48. <if test="deptId != null">dept_id,</if>
  49. </trim>
  50. <trim prefix="values (" suffix=")" suffixOverrides=",">
  51. <if test="planId != null">#{planId},</if>
  52. <if test="planTitle != null">#{planTitle},</if>
  53. <if test="delFlag != null">#{delFlag},</if>
  54. <if test="createBy != null">#{createBy},</if>
  55. <if test="createTime != null">#{createTime},</if>
  56. <if test="updateBy != null">#{updateBy},</if>
  57. <if test="updateTime != null">#{updateTime},</if>
  58. <if test="deptId != null">#{deptId},</if>
  59. </trim>
  60. </insert>
  61. <update id="updateTBranchPlan" parameterType="TBranchPlan">
  62. update t_branch_plan
  63. <trim prefix="SET" suffixOverrides=",">
  64. <if test="planTitle != null">plan_title = #{planTitle},</if>
  65. <if test="delFlag != null">del_flag = #{delFlag},</if>
  66. <if test="createBy != null">create_by = #{createBy},</if>
  67. <if test="createTime != null">create_time = #{createTime},</if>
  68. <if test="updateBy != null">update_by = #{updateBy},</if>
  69. <if test="updateTime != null">update_time = #{updateTime},</if>
  70. <if test="deptId != null">dept_id = #{deptId},</if>
  71. </trim>
  72. where plan_id = #{planId}
  73. </update>
  74. <update id="deleteTBranchPlanByPlanId" parameterType="Long">
  75. update t_branch_plan set del_flag = 2 where plan_id = #{planId}
  76. </update>
  77. <update id="deleteTBranchPlanByPlanIds" parameterType="String">
  78. update t_branch_plan set del_flag = 2 where plan_id in
  79. <foreach item="planId" collection="array" open="(" separator="," close=")">
  80. #{planId}
  81. </foreach>
  82. </update>
  83. </mapper>