formtableDAO.xml 3.33 KB
Newer Older
1 2 3 4 5
<?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.formtable.formtableDAO">
	<sql id="Where_Clause">
		<trim prefix="WHERE" prefixOverrides="AND |OR">
罗绍泽 committed
6 7 8
		 	<if test="DELETE_FLAG != null and DELETE_FLAG != ''">
				and f.DELETE_FLAG=#{DELETE_FLAG}
			</if>
9 10 11 12
			<if test="UUID != null and UUID != ''">
				and f.UUID = #{UUID}
			</if>
			<if test="TABLE_NAME != null and TABLE_NAME != ''">
陈玉兰 committed
13
				and f.TABLE_NAME like #{TABLE_NAME}
14 15
			</if>
			<if test="CONTENT != null and CONTENT != ''">
陈玉兰 committed
16
				and f.CONTENT like #{CONTENT}
17 18 19 20 21 22 23 24 25 26
			</if>
			<if test="IS_DBSYNCH != null and IS_DBSYNCH != ''">
				and f.IS_DBSYNCH = #{IS_DBSYNCH}
			</if>
			<if test="STATUS != null and STATUS != ''">
				and f.STATUS = #{STATUS}
			</if>
		</trim>
	</sql>
	<insert id="insert_form_table" parameterType="map">
陈玉兰 committed
27
	      insert into C_T_FORM_TABLE(
28
		<trim prefix="" suffixOverrides=",">
陈玉兰 committed
29 30
			<foreach collection="infoListKey" item="key">
				${key},
31 32 33 34
			</foreach>
		</trim>
	      <![CDATA[ ) values( ]]>
		<trim prefix="" suffixOverrides=",">
陈玉兰 committed
35 36
			<foreach collection="infoList" item="value">
				#{value},
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
			</foreach>
		</trim>
	      <![CDATA[ ) ]]>
	</insert>

	<update id="update_form_table" parameterType="map">
	       <![CDATA[
            update C_T_FORM_TABLE set 
         ]]>
		<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>

	<delete id="delete_form_table" parameterType="list">
        <![CDATA[
陈玉兰 committed
60
           update C_T_FORM_TABLE set DELETE_FLAG=1 where UUID IN
61 62 63 64 65 66 67 68 69
         ]]>
		<foreach collection="list" item="UUID" open="(" separator=","
			close=")">
			#{UUID}
		</foreach>
	</delete>

	<select id="list_form_table" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
70
	  select f.* ,c1.emname as create_user_name,c2.emname as update_user_name
陈玉兰 committed
71
	  from C_T_FORM_TABLE f
72 73 74 75
	  LEFT JOIN lcyq_system.c_t_sys_loginuser c1
		ON f.create_id=c1.code
		LEFT JOIN lcyq_system.c_t_sys_loginuser c2
		ON f.update_id=c2.code
76 77 78 79 80 81 82 83 84 85 86 87 88
     ]]>
		<include refid="Where_Clause" />
		order by f.CREATE_TIME DESC
	</select>

	<select id="listCount_form_table" parameterType="map"
		resultType="int">
	 <![CDATA[
	   select count(*) c from C_T_FORM_TABLE f 
     ]]>
		<include refid="Where_Clause" />
	</select>

陈玉兰 committed
89
	<update id="create_form_table" parameterType="map">
90
	CREATE TABLE ${lcyq_table_db}${tableName}(
罗绍泽 committed
91
	<trim>
陈玉兰 committed
92 93
			<foreach collection="list" item="item">
				${item.FIELD_NAME} ${item.TYPE}
罗绍泽 committed
94 95 96 97 98 99 100 101 102
    			<if test="item.LENGTH != null">
      				(${item.LENGTH}
      				<if test="item.POINT != null">
      				,${item.POINT}
      				</if>
      				)
    			</if>
				<if test="item.IS_NULL != 1">
				NOT 
陈玉兰 committed
103
				</if>
罗绍泽 committed
104 105 106
				NULL
				<if test="item.DEFAULT != null">
					DEFAULT '${item.DEFAULT}'
陈玉兰 committed
107
				</if>
罗绍泽 committed
108 109 110 111 112 113 114 115 116 117 118
				<if test="item.DEFAULT == null">
					<if test="item.IS_NULL == 1">
					DEFAULT NULL
					</if>
				</if>
				
				
				<if test="item.CONTENT != null">
				COMMENT '${item.CONTENT}'
				</if>
				,
陈玉兰 committed
119 120
			</foreach>
		</trim>
罗绍泽 committed
121 122 123 124 125 126 127 128
		<![CDATA[ 
		PRIMARY KEY (`uuid`)
		) ]]>
		ENGINE=InnoDB DEFAULT CHARSET=utf8 
		<if test="content != null">
		COMMENT='${content}'
		</if>
		;
陈玉兰 committed
129
	</update>
130
</mapper>