Blame view

backend/bpm/src/main/resources/mapper/ActTaskMapper.xml 4.89 KB
8d73e917   陈威   初始化提交
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
<?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.ActTaskDao">
	<resultMap id="ActTask" type="com.hotent.bpm.persistence.model.ActTask">
		<id property="id" column="ID_" jdbcType="VARCHAR"/>
		<result property="rev" column="REV_" jdbcType="NUMERIC"/>
		<result property="executionId" column="EXECUTION_ID_" jdbcType="VARCHAR"/>
		<result property="procInstId" column="PROC_INST_ID_" jdbcType="VARCHAR"/>
		<result property="procDefId" column="PROC_DEF_ID_" jdbcType="VARCHAR"/>
		<result property="name" column="NAME_" jdbcType="VARCHAR"/>
		<result property="parentTaskId" column="PARENT_TASK_ID_" jdbcType="VARCHAR"/>
		<result property="description" column="DESCRIPTION_" jdbcType="VARCHAR"/>
		<result property="taskDefKey" column="TASK_DEF_KEY_" jdbcType="VARCHAR"/>
		<result property="owner" column="OWNER_" jdbcType="VARCHAR"/>
		<result property="assignee" column="ASSIGNEE_" jdbcType="VARCHAR"/>
		<result property="delegation" column="DELEGATION_" jdbcType="VARCHAR"/>
		<result property="priority" column="PRIORITY_" jdbcType="NUMERIC"/>
		<result property="createTime" column="CREATE_TIME_" jdbcType="TIMESTAMP"/>
		<result property="dueDate" column="DUE_DATE_" jdbcType="TIMESTAMP"/>
		<result property="suspensionState" column="SUSPENSION_STATE_" jdbcType="NUMERIC"/>
	</resultMap>
	
	<insert id="create" parameterType="com.hotent.bpm.persistence.model.ActTask">
		INSERT INTO act_ru_task
		(ID_,REV_,EXECUTION_ID_,PROC_INST_ID_,PROC_DEF_ID_,NAME_,PARENT_TASK_ID_,DESCRIPTION_,TASK_DEF_KEY_,OWNER_,ASSIGNEE_,DELEGATION_,PRIORITY_,CREATE_TIME_,DUE_DATE_,SUSPENSION_STATE_)
		VALUES 
		(#{id,jdbcType=VARCHAR}, #{rev,jdbcType=NUMERIC}, #{executionId,jdbcType=VARCHAR}, #{procInstId,jdbcType=VARCHAR}, #{procDefId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{parentTaskId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{taskDefKey,jdbcType=VARCHAR}, #{owner,jdbcType=VARCHAR}, #{assignee,jdbcType=VARCHAR}, #{delegation,jdbcType=VARCHAR}, #{priority,jdbcType=NUMERIC}, #{createTime,jdbcType=TIMESTAMP}, #{dueDate,jdbcType=TIMESTAMP}, #{suspensionState,jdbcType=NUMERIC})
	</insert>
	
	<select id="get"   parameterType="java.lang.String" resultMap="ActTask">
		SELECT * FROM act_ru_task 
		WHERE 
		ID_=#{id}
	</select>
	
	<select id="query" parameterType="java.util.Map" resultMap="ActTask">
		SELECT * FROM act_ru_task
		<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 act_ru_task 
		WHERE
		ID_=#{id}
	</delete>
	
	<delete id="delByInstList" >
		DELETE FROM  act_ru_task where proc_inst_id_ in 
			<foreach collection="list" index="index" item="instId" open="(" separator="," close=")"> 
            #{instId} 
        	</foreach> 
	</delete>
	
	
	<delete id="delCandidateByInstList" >
		DELETE FROM  act_ru_identitylink where PROC_INST_ID_ in 
			<foreach collection="list" index="index" item="instId" open="(" separator="," close=")"> 
            #{instId} 
        	</foreach> 
	</delete>
	
	
	<delete id="delSpecVarsByInstList" >
		DELETE FROM  act_ru_variable where PROC_INST_ID_ in 
			<foreach collection="list" index="index" item="instId" open="(" separator="," close=")"> 
            #{instId} 
        	</foreach> 
        	and NAME_ in ('nrOfInstances','nrOfCompletedInstances','nrOfActiveInstances','loopCounter')
	</delete>
	
	
	<select id="getByInstId" parameterType="java.lang.String" resultMap="ActTask">
		SELECT * FROM act_ru_task 
		WHERE 
		PROC_INST_ID_=#{instId}
	</select>
	
	<delete id="delTaskByInstList">
		delete FROM act_ru_task where execution_id_ in (
			select id_ from act_ru_execution where PROC_INST_ID_
		  in <foreach collection="list" index="index" item="instId" open="(" separator="," close=")"> 
		            #{instId} 
		         </foreach> 
		         AND ID_ != PARENT_ID_
		)
	</delete>
	
	<delete id="removeByExecutionId">
	delete FROM act_ru_task where execution_id_ in (
	  select ID_ FROM act_ru_execution where PARENT_ID_
	  in <foreach collection="parentIds" index="index" item="parentId" open="(" separator="," close=")"> 
	            #{parentId}
	         </foreach> 
	       AND ID_ != PARENT_ID_
	       )
	</delete>

	<select id="getTaskIdsByExecutionIds" resultType="org.activiti.engine.impl.persistence.entity.TaskEntity">
		select id_,task_def_key_ as "taskDefinitionKey",proc_inst_id_ as "processInstanceId" from act_ru_task where execution_id_ in
		<foreach collection="executionIds" index="index" item="executionId" open="(" separator="," close=")">
			#{executionId}
		</foreach>
	</select>
	
	<select id="getExecutionIdByTaskId" resultType="string">
		SELECT execution_id_ FROM act_ru_task 
		WHERE 
		id_=#{taskId}
	</select>
</mapper>