Blame view

backend/form/src/main/resources/mapper/FormRightMapper.xml 4.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
<?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.form.persistence.dao.FormRightDao">
	<resultMap id="BpmFormRight" type="com.hotent.form.model.FormRight">
		<id property="id" column="id_" jdbcType="VARCHAR"/>
		<result property="formKey" column="form_key_" jdbcType="VARCHAR"/>
		<result property="flowKey" column="flow_key_" jdbcType="VARCHAR"/>
		<result property="nodeId" column="node_id_" jdbcType="VARCHAR"/>
		<result property="parentFlowKey" column="parent_flow_key_" jdbcType="VARCHAR"/>
		<result property="permission" column="permission_" jdbcType="LONGVARCHAR"/>
		<result property="permissionType" column="permission_type_" jdbcType="NUMERIC"/>
        <result property="isCheckOpinion" column="is_check_opinion" jdbcType="VARCHAR"/>
		<result property="dataKey" column="data_key_" jdbcType="VARCHAR"/>
		<result property="dataKey" column="data_key_" jdbcType="VARCHAR"/>
	</resultMap>
	
	<select id="getAllByFlowKey" parameterType="java.lang.String" resultMap="BpmFormRight">
		SELECT * FROM form_right WHERE flow_key_ = #{flowKey,jdbcType=VARCHAR}
	</select>
	<select id="getByFormKeys" resultType="com.hotent.form.model.FormRight">
		select * from form_right where form_key_ in
		<foreach collection="listFormKey" index="index" item="formKey" open="(" separator="," close=")">
			#{formKey}
		</foreach>
		AND permission_type_=#{type}
	</select>
	
	<select id="getByFlowKey"    resultMap="BpmFormRight">
		SELECT * FROM form_right
		WHERE   flow_key_=#{flowKey}
		and (node_id_ IS NULL OR node_id_ ='')
		and permission_type_=#{permissionType}
		<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(parentFlowKey)">and parent_flow_key_=#{parentFlowKey,jdbcType=VARCHAR} </if>
		<if test="@com.hotent.base.ognl.Ognl@isEmpty(parentFlowKey)">and (parent_flow_key_ is null or parent_flow_key_='') </if>
	</select>
	
	<select id="getByFormKey"   resultMap="BpmFormRight">
		SELECT * FROM form_right
		WHERE   form_key_=#{formKey}
		<if test="isReadOnly">
		and permission_type_='2'
		</if>
		<if test="!isReadOnly">
		and permission_type_='1'
		</if>
		and (flow_key_ is null or flow_key_='')
	</select>
	
	<select id="getByFormKeyAndType" resultMap="BpmFormRight">
		SELECT * FROM form_right
		WHERE form_key_=#{formKey}
		AND permission_type_=#{type}
		<if test="dataKey != null and dataKey != ''">
			AND DATA_KEY_=#{dataKey}
		</if>
		AND (flow_key_ is null or flow_key_='')
	</select>
	
	<select id="getByFlowNodeId"    resultMap="BpmFormRight">
		SELECT * FROM form_right
		WHERE   flow_key_=#{flowKey}
		<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(nodeId)">
		and node_id_=#{nodeId}
		</if>
		<if test="@com.hotent.base.ognl.Ognl@isEmpty(nodeId)">
		and (node_id_ IS NULL OR node_id_ ='')
		</if>
		<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(permissionType)">
		and permission_type_=#{permissionType}
		</if>
		<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(parentFlowKey)">and parent_flow_key_=#{parentFlowKey,jdbcType=VARCHAR} </if>
		<if test="@com.hotent.base.ognl.Ognl@isEmpty(parentFlowKey)">and (parent_flow_key_ is null or parent_flow_key_='') </if>
	</select>
	
	
	<delete id="removeByFlowKey" parameterType="java.lang.String">
		DELETE FROM form_right
		WHERE   flow_key_=#{flowKey}
		and permission_type_=#{permissionType}
		<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(parentFlowKey)">and parent_flow_key_=#{parentFlowKey,jdbcType=VARCHAR} </if>
		<if test="@com.hotent.base.ognl.Ognl@isEmpty(parentFlowKey)">and (parent_flow_key_ is null or parent_flow_key_='') </if>
	</delete>
	
	
	<delete id="removeByFlowNode" parameterType="java.lang.String">
		delete FROM form_right
		WHERE   flow_key_=#{flowKey}
		<if test="@com.hotent.base.ognl.Ognl@isEmpty(nodeId)">
		and (node_id_  is null or node_id_ ='' )
		</if>
		<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(nodeId)">
		and node_id_=#{nodeId}
		</if>
		<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(parentFlowKey)">and parent_flow_key_=#{parentFlowKey,jdbcType=VARCHAR} </if>
		<if test="@com.hotent.base.ognl.Ognl@isEmpty(parentFlowKey)">and (parent_flow_key_ is null or parent_flow_key_='') </if>
	</delete>
	
	
	<delete id="removeByFormKey" parameterType="java.lang.String">
		DELETE FROM form_right
		WHERE
		form_key_=#{formKey}  and (flow_key_ is null or flow_key_='')
	</delete>

    <select id="getByTeam" parameterType="java.lang.String" resultType="java.lang.String">
        SELECT is_check_opinion FROM form_right  where FLOW_KEY_=#{flowKey} and NODE_ID_=#{nodeId}
    </select>

	<delete id="emptyAll" parameterType="java.lang.String">
		DELETE FROM form_right
		WHERE
		form_key_=#{formKey}
		<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(flowKey)">
		and flow_key_=#{flowKey}
		</if>
	</delete>

</mapper>