6
jinlin
2023-11-29 d89ef43c4713adf26f74b796653d1dd15ff1f81a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?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 &lt;&gt; 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 diagram
        from wf_def
        where is_delete = 0
        <if test="flowCode!=null and flowCode!=''">
            and CODE = #{flowCode}
        </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>