procinstanceDAO.xml 3.42 KB
Newer Older
1 2 3 4 5 6 7 8
<?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.gaowj.business.procinstance.procinstanceDAO">
	<sql id="Where_Clause">
		<trim prefix="WHERE" prefixOverrides="AND |OR">
			<if test="UUID != null and UUID != ''">
				and f.UUID = #{UUID}
			</if>
9 10 11
			<if test="CREATE_ID != null and CREATE_ID != ''">
				and f.CREATE_ID = #{CREATE_ID}
			</if>
12 13 14
			<if test="PROC_DEFINITION_ID != null and PROC_DEFINITION_ID != ''">
				and f.PROC_DEFINITION_ID = #{PROC_DEFINITION_ID}
			</if>
罗绍泽 committed
15 16 17 18 19 20 21 22 23 24 25
			<if test="BUSINESS_ID != null and BUSINESS_ID != ''">
				and f.BUSINESS_ID = #{BUSINESS_ID}
			</if>
			<if test="INSTANCE_ID_IN != null and INSTANCE_ID_IN != ''">
				and f.INSTANCE_ID IN
				<trim prefix="(" suffix=")" suffixOverrides=",">
					<foreach collection="INSTANCE_ID_IN" item="value">
						#{value},
					</foreach>
				</trim>
			</if>
26 27
		</trim>
	</sql>
28 29
	<insert id="insert_proc_instance" parameterType="map">
	      insert into C_T_PROC_INSTANCE(
30 31 32 33 34 35 36 37 38 39 40 41 42 43
		<trim prefix="" suffixOverrides=",">
			<foreach collection="infoListKey" item="key">
				${key},
			</foreach>
		</trim>
	      <![CDATA[ ) values( ]]>
		<trim prefix="" suffixOverrides=",">
			<foreach collection="infoList" item="value">
				#{value},
			</foreach>
		</trim>
	      <![CDATA[ ) ]]>
	</insert>

44
	<update id="update_proc_instance" parameterType="map">
45
	       <![CDATA[
46
            update C_T_PROC_INSTANCE set 
47 48 49 50 51 52 53 54 55 56 57 58 59
         ]]>
		<trim prefix="" suffixOverrides=",">
			<foreach collection="info" item="info">
				${info.key} = #{info.value} ,
			</foreach>
		</trim>
		<where>
			<if test="UUID != null and UUID != ''">
				and UUID = #{UUID}
			</if>
		</where>
	</update>

60
	<delete id="delete_proc_instance" parameterType="list">
61
        <![CDATA[
62
            delete from  C_T_PROC_INSTANCE where UUID IN
63 64 65 66 67 68 69
         ]]>
		<foreach collection="list" item="UUID" open="(" separator=","
			close=")">
			#{UUID}
		</foreach>
	</delete>

70 71 72 73
	<select id="list_proc_instance" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
	  select f.* 
	  from (
罗绍泽 committed
74 75
	  	SELECT t.*,ins.proc_definition_id,ins.instance_id,ins.complete,ins.business_id,def.proc_name
	  	FROM ${tableName} t
76 77
		LEFT JOIN c_t_proc_instance ins
		ON t.uuid=ins.business_id
罗绍泽 committed
78
		LEFT JOIN c_t_proc_definition def ON def.uuid = ins.proc_definition_id
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
	  ) f
     ]]>
		<include refid="Where_Clause" />
		order by f.CREATE_TIME DESC
	</select>

	<select id="listCount_proc_instance" parameterType="map"
		resultType="int">
	 <![CDATA[
	   select count(*) c from 
	   (
	  	SELECT t.*,ins.proc_definition_id,ins.instance_id FROM ${tableName} t
		LEFT JOIN c_t_proc_instance ins
		ON t.uuid=ins.business_id
	  )
	    f 
     ]]>
		<include refid="Where_Clause" />
	</select>
	
	<select id="list_proc_instance_all" parameterType="map" resultType="upperCaseKeyMap">
100 101
	 <![CDATA[
	  select f.* 
102 103 104 105
	  from (
	  	SELECT ins.*,def.proc_name from c_t_proc_instance ins
		LEFT JOIN c_t_proc_definition def on ins.proc_definition_id=def.uuid
	  ) f
106 107 108 109 110
     ]]>
		<include refid="Where_Clause" />
		order by f.CREATE_TIME DESC
	</select>

111
	<select id="listCount_proc_instance_all" parameterType="map"
112 113
		resultType="int">
	 <![CDATA[
114 115 116 117 118 119
	   select count(*) c from 
	   (
	  	SELECT ins.*,def.proc_name from c_t_proc_instance ins
		LEFT JOIN c_t_proc_definition def on ins.proc_definition_id=def.uuid
	  )
	    f 
120 121 122 123 124
     ]]>
		<include refid="Where_Clause" />
	</select>

</mapper>