Blame view

backend/bpm/src/main/resources/mapper/CopyToMapper.xml 3.87 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
<?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.CopyToDao">
	<resultMap id="CopyTo" type="com.hotent.bpm.persistence.model.CopyTo">
		<id property="id" column="id_" jdbcType="VARCHAR"/>
		<result property="instId" column="inst_id_" jdbcType="VARCHAR"/>
		<result property="bpmnInstId" column="bpmn_inst_id_" jdbcType="VARCHAR"/>
		<result property="nodeId" column="node_id_" jdbcType="VARCHAR"/>
	
		<result property="createTime" column="create_time_" jdbcType="TIMESTAMP"/>
		<result property="opinion" column="opinion_" jdbcType="VARCHAR"/>
		<result property="subject" column="subject_" jdbcType="VARCHAR"/>
	
		<result property="type" column="type_" jdbcType="VARCHAR"/>
		<result property="startorId" column="startor_id_" jdbcType="VARCHAR"/>
		<result property="startor" column="startor_" jdbcType="VARCHAR"/>
		<result property="typeId" column="type_id_" jdbcType="VARCHAR"/>
		
		<result property="recever" column="recever" jdbcType="VARCHAR"/>
	</resultMap>
	
	<resultMap id="CopyToExt" extends="CopyTo" type="com.hotent.bpm.persistence.model.CopyTo">
	
		<result property="isRead" column="is_read_" jdbcType="NUMERIC"/>
		<result property="bId" column="bId" jdbcType="VARCHAR"/>
	</resultMap>
	
	<delete id="delByInstList" >
		DELETE FROM  bpm_pro_cpto where inst_id_ in 
			<foreach collection="list" index="index" item="instId" open="(" separator="," close=")"> 
            #{instId} 
        	</foreach> 
	</delete>
	
	
	<select id="getByUserId"   parameterType="java.lang.String" resultMap="CopyTo">
		SELECT * FROM bpm_pro_cpto 
		WHERE startor_id_=#{startorId}
		<if test="subject !=null">
			and a.subject_ like #{subject}
		</if>
	</select>

	
	<select id="getReceiverCopyTo" parameterType="java.util.Map" resultMap="CopyToExt" >
		<if test="map.support_mobile_ ==null">
			SELECT DISTINCT a.*, b.ID_ bId,b.IS_READ_ FROM bpm_pro_cpto a,bpm_cpto_receiver b
		</if>
		<if test="map.support_mobile_ !=null">
			SELECT DISTINCT a.*, b.ID_ bId,b.IS_READ_ FROM ( 
			SELECT DISTINCT a.* FROM bpm_pro_cpto a   
			left join bpm_pro_inst inst 
			on  a.INST_ID_ = inst.id_ 
			left join bpm_pro_inst_hi instHi 
			on  a.INST_ID_ = instHi.id_  
			where  a.INST_ID_ = inst.id_
			and inst.SUPPORT_MOBILE_ = #{map.support_mobile_} ) a ,bpm_cpto_receiver b 
		</if>
		where a.id_=b.CPTO_ID_ and b.RECEIVER_ID_=#{map.userId} 

		<if test="map.isRead!=null">
			and b.IS_READ_ = #{map.isRead}
		</if>
		<if test="map.createTimeStart!=null">
			and a.create_time_ >=#{map.createTimeStart}
		</if>
		<if test="map.createTimeEnd_DG!=null">
			and a.create_time_ &lt;=#{map.createTimeEnd_DG}
		</if>
		
		<if test="map.subject!=null">
			and a.subject_ like #{map.subject}
		</if>
		
		<if test="map.typeId!=null">
			and a.type_id_ = #{map.typeId}
		</if>
		
		<if test="map.type!=null">
			and a.type_ = #{map.type}
		</if>
		
		<if test="map.startorId!=null">
			and a.startor_id_=#{map.startorId}
		</if>
			
		order by a.create_time_ desc
		
	</select>
	
	<select id="getMyCopyTo" parameterType="java.util.Map" resultMap="CopyTo" >
		SELECT pc.* , cr.RECEIVER_ recever FROM bpm_pro_cpto pc ,bpm_cpto_receiver cr  where pc.startor_id_=#{map.userId} 
		AND cr.CPTO_ID_ = pc.ID_
		<if test="map.createTimeStart!=null">
			and pc.create_time_ >=#{map.createTimeStart}
		</if>
		<if test="map.createTimeEnd_DG!=null">
			and pc.create_time_ &lt;=#{map.createTimeEnd_DG}
		</if>
		
		<if test="map.subject!=null">
			and pc.subject_ like #{map.subject}
		</if>
		
		<if test="map.typeId!=null">
			and pc.type_id_ = #{map.typeId}
		</if>
		
		<if test="map.type!=null">
			and pc.type_ = #{map.type}
		</if>
		
		<choose>
			<when test="map.orderBySql==null">
				order by pc.create_time_ desc
			</when>
			<otherwise>
				ORDER BY ${map.orderBySql}
			</otherwise>
		</choose>
		
	</select>
	
	
	
	
</mapper>