TfProcessLMapper.xml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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.tofly.workflow.process.mapper.TfProcessLMapper">
  4. <resultMap id="tfProcessLMap" type="com.tofly.workflow.process.entity.TfProcessL">
  5. <id property="id" column="ID"/>
  6. <result property="processNumber" column="PROCESS_NUMBER"/>
  7. <result property="relationId" column="RELATION_ID"/>
  8. <result property="relationNumber" column="RELATION_NUMBER"/>
  9. <result property="category" column="CATEGORY"/>
  10. <result property="processType" column="PROCESS_TYPE"/>
  11. <result property="configId" column="CONFIG_ID"/>
  12. <result property="ywType" column="YW_TYPE"/>
  13. <result property="edition" column="EDITION"/>
  14. <result property="name" column="NAME"/>
  15. <result property="processState" column="PROCESS_STATE"/>
  16. <result property="registerPost" column="REGISTER_POST"/>
  17. <result property="registerDept" column="REGISTER_DEPT"/>
  18. <result property="registerStaff" column="REGISTER_STAFF"/>
  19. <result property="registerTime" column="REGISTER_TIME"/>
  20. <result property="passingNode" column="PASSING_NODE"/>
  21. <result property="tenantId" column="TENANT_ID"/>
  22. <result property="isDel" column="IS_DEL"/>
  23. <result property="remark" column="REMARK"/>
  24. <result property="createUser" column="CREATE_USER"/>
  25. <result property="createTime" column="CREATE_TIME"/>
  26. <association property="typeName" column="YW_TYPE"
  27. select="com.tofly.common.mapper.SysCommonMapper.getDictName"></association>
  28. <association property="createUserName" column="CREATE_USER"
  29. select="com.tofly.common.mapper.SysCommonMapper.getRealName"></association>
  30. <association property="processStateName" column="PROCESS_STATE" select="getProcessStateName"></association>
  31. <association property="isDelName" column="IS_DEL" select="getIsDelName"></association>
  32. <association property="tenantIdName" column="TENANT_ID" javaType="java.lang.String"
  33. select="com.tofly.common.mapper.SysCommonMapper.getTenantName"></association>
  34. </resultMap>
  35. <sql id="processsql" >
  36. ID,PROCESS_NUMBER,RELATION_ID,RELATION_NUMBER,CATEGORY,PROCESS_TYPE,CONFIG_ID,YW_TYPE,EDITION,NAME,PROCESS_STATE,REGISTER_POST,REGISTER_DEPT
  37. ,REGISTER_STAFF,REGISTER_TIME,PASSING_NODE,TENANT_ID,REMARK,CREATE_USER,CREATE_TIME
  38. </sql>
  39. <select id="getProcessStateName" resultType="string">
  40. SELECT decode(#{processState}, '1', '草稿', '2', '处理', '3', '终止', '4', '处理完成') as processStateName
  41. FROM dual
  42. </select>
  43. <select id="getIsDelName" resultType="string">
  44. SELECT decode(#{isDel}, '0', '未删除', '1', '已删除') as isDelName
  45. FROM dual
  46. </select>
  47. <select id="getProcessNumber" resultType="java.lang.String">
  48. SELECT PROCESS_NUMBER FROM(SELECT ID,PROCESS_NUMBER FROM TF_PROCESS_L WHERE CREATE_TIME> #{dateTime} AND PROCESS_TYPE = #{processType} order by ID DESC )where rownum=1
  49. </select>
  50. <resultMap id="ProcessByIdMap" type="com.tofly.workflow.process.entity.vo.ProcessVo" extends="tfProcessLMap">
  51. <association property="nodes" column="ID" select="com.tofly.workflow.process.mapper.TfProcessNodeLMapper.getProcessNodes" ></association>
  52. <association property="nowHandleLS" column="ID" select="com.tofly.workflow.process.mapper.TfNowHandleLMapper.getNowHandleLS" ></association>
  53. </resultMap>
  54. <select id="getProcessById" resultMap="ProcessByIdMap">
  55. SELECT <include refid="processsql"></include> FROM TF_PROCESS_L WHERE ID = #{id}
  56. </select>
  57. <!-- <select id="getProcessList" resultMap="ProcessByIdMap">-->
  58. <!-- SELECT <include refid="processsql"></include>-->
  59. <!-- FROM TF_PROCESS_L-->
  60. <!-- WHERE-->
  61. <!-- 1=1-->
  62. <!-- <if test="processIdList != null and processIdList.size() > 0">-->
  63. <!-- AND ID IN-->
  64. <!-- <foreach collection="processIdList" item="id" open="(" close=")" separator=",">-->
  65. <!-- #{id}-->
  66. <!-- </foreach>-->
  67. <!-- </if>-->
  68. <!-- </select>-->
  69. <select id="getProcessNodeList" resultType="com.tofly.workflow.process.entity.vo.ProcessNodeVo">
  70. SELECT t1.ID, (SELECT REAL_NAME FROM SYS_USER WHERE ID = t1.HANDLE_USER) HANDLE_USER_NAME, t1.HANDLE_TIME, t1.PROCESS_ID, t1.PROCESS_STEP, t1.STEP_NODE, t1.PAGE_CODE, t2.CONFIG_ID, t2.EDITION, t2.TENANT_ID
  71. FROM TF_PROCESS_NODE_L t1
  72. LEFT JOIN TF_PROCESS_L t2 ON t1.PROCESS_ID = t2.ID
  73. WHERE
  74. 1=1 AND t1.PAGE_CODE is not null AND t1.IS_VALID = 1
  75. <if test="processIdList != null and processIdList.size() > 0">
  76. AND t1.PROCESS_ID IN
  77. <foreach collection="processIdList" item="id" open="(" close=")" separator=",">
  78. #{id}
  79. </foreach>
  80. </if>
  81. </select>
  82. <select id="getFsProcess" resultMap="ProcessByIdMap">
  83. SELECT <include refid="processsql"></include> FROM TF_PROCESS_L
  84. <where>
  85. <if test="dto.id!=null"> AND ID = #{dto.id}</if>
  86. <if test="dto.relationId!=null"> AND RELATION_ID =#{dto.relationId}</if>
  87. <if test="dto.processType!=null and dto.processType.size()>0">
  88. AND PROCESS_TYPE IN
  89. <foreach collection="dto.processType" item="id" open="(" close=")" separator=",">
  90. #{id}
  91. </foreach>
  92. </if>
  93. <if test="dto.configId!=null and dto.configId.size()>0">
  94. AND CONFIG_ID IN
  95. <foreach collection="dto.configId" item="id" open="(" close=")" separator=",">
  96. #{id}
  97. </foreach>
  98. </if>
  99. <if test="dto.ywType!=null and dto.ywType.size()>0">
  100. AND YW_TYPE IN
  101. <foreach collection="dto.ywType" item="id" open="(" close=")" separator=",">
  102. #{id}
  103. </foreach>
  104. </if>
  105. </where>
  106. </select>
  107. <select id="getProcessNodeType" resultType="Integer">
  108. SELECT * FROM (select ttp.NODE_TYPE from TF_NOW_HANDLE_L h
  109. left join TF_TASK_P ttp on h.PROCESS_ID = ttp.PROCESS_ID AND h.PROCESS_STEP = ttp.PROCESS_STEP AND h.STEP_NODE = ttp.STEP_NODE AND ttp.STATUS = 0
  110. where h.PROCESS_ID = #{id} ORDER BY ttp.ID DESC) WHERE ROWNUM = 1
  111. </select>
  112. <select id="getMaterialNodeById" resultType="com.tofly.workflow.process.entity.vo.ProcessMaterialVo">
  113. SELECT p.ID PROCESS_ID,p.RELATION_ID,p.TENANT_ID,b.b.PROCESS_NUMBER, b.addre addr , hdu.job_number handle_user , sd.code deptCode,b.PROJECT_NAME,b.USER_TYPE,b.DUTY_USER,du.REAL_NAME DUTY_USER_NAME,n.ID NODE_ID,n.OUTCOME ACCESS_ID, a.YY_WZ_ID WAREHOUSE,ao.YY_WZ_ID OUT_WAREHOUSE,n.STAFF_ID,u.REAL_NAME STAFF_NAME,n.data_time
  114. FROM TF_PROCESS_L p LEFT JOIN TF_PROCESS_NODE_L n ON (p.ID = n.PROCESS_ID)
  115. LEFT JOIN TF_PROJECT_BASE_W b ON (p.RELATION_ID = b.PROCESS_ID)
  116. LEFT JOIN TF_MATTER_ACCESS_P a ON (n.OUTCOME = a.ID)
  117. LEFT JOIN TF_MATTER_ACCESS_P ao ON (n.ONE_ID = ao.ID)
  118. LEFT JOIN SYS_USER u ON (n.STAFF_ID = u.ID)
  119. LEFT JOIN SYS_USER hdu ON (n.handle_user = hdu.ID )
  120. LEFT JOIN SYS_USER du ON (b.DUTY_USER = du.ID)
  121. left join ZMRQ.SYS_USER_DEPT dept on n.handle_user = dept.user_id
  122. left join sys_dept sd on dept.dept_id = sd.id
  123. WHERE p.IS_DEL = 0 AND p.PROCESS_STATE = 4 AND n.IS_VALID = 1 AND n.IS_DEL = 0 AND n.PROCESS_STEP = 1 AND n.STEP_NODE = 1
  124. AND p.ID = #{id}
  125. </select>
  126. <select id="getProcessIdWithOutPush" resultType="java.lang.Long">
  127. select *from tf_process_l where process_number like 'clly%'
  128. and id not in (select process_id from tf_material_out_in_w )
  129. </select>
  130. <select id="findProcessLastCheckTime" resultType="java.util.Date">
  131. SELECT max(node.HANDLE_TIME)
  132. from TF_PROCESS_NODE_L node left join TF_PROCESS_L p on node.process_id = p.id
  133. LEFT JOIN TF_NOW_HANDLE_L n on (node.PROCESS_ID = n.PROCESS_ID and node.LABEL = n.LABEL)
  134. where node.LABEL = 1571328373371297794 and node.PROCESS_ID =#{processId} and n.id is null
  135. </select>
  136. <select id="findCompleteTime" resultType="java.util.Date">
  137. SELECT max(HANDLE_TIME) from TF_PROCESS_NODE_L where process_id = #{processId}
  138. </select>
  139. </mapper>