Blame view

backend/bpm/src/main/resources/mapper/BpmAgentSettingMapper.xml 4.61 KB
8ea9c133   陈威   初始化提交
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
<?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.hotent.bpm.persistence.dao.BpmAgentSettingDao">
	<resultMap id="BpmAgentSetting" type="com.hotent.bpm.persistence.model.BpmAgentSetting">
		<id property="id" column="id_" jdbcType="VARCHAR"/>
		<result property="subject" column="subject_" jdbcType="VARCHAR"/>
		<result property="authId" column="auth_id_" jdbcType="VARCHAR"/>
		<result property="authName" column="auth_name_" jdbcType="VARCHAR"/>
		<result property="startDate" column="start_date_" jdbcType="TIMESTAMP"/>
		<result property="endDate" column="end_date_" jdbcType="TIMESTAMP"/>
		<result property="isEnabled" column="is_enabled_" jdbcType="VARCHAR"/>
		<result property="agentId" column="agent_id_" jdbcType="VARCHAR"/>
		<result property="agent" column="agent_" jdbcType="VARCHAR"/>
		<result property="flowKey" column="flow_key_" jdbcType="VARCHAR"/>
		<result property="type" column="type_" jdbcType="NUMERIC"/>
		<result property="createBy" column="create_by_" jdbcType="VARCHAR"/>
		<result property="createTime" column="create_time_" jdbcType="TIMESTAMP"/>
		<result property="createOrgId" column="create_org_id_" jdbcType="VARCHAR"/>
		<result property="updateBy" column="update_by_" jdbcType="VARCHAR"/>
		<result property="updateTime" column="update_time_" jdbcType="TIMESTAMP"/>
	</resultMap>

	<select id="getSettingByFlowAndAuthidAndDate" parameterType="java.util.Map" resultMap="BpmAgentSetting">
		<![CDATA[
		SELECT S.* FROM bpm_agent_setting S 
		WHERE
		S.auth_id_ = #{authid} AND
		S.is_enabled_ = 'Y' AND      
       	 (
            S.start_date_ <= #{date,jdbcType=TIMESTAMP}
            AND 
            S.end_date_ >= #{date,jdbcType=TIMESTAMP}
      	
        )
        AND 
        (
        	S.TYPE_=1
        	or
        	(	
        		S.TYPE_=2
        		AND 
        		S.id_ IN 
	       		(
	        	 SELECT setting_id_ FROM bpm_agent_def  DEF WHERE DEF.flow_key_ = #{flowkey}
	       		)
        	)
        	or
        	(
        		S.TYPE_=3    		
	       		AND
		       	(
		       		S.flow_key_ = #{flowkey}
		       	)
		    )
        )
       ]]>
	</select>
	
	<select id="getByAuthAndDate" parameterType="java.util.Map"  resultType="java.lang.Integer">
		<![CDATA[
		SELECT count(*) FROM bpm_agent_setting S 
		WHERE S.auth_id_ = #{authid} AND  S.type_=1 and
		S.is_enabled_ = 'Y' AND     
       	 (
       	 	(s.start_date_>=#{startDate,jdbcType=TIMESTAMP} and s.start_date_<=#{endDate,jdbcType=TIMESTAMP})
       	 	or
       	 	(s.end_date_>=#{startDate,jdbcType=TIMESTAMP} and s.end_date_<=#{endDate,jdbcType=TIMESTAMP})
       	 	or
       	 	(s.end_date_>=#{endDate,jdbcType=TIMESTAMP} and s.start_date_<=#{startDate,jdbcType=TIMESTAMP})
       	 	or
       	 	(s.end_date_<=#{endDate,jdbcType=TIMESTAMP} and s.start_date_>=#{startDate,jdbcType=TIMESTAMP})
        )
         
		]]>
		<if test="settingId!=null">
			and S.id_&lt;>#{settingId}
		</if>  
	</select>
	
	
	<select id="getByAuthDateFlowKey" resultType="java.lang.Integer">
		<![CDATA[
		SELECT count(*) FROM bpm_agent_setting a ,bpm_agent_def b
		WHERE a.auth_id_ = #{authid} AND
		a.is_enabled_ = 'Y' AND     
       	 (
       	 	(a.start_date_>=#{startDate,jdbcType=TIMESTAMP} and a.start_date_<=#{endDate,jdbcType=TIMESTAMP})
       	 	or
       	 	(a.end_date_>=#{startDate,jdbcType=TIMESTAMP} and a.end_date_<=#{endDate,jdbcType=TIMESTAMP})
       	 	or
       	 	(a.end_date_>=#{endDate,jdbcType=TIMESTAMP} and a.start_date_<=#{startDate,jdbcType=TIMESTAMP})
       	 	or
       	 	(a.end_date_<=#{endDate,jdbcType=TIMESTAMP} and a.start_date_>=#{startDate,jdbcType=TIMESTAMP})
        )
        and a.id_=b.setting_id_ and b.flow_key_=#{flowKey}
        
		]]>
		<if test="settingId!=null">
			and a.id_&lt;>#{settingId}
		</if>   
	</select>
	
	
	
	
	<select id="getForCondition" resultType="java.lang.Integer">
		<![CDATA[
		SELECT count(*) FROM bpm_agent_setting S 
		WHERE S.auth_id_ = #{authid} AND  S.type_=3 and
		S.is_enabled_ = 'Y' AND     
       	 (
       	 	(s.start_date_>=#{startDate,jdbcType=TIMESTAMP} and s.start_date_<=#{endDate,jdbcType=TIMESTAMP})
       	 	or
       	 	(s.end_date_>=#{startDate,jdbcType=TIMESTAMP} and s.end_date_<=#{endDate,jdbcType=TIMESTAMP})
       	 	or
       	 	(s.end_date_>=#{endDate,jdbcType=TIMESTAMP} and s.start_date_<=#{startDate,jdbcType=TIMESTAMP})
       	 	or
       	 	(s.end_date_<=#{endDate,jdbcType=TIMESTAMP} and s.start_date_>=#{startDate,jdbcType=TIMESTAMP})
        )
        and s.flow_key_=#{flowKey}
		]]>
		<if test="settingId!=null">
			and s.id_&lt;>#{settingId}
		</if>
		
	</select>
	
	
	
</mapper>