This commit is contained in:
王鹏
2025-08-14 14:43:47 +08:00
commit a8bd6c53be
714 changed files with 79106 additions and 0 deletions

View File

@@ -0,0 +1,78 @@
<?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.ruoyi.generator.mapper.DatasourceMapper">
<resultMap type="Datasource" id="DatasourceResult">
<result property="datasourceId" column="datasource_id" />
<result property="datasourceName" column="datasource_name" />
<result property="driver" column="driver" />
<result property="url" column="url" />
<result property="user" column="user" />
<result property="password" column="password" />
</resultMap>
<sql id="selectDatasourceVo">
select datasource_id, datasource_name, driver, url, user, password from sys_datasource
</sql>
<select id="selectDatasourceList" parameterType="Datasource" resultMap="DatasourceResult">
<include refid="selectDatasourceVo"/>
<where>
<if test="datasourceName != null and datasourceName != ''"> and datasource_name like concat('%', #{datasourceName}, '%')</if>
<if test="driver != null and driver != ''"> and driver = #{driver}</if>
<if test="url != null and url != ''"> and url = #{url}</if>
<if test="user != null and user != ''"> and user = #{user}</if>
<if test="password != null and password != ''"> and password = #{password}</if>
</where>
</select>
<select id="selectDatasourceByDatasourceId" parameterType="Long" resultMap="DatasourceResult">
<include refid="selectDatasourceVo"/>
where datasource_id = #{datasourceId}
</select>
<insert id="insertDatasource" parameterType="Datasource">
insert into sys_datasource
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="datasourceId != null">datasource_id,</if>
<if test="datasourceName != null">datasource_name,</if>
<if test="driver != null">driver,</if>
<if test="url != null">url,</if>
<if test="user != null">user,</if>
<if test="password != null">password,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="datasourceId != null">#{datasourceId},</if>
<if test="datasourceName != null">#{datasourceName},</if>
<if test="driver != null">#{driver},</if>
<if test="url != null">#{url},</if>
<if test="user != null">#{user},</if>
<if test="password != null">#{password},</if>
</trim>
</insert>
<update id="updateDatasource" parameterType="Datasource">
update sys_datasource
<trim prefix="SET" suffixOverrides=",">
<if test="datasourceName != null">datasource_name = #{datasourceName},</if>
<if test="driver != null">driver = #{driver},</if>
<if test="url != null">url = #{url},</if>
<if test="user != null">user = #{user},</if>
<if test="password != null">password = #{password},</if>
</trim>
where datasource_id = #{datasourceId}
</update>
<delete id="deleteDatasourceByDatasourceId" parameterType="Long">
delete from sys_datasource where datasource_id = #{datasourceId}
</delete>
<delete id="deleteDatasourceByDatasourceIds" parameterType="String">
delete from sys_datasource where datasource_id in
<foreach item="datasourceId" collection="array" open="(" separator="," close=")">
#{datasourceId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,116 @@
<?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.ruoyi.generator.mapper.GenProjectMapper">
<resultMap type="GenProject" id="GenProjectResult">
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="projectFileName" column="project_file_name" />
<result property="packageName" column="package_name" />
<result property="version" column="version" />
<result property="projectDesc" column="project_desc" />
<result property="author" column="author" />
<result property="frontFramework" column="front_framework" />
<result property="backFramework" column="back_framework" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectGenProjectVo">
select project_id, project_name, project_file_name, package_name, version, project_desc, author, front_framework, back_framework, status, create_by, create_time, update_by, update_time, remark from gen_project
</sql>
<select id="selectGenProjectList" parameterType="GenProject" resultMap="GenProjectResult">
<include refid="selectGenProjectVo"/>
<where>
<if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
<if test="projectFileName != null and projectFileName != ''"> and project_file_name like concat('%', #{projectFileName}, '%')</if>
<if test="packageName != null and packageName != ''"> and package_name like concat('%', #{packageName}, '%')</if>
<if test="version != null and version != ''"> and version = #{version}</if>
<if test="projectDesc != null and projectDesc != ''"> and project_desc like concat('%', #{projectDesc}, '%')</if>
<if test="author != null and author != ''"> and author like concat('%', #{author}, '%')</if>
<if test="frontFramework != null and frontFramework != ''"> and front_framework = #{frontFramework}</if>
<if test="backFramework != null and backFramework != ''"> and back_framework = #{backFramework}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectGenProjectById" parameterType="Long" resultMap="GenProjectResult">
<include refid="selectGenProjectVo"/>
where project_id = #{projectId}
</select>
<insert id="insertGenProject" parameterType="GenProject" useGeneratedKeys="true" keyProperty="projectId">
insert into gen_project
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="projectName != null">project_name,</if>
<if test="projectFileName != null">project_file_name,</if>
<if test="packageName != null">package_name,</if>
<if test="version != null">version,</if>
<if test="projectDesc != null">project_desc,</if>
<if test="author != null">author,</if>
<if test="frontFramework != null">front_framework,</if>
<if test="backFramework != null">back_framework,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectName != null">#{projectName},</if>
<if test="projectFileName != null">#{projectFileName},</if>
<if test="packageName != null">#{packageName},</if>
<if test="version != null">#{version},</if>
<if test="projectDesc != null">#{projectDesc},</if>
<if test="author != null">#{author},</if>
<if test="frontFramework != null">#{frontFramework},</if>
<if test="backFramework != null">#{backFramework},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateGenProject" parameterType="GenProject">
update gen_project
<trim prefix="SET" suffixOverrides=",">
<if test="projectName != null">project_name = #{projectName},</if>
<if test="projectFileName != null">project_file_name = #{projectFileName},</if>
<if test="packageName != null">package_name = #{packageName},</if>
<if test="version != null">version = #{version},</if>
<if test="projectDesc != null">project_desc = #{projectDesc},</if>
<if test="author != null">author = #{author},</if>
<if test="frontFramework != null">front_framework = #{frontFramework},</if>
<if test="backFramework != null">back_framework = #{backFramework},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where project_id = #{projectId}
</update>
<delete id="deleteGenProjectById" parameterType="Long">
delete from gen_project where project_id = #{projectId}
</delete>
<delete id="deleteGenProjectByIds" parameterType="String">
delete from gen_project where project_id in
<foreach item="projectId" collection="array" open="(" separator="," close=")">
#{projectId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,127 @@
<?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.ruoyi.generator.mapper.GenTableColumnMapper">
<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="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectGenTableColumnVo">
select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column
</sql>
<select id="selectGenTableColumnListByTableId" parameterType="Long" resultMap="GenTableColumnResult">
<include refid="selectGenTableColumnVo"/>
where table_id = #{tableId}
order by sort
</select>
<select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else '0' end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type
from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
order by ordinal_position
</select>
<insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId">
insert into gen_table_column (
<if test="tableId != null and tableId != ''">table_id,</if>
<if test="columnName != null and columnName != ''">column_name,</if>
<if test="columnComment != null and columnComment != ''">column_comment,</if>
<if test="columnType != null and columnType != ''">column_type,</if>
<if test="javaType != null and javaType != ''">java_type,</if>
<if test="javaField != null and javaField != ''">java_field,</if>
<if test="isPk != null and isPk != ''">is_pk,</if>
<if test="isIncrement != null and isIncrement != ''">is_increment,</if>
<if test="isRequired != null and isRequired != ''">is_required,</if>
<if test="isInsert != null and isInsert != ''">is_insert,</if>
<if test="isEdit != null and isEdit != ''">is_edit,</if>
<if test="isList != null and isList != ''">is_list,</if>
<if test="isQuery != null and isQuery != ''">is_query,</if>
<if test="queryType != null and queryType != ''">query_type,</if>
<if test="htmlType != null and htmlType != ''">html_type,</if>
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="sort != null">sort,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="tableId != null and tableId != ''">#{tableId},</if>
<if test="columnName != null and columnName != ''">#{columnName},</if>
<if test="columnComment != null and columnComment != ''">#{columnComment},</if>
<if test="columnType != null and columnType != ''">#{columnType},</if>
<if test="javaType != null and javaType != ''">#{javaType},</if>
<if test="javaField != null and javaField != ''">#{javaField},</if>
<if test="isPk != null and isPk != ''">#{isPk},</if>
<if test="isIncrement != null and isIncrement != ''">#{isIncrement},</if>
<if test="isRequired != null and isRequired != ''">#{isRequired},</if>
<if test="isInsert != null and isInsert != ''">#{isInsert},</if>
<if test="isEdit != null and isEdit != ''">#{isEdit},</if>
<if test="isList != null and isList != ''">#{isList},</if>
<if test="isQuery != null and isQuery != ''">#{isQuery},</if>
<if test="queryType != null and queryType != ''">#{queryType},</if>
<if test="htmlType != null and htmlType != ''">#{htmlType},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="sort != null">#{sort},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateGenTableColumn" parameterType="GenTableColumn">
update gen_table_column
<set>
<if test="columnComment != null">column_comment = #{columnComment},</if>
<if test="javaType != null">java_type = #{javaType},</if>
<if test="javaField != null">java_field = #{javaField},</if>
<if test="isInsert != null">is_insert = #{isInsert},</if>
<if test="isEdit != null">is_edit = #{isEdit},</if>
<if test="isList != null">is_list = #{isList},</if>
<if test="isQuery != null">is_query = #{isQuery},</if>
<if test="isRequired != null">is_required = #{isRequired},</if>
<if test="queryType != null">query_type = #{queryType},</if>
<if test="htmlType != null">html_type = #{htmlType},</if>
<if test="dictType != null">dict_type = #{dictType},</if>
<if test="sort != null">sort = #{sort},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where column_id = #{columnId}
</update>
<delete id="deleteGenTableColumnByIds" parameterType="Long">
delete from gen_table_column where table_id in
<foreach collection="array" item="tableId" open="(" separator="," close=")">
#{tableId}
</foreach>
</delete>
<delete id="deleteGenTableColumns">
delete from gen_table_column where column_id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.columnId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,221 @@
<?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.ruoyi.generator.mapper.GenTableMapper">
<resultMap type="GenTable" id="GenTableResult">
<id 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="tplWebType" column="tpl_web_type" />
<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="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="createTableSql" column="create_table_sql" />
<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="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectGenTableVo">
select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, tpl_web_type, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark, create_table_sql from gen_table
</sql>
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
<include refid="selectGenTableVo"/>
<where>
<if test="tableName != null and tableName != ''">
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
</if>
<if test="tableComment != null and tableComment != ''">
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
</where>
</select>
<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time from information_schema.tables
where table_schema = (select database())
AND table_name NOT LIKE 'qrtz\_%' AND table_name NOT LIKE 'gen\_%'
AND table_name NOT IN (select table_name from gen_table)
<if test="tableName != null and tableName != ''">
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
</if>
<if test="tableComment != null and tableComment != ''">
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
order by create_time desc
</select>
<select id="selectDbTableListByNames" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time from information_schema.tables
where table_name NOT LIKE 'qrtz\_%' and table_name NOT LIKE 'gen\_%' and table_schema = (select database())
and table_name in
<foreach collection="array" item="name" open="(" separator="," close=")">
#{name}
</foreach>
</select>
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time from information_schema.tables
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
and table_name = #{tableName}
</select>
<select id="selectGenTableById" parameterType="Long" 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.tpl_web_type, 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, t.create_table_sql,
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, c.dict_type, c.sort
FROM gen_table t
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
where t.table_id = #{tableId} order by c.sort
</select>
<select id="selectGenTableByName" 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.tpl_web_type, 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, t.create_table_sql,
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, c.dict_type, c.sort
FROM gen_table t
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
where t.table_name = #{tableName} order by c.sort
</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.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark, t.create_table_sql,
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, c.dict_type, c.sort
FROM gen_table t
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
order by c.sort
</select>
<insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId">
insert into gen_table (
<if test="tableName != null">table_name,</if>
<if test="tableComment != null and tableComment != ''">table_comment,</if>
<if test="className != null and className != ''">class_name,</if>
<if test="tplCategory != null and tplCategory != ''">tpl_category,</if>
<if test="tplWebType != null and tplWebType != ''">tpl_web_type,</if>
<if test="packageName != null and packageName != ''">package_name,</if>
<if test="moduleName != null and moduleName != ''">module_name,</if>
<if test="businessName != null and businessName != ''">business_name,</if>
<if test="functionName != null and functionName != ''">function_name,</if>
<if test="functionAuthor != null and functionAuthor != ''">function_author,</if>
<if test="genType != null and genType != ''">gen_type,</if>
<if test="genPath != null and genPath != ''">gen_path,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createTableSql != null and createTableSql != ''">create_table_sql,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="tableName != null">#{tableName},</if>
<if test="tableComment != null and tableComment != ''">#{tableComment},</if>
<if test="className != null and className != ''">#{className},</if>
<if test="tplCategory != null and tplCategory != ''">#{tplCategory},</if>
<if test="tplWebType != null and tplWebType != ''">#{tplWebType},</if>
<if test="packageName != null and packageName != ''">#{packageName},</if>
<if test="moduleName != null and moduleName != ''">#{moduleName},</if>
<if test="businessName != null and businessName != ''">#{businessName},</if>
<if test="functionName != null and functionName != ''">#{functionName},</if>
<if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if>
<if test="genType != null and genType != ''">#{genType},</if>
<if test="genPath != null and genPath != ''">#{genPath},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createTableSql != null and createTableSql != ''">#{createTableSql},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="createTable">
${sql}
</update>
<update id="updateGenTable" parameterType="GenTable">
update gen_table
<set>
<if test="tableName != null">table_name = #{tableName},</if>
<if test="tableComment != null and tableComment != ''">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 and className != ''">class_name = #{className},</if>
<if test="functionAuthor != null and functionAuthor != ''">function_author = #{functionAuthor},</if>
<if test="genType != null and genType != ''">gen_type = #{genType},</if>
<if test="genPath != null and genPath != ''">gen_path = #{genPath},</if>
<if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if>
<if test="tplWebType != null and tplWebType != ''">tpl_web_type = #{tplWebType},</if>
<if test="packageName != null and packageName != ''">package_name = #{packageName},</if>
<if test="moduleName != null and moduleName != ''">module_name = #{moduleName},</if>
<if test="businessName != null and businessName != ''">business_name = #{businessName},</if>
<if test="functionName != null and functionName != ''">function_name = #{functionName},</if>
<if test="options != null and options != ''">options = #{options},</if>
<if test="createTableSql != null">create_table_sql = #{createTableSql},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where table_id = #{tableId}
</update>
<delete id="deleteGenTableByIds" parameterType="Long">
delete from gen_table where table_id in
<foreach collection="array" item="tableId" open="(" separator="," close=")">
#{tableId}
</foreach>
</delete>
<select id="selectGenTablesByProjectId" parameterType="Long" resultMap="GenTableResult">
SELECT distinct t.*
from gen_table t
INNER JOIN sys_project_table spt ON t.table_id = spt.table_id
WHERE spt.project_id = #{projectId}
</select>
</mapper>

View File

@@ -0,0 +1,130 @@
<?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.ruoyi.generator.mapper.SysCodeSnippetMapper">
<resultMap type="SysCodeSnippet" id="SysCodeSnippetResult">
<result property="snippetId" column="snippet_id" />
<result property="moduleId" column="module_id" />
<result property="snippetContent" column="snippet_content" />
<result property="insertPoint" column="insert_point" />
<result property="param1" column="param1" />
<result property="param2" column="param2" />
<result property="param3" column="param3" />
<result property="param4" column="param4" />
<result property="param5" column="param5" />
<result property="templateFileName" column="template_file_name" />
<result property="relationTableName" column="relation_table_name" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSysCodeSnippetVo">
select snippet_id, module_id, snippet_content, insert_point, param1, param2, param3, param4, param5, template_file_name, relation_table_name, status, del_flag, create_by, create_time, update_by, update_time, remark from sys_code_snippet
</sql>
<select id="selectSysCodeSnippetList" parameterType="SysCodeSnippet" resultMap="SysCodeSnippetResult">
<include refid="selectSysCodeSnippetVo"/>
<where>
<if test="relationTableName != null and relationTableName != ''"> and relation_table_name = #{relationTableName}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="moduleId != null and moduleId != ''"> and module_id = #{moduleId}</if>
<if test="moduleIds != null and moduleIds.size() > 0">
and snippet_id IN (
SELECT DISTINCT snippet_id FROM sys_code_snippet_module WHERE module_id IN
<foreach item="moduleId" collection="moduleIds" open="(" separator="," close=")">
#{moduleId}
</foreach>
)
</if>
</where>
</select>
<select id="selectSysCodeSnippetBySnippetId" parameterType="Long" resultMap="SysCodeSnippetResult">
<include refid="selectSysCodeSnippetVo"/>
where snippet_id = #{snippetId}
</select>
<insert id="insertSysCodeSnippet" parameterType="SysCodeSnippet" useGeneratedKeys="true" keyProperty="snippetId">
insert into sys_code_snippet
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="moduleId != null">module_id,</if>
<if test="snippetContent != null and snippetContent != ''">snippet_content,</if>
<if test="insertPoint != null">insert_point,</if>
<if test="param1 != null">param1,</if>
<if test="param2 != null">param2,</if>
<if test="param3 != null">param3,</if>
<if test="param4 != null">param4,</if>
<if test="param5 != null">param5,</if>
<if test="templateFileName != null and templateFileName != ''">template_file_name,</if>
<if test="relationTableName != null">relation_table_name,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="moduleId != null">#{moduleId},</if>
<if test="snippetContent != null and snippetContent != ''">#{snippetContent},</if>
<if test="insertPoint != null">#{insertPoint},</if>
<if test="param1 != null">#{param1},</if>
<if test="param2 != null">#{param2},</if>
<if test="param3 != null">#{param3},</if>
<if test="param4 != null">#{param4},</if>
<if test="param5 != null">#{param5},</if>
<if test="templateFileName != null and templateFileName != ''">#{templateFileName},</if>
<if test="relationTableName != null">#{relationTableName},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSysCodeSnippet" parameterType="SysCodeSnippet">
update sys_code_snippet
<trim prefix="SET" suffixOverrides=",">
<if test="moduleId != null">module_id = #{moduleId},</if>
<if test="snippetContent != null and snippetContent != ''">snippet_content = #{snippetContent},</if>
<if test="insertPoint != null">insert_point = #{insertPoint},</if>
<if test="param1 != null">param1 = #{param1},</if>
<if test="param2 != null">param2 = #{param2},</if>
<if test="param3 != null">param3 = #{param3},</if>
<if test="param4 != null">param4 = #{param4},</if>
<if test="param5 != null">param5 = #{param5},</if>
<if test="templateFileName != null and templateFileName != ''">template_file_name = #{templateFileName},</if>
<if test="relationTableName != null">relation_table_name = #{relationTableName},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where snippet_id = #{snippetId}
</update>
<delete id="deleteSysCodeSnippetBySnippetId" parameterType="Long">
delete from sys_code_snippet where snippet_id = #{snippetId}
</delete>
<delete id="deleteSysCodeSnippetBySnippetIds" parameterType="String">
delete from sys_code_snippet where snippet_id in
<foreach item="snippetId" collection="array" open="(" separator="," close=")">
#{snippetId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,95 @@
<?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.ruoyi.generator.mapper.SysModuleMapper">
<resultMap type="SysModule" id="SysModuleResult">
<result property="moduleId" column="module_id" />
<result property="moduleName" column="module_name" />
<result property="moduleAlias" column="module_alias" />
<result property="moduleDesc" column="module_desc" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSysModuleVo">
select module_id, module_name, module_alias, module_desc, status, del_flag, create_by, create_time, update_by, update_time, remark from sys_module
</sql>
<select id="selectSysModuleList" parameterType="SysModule" resultMap="SysModuleResult">
<include refid="selectSysModuleVo"/>
<where>
<if test="moduleName != null and moduleName != ''"> and module_name like concat('%', #{moduleName}, '%')</if>
<if test="moduleAlias != null and moduleAlias != ''"> and module_alias = #{moduleAlias}</if>
<if test="moduleDesc != null and moduleDesc != ''"> and module_desc = #{moduleDesc}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectSysModuleByModuleId" parameterType="Long" resultMap="SysModuleResult">
<include refid="selectSysModuleVo"/>
where module_id = #{moduleId}
</select>
<insert id="insertSysModule" parameterType="SysModule" useGeneratedKeys="true" keyProperty="moduleId">
insert into sys_module
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="moduleName != null and moduleName != ''">module_name,</if>
<if test="moduleAlias != null">module_alias,</if>
<if test="moduleDesc != null">module_desc,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="moduleName != null and moduleName != ''">#{moduleName},</if>
<if test="moduleAlias != null">#{moduleAlias},</if>
<if test="moduleDesc != null">#{moduleDesc},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSysModule" parameterType="SysModule">
update sys_module
<trim prefix="SET" suffixOverrides=",">
<if test="moduleName != null and moduleName != ''">module_name = #{moduleName},</if>
<if test="moduleAlias != null">module_alias = #{moduleAlias},</if>
<if test="moduleDesc != null">module_desc = #{moduleDesc},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where module_id = #{moduleId}
</update>
<delete id="deleteSysModuleByModuleId" parameterType="Long">
delete from sys_module where module_id = #{moduleId}
</delete>
<delete id="deleteSysModuleByModuleIds" parameterType="String">
delete from sys_module where module_id in
<foreach item="moduleId" collection="array" open="(" separator="," close=")">
#{moduleId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,86 @@
<?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.ruoyi.generator.mapper.SysProjectModuleMapper">
<resultMap type="SysProjectModule" id="SysProjectModuleResult">
<result property="id" column="id" />
<result property="projectId" column="project_id" />
<result property="moduleId" column="module_id" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSysProjectModuleVo">
select id, project_id, module_id, status, create_by, create_time, update_by, update_time, remark from sys_project_module
</sql>
<select id="selectSysProjectModuleList" parameterType="SysProjectModule" resultMap="SysProjectModuleResult">
<include refid="selectSysProjectModuleVo"/>
<where>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="moduleId != null "> and module_id = #{moduleId}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectSysProjectModuleById" parameterType="Long" resultMap="SysProjectModuleResult">
<include refid="selectSysProjectModuleVo"/>
where id = #{id}
</select>
<insert id="insertSysProjectModule" parameterType="SysProjectModule" useGeneratedKeys="true" keyProperty="id">
insert into sys_project_module
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="projectId != null">project_id,</if>
<if test="moduleId != null">module_id,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectId != null">#{projectId},</if>
<if test="moduleId != null">#{moduleId},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSysProjectModule" parameterType="SysProjectModule">
update sys_project_module
<trim prefix="SET" suffixOverrides=",">
<if test="projectId != null">project_id = #{projectId},</if>
<if test="moduleId != null">module_id = #{moduleId},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysProjectModuleById" parameterType="Long">
delete from sys_project_module where id = #{id}
</delete>
<delete id="deleteSysProjectModuleByIds" parameterType="String">
delete from sys_project_module where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,123 @@
<?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.ruoyi.generator.mapper.SysProjectStructureMapper">
<resultMap type="SysProjectStructure" id="SysProjectStructureResult">
<result property="nodeId" column="node_id" />
<result property="parentId" column="parent_id" />
<result property="nodeName" column="node_name" />
<result property="nodeType" column="node_type" />
<result property="module" column="module" />
<result property="templateId" column="template_id" />
<result property="tableId" column="table_id" />
<result property="category" column="category" />
<result property="sortOrder" column="sort_order" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSysProjectStructureVo">
select node_id, parent_id, node_name, node_type, module, template_id, table_id, category, sort_order, status, create_by, create_time, update_by, update_time from sys_project_structure
</sql>
<select id="selectSysProjectStructureList" parameterType="SysProjectStructure" resultMap="SysProjectStructureResult">
<include refid="selectSysProjectStructureVo"/>
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
<if test="nodeType != null and nodeType != ''"> and node_type = #{nodeType}</if>
<if test="module != null and module != ''"> and module = #{module}</if>
<if test="templateId != null "> and template_id = #{templateId}</if>
<if test="tableId != null "> and table_id = #{tableId}</if>
<if test="category != null and category != ''"> and category = #{category}</if>
<if test="sortOrder != null "> and sort_order = #{sortOrder}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
order by sort_order
</select>
<select id="selectSysProjectStructureByNodeId" parameterType="Long" resultMap="SysProjectStructureResult">
<include refid="selectSysProjectStructureVo"/>
where node_id = #{nodeId}
</select>
<select id="selectProjectStructureListByModule" resultMap="SysProjectStructureResult">
select s.node_id, s.parent_id, s.node_name, s.node_type, s.module, s.template_id, s.table_id,
s.category, s.sort_order, s.status, s.create_by, s.create_time, s.update_by, s.update_time
from sys_project_structure s
left join sys_project_module pm on s.module = pm.module_id and pm.project_id = #{projectId}
where (s.module is null or s.module = '' or pm.module_id is not null)
and s.template_id = #{templateId}
order by s.sort_order
</select>
<insert id="insertSysProjectStructure" parameterType="SysProjectStructure" useGeneratedKeys="true" keyProperty="nodeId">
insert into sys_project_structure
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,</if>
<if test="nodeName != null">node_name,</if>
<if test="nodeType != null">node_type,</if>
<if test="module != null">module,</if>
<if test="templateId != null">template_id,</if>
<if test="tableId != null">table_id,</if>
<if test="category != null">category,</if>
<if test="sortOrder != null">sort_order,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="nodeName != null">#{nodeName},</if>
<if test="nodeType != null">#{nodeType},</if>
<if test="module != null">#{module},</if>
<if test="templateId != null">#{templateId},</if>
<if test="tableId != null">#{tableId},</if>
<if test="category != null">#{category},</if>
<if test="sortOrder != null">#{sortOrder},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateSysProjectStructure" parameterType="SysProjectStructure">
update sys_project_structure
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="nodeName != null">node_name = #{nodeName},</if>
<if test="nodeType != null">node_type = #{nodeType},</if>
<if test="module != null">module = #{module},</if>
<if test="templateId != null">template_id = #{templateId},</if>
<if test="tableId != null">table_id = #{tableId},</if>
<if test="category != null">category = #{category},</if>
<if test="sortOrder != null">sort_order = #{sortOrder},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where node_id = #{nodeId}
</update>
<delete id="deleteSysProjectStructureByNodeId" parameterType="Long">
delete from sys_project_structure where node_id = #{nodeId}
</delete>
<delete id="deleteSysProjectStructureByNodeIds" parameterType="String">
delete from sys_project_structure where node_id in
<foreach item="nodeId" collection="array" open="(" separator="," close=")">
#{nodeId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,73 @@
<?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.ruoyi.generator.mapper.SysProjectTableMapper">
<resultMap type="com.ruoyi.generator.domain.SysProjectTable" id="SysProjectTableResult">
<result property="id" column="id" />
<result property="tableId" column="table_id" />
<result property="projectId" column="project_id" />
</resultMap>
<sql id="selectSysProjectTableVo">
select id, table_id, project_id from sys_project_table
</sql>
<select id="selectSysProjectTableList" parameterType="com.ruoyi.generator.domain.SysProjectTable" resultMap="SysProjectTableResult">
<include refid="selectSysProjectTableVo"/>
<where>
<if test="tableId != null ">
AND table_id = #{tableId}
</if>
<if test="projectId != null ">
AND project_id = #{projectId}
</if>
</where>
</select>
<select id="selectSysProjectTableById" parameterType="Long" resultMap="SysProjectTableResult">
<include refid="selectSysProjectTableVo"/>
where id = #{id}
</select>
<insert id="insertSysProjectTable" parameterType="com.ruoyi.generator.domain.SysProjectTable" useGeneratedKeys="true" keyProperty="id">
insert into sys_project_table
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tableId != null">table_id,</if>
<if test="projectId != null">project_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tableId != null">#{tableId},</if>
<if test="projectId != null">#{projectId},</if>
</trim>
</insert>
<update id="updateSysProjectTable" parameterType="com.ruoyi.generator.domain.SysProjectTable">
update sys_project_table
<trim prefix="SET" suffixOverrides=",">
<if test="tableId != null">table_id = #{tableId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysProjectTableById" parameterType="Long">
delete from sys_project_table where id = #{id}
</delete>
<delete id="deleteSysProjectTableByIds" parameterType="String">
delete from sys_project_table where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteSysProjectTableByProjectId" parameterType="Long">
delete from sys_project_table where project_id = #{projectId}
</delete>
<delete id="deleteSysProjectTableByTableId" parameterType="Long">
delete from sys_project_table where table_id = #{tableId}
</delete>
</mapper>

View File

@@ -0,0 +1,80 @@
<?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.ruoyi.generator.mapper.SysProjectTemplateMapper">
<resultMap type="SysProjectTemplate" id="SysProjectTemplateResult">
<result property="id" column="id" />
<result property="projectId" column="project_id" />
<result property="templateId" column="template_id" />
<result property="templateType" column="template_type" />
</resultMap>
<sql id="selectSysProjectTemplateVo">
select id, project_id, template_id, template_type from sys_project_template
</sql>
<select id="selectSysProjectTemplateList" parameterType="SysProjectTemplate" resultMap="SysProjectTemplateResult">
<include refid="selectSysProjectTemplateVo"/>
<where>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="templateId != null "> and template_id = #{templateId}</if>
<if test="templateType != null and templateType != ''"> and template_type = #{templateType}</if>
</where>
</select>
<select id="selectSysProjectTemplateById" parameterType="Long" resultMap="SysProjectTemplateResult">
<include refid="selectSysProjectTemplateVo"/>
where id = #{id}
</select>
<select id="selectSysProjectTemplateByProjectAndType" parameterType="SysProjectTemplate" resultMap="SysProjectTemplateResult">
<include refid="selectSysProjectTemplateVo"/>
where project_id = #{projectId} and template_type = #{templateType}
</select>
<insert id="insertSysProjectTemplate" parameterType="SysProjectTemplate" useGeneratedKeys="true" keyProperty="id">
insert into sys_project_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="projectId != null">project_id,</if>
<if test="templateId != null">template_id,</if>
<if test="templateType != null">template_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectId != null">#{projectId},</if>
<if test="templateId != null">#{templateId},</if>
<if test="templateType != null">#{templateType},</if>
</trim>
</insert>
<update id="updateSysProjectTemplate" parameterType="SysProjectTemplate">
update sys_project_template
<trim prefix="SET" suffixOverrides=",">
<if test="projectId != null">project_id = #{projectId},</if>
<if test="templateId != null">template_id = #{templateId},</if>
<if test="templateType != null">template_type = #{templateType},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysProjectTemplateById" parameterType="Long">
delete from sys_project_template where id = #{id}
</delete>
<delete id="deleteSysProjectTemplateByIds" parameterType="String">
delete from sys_project_template where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteSysProjectTemplateByProjectId" parameterType="Long">
delete from sys_project_template where project_id = #{projectId}
</delete>
<select id="selectSysProjectTemplateListByProjectId" parameterType="Long" resultMap="SysProjectTemplateResult">
<include refid="selectSysProjectTemplateVo"/>
where project_id = #{projectId}
</select>
</mapper>

View File

@@ -0,0 +1,90 @@
<?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.ruoyi.generator.mapper.TemplateFileMapper">
<resultMap type="com.ruoyi.generator.domain.TemplateFile" id="TemplateFileResult">
<result property="templateFileId" column="template_file_id" />
<result property="templateId" column="template_id" />
<result property="fileName" column="file_name" />
<result property="filePath" column="file_path" />
<result property="fileContent" column="file_content" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTemplateFileVo">
select template_file_id, template_id, file_name, file_path, file_content, create_by, create_time, update_by, update_time from sys_template_file
</sql>
<select id="selectTemplateFileList" parameterType="com.ruoyi.generator.domain.TemplateFile" resultMap="TemplateFileResult">
<include refid="selectTemplateFileVo"/>
<where>
<if test="templateId != null "> and template_id = #{templateId}</if>
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
<if test="filePath != null and filePath != ''"> and file_path like concat('%', #{filePath}, '%')</if>
</where>
</select>
<select id="selectTemplateFilesByTemplateId" parameterType="Long" resultMap="TemplateFileResult">
<include refid="selectTemplateFileVo"/>
where template_id = #{templateId}
</select>
<select id="selectTemplateFileByTemplateFileId" parameterType="Long" resultMap="TemplateFileResult">
<include refid="selectTemplateFileVo"/>
where template_file_id = #{templateFileId}
</select>
<insert id="insertTemplateFile" parameterType="com.ruoyi.generator.domain.TemplateFile" useGeneratedKeys="true" keyProperty="templateFileId">
insert into sys_template_file
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="templateId != null">template_id,</if>
<if test="fileName != null and fileName != ''">file_name,</if>
<if test="filePath != null and filePath != ''">file_path,</if>
<if test="fileContent != null and fileContent != ''">file_content,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="templateId != null">#{templateId},</if>
<if test="fileName != null and fileName != ''">#{fileName},</if>
<if test="filePath != null and filePath != ''">#{filePath},</if>
<if test="fileContent != null and fileContent != ''">#{fileContent},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
</trim>
</insert>
<update id="updateTemplateFile" parameterType="com.ruoyi.generator.domain.TemplateFile">
update sys_template_file
<trim prefix="SET" suffixOverrides=",">
<if test="templateId != null">template_id = #{templateId},</if>
<if test="fileName != null and fileName != ''">file_name = #{fileName},</if>
<if test="filePath != null and filePath != ''">file_path = #{filePath},</if>
<if test="fileContent != null and fileContent != ''">file_content = #{fileContent},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</trim>
where template_file_id = #{templateFileId}
</update>
<delete id="deleteTemplateFileByTemplateFileId" parameterType="Long">
delete from sys_template_file where template_file_id = #{templateFileId}
</delete>
<delete id="deleteTemplateFileByTemplateFileIds" parameterType="String">
delete from sys_template_file where template_file_id in
<foreach item="templateFileId" collection="array" open="(" separator="," close=")">
#{templateFileId}
</foreach>
</delete>
<delete id="deleteTemplateFilesByTemplateId" parameterType="Long">
delete from sys_template_file where template_id = #{templateId}
</delete>
</mapper>

View File

@@ -0,0 +1,97 @@
<?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.ruoyi.generator.mapper.TemplateMapper">
<resultMap type="com.ruoyi.generator.domain.Template" id="TemplateResult">
<id property="templateId" column="template_id" />
<result property="templateName" column="template_name" />
<result property="templatePath" column="template_path" />
<result property="templateDesc" column="template_desc" />
<result property="templateType" column="template_type" />
<result property="templateStatus" column="template_status" />
<collection property="templateFiles" javaType="java.util.List" resultMap="com.ruoyi.generator.mapper.TemplateFileMapper.TemplateFileResult" />
</resultMap>
<sql id="selectTemplateVo">
select t.template_id, t.template_name, t.template_path, t.template_desc, t.template_type, t.template_status
from sys_template t
</sql>
<select id="selectTemplateList" parameterType="com.ruoyi.generator.domain.Template" resultMap="TemplateResult">
<include refid="selectTemplateVo"/>
<where>
<if test="templateName != null and templateName != ''">
AND t.template_name like concat('%', #{templateName}, '%')
</if>
<if test="templateType != null and templateType != ''">
AND t.template_type = #{templateType}
</if>
</where>
</select>
<select id="selectTemplateByTemplateId" parameterType="Long" resultMap="TemplateResult">
select t.template_id, t.template_name, t.template_path, t.template_desc, t.template_type, t.template_status,
tf.template_file_id, tf.file_name, tf.file_path, tf.file_content, tf.create_by, tf.create_time, tf.update_by, tf.update_time
from sys_template t
left join sys_template_file tf on t.template_id = tf.template_id
where t.template_id = #{templateId}
</select>
<select id="selectActiveTemplate" resultMap="TemplateResult">
<include refid="selectTemplateVo"/>
where t.template_status = 0
</select>
<insert id="insertTemplate" parameterType="com.ruoyi.generator.domain.Template" useGeneratedKeys="true" keyProperty="templateId">
insert into sys_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="templateName != null and templateName != ''">template_name,</if>
<if test="templatePath != null and templatePath != ''">template_path,</if>
<if test="templateDesc != null and templateDesc != ''">template_desc,</if>
<if test="templateType != null and templateType != ''">template_type,</if>
<if test="templateStatus != null">template_status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="templateName != null and templateName != ''">#{templateName},</if>
<if test="templatePath != null and templatePath != ''">#{templatePath},</if>
<if test="templateDesc != null and templateDesc != ''">#{templateDesc},</if>
<if test="templateType != null and templateType != ''">#{templateType},</if>
<if test="templateStatus != null">#{templateStatus},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
</trim>
</insert>
<update id="updateTemplate" parameterType="com.ruoyi.generator.domain.Template">
update sys_template
<trim prefix="SET" suffixOverrides=",">
<if test="templateName != null and templateName != ''">template_name = #{templateName},</if>
<if test="templatePath != null and templatePath != ''">template_path = #{templatePath},</if>
<if test="templateDesc != null and templateDesc != ''">template_desc = #{templateDesc},</if>
<if test="templateType != null and templateType != ''">template_type = #{templateType},</if>
<if test="templateStatus != null">template_status = #{templateStatus},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</trim>
where template_id = #{templateId}
</update>
<delete id="deleteTemplateByTemplateId" parameterType="Long">
delete from sys_template where template_id = #{templateId}
</delete>
<delete id="deleteTemplateByTemplateIds" parameterType="String">
delete from sys_template where template_id in
<foreach item="templateId" collection="array" open="(" separator="," close=")">
#{templateId}
</foreach>
</delete>
<update id="updateTemplateStatus" parameterType="com.ruoyi.generator.domain.Template">
update sys_template set template_status = #{templateStatus} where template_id = #{templateId}
</update>
</mapper>