cn.ps1.soar.dao.FlowDao.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- namespace命名规则:表对应 java 类的名称 --> <mapper namespace="cn.ps1.soar.dao.FlowDao"> <!-- 获取条件顺序 --> <select id="getActionIdx" parameterType="String" resultType="int"> SELECT (CASE WHEN ${cond} THEN 0 ELSE 1 END) idx </select> <!-- 忽略未完成的就绪的并行子节点 --> <update id="skipParallelNodes"> UPDATE ${joinTables} ON NODE_PARENT IN <foreach collection="map.skipNodes" index="index" open="(" separator="," close=")" item="val">#{val}</foreach> and NODE_COMP=#{map.taskComp} and NODE_NO=WORK_NODENO SET WORK_STATE=#{map.stateSkip} WHERE WORK_COMP=#{map.taskComp} AND WORK_TASKID=#{map.taskId} AND WORK_STATE=#{map.stateReady} </update> <!-- 自动递增审批节点表的审批序号(避免主键冲突:从大到小降序处理) --> <update id="incrApproveIdx"> UPDATE ${table} SET WORK_IDX=(WORK_IDX+1),WORK_UPDATE=WORK_UPDATE WHERE WORK_COMP=#{map.workComp} AND WORK_TASKID=#{map.workTaskId} ORDER BY WORK_IDX DESC<!-- 这里倒序逐次递加以预防主键冲突 --> </update> <!-- 归集单个岗位职责包含的员工数 --> <select id="groupEmpByJob" parameterType="Map" resultType="int"> SELECT count(1) FROM FF_ORGN left join FF_EMPLOYEE on EMP_COMP=ORGN_COMP and EMP_ID=ORGN_EMPID WHERE ORGN_COMP=#{orgnComp} and EMP_STATE='1' and json_extract(ORGN_JOBS, concat('$."', #{orgnJob}, '"'))='1' </select> </mapper>