Blame view

backend/bpm/src/main/resources/mapper/BpmExeStackRelationMapper.xml 2.91 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
<?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.BpmExeStackRelationDao">
	<resultMap id="BpmExeStackRelation" type="com.hotent.bpm.persistence.model.BpmExeStackRelation">
		<id property="relationId" column="relation_id_" jdbcType="VARCHAR"/>
		<result property="procInstId" column="proc_inst_id_" jdbcType="VARCHAR"/>
		<result property="fromStackId" column="from_stack_id_" jdbcType="VARCHAR"/>
		<result property="toStackId" column="to_stack_id_" jdbcType="VARCHAR"/>
		<result property="fromNodeId" column="from_node_id_" jdbcType="VARCHAR"/>
		<result property="toNodeId" column="to_node_id_" jdbcType="VARCHAR"/>
		<result property="relationState" column="relation_state_" jdbcType="NUMERIC"/>
		<result property="fromNodeType" column="from_node_type_" jdbcType="VARCHAR"/>
		<result property="toNodeType" column="to_node_type_" jdbcType="VARCHAR"/>
		<result property="createdTime" column="created_time_" jdbcType="TIMESTAMP"/>
	</resultMap>
	
	<select id="getByToStackId"   parameterType="java.lang.String" resultMap="BpmExeStackRelation">
		SELECT * FROM bpm_exe_stack_relation 
		WHERE 
		to_stack_id_=#{stackId} ORDER BY created_time_ DESC
	</select>
		
	<select id="getByFromStackId"   parameterType="java.lang.String" resultMap="BpmExeStackRelation">
		SELECT * FROM bpm_exe_stack_relation 
		WHERE 
		from_stack_id_=#{stackId}
	</select>
	
    <select id="getListByProcInstId"   parameterType="java.lang.String" resultMap="BpmExeStackRelation">
		SELECT * FROM bpm_exe_stack_relation 
		WHERE 
		proc_inst_id_=#{procInstId} ORDER BY created_time_ DESC
	</select>

    <select id="getById"   parameterType="java.lang.String" resultMap="BpmExeStackRelation">
		SELECT * FROM bpm_exe_stack_relation
		WHERE
		proc_inst_id_= #{instId} and from_stack_id_ = #{fromId} and to_stack_id_ = #{toId}
	</select>
	
	<delete id="removeHisByInstId">
		DELETE FROM bpm_exe_stack_relation_his
		WHERE
		proc_inst_id_=#{procInstId,jdbcType=VARCHAR}
	</delete>
	
	<select id="getByToNodeId"   parameterType="java.lang.String" resultMap="BpmExeStackRelation">
		SELECT * FROM bpm_exe_stack_relation
		WHERE
		proc_inst_id_= #{instId} and to_node_id_ = #{toNodeId}  ORDER BY created_time_ DESC
	</select>

	<select id="stackRelation2HisInToStackIdOrFormStackId" resultMap="BpmExeStackRelation">
		select
			*
		from bpm_exe_stack_relation
		where to_stack_id_ in
			  (SELECT id_ from
				  bpm_exe_stack where node_path_ !=
			'${@com.hotent.base.util.StringUtil@substringBeforeLast(nodePath,
            "%")}' and
			proc_inst_id_=#{procInstId,jdbcType=VARCHAR} and
			node_path_
			like
			#{nodePath}
			)
		UNION
		select
			*
		from bpm_exe_stack_relation
		where from_stack_id_ in
			(SELECT id_ from
			bpm_exe_stack where
			proc_inst_id_=#{procInstId,jdbcType=VARCHAR} and
			node_path_ like
			#{nodePath}
			)
	</select>
</mapper>