AuditPathsMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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.approvalFlow.mapper.AuditPathsMapper">
  6. <resultMap type="AuditPaths" id="AuditPathsResult">
  7. <result property="id" column="id"/>
  8. <result property="pathId" column="path_id"/>
  9. <result property="pathName" column="path_name"/>
  10. <result property="opUserId" column="op_user_id"/>
  11. <result property="opUserName" column="op_user_name"/>
  12. <result property="opDate" column="op_date"/>
  13. <result property="branchId" column="branch_id"/>
  14. <result property="status" column="status"/>
  15. <result property="remarks" column="remarks"/>
  16. </resultMap>
  17. <sql id="selectAuditPathsVo">
  18. select id, path_id, path_name, op_user_id, op_user_name, op_date, branch_id, status, remarks from audit_paths
  19. </sql>
  20. <select id="selectAuditPathsList" parameterType="AuditPaths" resultMap="AuditPathsResult">
  21. <include refid="selectAuditPathsVo"/>
  22. <where>
  23. <if test="pathId != null ">and path_id = #{pathId}</if>
  24. <if test="pathName != null and pathName != ''">and path_name like concat('%', #{pathName}, '%')</if>
  25. <if test="opUserId != null ">and op_user_id = #{opUserId}</if>
  26. <if test="opUserName != null and opUserName != ''">and op_user_name like concat('%', #{opUserName}, '%')
  27. </if>
  28. <if test="opDate != null ">and op_date = #{opDate}</if>
  29. <if test="branchId != null ">and branch_id = #{branchId}</if>
  30. <if test="status != null and status != ''">and status = #{status}</if>
  31. <if test="remarks != null and remarks != ''">and remarks = #{remarks}</if>
  32. </where>
  33. </select>
  34. <select id="selectAuditPathsById" parameterType="Long" resultMap="AuditPathsResult">
  35. <include refid="selectAuditPathsVo"/>
  36. where id = #{id}
  37. </select>
  38. <insert id="insertAuditPaths" parameterType="AuditPaths" useGeneratedKeys="true" keyProperty="id">
  39. insert into audit_paths
  40. <trim prefix="(" suffix=")" suffixOverrides=",">
  41. <if test="pathId != null">path_id,</if>
  42. <if test="pathName != null">path_name,</if>
  43. <if test="opUserId != null">op_user_id,</if>
  44. <if test="opUserName != null">op_user_name,</if>
  45. <if test="opDate != null">op_date,</if>
  46. <if test="branchId != null">branch_id,</if>
  47. <if test="status != null">status,</if>
  48. <if test="remarks != null">remarks,</if>
  49. </trim>
  50. <trim prefix="values (" suffix=")" suffixOverrides=",">
  51. <if test="pathId != null">#{pathId},</if>
  52. <if test="pathName != null">#{pathName},</if>
  53. <if test="opUserId != null">#{opUserId},</if>
  54. <if test="opUserName != null">#{opUserName},</if>
  55. <if test="opDate != null">#{opDate},</if>
  56. <if test="branchId != null">#{branchId},</if>
  57. <if test="status != null">#{status},</if>
  58. <if test="remarks != null">#{remarks},</if>
  59. </trim>
  60. </insert>
  61. <update id="updateAuditPaths" parameterType="AuditPaths">
  62. update audit_paths
  63. <trim prefix="SET" suffixOverrides=",">
  64. <if test="pathId != null">path_id = #{pathId},</if>
  65. <if test="pathName != null">path_name = #{pathName},</if>
  66. <if test="opUserId != null">op_user_id = #{opUserId},</if>
  67. <if test="opUserName != null">op_user_name = #{opUserName},</if>
  68. <if test="opDate != null">op_date = #{opDate},</if>
  69. <if test="branchId != null">branch_id = #{branchId},</if>
  70. <if test="status != null">status = #{status},</if>
  71. <if test="remarks != null">remarks = #{remarks},</if>
  72. </trim>
  73. where id = #{id}
  74. </update>
  75. <delete id="deleteAuditPathsById" parameterType="Long">
  76. delete
  77. audit.*,
  78. levels.*
  79. from
  80. audit_paths audit
  81. LEFT JOIN audit_paths_levels levels ON levels.path_id = audit.id
  82. where
  83. audit.id = #{id}
  84. </delete>
  85. <delete id="deleteAuditPathsByIds" parameterType="String">
  86. delete
  87. audit.*,
  88. levels.*
  89. from
  90. audit_paths audit
  91. LEFT JOIN audit_paths_levels levels ON levels.path_id = audit.id
  92. where
  93. audit.id in
  94. <foreach item="id" collection="array" open="(" separator="," close=")">
  95. #{id}
  96. </foreach>
  97. </delete>
  98. </mapper>