| <?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"> | 
|   | 
| <mapper namespace="com.zt.modules.workflowconfig.dao.WfDefDao"> | 
|   | 
|     <select id="listWfdef" resultType="java.lang.Integer"> | 
|         SELECT COUNT(1) | 
|         FROM WF_DEF | 
|         WHERE ID = #{id} | 
|     </select> | 
|   | 
|     <select id="wfDefList" resultType="com.zt.modules.workflowconfig.model.WfDef"> | 
|         SELECT * | 
|         FROM WF_DEF where IS_DELETE=0 | 
|         ORDER BY type,id | 
|     </select> | 
|   | 
|     <select id="listWfdefcode" resultType="java.lang.Integer" parameterType="java.lang.String"> | 
|         SELECT COUNT(1) | 
|         FROM WF_DEF | 
|         WHERE CODE = #{code} | 
|     </select> | 
|   | 
|     <select id="queryWfDef" resultType="com.zt.modules.workflowconfig.model.WfDef"> | 
|         SELECT | 
|         * | 
|         FROM | 
|         WF_DEF | 
|         WHERE | 
|         status = 1 | 
|         <if test="wfDefId!=null"> | 
|             and id = #{wfDefId} | 
|         </if> | 
|         <if test="wfDefCode!=null"> | 
|             and code=#{wfDefCode} | 
|         </if> | 
|     </select> | 
|     <select id="getFlowList" resultType="com.zt.modules.workflowconfig.model.WfDef"> | 
|         SELECT | 
|             * | 
|         FROM | 
|             WF_DEF | 
|         where IS_DELETE=0 | 
|         order by type,id | 
| /*        union | 
|         SELECT | 
|         * | 
|         FROM | 
|         WF_DEF | 
|         WHERE | 
|         IS_DELETE=0 and status = 1 | 
|         and type = 3*/ | 
|     </select> | 
|   | 
|     <select id="getFlowStepList" resultType="com.zt.modules.workflowconfig.model.WfDefStep"> | 
|         select * from ( | 
|         SELECT | 
|         a.id, | 
|         a.name as STEP_TITLE, | 
|         a.name, | 
|         a.STEP_MARKER, | 
|         a.step_no, | 
|         WF_DEF_ID | 
|         FROM | 
|         wf_def_step a | 
|         left join wf_def b on a.WF_DEF_ID=b.ID | 
|         where a.IS_DELETE = 0 | 
|         and WF_DEF_ID  = #{flowId} | 
|         and type <> 9 | 
|         union | 
|         select | 
|         a.id, | 
|         a.name as STEP_TITLE, | 
|         a.name, | 
|         a.code, | 
|         a.id, | 
|         a.id | 
|         FROM wf_def a | 
|         where a.IS_DELETE = 0 | 
|         and phase_node in ( | 
|         select code FROM wf_def | 
|         where IS_DELETE = 0 | 
|         and ID  = #{flowId} | 
|         and type = 9 | 
|         ) | 
|         ) c | 
|         order by WF_DEF_ID,step_no | 
|     </select> | 
|   | 
| <!--    <select id="getFlowStepList" resultType="com.zt.modules.workflowconfig.model.WfDefStep"> | 
|         SELECT | 
|         a.id, | 
|         concat(b.name,':',a.name) as STEP_TITLE, | 
|         a.name, | 
|         a.STEP_MARKER | 
|         FROM | 
|         wf_def_step a | 
|         left join wf_def b on a.WF_DEF_ID=b.ID | 
|         where a.IS_DELETE = 0 | 
|         <if test="flowId!=2009"> | 
|             and WF_DEF_ID  = #{flowId} | 
|         </if> | 
|         <if test="flowId==2009"> | 
|             and WF_DEF_ID in (select id from WF_DEF where type in (1,2)) | 
|         </if> | 
|         order by WF_DEF_ID,step_no | 
|     </select>--> | 
|   | 
|     <select id="wfDefList2" resultType="com.zt.modules.workflowconfig.model.WfDef"> | 
|         SELECT * | 
|         FROM WF_DEF | 
|         where IS_DELETE=0 | 
|             and id in (select case when type in (1,2) then 2009 | 
|                 else id end as id from WF_DEF where code=#{flowCode}) | 
|         ORDER BY id | 
|     </select> | 
|   | 
|     <select id="getStyleList" resultType="com.zt.modules.workflowconfig.model.WfDef"> | 
|         select Content as diagram | 
|         from WX_NETWORK_DIAGRAM | 
|         where is_delete = 0 | 
|         <if test="projectId!=null and projectId!=''"> | 
|             and PROJECT_ID = #{projectId} | 
|         </if> | 
|         <if test="diagramId!=null and diagramId!=''"> | 
|             and DIAGRAM_ID = #{diagramId} | 
|         </if> | 
|     </select> | 
|   | 
|     <select id="getRoleCount" resultType="java.lang.Integer"> | 
|         SELECT count(1) | 
|         FROM sys_role_user a, | 
|              sys_role b | 
|         WHERE a.is_delete = 0 | 
|           and b.is_delete = 1 | 
|           and b.code = #{code} | 
|           and a.user_id = #{userId} | 
|     </select> | 
|   | 
|     <select id="getPlanStatus" resultType="java.lang.Integer"> | 
|         SELECT CURRENT_STATE | 
|         FROM zhgl_annual_plan a | 
|         WHERE a.is_delete = 0 | 
|           and a.id = #{bizId} | 
|     </select> | 
| </mapper> |