| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359 |
- <?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.gov.customs.wxjy.generator.dao.GenTableMapper">
- <resultMap type="GenTable" id="GenTableResult">
- <result property="tableId" column="TABLE_ID"/>
- <result property="tableName" column="TABLE_NAME"/>
- <result property="tableComment" column="TABLE_COMMENT"/>
- <result property="subTableName" column="SUB_TABLE_NAME"/>
- <result property="subTableFkName" column="SUB_TABLE_FK_NAME"/>
- <result property="className" column="CLASS_NAME"/>
- <result property="tplCategory" column="TPL_CATEGORY"/>
- <result property="packageName" column="PACKAGE_NAME"/>
- <result property="moduleName" column="MODULE_NAME"/>
- <result property="businessName" column="BUSINESS_NAME"/>
- <result property="functionName" column="FUNCTION_NAME"/>
- <result property="functionAuthor" column="FUNCTION_AUTHOR"/>
- <result property="genType" column="GEN_TYPE"/>
- <result property="genPath" column="GEN_PATH"/>
- <result property="options" column="OPTIONS"/>
- <result property="createUser" column="CREATE_USER"/>
- <result property="createTime" column="CREATE_TIME"/>
- <result property="updateUser" column="UPDATE_USER"/>
- <result property="updateTime" column="UPDATE_TIME"/>
- <result property="remark" column="REMARK"/>
- <result property="tplWebType" column="TPL_WEB_TYPE"/>
- <result property="isDeleted" column="IS_DELETED"/>
- <collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" />
- </resultMap>
- <resultMap type="GenTableColumn" id="GenTableColumnResult">
- <id property="columnId" column="column_id" />
- <result property="tableId" column="table_id" />
- <result property="columnName" column="column_name" />
- <result property="columnComment" column="column_comment" />
- <result property="columnType" column="column_type" />
- <result property="javaType" column="java_type" />
- <result property="javaField" column="java_field" />
- <result property="isPk" column="is_pk" />
- <result property="isIncrement" column="is_increment" />
- <result property="isRequired" column="is_required" />
- <result property="isInsert" column="is_insert" />
- <result property="isEdit" column="is_edit" />
- <result property="isList" column="is_list" />
- <result property="isQuery" column="is_query" />
- <result property="queryType" column="query_type" />
- <result property="htmlType" column="html_type" />
- <result property="dictType" column="dict_type" />
- <result property="sort" column="sort" />
- <result property="createUser" column="CREATE_USER" />
- <result property="createTime" column="create_time" />
- <result property="updateUser" column="UPDATE_USER" />
- <result property="updateTime" column="update_time" />
- </resultMap>
- <sql id="baseVo">
- select TABLE_ID, TABLE_NAME, TABLE_COMMENT, SUB_TABLE_NAME, SUB_TABLE_FK_NAME, CLASS_NAME, TPL_CATEGORY, PACKAGE_NAME, MODULE_NAME, BUSINESS_NAME, FUNCTION_NAME, FUNCTION_AUTHOR, GEN_TYPE, GEN_PATH, OPTIONS, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK, TPL_WEB_TYPE, IS_DELETED
- from SYS_GEN_TABLE
- </sql>
- <select id="selectList" parameterType="GenTableQuery" resultMap="GenTableResult">
- <include refid="baseVo"/>
- <where>
- <if test="tableName != null and tableName != ''">
- and TABLE_NAME like concat('%', #{tableName}, '%')
- </if>
- <if test="tableComment != null and tableComment != ''">
- and TABLE_COMMENT = #{tableComment}
- </if>
- <if test="subTableName != null and subTableName != ''">
- and SUB_TABLE_NAME like concat('%', #{subTableName}, '%')
- </if>
- <if test="subTableFkName != null and subTableFkName != ''">
- and SUB_TABLE_FK_NAME like concat('%', #{subTableFkName}, '%')
- </if>
- <if test="className != null and className != ''">
- and CLASS_NAME like concat('%', #{className}, '%')
- </if>
- <if test="tplCategory != null and tplCategory != ''">
- and TPL_CATEGORY = #{tplCategory}
- </if>
- <if test="packageName != null and packageName != ''">
- and PACKAGE_NAME like concat('%', #{packageName}, '%')
- </if>
- <if test="moduleName != null and moduleName != ''">
- and MODULE_NAME like concat('%', #{moduleName}, '%')
- </if>
- <if test="businessName != null and businessName != ''">
- and BUSINESS_NAME like concat('%', #{businessName}, '%')
- </if>
- <if test="functionName != null and functionName != ''">
- and FUNCTION_NAME like concat('%', #{functionName}, '%')
- </if>
- <if test="functionAuthor != null and functionAuthor != ''">
- and FUNCTION_AUTHOR = #{functionAuthor}
- </if>
- <if test="genType != null and genType != ''">
- and GEN_TYPE = #{genType}
- </if>
- <if test="genPath != null and genPath != ''">
- and GEN_PATH = #{genPath}
- </if>
- <if test="options != null and options != ''">
- and OPTIONS = #{options}
- </if>
- <if test="beginDate != null and beginDate != ''">
- and UPDATE_TIME >= #{beginDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and UPDATE_TIME <= #{endDate}
- </if>
- <if test="tplWebType != null and tplWebType != ''">
- and TPL_WEB_TYPE = #{tplWebType}
- </if>
- </where>
- </select>
- <select id="selectByTableId" parameterType="String"
- resultMap="GenTableResult">
- <include refid="baseVo"/>
- where TABLE_ID = #{tableId}
- </select>
- <select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
- SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark,
- c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, coalesce(c.dict_type,'') as dict_type, c.sort
- FROM sys_gen_table t
- LEFT JOIN sys_gen_table_column c ON t.table_id = c.table_id
- order by c.sort
- </select>
- <select id="selectDbTableList" parameterType="GenTableQuery" resultMap="GenTableResult">
- SELECT
- t.TABLE_NAME as TABLE_NAME,
- t.COMMENTS as TABLE_COMMENT,
- SYSDATE as CREATE_TIME,
- SYSDATE as UPDATE_TIME
- FROM ALL_TAB_COMMENTS t
- WHERE t.OWNER = (SELECT USER FROM DUAL)
- AND t.TABLE_NAME NOT LIKE 'QRTZ_%'
- AND t.TABLE_NAME NOT LIKE 'GEN_%'
- AND t.TABLE_NAME NOT LIKE 'SYS_GEN_%'
- AND t.TABLE_NAME NOT IN (SELECT table_name FROM sys_gen_table)
- <if test="tableName != null and tableName != ''">
- AND LOWER(t.TABLE_NAME) LIKE LOWER(CONCAT(CONCAT('%', #{tableName}), '%'))
- </if>
- <if test="tableComment != null and tableComment != ''">
- AND LOWER(t.COMMENTS) LIKE LOWER(CONCAT(CONCAT('%', #{tableComment}), '%'))
- </if>
- ORDER BY t.TABLE_NAME
- </select>
- <select id="selectDbTableListByNames" resultMap="GenTableResult">
- SELECT
- t.TABLE_NAME as TABLE_NAME,
- t.COMMENTS as TABLE_COMMENT,
- SYSDATE as CREATE_TIME,
- SYSDATE as UPDATE_TIME
- FROM ALL_TAB_COMMENTS t
- WHERE t.OWNER = (SELECT USER FROM DUAL)
- AND t.TABLE_NAME NOT LIKE 'QRTZ_%'
- AND t.TABLE_NAME NOT LIKE 'GEN_%'
- AND t.TABLE_NAME NOT LIKE 'SYS_GEN_%'
- AND t.TABLE_NAME IN
- <foreach collection="array" item="name" open="(" separator="," close=")">
- #{name}
- </foreach>
- </select>
- <select id="selectGenTableByName" resultMap="GenTableResult">
- SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
- c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, coalesce(c.dict_type,'') as dict_type, c.sort
- FROM SYS_GEN_TABLE t
- LEFT JOIN sys_gen_table_column c ON t.table_id = c.table_id
- where t.table_name = #{tableName} order by c.sort
- </select>
- <insert id="insert" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId">
- insert into SYS_GEN_TABLE
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="tableId != null and tableId != ''">TABLE_ID,
- </if>
- <if test="tableName != null">TABLE_NAME,
- </if>
- <if test="tableComment != null">TABLE_COMMENT,
- </if>
- <if test="subTableName != null">SUB_TABLE_NAME,
- </if>
- <if test="subTableFkName != null">SUB_TABLE_FK_NAME,
- </if>
- <if test="className != null">CLASS_NAME,
- </if>
- <if test="tplCategory != null">TPL_CATEGORY,
- </if>
- <if test="packageName != null">PACKAGE_NAME,
- </if>
- <if test="moduleName != null">MODULE_NAME,
- </if>
- <if test="businessName != null">BUSINESS_NAME,
- </if>
- <if test="functionName != null">FUNCTION_NAME,
- </if>
- <if test="functionAuthor != null">FUNCTION_AUTHOR,
- </if>
- <if test="genType != null">GEN_TYPE,
- </if>
- <if test="genPath != null">GEN_PATH,
- </if>
- <if test="options != null">OPTIONS,
- </if>
- <if test="createUser != null">CREATE_USER,
- </if>
- <if test="createTime != null">CREATE_TIME,
- </if>
- <if test="updateUser != null">UPDATE_USER,
- </if>
- <if test="updateTime != null">UPDATE_TIME,
- </if>
- <if test="remark != null">REMARK,
- </if>
- <if test="tplWebType != null">TPL_WEB_TYPE,
- </if>
- <if test="isDeleted != null">IS_DELETED,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="tableId != null and tableId != ''">#{tableId},
- </if>
- <if test="tableName != null">#{tableName},
- </if>
- <if test="tableComment != null">#{tableComment},
- </if>
- <if test="subTableName != null">#{subTableName},
- </if>
- <if test="subTableFkName != null">#{subTableFkName},
- </if>
- <if test="className != null">#{className},
- </if>
- <if test="tplCategory != null">#{tplCategory},
- </if>
- <if test="packageName != null">#{packageName},
- </if>
- <if test="moduleName != null">#{moduleName},
- </if>
- <if test="businessName != null">#{businessName},
- </if>
- <if test="functionName != null">#{functionName},
- </if>
- <if test="functionAuthor != null">#{functionAuthor},
- </if>
- <if test="genType != null">#{genType},
- </if>
- <if test="genPath != null">#{genPath},
- </if>
- <if test="options != null">#{options},
- </if>
- <if test="createUser != null">#{createUser},
- </if>
- <if test="createTime != null">#{createTime},
- </if>
- <if test="updateUser != null">#{updateUser},
- </if>
- <if test="updateTime != null">#{updateTime},
- </if>
- <if test="remark != null">#{remark},
- </if>
- <if test="tplWebType != null">#{tplWebType},
- </if>
- <if test="isDeleted != null">#{isDeleted},
- </if>
- </trim>
- </insert>
- <update id="update" parameterType="GenTable">
- update SYS_GEN_TABLE
- <trim prefix="SET" suffixOverrides=",">
- <if test="tableName != null">TABLE_NAME =
- #{tableName},
- </if>
- <if test="tableComment != null">TABLE_COMMENT =
- #{tableComment},
- </if>
- <if test="subTableName != null">SUB_TABLE_NAME =
- #{subTableName},
- </if>
- <if test="subTableFkName != null">SUB_TABLE_FK_NAME =
- #{subTableFkName},
- </if>
- <if test="className != null">CLASS_NAME =
- #{className},
- </if>
- <if test="tplCategory != null">TPL_CATEGORY =
- #{tplCategory},
- </if>
- <if test="packageName != null">PACKAGE_NAME =
- #{packageName},
- </if>
- <if test="moduleName != null">MODULE_NAME =
- #{moduleName},
- </if>
- <if test="businessName != null">BUSINESS_NAME =
- #{businessName},
- </if>
- <if test="functionName != null">FUNCTION_NAME =
- #{functionName},
- </if>
- <if test="functionAuthor != null">FUNCTION_AUTHOR =
- #{functionAuthor},
- </if>
- <if test="genType != null">GEN_TYPE =
- #{genType},
- </if>
- <if test="genPath != null">GEN_PATH =
- #{genPath},
- </if>
- <if test="options != null">OPTIONS =
- #{options},
- </if>
- <if test="createUser != null">CREATE_USER =
- #{createUser},
- </if>
- <if test="createTime != null">CREATE_TIME =
- #{createTime},
- </if>
- <if test="updateUser != null">UPDATE_USER =
- #{updateUser},
- </if>
- <if test="updateTime != null">UPDATE_TIME =
- #{updateTime},
- </if>
- <if test="remark != null">REMARK =
- #{remark},
- </if>
- <if test="tplWebType != null">TPL_WEB_TYPE =
- #{tplWebType},
- </if>
- <if test="isDeleted != null">IS_DELETED =
- #{isDeleted},
- </if>
- </trim>
- where TABLE_ID = #{tableId}
- </update>
- <delete id="deleteByTableId" parameterType="String">
- delete
- from SYS_GEN_TABLE where TABLE_ID = #{tableId}
- </delete>
- <delete id="deleteByTableIds" parameterType="String">
- delete from SYS_GEN_TABLE where TABLE_ID in
- <foreach item="tableId" collection="array" open="(" separator="," close=")">
- #{tableId}
- </foreach>
- </delete>
- <delete id="logicDelete" parameterType="String">
- update SYS_GEN_TABLE set is_del = 1 where TABLE_ID = #{tableId}
- </delete>
- </mapper>
|