Blame view

backend/bpm/src/main/resources/mapper/BpmSignDataMapper.xml 4.86 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
<?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.BpmSignDataDao">
	<resultMap id="BpmSignData" type="com.hotent.bpm.persistence.model.BpmSignData">
		<id property="id" column="id_" jdbcType="VARCHAR"/>
		<result property="defId" column="def_id_" jdbcType="VARCHAR"/>
		<result property="instId" column="inst_id_" jdbcType="VARCHAR"/>
		<result property="actInstId" column="act_inst_id_" jdbcType="VARCHAR"/>
		<result property="executeId" column="execute_id_" jdbcType="VARCHAR"/>
		<result property="nodeId" column="node_id_" jdbcType="VARCHAR"/>
		<result property="taskId" column="task_id_" jdbcType="VARCHAR"/>
		<result property="qualifiedId" column="qualified_id_" jdbcType="VARCHAR"/>
		<result property="qualifiedName" column="qualified_name_" jdbcType="VARCHAR"/>
		<result property="createTime" column="create_time_" jdbcType="TIMESTAMP"/>
		<result property="voteResult" column="vote_result_" jdbcType="VARCHAR"/>
		<result property="voteId" column="vote_id_" jdbcType="VARCHAR"/>
		<result property="voter" column="voter_" jdbcType="VARCHAR"/>
		<result property="voteTime" column="vote_time_" jdbcType="TIMESTAMP"/>
		<result property="index" column="index_" jdbcType="NUMERIC"/>
		<result property="isActive" column="IS_ACTIVE_" jdbcType="NUMERIC"/>
		<result property="type" column="TYPE_" jdbcType="VARCHAR" />
	</resultMap>
	
	<insert id="create" parameterType="com.hotent.bpm.persistence.model.BpmSignData">
		INSERT INTO bpm_task_signdata
		(id_,def_id_,inst_id_,act_inst_id_,execute_id_,node_id_,task_id_,qualified_id_,qualified_name_,create_time_,vote_result_,vote_id_,voter_,vote_time_,index_,IS_ACTIVE_,TYPE_)
		VALUES 
		(#{id,jdbcType=VARCHAR}, #{defId,jdbcType=VARCHAR}, #{instId,jdbcType=VARCHAR}, #{actInstId,jdbcType=VARCHAR},#{executeId,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{taskId,jdbcType=VARCHAR}, #{qualifiedId,jdbcType=VARCHAR}, #{qualifiedName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{voteResult,jdbcType=VARCHAR}, #{voteId,jdbcType=VARCHAR}, #{voter,jdbcType=VARCHAR}, #{voteTime,jdbcType=TIMESTAMP},
		#{index,jdbcType=NUMERIC},#{isActive,jdbcType=NUMERIC},#{type,jdbcType=VARCHAR})
	</insert>
	
	<select id="get"   parameterType="java.lang.String" resultMap="BpmSignData">
		SELECT * FROM bpm_task_signdata 
		WHERE 
		id_=#{id}
	</select>
	
	<select id="query" parameterType="java.util.Map" resultMap="BpmSignData">
		SELECT * FROM bpm_task_signdata
		<where>
			<if test="whereSql!=null">
				${whereSql}
			</if>
		</where>
		<if test="orderBySql!=null">
			ORDER BY ${orderBySql}
		</if>
		<if test="orderBySql==null">
			ORDER BY id_ DESC
		</if>
	</select>
	
	<delete id="remove" parameterType="java.lang.String">
		DELETE FROM bpm_task_signdata 
		WHERE
		id_=#{id}
	</delete>
	
	<delete id="removeByNotActive" >
		DELETE FROM  bpm_task_signdata 
		WHERE
		execute_id_=#{executeId}
		and
		node_id_=#{nodeId}
		and IS_ACTIVE_=0
	</delete>

	<select id="countNotActiveByActExecuteIdAndNodeId" resultType="int" >
		select count(1) FROM  bpm_task_signdata
		WHERE
			execute_id_=#{executeId}
		  and
			node_id_=#{nodeId}
		  and IS_ACTIVE_=0
	</select>

	<update id="updByNotActive" >
		update   bpm_task_signdata set IS_ACTIVE_=0
		WHERE
		execute_id_=#{executeId}
		and
		node_id_=#{nodeId}
	</update>
	
	<select id="getVoteByExecuteNode" resultMap="BpmSignData">
		SELECT * from bpm_task_signdata where execute_id_=#{executeId} and node_id_=#{nodeId}  and IS_ACTIVE_=#{isActive}
	</select>
	
	<select id="getByExeNodeIndex" resultMap="BpmSignData">
		SELECT * from bpm_task_signdata where execute_id_=#{executeId} and node_id_=#{nodeId}  and index_=#{index}  and IS_ACTIVE_=1
	</select>
	
	<select id="getByInstanIdAndUserId" resultMap="BpmSignData">
		select * from bpm_task_signdata WHERE INST_ID_ =#{instancId}  AND QUALIFIED_ID_ = #{userId} AND TASK_ID_ = #{taskId}
	</select>

	<select id="getNodeAddSignData" resultMap="BpmSignData">
		select * from bpm_task_signdata WHERE INST_ID_ =#{instancId}  AND QUALIFIED_ID_ = #{userId} AND NODE_ID_ = #{nodeId} AND VOTE_RESULT_ = 'no'AND IS_ACTIVE_ = 1
	</select>

	<delete id="delByInstList" >
		DELETE FROM  bpm_task_signdata where inst_id_ in 
			<foreach collection="list" index="index" item="instId" open="(" separator="," close=")"> 
            #{instId} 
        	</foreach> 
	</delete>
	
	<select id="getByInstanIdAndNodeIdAndNo" resultMap="BpmSignData">
		SELECT * from bpm_task_signdata where inst_id_=#{instId} and node_id_=#{nodeId}  and vote_result_='no'
	</select>
	<delete id="deleteByInstanIdAndNodeIdAndNo">
		DELETE FROM  bpm_task_signdata 
		WHERE inst_id_=#{instId} and node_id_=#{nodeId}  and vote_result_='no'
	</delete>
	
	<update id="updByActive" >
		update   bpm_task_signdata set IS_ACTIVE_=1, index_=-1
		WHERE
		inst_id_=#{instId}
		and
		node_id_=#{nodeId}
	</update>
	
	
</mapper>