Blame view

backend/bpm/src/main/resources/mapper/BpmTaskTurnMapper.xml 5.73 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?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.BpmTaskTurnDao">
	<resultMap id="BpmTaskTurn" type="com.hotent.bpm.persistence.model.DefaultBpmTaskTurn">
		<id property="id" column="id_" jdbcType="VARCHAR"/>
		<result property="taskId" column="task_id_" jdbcType="VARCHAR"/>
		<result property="taskName" column="task_name_" jdbcType="VARCHAR"/>
		<result property="taskSubject" column="task_subject_" jdbcType="VARCHAR"/>
		<result property="nodeId" column="node_id_" jdbcType="VARCHAR"/>
		<result property="procInstId" column="proc_inst_id_" jdbcType="VARCHAR"/>
		<result property="ownerId" column="owner_id_" jdbcType="VARCHAR"/>
		<result property="ownerName" column="owner_name_" jdbcType="VARCHAR"/>
		<result property="assigneeId" column="assignee_id_" jdbcType="VARCHAR"/>
		<result property="assigneeName" column="assignee_name_" jdbcType="VARCHAR"/>
		<result property="status" column="status_" jdbcType="VARCHAR"/>
		<result property="turnType" column="turn_type_" jdbcType="VARCHAR"/>
		<result property="typeId" column="type_id_" jdbcType="VARCHAR"/>
		<result property="createTime" column="create_time_" jdbcType="TIMESTAMP"/>
		<result property="typeId" column="type_id_" jdbcType="VARCHAR"/>
		<result property="supportMobile" column="SUPPORT_MOBILE_" jdbcType="NUMERIC"/>
		<result property="finishTime" column="finish_time_" jdbcType="TIMESTAMP"/>
		<result property="createOrgId" column="create_org_id_" jdbcType="VARCHAR"/>
		<result property="procDefKey" column="proc_def_key_" jdbcType="VARCHAR"/>
	</resultMap>

	<insert id="create" parameterType="com.hotent.bpm.persistence.model.DefaultBpmTaskTurn">
		INSERT INTO bpm_task_turn
		(id_,task_id_,task_name_,task_subject_,node_id_,proc_inst_id_,owner_id_,owner_name_,assignee_id_,assignee_name_,status_,turn_type_,type_id_,create_time_,finish_time_)
		VALUES
		(#{id,jdbcType=VARCHAR}, #{taskId,jdbcType=VARCHAR}, #{taskName,jdbcType=VARCHAR}, #{taskSubject,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{procInstId,jdbcType=VARCHAR}, #{ownerId,jdbcType=VARCHAR}, #{ownerName,jdbcType=VARCHAR}, #{assigneeId,jdbcType=VARCHAR}, #{assigneeName,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{turnType,jdbcType=VARCHAR}, #{typeId,jdbcType=VARCHAR},  #{createTime,jdbcType=TIMESTAMP}, #{finishTime,jdbcType=TIMESTAMP})
	</insert>

	<select id="get"   parameterType="java.lang.String" resultMap="BpmTaskTurn">
		SELECT * FROM bpm_task_turn
		WHERE
		id_=#{id}
	</select>

	<select id="query" parameterType="java.util.Map" resultMap="BpmTaskTurn">
		SELECT * FROM bpm_task_turn
		<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_turn
		WHERE
		id_=#{id}
	</delete>

	<select id="getByTaskId"    resultMap="BpmTaskTurn">
		SELECT * FROM bpm_task_turn
		WHERE
		task_id_=#{taskId}
	</select>


	<update id="updateSubjectByInstId">
		update bpm_task_turn set task_subject_=#{subject} where proc_inst_id_=#{instId} and task_subject_ != #{subject}
	</update>

	<select id="getByTaskIds"    resultMap="BpmTaskTurn">
		SELECT * FROM bpm_task_turn
		WHERE
		task_id_ in
		<foreach collection="taskIds" item="taskId" open="(" separator="," close=")">
			#{taskId}
		</foreach>
	</select>

	<update id="updComplete" parameterType="com.hotent.bpm.persistence.model.DefaultBpmTaskTurn">
		UPDATE bpm_task_turn SET
		status_='finish',
		finish_time_=#{finishTime,jdbcType=TIMESTAMP}
		WHERE
		task_id_=#{taskId}
	</update>

	<update id="updSubjectByTaskId">
		UPDATE bpm_task_turn
		SET TASK_SUBJECT_ = #{subject}
		WHERE
			task_id_=#{taskId}
	</update>

	<delete id="delByInstList">
		DELETE FROM bpm_task_turn
		WHERE
		proc_inst_id_  in
		<foreach collection="list" index="index" item="instId" open="(" separator="," close=")">
            #{instId}
        </foreach>
	</delete>

	<select id="getMyDelegate" parameterType="java.lang.String" resultMap="BpmTaskTurn">
		SELECT  DISTINCT a.*,hi.SUPPORT_MOBILE_,hi.create_org_id_,hi.proc_def_key_ FROM bpm_task_turn a
		LEFT JOIN bpm_task_turnassign b  ON a.id_ = b.task_turn_id_
		inner join bpm_pro_inst hi on a.proc_inst_id_ = hi.id_
		<if test="defKey!=''">
            and hi.proc_def_key_ = #{defKey}
        </if>
		${ew.customSqlSegment}
	</select>

	<select id="getMyDelegateCount" parameterType="java.lang.String" resultType="java.util.Map">
		select count(1) as "count",type_id_ as "typeId" from (
			SELECT DISTINCT a.*,hi.SUPPORT_MOBILE_ FROM bpm_task_turn a
			LEFT JOIN bpm_task_turnassign b ON a.id_ = b.task_turn_id_
			inner join bpm_pro_inst hi on a.proc_inst_id_ = hi.id_
			<where>
				(owner_id_ = #{userId} OR from_user_id_ = #{userId} )
			</where>
			 order by a.create_time_) temp
		 group by type_id_
	</select>
	<select id="getMyDelegateCountByUserId" parameterType="java.lang.String" resultType="java.lang.Long">
		select count(1) from (
		SELECT DISTINCT a.*,hi.SUPPORT_MOBILE_ FROM bpm_task_turn a
		LEFT JOIN bpm_task_turnassign b ON a.id_ = b.task_turn_id_
		inner join bpm_pro_inst hi on a.proc_inst_id_ = hi.id_
		where (owner_id_ = #{userId} OR from_user_id_ = #{userId} )) temp
	</select>

	<select id="getByTaskIdAndAssigneeId" parameterType="java.util.Map" resultMap="BpmTaskTurn">
		SELECT * FROM bpm_task_turn
			WHERE 1=1
				<if test="taskId!=null">
					AND task_id_=#{taskId}
				</if>
				<if test="assigneeId!=null">
					 AND assignee_id_=#{assigneeId}
				</if>
	</select>

    <delete id="delByTaskId" parameterType="java.lang.String">
		DELETE FROM bpm_task_turn
		WHERE
		task_id_=#{taskId}
	</delete>

</mapper>