MagicTemplateConfigInfoMapper.xml
3.12 KB
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
<?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="cn.com.glsx.entmicro.mapper.MagicTemplateConfigInfoMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.magic.MagicTemplateConfigInfo">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="field_name" jdbcType="VARCHAR" property="fieldName"/>
<result column="field_type" jdbcType="INTEGER" property="fieldType"/>
<result column="field_comment" jdbcType="VARCHAR" property="fieldComment"/>
<result column="field_length" jdbcType="INTEGER" property="fieldLength"/>
<result column="field_primary" jdbcType="INTEGER" property="fieldPrimary"/>
<result column="config_id" jdbcType="INTEGER" property="configId"/>
<result column="cloumn_name" jdbcType="VARCHAR" property="cloumnName"/>
<result column="cloumn_index" jdbcType="INTEGER" property="cloumnIndex"/>
<result column="cloumn_regular" jdbcType="VARCHAR" property="cloumnRegular"/>
<result column="cloumn_error_prompt" jdbcType="VARCHAR" property="cloumnErrorPrompt"/>
<result column="field_base" jdbcType="INTEGER" property="fieldBase"/>
<result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
<result column="created_by" jdbcType="INTEGER" property="createdBy"/>
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
<result column="updated_by" jdbcType="INTEGER" property="updatedBy"/>
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime"/>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, field_name, field_type, field_comment, field_length, field_primary, config_id,
cloumn_name, cloumn_index, cloumn_regular, cloumn_error_prompt, field_base, del_flag, created_by,
created_time, updated_by, updated_time
</sql>
<select id="findByConfigId" resultMap="BaseResultMap">
select * from magic_template_config_info where config_id=#{id}
</select>
<update id="createTable">
CREATE TABLE IF NOT EXISTS ${tableConfig.magicTemplateConfig.tableName} (
<foreach collection="tableConfig.magicTemplateConfigInfoList" item="conf" separator=",">
<choose>
<when test="conf.fieldPrimary==0">
${conf.cloumnName} ${conf.fieldTypeName}<if test="conf.fieldType != 6 and conf.fieldLength != null">(${conf.fieldLength})</if>
COMMENT #{conf.fieldComment}
</when>
<when test="conf.fieldPrimary==1">
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT #{conf.fieldComment},
PRIMARY KEY (`id`)
</when>
</choose>
</foreach>
)
</update>
<select id="tableNameExists" resultType="java.lang.Integer">
SELECT COUNT(1) FROM information_schema.TABLES WHERE table_name = #{tableName}
</select>
</mapper>