This commit is contained in:
王鹏
2025-08-14 14:32:37 +08:00
commit 48822a3444
925 changed files with 352599 additions and 0 deletions

View File

@@ -0,0 +1,270 @@
<?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.feast.coding.mapper.generator.ColunmMapper">
<!-- Result Map -->
<resultMap id="baseResultMap" type="cn.feast.coding.model.generator.Colunm">
<result column="id" property="id"/>
<result column="colunm_name" property="colunmName"/>
<result column="filed_name" property="filedName"/>
<result column="colunm_type" property="colunmType"/>
<result column="show_name" property="showName"/>
<result column="edit_style" property="editStyle"/>
<result column="is_primary" property="isPrimary"/>
<result column="is_showed" property="isShowed"/>
<result column="table_id" property="tableId"/>
<association property="table" column="table_id" select="cn.feast.coding.mapper.generator.TableMapper.queryById" />
</resultMap>
<resultMap id="queryResultMap" type="cn.feast.coding.model.generator.Colunm">
<result column="id" property="id"/>
<result column="colunm_name" property="colunmName"/>
<result column="filed_name" property="filedName"/>
<result column="colunm_type" property="colunmType"/>
<result column="show_name" property="showName"/>
<result column="edit_style" property="editStyle"/>
<result column="is_primary" property="isPrimary"/>
<result column="is_showed" property="isShowed"/>
<result column="table_id" property="tableId"/>
<association property="table" javaType="cn.feast.coding.model.generator.Table">
<id property="id" column="id"/>
<result property="tableName" column="table_name"/>
<result column="class_name" property="className"/>
<result column="show_name" property="showName"/>
<result column="show_style" property="showStyle"/>
<result column="project_id" property="projectId"/>
</association>
</resultMap>
<!-- table name -->
<sql id="table_name">
t_colunm
</sql>
<!-- property table all fields -->
<sql id="base_column_list">
id,
colunm_name,
filed_name,
colunm_type,
show_name,
edit_style,
is_primary,
is_showed,
table_id
</sql>
<sql id="update_clause">
<trim suffixOverrides=",">
<if test="colunmName != null and colunmName !=''">
colunm_name=#{colunmName},
</if>
<if test="filedName != null and filedName !=''">
filed_name=#{filedName},
</if>
<if test="colunmType != null and colunmType !=''">
colunm_type=#{colunmType},
</if>
<if test="showName != null and showName !=''">
show_name=#{showName},
</if>
<if test="editStyle != null">
edit_style=#{editStyle},
</if>
<if test="isPrimary != null">
is_primary=#{isPrimary},
</if>
<if test="isShowed != null">
is_showed=#{isShowed},
</if>
<if test="tableId != null">
table_id=#{tableId},
</if>
</trim>
</sql>
<sql id="query_where_clause">
where 1=1
<trim suffixOverrides=",">
<if test="id != null">
and id=#{id}
</if>
<if test="colunmName != null and colunmName !=''">
and colunm_name=#{colunmName}
</if>
<if test="filedName != null and filedName !=''">
and filed_name=#{filedName}
</if>
<if test="colunmType != null and colunmType !=''">
and colunm_type=#{colunmType}
</if>
<if test="showName != null and showName !=''">
and show_name=#{showName}
</if>
<if test="editStyle != null">
and edit_style=#{editStyle}
</if>
<if test="isPrimary != null">
and is_primary=#{isPrimary}
</if>
<if test="isShowed != null">
and is_showed=#{isShowed}
</if>
<if test="tableId != null">
and table_id=#{tableId}
</if>
</trim>
</sql>
<insert id="save" parameterType="Object">
insert into
<include refid="table_name"/>
(
colunm_name,
filed_name,
colunm_type,
show_name,
edit_style,
is_primary,
is_showed,
table_id
)
values
(
#{colunmName},
#{filedName},
#{colunmType},
#{showName},
#{editStyle},
#{isPrimary},
#{isShowed},
#{tableId}
)
</insert>
<insert id="saveByBatch" parameterType="Object">
insert into
<include refid="table_name"/>
(
colunm_name,
filed_name,
colunm_type,
show_name,
edit_style,
is_primary,
is_showed,
table_id
)
values
<foreach collection="list" item="c" separator=",">
(
#{c.colunmName},
#{c.filedName},
#{c.colunmType},
#{c.showName},
#{c.editStyle},
#{c.isPrimary},
#{c.isShowed},
#{c.tableId}
)
</foreach>
</insert>
<select id="queryById" resultMap="queryResultMap" parameterType="Object">
select
*
from
t_colunm c, t_table t
where
c.table_id = t.id
and c.id = #{id}
</select>
<select id="queryPrimaryKey" resultMap="queryResultMap" parameterType="Object">
select
*
from
t_colunm c, t_table t
where
c.table_id = t.id
and c.table_id = #{tableId}
and c.is_primary = 1
</select>
<select id="queryByTable" resultMap="queryResultMap" parameterType="Object">
select
*
from
t_colunm c, t_table t
where
c.table_id = t.id
and c.table_id = #{tableId}
order by c.id asc
</select>
<select id="queryByCount" resultType="java.lang.Integer" parameterType="Object">
select count(1) from
<include refid="table_name"/>
<include refid="query_where_clause"/>
</select>
<select id="queryByList" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name"/>
<include refid="query_where_clause"/>
order by id asc
${pageQueryCondition}
</select>
<select id="queryByColunm" resultMap="queryResultMap" parameterType="Object">
select
*
from
t_colunm c, t_table t
where
c.table_id = t.id
<if test="tableId != null">
and c.table_id=#{tableId}
</if>
</select>
<!--<select id="queryByColunm" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name"/>
<include refid="query_where_clause"/>
</select>-->
<update id="update" parameterType="Object">
update
<include refid="table_name"/>
set
<include refid="update_clause"/>
where id = #{id}
</update>
<update id="updateResult" parameterType="Object">
update
<include refid="table_name"/>
set
<include refid="update_clause"/>
where id = #{id}
</update>
<delete id="deleteById" parameterType="Object">
delete from
<include refid="table_name"/>
where id = #{id}
</delete>
<delete id="deleteProjectRelatedData" parameterType="Object">
delete
tc
from
t_colunm as tc, t_table as tt, t_project as tp
where
tc.table_id = tt.id
and tt.project_id = tp.id
and tp.id = #{projectId}
</delete>
</mapper>

View File

@@ -0,0 +1,154 @@
<?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.feast.coding.mapper.generator.DataSourceMapper">
<!-- Result Map -->
<resultMap id="baseResultMap" type="cn.feast.coding.model.generator.DataSource">
<result column="id" property="id"/>
<result column="name" property="name"/>
<result column="jdbc_url" property="jdbcUrl"/>
<result column="jdbc_user" property="jdbcUser"/>
<result column="jdbc_pass" property="jdbcPass"/>
<result column="is_default" property="isDefault"/>
</resultMap>
<!-- table name -->
<sql id="table_name">
t_data_source
</sql>
<!-- property table all fields -->
<sql id="base_column_list">
id,
name,
jdbc_url,
jdbc_user,
jdbc_pass,
is_default
</sql>
<sql id="update_clause">
<trim suffixOverrides=",">
<if test="name != null and name !=''">
name=#{name},
</if>
<if test="jdbcUrl != null and jdbcUrl !=''">
jdbc_url=#{jdbcUrl},
</if>
<if test="jdbcUser != null and jdbcUser !=''">
jdbc_user=#{jdbcUser},
</if>
<if test="jdbcPass != null and jdbcPass !=''">
jdbc_pass=#{jdbcPass},
</if>
<if test="isDefault != null">
is_default=#{isDefault},
</if>
</trim>
</sql>
<sql id="query_where_clause">
where 1=1
<trim suffixOverrides=",">
<if test="id != null">
and id=#{id}
</if>
<if test="name != null and name !=''">
and name=#{name}
</if>
<if test="jdbcUrl != null and jdbcUrl !=''">
and jdbc_url=#{jdbcUrl}
</if>
<if test="jdbcUser != null and jdbcUser !=''">
and jdbc_user=#{jdbcUser}
</if>
<if test="jdbcPass != null and jdbcPass !=''">
and jdbc_pass=#{jdbcPass}
</if>
<if test="isDefault != null">
and is_default=#{isDefault}
</if>
</trim>
</sql>
<insert id="save" parameterType="Object">
insert into
<include refid="table_name"/>
(
name,
jdbc_url,
jdbc_user,
jdbc_pass,
is_default
)
values
(
#{name},
#{jdbcUrl},
#{jdbcUser},
#{jdbcPass},
#{isDefault}
)
</insert>
<select id="queryById" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name"/>
where id = #{id}
</select>
<select id="queryAll" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name"/>
</select>
<select id="queryByCount" resultType="java.lang.Integer" parameterType="Object">
select count(1) from
<include refid="table_name"/>
<include refid="query_where_clause"/>
</select>
<select id="queryByList" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name"/>
<include refid="query_where_clause"/>
order by id desc
${pageQueryCondition}
</select>
<select id="queryByDataSource" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name"/>
<include refid="query_where_clause"/>
order by id desc
</select>
<update id="update" parameterType="Object">
update
<include refid="table_name"/>
set
<include refid="update_clause"/>
where id = #{id}
</update>
<update id="updateResult" parameterType="Object">
update
<include refid="table_name"/>
set
<include refid="update_clause"/>
where id = #{id}
</update>
<delete id="deleteById" parameterType="Object">
delete from
<include refid="table_name"/>
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,131 @@
<?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.feast.coding.mapper.generator.ModuleMapper">
<!-- Result Map -->
<resultMap id="baseResultMap" type="cn.feast.coding.model.generator.Module">
<result column="id" property="id"/>
<result column="module_name" property="moduleName"/>
<result column="module_desc" property="moduleDesc"/>
<result column="module_method" property="moduleMethod"/>
<result column="module_default" property="moduleDefault"/>
</resultMap>
<!-- table name -->
<sql id="table_name">
t_module
</sql>
<!-- property table all fields -->
<sql id="base_column_list">
id,
module_name,
module_desc,
module_method,
module_default
</sql>
<sql id="update_clause">
<trim suffixOverrides=",">
<if test="moduleName != null and moduleName !=''">
module_name=#{moduleName},
</if>
<if test="moduleDesc != null and moduleDesc !=''">
module_desc=#{moduleDesc},
</if>
<if test="moduleMethod != null and moduleMethod !=''">
module_method=#{moduleMethod},
</if>
<if test="moduleDefault != null">
module_default=#{moduleDefault},
</if>
</trim>
</sql>
<sql id="query_where_clause">
where 1=1
<trim suffixOverrides=",">
<if test="id != null">
and id=#{id}
</if>
<if test="moduleName != null and moduleName !=''">
and module_name=#{moduleName}
</if>
<if test="moduleDesc != null and moduleDesc !=''">
and module_desc=#{moduleDesc}
</if>
<if test="moduleMethod != null and moduleMethod !=''">
and module_method=#{moduleMethod}
</if>
<if test="moduleDefault != null">
and module_default=#{moduleDefault}
</if>
</trim>
</sql>
<insert id="save" parameterType="Object" >
insert into
<include refid="table_name" />
(
module_name,
module_desc,
module_method,
module_default
)
values
(
#{moduleName},
#{moduleDesc},
#{moduleMethod},
#{moduleDefault}
)
</insert>
<select id="queryById" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list" />
from <include refid="table_name" /> where id = #{id}
</select>
<select id="queryAll" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list" />
from <include refid="table_name" />
</select>
<select id="queryByCount" resultType="java.lang.Integer" parameterType="Object">
select count(1) from
<include refid="table_name" />
<include refid="query_where_clause" />
</select>
<select id="queryByList" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name" />
<include refid="query_where_clause"/>
order by id desc
${pageQueryCondition}
</select>
<select id="queryByModule" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name" />
<include refid="query_where_clause"/>
order by id desc
</select>
<update id="update" parameterType="Object" >
update <include refid="table_name" /> set <include refid="update_clause" /> where id = #{id}
</update>
<update id="updateResult" parameterType="Object" >
update <include refid="table_name" /> set <include refid="update_clause" /> where id = #{id}
</update>
<delete id="deleteById" parameterType="Object">
delete from <include refid="table_name" /> where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,271 @@
<?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.feast.coding.mapper.generator.ModuleProjectMapper">
<!-- Result Map -->
<resultMap id="baseResultMap" type="cn.feast.coding.model.generator.ModuleProject">
<result column="id" property="id"/>
<result column="module_id" property="moduleId"/>
<result column="project_id" property="projectId"/>
<result column="table_id" property="tableId"/>
<result column="module_param1" property="moduleParam1"/>
<result column="module_param1_type" property="moduleParam1Type"/>
<result column="module_param1_field" property="moduleParam1Field"/>
<result column="module_param2" property="moduleParam2"/>
<result column="module_param2_type" property="moduleParam2Type"/>
<result column="module_param2_field" property="moduleParam2Field"/>
<result column="module_param3" property="moduleParam3"/>
<result column="module_param3_type" property="moduleParam3Type"/>
<result column="module_param3_field" property="moduleParam3Field"/>
<association property="table" column="table_id" select="cn.feast.coding.mapper.generator.TableMapper.queryById" />
<association property="module" column="module_id" select="cn.feast.coding.mapper.generator.ModuleMapper.queryById" />
<association property="project" column="project_id" select="cn.feast.coding.mapper.generator.ProjectMapper.queryById" />
</resultMap>
<resultMap id="queryResultMap" type="cn.feast.coding.model.generator.ModuleProject">
<result column="id" property="id"/>
<result column="module_id" property="moduleId"/>
<result column="project_id" property="projectId"/>
<result column="table_id" property="tableId"/>
<result column="module_param1" property="moduleParam1"/>
<result column="module_param1_type" property="moduleParam1Type"/>
<result column="module_param1_field" property="moduleParam1Field"/>
<result column="module_param2" property="moduleParam2"/>
<result column="module_param2_type" property="moduleParam2Type"/>
<result column="module_param2_field" property="moduleParam2Field"/>
<result column="module_param3" property="moduleParam3"/>
<result column="module_param3_type" property="moduleParam3Type"/>
<result column="module_param3_field" property="moduleParam3Field"/>
<association property="project" javaType="cn.feast.coding.model.generator.Project">
<id property="id" column="id"/>
<result property="projectName" column="project_name"/>
</association>
<association property="module" javaType="cn.feast.coding.model.generator.Module">
<id property="id" column="id"/>
<result property="moduleName" column="module_name"/>
</association>
<association property="table" javaType="cn.feast.coding.model.generator.Table">
<id property="id" column="id"/>
<result property="tableName" column="table_name"/>
<result property="className" column="class_name"/>
</association>
</resultMap>
<!-- table name -->
<sql id="table_name">
t_module_project
</sql>
<!-- property table all fields -->
<sql id="base_column_list">
id,
module_id,
project_id,
table_id,
module_param1,
module_param1_type,
module_param1_field,
module_param2,
module_param2_type,
module_param2_field,
module_param3,
module_param3_type,
module_param3_field
</sql>
<sql id="update_clause">
<trim suffixOverrides=",">
<if test="moduleId != null">
module_id=#{moduleId},
</if>
<if test="projectId != null">
project_id=#{projectId},
</if>
<if test="tableId != null">
table_id=#{tableId},
</if>
<if test="moduleParam1 != null">
module_param1=#{moduleParam1},
</if>
<if test="moduleParam1Type != null">
module_param1_type=#{moduleParam1Type},
</if>
<if test="moduleParam1Field != null">
module_param1_field=#{moduleParam1Field},
</if>
<if test="moduleParam2 != null">
module_param2=#{moduleParam2},
</if>
<if test="moduleParam2Type != null">
module_param2_type=#{moduleParam2Type},
</if>
<if test="moduleParam2Field != null">
module_param2_field=#{moduleParam2Field},
</if>
<if test="moduleParam3 != null">
module_param3=#{moduleParam3},
</if>
<if test="moduleParam3Type != null">
module_param3_type=#{moduleParam3Type},
</if>
<if test="moduleParam3Field != null">
module_param3_field=#{moduleParam3Field},
</if>
</trim>
</sql>
<sql id="query_where_clause">
where 1=1
<trim suffixOverrides=",">
<if test="id != null">
and id=#{id}
</if>
<if test="moduleId != null">
and module_id=#{moduleId}
</if>
<if test="projectId != null">
and project_id=#{projectId}
</if>
<if test="tableId != null">
and table_id=#{tableId}
</if>
<if test="moduleParam1 != null">
and module_param1=#{moduleParam1}
</if>
<if test="moduleParam1Type != null">
and module_param1_type=#{moduleParam1Type}
</if>
<if test="moduleParam1Field != null">
and module_param1_field=#{moduleParam1Field}
</if>
<if test="moduleParam2 != null">
and module_param2=#{moduleParam2}
</if>
<if test="moduleParam2Type != null">
and module_param2_type=#{moduleParam2Type}
</if>
<if test="moduleParam2Field != null">
and module_param2_field=#{moduleParam2Field}
</if>
<if test="moduleParam3 != null">
and module_param3=#{moduleParam3}
</if>
<if test="moduleParam3Type != null">
and module_param3_type=#{moduleParam3Type}
</if>
<if test="moduleParam3Field != null">
and module_param3_field=#{moduleParam3Field}
</if>
</trim>
</sql>
<insert id="save" parameterType="Object" >
insert into
<include refid="table_name" />
(
module_id,
project_id,
table_id,
module_param1,
module_param1_type,
module_param1_field,
module_param2,
module_param2_type,
module_param2_field,
module_param3,
module_param3_type,
module_param3_field
)
values
(
#{moduleId},
#{projectId},
#{tableId},
#{moduleParam1},
#{moduleParam1Type},
#{moduleParam1Field},
#{moduleParam2},
#{moduleParam2Type},
#{moduleParam2Field},
#{moduleParam3},
#{moduleParam3Type},
#{moduleParam3Field}
)
</insert>
<select id="queryById" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list" />
from <include refid="table_name" /> where id = #{id}
</select>
<select id="queryByModule" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list" />
from <include refid="table_name" /> where module_id = #{moduleId}
</select>
<select id="queryByProject" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list" />
from <include refid="table_name" /> where project_id = #{projectId}
</select>
<select id="queryByProjectAndModule" resultMap="queryResultMap" parameterType="Object">
select
*
from
t_module_project mp, t_module m, t_table t
where
mp.module_id = m.id
and mp.table_id = t.id
and mp.project_id = #{projectId}
and m.module_method = #{moduleName}
</select>
<select id="queryByCount" resultType="java.lang.Integer" parameterType="Object">
select count(1) from
<include refid="table_name" />
<include refid="query_where_clause" />
</select>
<select id="queryByList" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name" />
<include refid="query_where_clause"/>
order by id desc
${pageQueryCondition}
</select>
<select id="queryByModuleProject" resultMap="queryResultMap" parameterType="Object">
select
*
from
t_module_project mp, t_project p, t_table t, t_module m
where 1=1
<if test="projectId != null">
and mp.project_id=#{projectId}
</if>
and mp.module_id = m.id
and mp.project_id = p.id
and mp.table_id = t.id
order by mp.id desc
</select>
<update id="update" parameterType="Object" >
update <include refid="table_name" /> set <include refid="update_clause" /> where id = #{id}
</update>
<update id="updateResult" parameterType="Object" >
update <include refid="table_name" /> set <include refid="update_clause" /> where id = #{id}
</update>
<delete id="deleteById" parameterType="Object">
delete from <include refid="table_name" /> where id = #{id}
</delete>
<delete id="deleteProjectRelatedData" parameterType="Object">
delete from <include refid="table_name" /> where project_id = #{projectId}
</delete>
</mapper>

View File

@@ -0,0 +1,172 @@
<?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.feast.coding.mapper.generator.PageTemplateMapper">
<!-- Result Map -->
<resultMap id="baseResultMap" type="cn.feast.coding.model.generator.PageTemplate">
<result column="id" property="id"/>
<result column="page_name" property="pageName"/>
<result column="page_path" property="pagePath"/>
<result column="page_imag" property="pageImag"/>
<result column="page_frame" property="pageFrame"/>
<result column="page_desc" property="pageDesc"/>
<result column="page_default" property="pageDefault"/>
</resultMap>
<!-- table name -->
<sql id="table_name">
t_page_template
</sql>
<!-- property table all fields -->
<sql id="base_column_list">
id,
page_name,
page_path,
page_imag,
page_frame,
page_desc,
page_default
</sql>
<sql id="update_clause">
<trim suffixOverrides=",">
<if test="pageName != null and pageName !=''">
page_name=#{pageName},
</if>
<if test="pagePath != null and pagePath !=''">
page_path=#{pagePath},
</if>
<if test="pageImag != null and pageImag !=''">
page_imag=#{pageImag},
</if>
<if test="pageFrame != null and pageFrame !=''">
page_frame=#{pageFrame},
</if>
<if test="pageDesc != null and pageDesc !=''">
page_desc=#{pageDesc},
</if>
<if test="pageDefault != null and pageDefault !=''">
page_default=#{pageDefault},
</if>
</trim>
</sql>
<sql id="query_where_clause">
where 1=1
<trim suffixOverrides=",">
<if test="id != null">
and id=#{id}
</if>
<if test="pageName != null and pageName !=''">
and page_name=#{pageName}
</if>
<if test="pagePath != null and pagePath !=''">
and page_path=#{pagePath}
</if>
<if test="pageImag != null and pageImag !=''">
and page_imag=#{pageImag}
</if>
<if test="pageFrame != null and pageFrame !=''">
and page_frame=#{pageFrame}
</if>
<if test="pageDesc != null and pageDesc !=''">
and page_desc=#{pageDesc}
</if>
<if test="pageDefault != null">
and page_default=#{pageDefault}
</if>
</trim>
</sql>
<insert id="save" parameterType="Object">
insert into
<include refid="table_name"/>
(
page_name,
page_path,
page_imag,
page_frame,
page_desc,
page_default
)
values
(
#{pageName},
#{pagePath},
#{pageImag},
#{pageFrame},
#{pageDesc},
#{pageDefault}
)
</insert>
<select id="queryById" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name"/>
where id = #{id}
</select>
<select id="queryAll" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name"/>
</select>
<select id="getPage" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name"/>
where
FIND_IN_SET(#{templateType}, page_frame)
</select>
<select id="queryByCount" resultType="java.lang.Integer" parameterType="Object">
select count(1) from
<include refid="table_name"/>
<include refid="query_where_clause"/>
</select>
<select id="queryByList" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name"/>
<include refid="query_where_clause"/>
order by id desc
${pageQueryCondition}
</select>
<select id="queryByPageTemplate" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name"/>
<include refid="query_where_clause"/>
order by id desc
</select>
<update id="update" parameterType="Object">
update
<include refid="table_name"/>
set
<include refid="update_clause"/>
where id = #{id}
</update>
<update id="updateResult" parameterType="Object">
update
<include refid="table_name"/>
set
<include refid="update_clause"/>
where id = #{id}
</update>
<delete id="deleteById" parameterType="Object">
delete from
<include refid="table_name"/>
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,204 @@
<?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.feast.coding.mapper.generator.ProjectMapper">
<!-- Result Map -->
<resultMap id="baseResultMap" type="cn.feast.coding.model.generator.Project">
<result column="id" property="id"/>
<result column="project_name" property="projectName"/>
<result column="project_file_name" property="projectFileName"/>
<result column="project_desc" property="projectDesc"/>
<result column="data_sourse" property="dataSourse"/>
<result column="pack_name" property="packName"/>
<result column="page_path" property="pagePath"/>
<result column="page_style" property="pageStyle"/>
<result column="template_type" property="templateType"/>
</resultMap>
<resultMap id="queryResultMap" type="cn.feast.coding.model.generator.Project">
<result column="id" property="id"/>
<result column="project_name" property="projectName"/>
<result column="project_file_name" property="projectFileName"/>
<result column="project_desc" property="projectDesc"/>
<result column="data_sourse" property="dataSourse"/>
<result column="pack_name" property="packName"/>
<result column="page_path" property="pagePath"/>
<result column="page_style" property="pageStyle"/>
<result column="template_type" property="templateType"/>
<association property="dataSource" javaType="cn.feast.coding.model.generator.DataSource">
<id property="id" column="id"/>
<result property="name" column="name"/>
</association>
<association property="pageTemplate" javaType="cn.feast.coding.model.generator.PageTemplate">
<id property="id" column="id"/>
<result property="pageName" column="page_name"/>
</association>
</resultMap>
<!-- table name -->
<sql id="table_name">
t_project
</sql>
<!-- property table all fields -->
<sql id="base_column_list">
id,
project_name,
project_file_name,
project_desc,
data_sourse,
pack_name,
page_path,
page_style,
template_type
</sql>
<sql id="update_clause">
<trim suffixOverrides=",">
<if test="projectName != null and projectName !=''">
project_name=#{projectName},
</if>
<if test="projectFileName != null and projectFileName !=''">
project_file_name=#{projectFileName},
</if>
<if test="projectDesc != null and projectDesc !=''">
project_desc=#{projectDesc},
</if>
<if test="dataSourse != null">
data_sourse=#{dataSourse},
</if>
<if test="packName != null and packName !=''">
pack_name=#{packName},
</if>
<if test="pagePath != null and pagePath !=''">
page_path=#{pagePath},
</if>
<if test="pageStyle != null">
page_style=#{pageStyle},
</if>
<if test="templateType != null">
template_type=#{templateType},
</if>
</trim>
</sql>
<sql id="query_where_clause">
where 1=1
<trim suffixOverrides=",">
<if test="id != null">
and id=#{id}
</if>
<if test="projectName != null and projectName !=''">
and project_name LIKE CONCAT(CONCAT('%', #{projectName}), '%')
</if>
<if test="projectFileName != null and projectFileName !=''">
and project_file_name=#{projectFileName}
</if>
<if test="projectDesc != null and projectDesc !=''">
and project_desc=#{projectDesc}
</if>
<if test="dataSourse != null">
and data_sourse=#{dataSourse}
</if>
<if test="packName != null and packName !=''">
and pack_name=#{packName}
</if>
<if test="pagePath != null and pagePath !=''">
and page_path=#{pagePath}
</if>
<if test="pageStyle != null">
and page_style=#{pageStyle}
</if>
<if test="templateType != null">
and template_type=#{templateType}
</if>
</trim>
</sql>
<insert id="save" parameterType="Object" >
insert into
<include refid="table_name" />
(
project_name,
project_file_name,
project_desc,
data_sourse,
pack_name,
page_path,
page_style,
template_type
)
values
(
#{projectName},
#{projectFileName},
#{projectDesc},
#{dataSourse},
#{packName},
#{pagePath},
#{pageStyle},
#{templateType}
)
</insert>
<select id="queryById" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list" />
from <include refid="table_name" /> where id = #{id}
</select>
<select id="queryByDataSource" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list" />
from <include refid="table_name" /> where data_sourse = #{dataSourceId}
</select>
<select id="queryByPageTemplate" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list" />
from <include refid="table_name" /> where page_style = #{pageTemplateId}
</select>
<select id="queryAll" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list" />
from <include refid="table_name" />
</select>
<select id="queryByCount" resultType="java.lang.Integer" parameterType="Object">
select count(1) from
<include refid="table_name" />
<include refid="query_where_clause" />
</select>
<select id="queryByList" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name" />
<include refid="query_where_clause"/>
order by id desc
${pageQueryCondition}
</select>
<select id="queryByProject" resultMap="queryResultMap" parameterType="Object">
select
*
from
t_project p, t_data_source ds, t_page_template pt
<include refid="query_where_clause"/>
and p.data_sourse = ds.id
and p.page_style = pt.id
order by p.id desc
</select>
<update id="update" parameterType="Object" >
update <include refid="table_name" /> set <include refid="update_clause" /> where id = #{id}
</update>
<update id="updateResult" parameterType="Object" >
update <include refid="table_name" /> set <include refid="update_clause" /> where id = #{id}
</update>
<delete id="deleteById" parameterType="Object">
delete from <include refid="table_name" /> where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,197 @@
<?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.feast.coding.mapper.generator.TableMapper">
<!-- Result Map -->
<resultMap id="baseResultMap" type="cn.feast.coding.model.generator.Table">
<result column="id" property="id"/>
<result column="table_name" property="tableName"/>
<result column="class_name" property="className"/>
<result column="show_name" property="showName"/>
<result column="show_style" property="showStyle"/>
<result column="project_id" property="projectId"/>
</resultMap>
<resultMap id="queryResultMap" type="cn.feast.coding.model.generator.Table">
<result column="id" property="id"/>
<result column="table_name" property="tableName"/>
<result column="class_name" property="className"/>
<result column="show_name" property="showName"/>
<result column="show_style" property="showStyle"/>
<result column="project_id" property="projectId"/>
</resultMap>
<!-- table name -->
<sql id="table_name">
t_table
</sql>
<!-- property table all fields -->
<sql id="base_column_list">
id,
table_name,
class_name,
show_name,
show_style,
project_id
</sql>
<sql id="update_clause">
<trim suffixOverrides=",">
<if test="tableName != null and tableName !=''">
table_name=#{tableName},
</if>
<if test="className != null and className !=''">
class_name=#{className},
</if>
<if test="showName != null and showName !=''">
show_name=#{showName},
</if>
<if test="showStyle != null">
show_style=#{showStyle},
</if>
<if test="projectId != null">
project_id=#{projectId},
</if>
</trim>
</sql>
<sql id="query_where_clause">
where 1=1
<trim suffixOverrides=",">
<if test="id != null">
and id=#{id}
</if>
<if test="tableName != null and tableName !=''">
and table_name=#{tableName}
</if>
<if test="className != null and className !=''">
and class_name=#{className}
</if>
<if test="showName != null and showName !=''">
and show_name=#{showName}
</if>
<if test="showStyle != null">
and show_style=#{showStyle}
</if>
<if test="projectId != null">
and project_id=#{projectId}
</if>
</trim>
</sql>
<insert id="save" parameterType="Object">
<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
SELECT LAST_INSERT_ID() AS id
</selectKey>
insert into
<include refid="table_name"/>
(
table_name,
class_name,
show_name,
show_style,
project_id
)
values
(
#{tableName},
#{className},
#{showName},
#{showStyle},
#{projectId}
)
</insert>
<insert id="saveByBatch" parameterType="Object">
insert into
<include refid="table_name"/>
(
table_name,
class_name,
show_name,
show_style,
project_id
)
values
<foreach collection="list" item="t" separator=",">
(
#{t.tableName},
#{t.className},
#{t.showName},
#{t.showStyle},
#{t.projectId}
)
</foreach>
</insert>
<select id="queryById" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name"/>
where id = #{id}
</select>
<select id="queryByProject" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name"/>
where project_id = #{projectId}
</select>
<select id="queryByCount" resultType="java.lang.Integer" parameterType="Object">
select count(1) from
<include refid="table_name"/>
<include refid="query_where_clause"/>
</select>
<select id="queryByList" resultMap="baseResultMap" parameterType="Object">
select
<include refid="base_column_list"/>
from
<include refid="table_name"/>
<include refid="query_where_clause"/>
${pageQueryCondition}
</select>
<select id="queryByTable" resultMap="queryResultMap" parameterType="Object">
select
*
from
t_table t, t_project p
<include refid="query_where_clause"/>
and t.project_id = p.id
</select>
<update id="update" parameterType="Object">
update
<include refid="table_name"/>
set
<include refid="update_clause"/>
where id = #{id}
</update>
<update id="updateResult" parameterType="Object">
update
<include refid="table_name"/>
set
<include refid="update_clause"/>
where id = #{id}
</update>
<delete id="deleteById" parameterType="Object">
delete from
<include refid="table_name"/>
where id = #{id}
</delete>
<delete id="deleteProjectRelatedData" parameterType="Object">
delete
tt
from
t_table as tt, t_project as tp
where
tt.project_id = tp.id
and tp.id = #{projectId}
</delete>
</mapper>