FlowMapper.xml 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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.cool.bang.modules.mysql.mapper.FlowMapper">
  4. <!-- //////////////////////审批流程//////////////////////////////-->
  5. <!-- 结果集 -->
  6. <resultMap id="ApprovalFlowMap" type="com.cool.bang.modules.mysql.domain.flowPo.ApprovalFlow">
  7. <id property="id" column="id"/>
  8. <result property="flowNumber" column="flow_number" jdbcType="VARCHAR"/>
  9. <result property="flowName" column="flow_name" jdbcType="VARCHAR"/>
  10. <result property="flowType" column="flow_type" jdbcType="INTEGER"/>
  11. </resultMap>
  12. <!-- 返回单条记录 -->
  13. <select id="selectFlowByType" resultMap="ApprovalFlowMap">
  14. select
  15. id, flow_number, flow_type, flow_name
  16. from
  17. fc_approval_flow
  18. where
  19. flow_type = #{type} and state = 1
  20. </select>
  21. <!--//////////////////////审批节点//////////////////////////////-->
  22. <!-- 结果集 -->
  23. <resultMap id="ApprovalNodeMap" type="com.cool.bang.modules.mysql.domain.flowPo.ApprovalNode">
  24. <id property="id" column="id"/>
  25. <result property="flowId" column="flow_id" jdbcType="BIGINT"/>
  26. <result property="nodeType" column="node_type" jdbcType="TINYINT"/>
  27. <result property="nodeName" column="node_name" jdbcType="VARCHAR"/>
  28. <result property="prevNodeId" column="prev_node_id" jdbcType="BIGINT"/>
  29. <result property="nextNodeId" column="next_node_id" jdbcType="BIGINT"/>
  30. <result property="userId" column="user_id" jdbcType="BIGINT"/>
  31. <result property="userName" column="user_name" jdbcType="VARCHAR"/>
  32. <result property="number" column="number" jdbcType="INTEGER"/>
  33. <result property="delFlag" column="del_flag" jdbcType="TINYINT"/>
  34. <result property="flowNumber" column="flow_number" jdbcType="VARCHAR"/>
  35. </resultMap>
  36. <!-- 根据流程号查询节点 -->
  37. <select id="selectNodeByFlowNumber" resultMap="ApprovalNodeMap">
  38. select
  39. t.id, t.flow_id, t.node_type, t.node_name, t.prev_node_id, t.next_node_id, t.user_id, t.user_name, t.number, t.remark, t.create_by
  40. from
  41. fc_approval_node t
  42. left join fc_approval_flow t2 on t2.id = t.flow_id
  43. where
  44. t2.flow_number = #{flowNumber}
  45. order by
  46. t.node_type asc
  47. </select>
  48. <!--//////////////////////审批记录//////////////////////////////-->
  49. <!-- 插入一条记录 -->
  50. <insert id="insertRecord" parameterType="com.cool.bang.modules.mysql.domain.flowPo.ApprovalRecord">
  51. insert into
  52. fc_approval_record (id, business_number, flow_number,table_id, node_id, node_name, approver_id, approver, approval_time, approval_status, approval_remark, create_time, update_time, del_flag)
  53. values
  54. (#{id}, #{businessNumber}, #{flowNumber}, #{tableId}, #{nodeId}, #{nodeName}, #{approverId}, #{approver}, #{approvalTime}, #{approvalStatus}, #{approvalRemark}, #{createTime}, #{updateTime}, #{delFlag})
  55. </insert>
  56. <!-- 批量插入 -->
  57. <insert id="insertRecordBatch" parameterType="com.cool.bang.modules.mysql.domain.flowPo.ApprovalRecord">
  58. insert into
  59. fc_approval_record (id, business_number, flow_number,table_id, node_id, node_name, approver_id, approver, approval_time, approval_status, approval_remark, create_time, update_time, del_flag)
  60. values
  61. <foreach collection="list" item="item" separator=",">
  62. (#{item.id}, #{item.businessNumber}, #{item.flowNumber}, #{item.tableId}, #{item.nodeId}, #{item.nodeName}, #{item.approverId}, #{item.approver}, #{item.approvalTime}, #{item.approvalStatus}, #{item.approvalRemark}, #{item.createTime}, #{item.updateTime}, #{item.delFlag})
  63. </foreach>
  64. </insert>
  65. </mapper>