mirror of
https://github.com/201206030/novel-plus.git
synced 2025-07-04 16:26:40 +00:00
上传后台管理系统代码
This commit is contained in:
132
novel-admin/src/main/resources/mybatis/common/DictMapper.xml
Normal file
132
novel-admin/src/main/resources/mybatis/common/DictMapper.xml
Normal file
@ -0,0 +1,132 @@
|
||||
<?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.java2nb.common.dao.DictDao">
|
||||
|
||||
<select id="get" resultType="com.java2nb.common.domain.DictDO">
|
||||
select
|
||||
`id`,`name`,`value`,`type`,`description`,`sort`,`parent_id`,`create_by`,`create_date`,`update_by`,`update_date`,`remarks`,`del_flag`
|
||||
from sys_dict where id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.java2nb.common.domain.DictDO">
|
||||
select
|
||||
`id`,`name`,`value`,`type`,`description`,`sort`,`parent_id`,`create_by`,`create_date`,`update_by`,`update_date`,`remarks`,`del_flag`
|
||||
from sys_dict
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="name != null and name != ''"> and name = #{name} </if>
|
||||
<if test="value != null and value != ''"> and value = #{value} </if>
|
||||
<if test="type != null and type != ''"> and type = #{type} </if>
|
||||
<if test="description != null and description != ''"> and description = #{description} </if>
|
||||
<if test="sort != null and sort != ''"> and sort = #{sort} </if>
|
||||
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId} </if>
|
||||
<if test="createBy != null and createBy != ''"> and create_by = #{createBy} </if>
|
||||
<if test="createDate != null and createDate != ''"> and create_date = #{createDate} </if>
|
||||
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy} </if>
|
||||
<if test="updateDate != null and updateDate != ''"> and update_date = #{updateDate} </if>
|
||||
<if test="remarks != null and remarks != ''"> and remarks = #{remarks} </if>
|
||||
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag} </if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from sys_dict
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="name != null and name != ''"> and name = #{name} </if>
|
||||
<if test="value != null and value != ''"> and value = #{value} </if>
|
||||
<if test="type != null and type != ''"> and type = #{type} </if>
|
||||
<if test="description != null and description != ''"> and description = #{description} </if>
|
||||
<if test="sort != null and sort != ''"> and sort = #{sort} </if>
|
||||
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId} </if>
|
||||
<if test="createBy != null and createBy != ''"> and create_by = #{createBy} </if>
|
||||
<if test="createDate != null and createDate != ''"> and create_date = #{createDate} </if>
|
||||
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy} </if>
|
||||
<if test="updateDate != null and updateDate != ''"> and update_date = #{updateDate} </if>
|
||||
<if test="remarks != null and remarks != ''"> and remarks = #{remarks} </if>
|
||||
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag} </if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.java2nb.common.domain.DictDO"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_dict
|
||||
(
|
||||
`name`,
|
||||
`value`,
|
||||
`type`,
|
||||
`description`,
|
||||
`sort`,
|
||||
`parent_id`,
|
||||
`create_by`,
|
||||
`create_date`,
|
||||
`update_by`,
|
||||
`update_date`,
|
||||
`remarks`,
|
||||
`del_flag`
|
||||
)
|
||||
values
|
||||
(
|
||||
#{name},
|
||||
#{value},
|
||||
#{type},
|
||||
#{description},
|
||||
#{sort},
|
||||
#{parentId},
|
||||
#{createBy},
|
||||
#{createDate},
|
||||
#{updateBy},
|
||||
#{updateDate},
|
||||
#{remarks},
|
||||
#{delFlag}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.java2nb.common.domain.DictDO">
|
||||
update sys_dict
|
||||
<set>
|
||||
<if test="name != null">`name` = #{name}, </if>
|
||||
<if test="value != null">`value` = #{value}, </if>
|
||||
<if test="type != null">`type` = #{type}, </if>
|
||||
<if test="description != null">`description` = #{description}, </if>
|
||||
<if test="sort != null">`sort` = #{sort}, </if>
|
||||
<if test="parentId != null">`parent_id` = #{parentId}, </if>
|
||||
<if test="createBy != null">`create_by` = #{createBy}, </if>
|
||||
<if test="createDate != null">`create_date` = #{createDate}, </if>
|
||||
<if test="updateBy != null">`update_by` = #{updateBy}, </if>
|
||||
<if test="updateDate != null">`update_date` = #{updateDate}, </if>
|
||||
<if test="remarks != null">`remarks` = #{remarks}, </if>
|
||||
<if test="delFlag != null">`del_flag` = #{delFlag}</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="remove">
|
||||
delete from sys_dict where id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from sys_dict where id in
|
||||
<foreach item="id" collection="array" open="(" separator=","
|
||||
close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="listType" resultType="com.java2nb.common.domain.DictDO">
|
||||
select distinct `type` , description from sys_dict
|
||||
</select>
|
||||
|
||||
</mapper>
|
77
novel-admin/src/main/resources/mybatis/common/FileMapper.xml
Normal file
77
novel-admin/src/main/resources/mybatis/common/FileMapper.xml
Normal file
@ -0,0 +1,77 @@
|
||||
<?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.java2nb.common.dao.FileDao">
|
||||
|
||||
<select id="get" resultType="com.java2nb.common.domain.FileDO">
|
||||
select `id`,`type`,`url`,`create_date` from sys_file where id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.java2nb.common.domain.FileDO">
|
||||
select `id`,`type`,`url`,`create_date` from sys_file
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="type != null and type != ''"> and type = #{type} </if>
|
||||
<if test="url != null and url != ''"> and url = #{url} </if>
|
||||
<if test="createDate != null and createDate != ''"> and create_date = #{createDate} </if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from sys_file
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="type != null and type != ''"> and type = #{type} </if>
|
||||
<if test="url != null and url != ''"> and url = #{url} </if>
|
||||
<if test="createDate != null and createDate != ''"> and create_date = #{createDate} </if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.java2nb.common.domain.FileDO" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_file
|
||||
(
|
||||
`type`,
|
||||
`url`,
|
||||
`create_date`
|
||||
)
|
||||
values
|
||||
(
|
||||
#{type},
|
||||
#{url},
|
||||
#{createDate}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.java2nb.common.domain.FileDO">
|
||||
update sys_file
|
||||
<set>
|
||||
<if test="type != null">`type` = #{type}, </if>
|
||||
<if test="url != null">`url` = #{url}, </if>
|
||||
<if test="createDate != null">`create_date` = #{createDate}</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="remove">
|
||||
delete from sys_file where id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from sys_file where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,151 @@
|
||||
<?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.java2nb.common.dao.GenColumnsDao">
|
||||
|
||||
<select id="get" resultType="com.java2nb.common.domain.GenColumnsDO">
|
||||
select `id`,`table_name`,`column_name`,`column_type`,`java_type`,`column_comment`,`column_sort`,`column_label`,`page_type`,`is_required`,`dict_type` from sys_gen_columns where id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.java2nb.common.domain.GenColumnsDO">
|
||||
select `id`,`table_name`,`column_name`,`column_type`,`java_type`,`column_comment`,`column_sort`,`column_label`,`page_type`,`is_required`,`dict_type` from sys_gen_columns
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="tableName != null and tableName != ''"> and table_name = #{tableName} </if>
|
||||
<if test="columnName != null and columnName != ''"> and column_name = #{columnName} </if>
|
||||
<if test="columnType != null and columnType != ''"> and column_type = #{columnType} </if>
|
||||
<if test="javaType != null and javaType != ''"> and java_type = #{javaType} </if>
|
||||
<if test="columnComment != null and columnComment != ''"> and column_comment = #{columnComment} </if>
|
||||
<if test="columnSort != null and columnSort != ''"> and column_sort = #{columnSort} </if>
|
||||
<if test="columnLabel != null and columnLabel != ''"> and column_label = #{columnLabel} </if>
|
||||
<if test="pageType != null and pageType != ''"> and page_type = #{pageType} </if>
|
||||
<if test="isRequired != null and isRequired != ''"> and is_required = #{isRequired} </if>
|
||||
<if test="dictType != null and dictType != ''"> and dict_type = #{dictType} </if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from sys_gen_columns
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="tableName != null and tableName != ''"> and table_name = #{tableName} </if>
|
||||
<if test="columnName != null and columnName != ''"> and column_name = #{columnName} </if>
|
||||
<if test="columnType != null and columnType != ''"> and column_type = #{columnType} </if>
|
||||
<if test="javaType != null and javaType != ''"> and java_type = #{javaType} </if>
|
||||
<if test="columnComment != null and columnComment != ''"> and column_comment = #{columnComment} </if>
|
||||
<if test="columnSort != null and columnSort != ''"> and column_sort = #{columnSort} </if>
|
||||
<if test="columnLabel != null and columnLabel != ''"> and column_label = #{columnLabel} </if>
|
||||
<if test="pageType != null and pageType != ''"> and page_type = #{pageType} </if>
|
||||
<if test="isRequired != null and isRequired != ''"> and is_required = #{isRequired} </if>
|
||||
<if test="dictType != null and dictType != ''"> and dict_type = #{dictType} </if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.java2nb.common.domain.GenColumnsDO" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_gen_columns
|
||||
(
|
||||
`table_name`,
|
||||
`column_name`,
|
||||
`column_type`,
|
||||
`java_type`,
|
||||
`column_comment`,
|
||||
`column_sort`,
|
||||
`column_label`,
|
||||
`page_type`,
|
||||
`is_required`,
|
||||
`dict_type`
|
||||
)
|
||||
values
|
||||
(
|
||||
#{tableName},
|
||||
#{columnName},
|
||||
#{columnType},
|
||||
#{javaType},
|
||||
#{columnComment},
|
||||
#{columnSort},
|
||||
#{columnLabel},
|
||||
#{pageType},
|
||||
#{isRequired},
|
||||
#{dictType}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.java2nb.common.domain.GenColumnsDO">
|
||||
update sys_gen_columns
|
||||
<set>
|
||||
<if test="tableName != null">`table_name` = #{tableName}, </if>
|
||||
<if test="columnName != null">`column_name` = #{columnName}, </if>
|
||||
<if test="columnType != null">`column_type` = #{columnType}, </if>
|
||||
<if test="javaType != null">`java_type` = #{javaType}, </if>
|
||||
<if test="columnComment != null">`column_comment` = #{columnComment}, </if>
|
||||
<if test="columnSort != null">`column_sort` = #{columnSort}, </if>
|
||||
<if test="columnLabel != null">`column_label` = #{columnLabel}, </if>
|
||||
<if test="pageType != null">`page_type` = #{pageType}, </if>
|
||||
<if test="isRequired != null">`is_required` = #{isRequired}, </if>
|
||||
<if test="dictType != null">`dict_type` = #{dictType}</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="remove">
|
||||
delete from sys_gen_columns where id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from sys_gen_columns where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<insert id="saveBatch" parameterType="java.util.List">
|
||||
insert into sys_gen_columns
|
||||
(
|
||||
`table_name`,
|
||||
`column_name`,
|
||||
`column_type`,
|
||||
`java_type`,
|
||||
`column_comment`,
|
||||
`column_sort`,
|
||||
`column_label`,
|
||||
`page_type`,
|
||||
`is_required`,
|
||||
`dict_type`
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index"
|
||||
separator=",">
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
#{item.tableName},
|
||||
#{item.columnName},
|
||||
#{item.columnType},
|
||||
#{item.javaType},
|
||||
#{item.columnComment},
|
||||
#{item.columnSort},
|
||||
#{item.columnLabel},
|
||||
#{item.pageType},
|
||||
#{item.isRequired},
|
||||
#{item.dictType}
|
||||
</trim>
|
||||
</foreach>
|
||||
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByTableName" parameterType="string">
|
||||
delete from sys_gen_columns where table_name = #{tableName}
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
102
novel-admin/src/main/resources/mybatis/common/LogMapper.xml
Normal file
102
novel-admin/src/main/resources/mybatis/common/LogMapper.xml
Normal file
@ -0,0 +1,102 @@
|
||||
<?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.java2nb.common.dao.LogDao">
|
||||
|
||||
<select id="get" resultType="com.java2nb.common.domain.LogDO">
|
||||
select `id`,`user_id`,`username`,`operation`,`time`,`method`,`params`,`ip`,`gmt_create` from sys_log where id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.java2nb.common.domain.LogDO">
|
||||
select `id`,`user_id`,`username`,`operation`,`time`,`method`,`params`,`ip`,`gmt_create` from sys_log
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="userId != null and userId != ''"> and user_id = #{userId} </if>
|
||||
<if test="username != null and username != ''"> and username = #{username} </if>
|
||||
<if test="operation != null and operation != ''"> and operation = #{operation} </if>
|
||||
<if test="time != null and time != ''"> and time = #{time} </if>
|
||||
<if test="method != null and method != ''"> and method = #{method} </if>
|
||||
<if test="params != null and params != ''"> and params = #{params} </if>
|
||||
<if test="ip != null and ip != ''"> and ip = #{ip} </if>
|
||||
<if test="gmtCreate != null and gmtCreate != ''"> and gmt_create = #{gmtCreate} </if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from sys_log
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="userId != null and userId != ''"> and user_id = #{userId} </if>
|
||||
<if test="username != null and username != ''"> and username = #{username} </if>
|
||||
<if test="operation != null and operation != ''"> and operation = #{operation} </if>
|
||||
<if test="time != null and time != ''"> and time = #{time} </if>
|
||||
<if test="method != null and method != ''"> and method = #{method} </if>
|
||||
<if test="params != null and params != ''"> and params = #{params} </if>
|
||||
<if test="ip != null and ip != ''"> and ip = #{ip} </if>
|
||||
<if test="gmtCreate != null and gmtCreate != ''"> and gmt_create = #{gmtCreate} </if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.java2nb.common.domain.LogDO" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_log
|
||||
(
|
||||
`user_id`,
|
||||
`username`,
|
||||
`operation`,
|
||||
`time`,
|
||||
`method`,
|
||||
`params`,
|
||||
`ip`,
|
||||
`gmt_create`
|
||||
)
|
||||
values
|
||||
(
|
||||
#{userId},
|
||||
#{username},
|
||||
#{operation},
|
||||
#{time},
|
||||
#{method},
|
||||
#{params},
|
||||
#{ip},
|
||||
#{gmtCreate}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.java2nb.common.domain.LogDO">
|
||||
update sys_log
|
||||
<set>
|
||||
<if test="userId != null">`user_id` = #{userId}, </if>
|
||||
<if test="username != null">`username` = #{username}, </if>
|
||||
<if test="operation != null">`operation` = #{operation}, </if>
|
||||
<if test="time != null">`time` = #{time}, </if>
|
||||
<if test="method != null">`method` = #{method}, </if>
|
||||
<if test="params != null">`params` = #{params}, </if>
|
||||
<if test="ip != null">`ip` = #{ip}, </if>
|
||||
<if test="gmtCreate != null">`gmt_create` = #{gmtCreate}</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="remove">
|
||||
delete from sys_log where id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from sys_log where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
151
novel-admin/src/main/resources/mybatis/system/DataPermMapper.xml
Normal file
151
novel-admin/src/main/resources/mybatis/system/DataPermMapper.xml
Normal file
@ -0,0 +1,151 @@
|
||||
<?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.java2nb.system.dao.DataPermDao">
|
||||
|
||||
<select id="get" resultType="com.java2nb.system.domain.DataPermDO">
|
||||
select `id`,`name`,`table_name`,`module_name`,`crl_attr_name`,`crl_column_name`,`perm_code`,`order_num`,`gmt_create`,`gmt_modified` from sys_data_perm where id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.java2nb.system.domain.DataPermDO">
|
||||
select `id`,`name`,`table_name`,`module_name`,`crl_attr_name`,`crl_column_name`,`perm_code`,`order_num`,`gmt_create`,`gmt_modified` from sys_data_perm
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="name != null and name != ''"> and name = #{name} </if>
|
||||
<if test="tableName != null and tableName != ''"> and table_name = #{tableName} </if>
|
||||
<if test="moduleName != null and moduleName != ''"> and module_name = #{moduleName} </if>
|
||||
<if test="crlAttrName != null and crlAttrName != ''"> and crl_attr_name = #{crlAttrName} </if>
|
||||
<if test="crlColumnName != null and crlColumnName != ''"> and crl_column_name = #{crlColumnName} </if>
|
||||
<if test="permCode != null and permCode != ''"> and perm_code = #{permCode} </if>
|
||||
<if test="orderNum != null and orderNum != ''"> and order_num = #{orderNum} </if>
|
||||
<if test="gmtCreate != null and gmtCreate != ''"> and gmt_create = #{gmtCreate} </if>
|
||||
<if test="gmtModified != null and gmtModified != ''"> and gmt_modified = #{gmtModified} </if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from sys_data_perm
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="name != null and name != ''"> and name = #{name} </if>
|
||||
<if test="tableName != null and tableName != ''"> and table_name = #{tableName} </if>
|
||||
<if test="moduleName != null and moduleName != ''"> and module_name = #{moduleName} </if>
|
||||
<if test="crlAttrName != null and crlAttrName != ''"> and crl_attr_name = #{crlAttrName} </if>
|
||||
<if test="crlColumnName != null and crlColumnName != ''"> and crl_column_name = #{crlColumnName} </if>
|
||||
<if test="permCode != null and permCode != ''"> and perm_code = #{permCode} </if>
|
||||
<if test="orderNum != null and orderNum != ''"> and order_num = #{orderNum} </if>
|
||||
<if test="gmtCreate != null and gmtCreate != ''"> and gmt_create = #{gmtCreate} </if>
|
||||
<if test="gmtModified != null and gmtModified != ''"> and gmt_modified = #{gmtModified} </if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.java2nb.system.domain.DataPermDO" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_data_perm
|
||||
(
|
||||
`name`,
|
||||
`table_name`,
|
||||
`module_name`,
|
||||
`crl_attr_name`,
|
||||
`crl_column_name`,
|
||||
`perm_code`,
|
||||
`order_num`,
|
||||
`gmt_create`,
|
||||
`gmt_modified`
|
||||
)
|
||||
values
|
||||
(
|
||||
#{name},
|
||||
#{tableName},
|
||||
#{moduleName},
|
||||
#{crlAttrName},
|
||||
#{crlColumnName},
|
||||
#{permCode},
|
||||
#{orderNum},
|
||||
#{gmtCreate},
|
||||
#{gmtModified}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="saveSelective" parameterType="com.java2nb.system.domain.DataPermDO" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_data_perm
|
||||
(
|
||||
<if test="id != null"> `id`, </if>
|
||||
<if test="name != null"> `name`, </if>
|
||||
<if test="tableName != null"> `table_name`, </if>
|
||||
<if test="moduleName != null"> `module_name`, </if>
|
||||
<if test="crlAttrName != null"> `crl_attr_name`, </if>
|
||||
<if test="crlColumnName != null"> `crl_column_name`, </if>
|
||||
<if test="permCode != null"> `perm_code`, </if>
|
||||
<if test="orderNum != null"> `order_num`, </if>
|
||||
<if test="gmtCreate != null"> `gmt_create`, </if>
|
||||
<if test="gmtModified != null"> `gmt_modified` </if>
|
||||
)
|
||||
values
|
||||
(
|
||||
<if test="id != null"> #{id}, </if>
|
||||
<if test="name != null"> #{name}, </if>
|
||||
<if test="tableName != null"> #{tableName}, </if>
|
||||
<if test="moduleName != null"> #{moduleName}, </if>
|
||||
<if test="crlAttrName != null"> #{crlAttrName}, </if>
|
||||
<if test="crlColumnName != null"> #{crlColumnName}, </if>
|
||||
<if test="permCode != null"> #{permCode}, </if>
|
||||
<if test="orderNum != null"> #{orderNum}, </if>
|
||||
<if test="gmtCreate != null"> #{gmtCreate}, </if>
|
||||
<if test="gmtModified != null"> #{gmtModified} </if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.java2nb.system.domain.DataPermDO">
|
||||
update sys_data_perm
|
||||
<set>
|
||||
<if test="name != null">`name` = #{name}, </if>
|
||||
<if test="tableName != null">`table_name` = #{tableName}, </if>
|
||||
<if test="moduleName != null">`module_name` = #{moduleName}, </if>
|
||||
<if test="crlAttrName != null">`crl_attr_name` = #{crlAttrName}, </if>
|
||||
<if test="crlColumnName != null">`crl_column_name` = #{crlColumnName}, </if>
|
||||
<if test="permCode != null">`perm_code` = #{permCode}, </if>
|
||||
<if test="orderNum != null">`order_num` = #{orderNum}, </if>
|
||||
<if test="gmtCreate != null">`gmt_create` = #{gmtCreate}, </if>
|
||||
<if test="gmtModified != null">`gmt_modified` = #{gmtModified}</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="remove">
|
||||
delete from sys_data_perm where id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from sys_data_perm where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="listModuleName" resultType="com.java2nb.system.domain.DataPermDO">
|
||||
select distinct `module_name` from sys_data_perm ;
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectDataPermsByUserId" parameterType="long" resultType="com.java2nb.system.domain.DataPermDO">
|
||||
|
||||
select distinct t1.`table_name`,t1.`module_name`,t1.`crl_attr_name`,t1.`crl_column_name`,t1.`perm_code`
|
||||
from sys_data_perm t1
|
||||
inner join sys_role_data_perm t2 on t1.id = t2.perm_id
|
||||
inner join sys_user_role t3 on t2.role_id = t3.role_id
|
||||
and t3.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
98
novel-admin/src/main/resources/mybatis/system/DeptMapper.xml
Normal file
98
novel-admin/src/main/resources/mybatis/system/DeptMapper.xml
Normal file
@ -0,0 +1,98 @@
|
||||
<?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.java2nb.system.dao.DeptDao">
|
||||
|
||||
<select id="get" resultType="com.java2nb.system.domain.DeptDO">
|
||||
select
|
||||
`dept_id`,`parent_id`,`name`,`order_num`,`del_flag` from sys_dept
|
||||
where dept_id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.java2nb.system.domain.DeptDO">
|
||||
select `dept_id`,`parent_id`,`name`,`order_num`,`del_flag` from
|
||||
sys_dept
|
||||
<where>
|
||||
<if test="deptId != null and deptId != ''"> and dept_id = #{deptId} </if>
|
||||
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId} </if>
|
||||
<if test="name != null and name != ''"> and name = #{name} </if>
|
||||
<if test="orderNum != null and orderNum != ''"> and order_num = #{orderNum} </if>
|
||||
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag} </if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by dept_id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from sys_dept
|
||||
<where>
|
||||
<if test="deptId != null and deptId != ''"> and dept_id = #{deptId} </if>
|
||||
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId} </if>
|
||||
<if test="name != null and name != ''"> and name = #{name} </if>
|
||||
<if test="orderNum != null and orderNum != ''"> and order_num = #{orderNum} </if>
|
||||
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag} </if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.java2nb.system.domain.DeptDO"
|
||||
useGeneratedKeys="true" keyProperty="deptId">
|
||||
insert into sys_dept
|
||||
(
|
||||
`parent_id`,
|
||||
`name`,
|
||||
`order_num`,
|
||||
`del_flag`
|
||||
)
|
||||
values
|
||||
(
|
||||
#{parentId},
|
||||
#{name},
|
||||
#{orderNum},
|
||||
#{delFlag}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.java2nb.system.domain.DeptDO">
|
||||
update sys_dept
|
||||
<set>
|
||||
<if test="parentId != null">`parent_id` = #{parentId}, </if>
|
||||
<if test="name != null">`name` = #{name}, </if>
|
||||
<if test="orderNum != null">`order_num` = #{orderNum}, </if>
|
||||
<if test="delFlag != null">`del_flag` = #{delFlag}</if>
|
||||
</set>
|
||||
where dept_id = #{deptId}
|
||||
</update>
|
||||
|
||||
<delete id="remove">
|
||||
delete from sys_dept where dept_id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from sys_dept where dept_id in
|
||||
<foreach item="deptId" collection="array" open="(" separator=","
|
||||
close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="listParentDept" resultType="long">
|
||||
select DISTINCT parent_id from sys_dept
|
||||
</select>
|
||||
|
||||
<select id="getDeptUserNumber" resultType="int">
|
||||
select count(*) from sys_user where dept_id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="getDeptIdsByParentId" parameterType="long" resultType="String">
|
||||
select group_concat(dept_id) from sys_dept where parent_id = #{deptId}
|
||||
</select>
|
||||
</mapper>
|
136
novel-admin/src/main/resources/mybatis/system/MenuMapper.xml
Normal file
136
novel-admin/src/main/resources/mybatis/system/MenuMapper.xml
Normal file
@ -0,0 +1,136 @@
|
||||
<?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.java2nb.system.dao.MenuDao">
|
||||
|
||||
<select id="get" resultType="com.java2nb.system.domain.MenuDO">
|
||||
select
|
||||
`menu_id`,`parent_id`,`name`,`url`,`perms`,`type`,`icon`,`order_num`,`gmt_create`,`gmt_modified`
|
||||
from sys_menu where menu_id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.java2nb.system.domain.MenuDO">
|
||||
select
|
||||
`menu_id`,`parent_id`,`name`,`url`,`perms`,`type`,`icon`,`order_num`,`gmt_create`,`gmt_modified`
|
||||
from sys_menu
|
||||
<where>
|
||||
<if test="menuId != null and menuId != ''"> and menu_id = #{menuId} </if>
|
||||
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId} </if>
|
||||
<if test="name != null and name != ''"> and name = #{name} </if>
|
||||
<if test="url != null and url != ''"> and url = #{url} </if>
|
||||
<if test="perms != null and perms != ''"> and perms = #{perms} </if>
|
||||
<if test="type != null and type != ''"> and type = #{type} </if>
|
||||
<if test="icon != null and icon != ''"> and icon = #{icon} </if>
|
||||
<if test="orderNum != null and orderNum != ''"> and order_num = #{orderNum} </if>
|
||||
<if test="gmtCreate != null and gmtCreate != ''"> and gmt_create = #{gmtCreate} </if>
|
||||
<if test="gmtModified != null and gmtModified != ''"> and gmt_modified = #{gmtModified} </if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by menu_id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from sys_menu
|
||||
<where>
|
||||
<if test="menuId != null and menuId != ''"> and menu_id = #{menuId} </if>
|
||||
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId} </if>
|
||||
<if test="name != null and name != ''"> and name = #{name} </if>
|
||||
<if test="url != null and url != ''"> and url = #{url} </if>
|
||||
<if test="perms != null and perms != ''"> and perms = #{perms} </if>
|
||||
<if test="type != null and type != ''"> and type = #{type} </if>
|
||||
<if test="icon != null and icon != ''"> and icon = #{icon} </if>
|
||||
<if test="orderNum != null and orderNum != ''"> and order_num = #{orderNum} </if>
|
||||
<if test="gmtCreate != null and gmtCreate != ''"> and gmt_create = #{gmtCreate} </if>
|
||||
<if test="gmtModified != null and gmtModified != ''"> and gmt_modified = #{gmtModified} </if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.java2nb.system.domain.MenuDO"
|
||||
useGeneratedKeys="true" keyProperty="menuId">
|
||||
insert into sys_menu
|
||||
(
|
||||
`parent_id`,
|
||||
`name`,
|
||||
`url`,
|
||||
`perms`,
|
||||
`type`,
|
||||
`icon`,
|
||||
`order_num`,
|
||||
`gmt_create`,
|
||||
`gmt_modified`
|
||||
)
|
||||
values
|
||||
(
|
||||
#{parentId},
|
||||
#{name},
|
||||
#{url},
|
||||
#{perms},
|
||||
#{type},
|
||||
#{icon},
|
||||
#{orderNum},
|
||||
#{gmtCreate},
|
||||
#{gmtModified}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.java2nb.system.domain.MenuDO">
|
||||
update sys_menu
|
||||
<set>
|
||||
<if test="parentId != null">`parent_id` = #{parentId}, </if>
|
||||
<if test="name != null">`name` = #{name}, </if>
|
||||
<if test="url != null">`url` = #{url}, </if>
|
||||
<if test="perms != null">`perms` = #{perms}, </if>
|
||||
<if test="type != null">`type` = #{type}, </if>
|
||||
<if test="icon != null">`icon` = #{icon}, </if>
|
||||
<if test="orderNum != null">`order_num` = #{orderNum}, </if>
|
||||
<if test="gmtCreate != null">`gmt_create` = #{gmtCreate}, </if>
|
||||
<if test="gmtModified != null">`gmt_modified` = #{gmtModified}</if>
|
||||
</set>
|
||||
where menu_id = #{menuId}
|
||||
</update>
|
||||
|
||||
<delete id="remove">
|
||||
delete from sys_menu where menu_id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from sys_menu where menu_id in
|
||||
<foreach item="menuId" collection="array" open="(" separator=","
|
||||
close=")">
|
||||
#{menuId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="listMenuByUserId" resultType="com.java2nb.system.domain.MenuDO">
|
||||
select distinct
|
||||
m.menu_id , parent_id, name, url,
|
||||
perms,`type`,icon,order_num,gmt_create, gmt_modified
|
||||
from sys_menu m
|
||||
left
|
||||
join sys_role_menu rm on m.menu_id = rm.menu_id left join
|
||||
sys_user_role ur
|
||||
on rm.role_id =ur.role_id where ur.user_id = #{id}
|
||||
and
|
||||
m.type in(0,1)
|
||||
order by
|
||||
m.order_num
|
||||
</select>
|
||||
|
||||
<select id="listUserPerms" resultType="string">
|
||||
select distinct m.perms
|
||||
from sys_menu m left join
|
||||
sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
left join sys_user_role ur
|
||||
on rm.role_id = ur.role_id where ur.user_id
|
||||
= #{id}
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,105 @@
|
||||
<?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.java2nb.system.dao.RoleDataPermDao">
|
||||
|
||||
<select id="get" resultType="com.java2nb.system.domain.RoleDataPermDO">
|
||||
select `id`,`role_id`,`perm_id` from sys_role_data_perm where id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.java2nb.system.domain.RoleDataPermDO">
|
||||
select `id`,`role_id`,`perm_id` from sys_role_data_perm
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="roleId != null and roleId != ''"> and role_id = #{roleId} </if>
|
||||
<if test="permId != null and permId != ''"> and perm_id = #{permId} </if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from sys_role_data_perm
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="roleId != null and roleId != ''"> and role_id = #{roleId} </if>
|
||||
<if test="permId != null and permId != ''"> and perm_id = #{permId} </if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.java2nb.system.domain.RoleDataPermDO" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_role_data_perm
|
||||
(
|
||||
`role_id`,
|
||||
`perm_id`
|
||||
)
|
||||
values
|
||||
(
|
||||
#{roleId},
|
||||
#{permId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="saveSelective" parameterType="com.java2nb.system.domain.RoleDataPermDO" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_role_data_perm
|
||||
(
|
||||
<if test="id != null"> `id`, </if>
|
||||
<if test="roleId != null"> `role_id`, </if>
|
||||
<if test="permId != null"> `perm_id` </if>
|
||||
)
|
||||
values
|
||||
(
|
||||
<if test="id != null"> #{id}, </if>
|
||||
<if test="roleId != null"> #{roleId}, </if>
|
||||
<if test="permId != null"> #{permId} </if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.java2nb.system.domain.RoleDataPermDO">
|
||||
update sys_role_data_perm
|
||||
<set>
|
||||
<if test="roleId != null">`role_id` = #{roleId}, </if>
|
||||
<if test="permId != null">`perm_id` = #{permId}</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="remove">
|
||||
delete from sys_role_data_perm where id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from sys_role_data_perm where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="removeByRoleId">
|
||||
DELETE FROM sys_role_data_perm WHERE role_id=#{roleId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchSave">
|
||||
INSERT INTO sys_role_data_perm(role_id, perm_id) values
|
||||
<foreach item="item" index="index" collection="list"
|
||||
separator=",">
|
||||
(#{item.roleId},#{item.permId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="listPermIdByRoleId" resultType="long">
|
||||
select perm_id from sys_role_data_perm
|
||||
<where>role_id = #{roleId}</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
98
novel-admin/src/main/resources/mybatis/system/RoleMapper.xml
Normal file
98
novel-admin/src/main/resources/mybatis/system/RoleMapper.xml
Normal file
@ -0,0 +1,98 @@
|
||||
<?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.java2nb.system.dao.RoleDao">
|
||||
|
||||
<select id="get" resultType="com.java2nb.system.domain.RoleDO">
|
||||
select
|
||||
`role_id`,`role_name`,`role_sign`,`remark`,`user_id_create`,`gmt_create`,`gmt_modified`
|
||||
from sys_role where role_id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.java2nb.system.domain.RoleDO">
|
||||
select
|
||||
`role_id`,`role_name`,`role_sign`,`remark`,`user_id_create`,`gmt_create`,`gmt_modified`
|
||||
from sys_role
|
||||
<where>
|
||||
<if test="roleId != null and roleId != ''"> and role_id = #{roleId} </if>
|
||||
<if test="roleName != null and roleName != ''"> and role_name = #{roleName} </if>
|
||||
<if test="roleSign != null and roleSign != ''"> and role_sign = #{roleSign} </if>
|
||||
<if test="remark != null and remark != ''"> and remark = #{remark} </if>
|
||||
<if test="userIdCreate != null and userIdCreate != ''"> and user_id_create = #{userIdCreate} </if>
|
||||
<if test="gmtCreate != null and gmtCreate != ''"> and gmt_create = #{gmtCreate} </if>
|
||||
<if test="gmtModified != null and gmtModified != ''"> and gmt_modified = #{gmtModified} </if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by role_id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from sys_role
|
||||
<where>
|
||||
<if test="roleId != null and roleId != ''"> and role_id = #{roleId} </if>
|
||||
<if test="roleName != null and roleName != ''"> and role_name = #{roleName} </if>
|
||||
<if test="roleSign != null and roleSign != ''"> and role_sign = #{roleSign} </if>
|
||||
<if test="remark != null and remark != ''"> and remark = #{remark} </if>
|
||||
<if test="userIdCreate != null and userIdCreate != ''"> and user_id_create = #{userIdCreate} </if>
|
||||
<if test="gmtCreate != null and gmtCreate != ''"> and gmt_create = #{gmtCreate} </if>
|
||||
<if test="gmtModified != null and gmtModified != ''"> and gmt_modified = #{gmtModified} </if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.java2nb.system.domain.RoleDO"
|
||||
useGeneratedKeys="true" keyProperty="roleId">
|
||||
insert into sys_role
|
||||
(
|
||||
`role_name`,
|
||||
`role_sign`,
|
||||
`remark`,
|
||||
`user_id_create`,
|
||||
`gmt_create`,
|
||||
`gmt_modified`
|
||||
)
|
||||
values
|
||||
(
|
||||
#{roleName},
|
||||
#{roleSign},
|
||||
#{remark},
|
||||
#{userIdCreate},
|
||||
#{gmtCreate},
|
||||
#{gmtModified}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.java2nb.system.domain.RoleDO">
|
||||
update sys_role
|
||||
<set>
|
||||
<if test="roleName != null">`role_name` = #{roleName}, </if>
|
||||
<if test="roleSign != null">`role_sign` = #{roleSign}, </if>
|
||||
<if test="remark != null">`remark` = #{remark}, </if>
|
||||
<if test="userIdCreate != null">`user_id_create` = #{userIdCreate}, </if>
|
||||
<if test="gmtCreate != null">`gmt_create` = #{gmtCreate}, </if>
|
||||
<if test="gmtModified != null">`gmt_modified` = #{gmtModified}</if>
|
||||
</set>
|
||||
where role_id = #{roleId}
|
||||
</update>
|
||||
|
||||
<delete id="remove">
|
||||
delete from sys_role where role_id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from sys_role where role_id in
|
||||
<foreach item="roleId" collection="array" open="(" separator=","
|
||||
close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -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.java2nb.system.dao.RoleMenuDao">
|
||||
|
||||
<select id="get" resultType="com.java2nb.system.domain.RoleMenuDO">
|
||||
select `id`,`role_id`,`menu_id` from
|
||||
sys_role_menu where id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.java2nb.system.domain.RoleMenuDO">
|
||||
select `id`,`role_id`,`menu_id` from sys_role_menu
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="roleId != null and roleId != ''"> and role_id = #{roleId} </if>
|
||||
<if test="menuId != null and menuId != ''"> and menu_id = #{menuId} </if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from sys_role_menu
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="roleId != null and roleId != ''"> and role_id = #{roleId} </if>
|
||||
<if test="menuId != null and menuId != ''"> and menu_id = #{menuId} </if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.java2nb.system.domain.RoleMenuDO"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_role_menu
|
||||
(
|
||||
`role_id`,
|
||||
`menu_id`
|
||||
)
|
||||
values
|
||||
(
|
||||
#{roleId},
|
||||
#{menuId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.java2nb.system.domain.RoleMenuDO">
|
||||
update sys_role_menu
|
||||
<set>
|
||||
<if test="roleId != null">`role_id` = #{roleId}, </if>
|
||||
<if test="menuId != null">`menu_id` = #{menuId}</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="remove">
|
||||
delete from sys_role_menu where id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from sys_role_menu where id in
|
||||
<foreach item="id" collection="array" open="(" separator=","
|
||||
close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="listMenuIdByRoleId" resultType="long">
|
||||
select menu_id from sys_role_menu
|
||||
<where>role_id = #{roleId}</where>
|
||||
</select>
|
||||
|
||||
<delete id="removeByRoleId">
|
||||
DELETE FROM sys_role_menu WHERE role_id=#{roleId}
|
||||
</delete>
|
||||
|
||||
<delete id="removeByMenuId">
|
||||
DELETE FROM sys_role_menu WHERE menu_id=#{menuId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchSave">
|
||||
INSERT INTO sys_role_menu(role_id, menu_id) values
|
||||
<foreach item="item" index="index" collection="list"
|
||||
separator=",">
|
||||
(#{item.roleId},#{item.menuId})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
236
novel-admin/src/main/resources/mybatis/system/UserMapper.xml
Normal file
236
novel-admin/src/main/resources/mybatis/system/UserMapper.xml
Normal file
@ -0,0 +1,236 @@
|
||||
<?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.java2nb.system.dao.UserDao">
|
||||
|
||||
<select id="get" resultType="com.java2nb.system.domain.UserDO">
|
||||
select `user_id`,`username`,`name`,`password`,`dept_id`,`email`,`mobile`,`status`,`user_id_create`,`gmt_create`,`gmt_modified`,`sex`,`birth`,`pic_id`,`live_address`,`hobby`,`province`,`city`,`district` from sys_user where user_id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.java2nb.system.domain.UserDO">
|
||||
select
|
||||
`user_id`,`username`,`name`,`password`,`dept_id`,`email`,`mobile`,`status`,`user_id_create`,`gmt_create`,`gmt_modified`,`sex`,`birth`,`pic_id`,`live_address`,`hobby`,`province`,`city`,`district`
|
||||
from sys_user
|
||||
<where>
|
||||
<if test="userId != null and userId != ''">and user_id = #{userId}</if>
|
||||
<if test="username != null and username != ''">and username = #{username}</if>
|
||||
<if test="name != null and name != ''">and name = #{name}</if>
|
||||
<if test="password != null and password != ''">and password = #{password}</if>
|
||||
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
|
||||
<if test="deptIds != null and deptIds.size() > 0">and dept_id in
|
||||
<foreach collection="deptIds" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="email != null and email != ''">and email = #{email}</if>
|
||||
<if test="mobile != null and mobile != ''">and mobile = #{mobile}</if>
|
||||
<if test="status != null and status != ''">and status = #{status}</if>
|
||||
<if test="userIdCreate != null and userIdCreate != ''">and user_id_create = #{userIdCreate}</if>
|
||||
<if test="gmtCreate != null and gmtCreate != ''">and gmt_create = #{gmtCreate}</if>
|
||||
<if test="gmtModified != null and gmtModified != ''">and gmt_modified = #{gmtModified}</if>
|
||||
<if test="sex != null and sex != ''">and sex = #{sex}</if>
|
||||
<if test="birth != null and birth != ''">and birth = #{birth}</if>
|
||||
<if test="picId != null and picId != ''">and pic_id = #{picId}</if>
|
||||
<if test="liveAddress != null and liveAddress != ''">and live_address = #{liveAddress}</if>
|
||||
<if test="hobby != null and hobby != ''">and hobby = #{hobby}</if>
|
||||
<if test="province != null and province != ''">and province = #{province}</if>
|
||||
<if test="city != null and city != ''">and city = #{city}</if>
|
||||
<if test="district != null and district != ''">and district = #{district}</if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by user_id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="listByPerm" resultType="com.java2nb.system.domain.UserDO">
|
||||
select `user_id`,`username`,`name`,`password`,`dept_id`,`email`,`mobile`,`status`,`user_id_create`,`gmt_create`,`gmt_modified`,`sex`,`birth`,`pic_id`,`live_address`,`hobby`,`province`,`city`,`district`
|
||||
from (
|
||||
select
|
||||
`user_id`,`username`,`name`,`password`,`dept_id`,`email`,`mobile`,`status`,`user_id_create`,`gmt_create`,`gmt_modified`,`sex`,`birth`,`pic_id`,`live_address`,`hobby`,`province`,`city`,`district`
|
||||
from sys_user
|
||||
<where>
|
||||
<if test="userId != null and userId != ''">and user_id = #{userId}</if>
|
||||
<if test="username != null and username != ''">and username = #{username}</if>
|
||||
<if test="name != null and name != ''">and name = #{name}</if>
|
||||
<if test="password != null and password != ''">and password = #{password}</if>
|
||||
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
|
||||
<if test="deptIds != null and deptIds.size() > 0">and dept_id in
|
||||
<foreach collection="deptIds" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="email != null and email != ''">and email = #{email}</if>
|
||||
<if test="mobile != null and mobile != ''">and mobile = #{mobile}</if>
|
||||
<if test="status != null and status != ''">and status = #{status}</if>
|
||||
<if test="userIdCreate != null and userIdCreate != ''">and user_id_create = #{userIdCreate}</if>
|
||||
<if test="gmtCreate != null and gmtCreate != ''">and gmt_create = #{gmtCreate}</if>
|
||||
<if test="gmtModified != null and gmtModified != ''">and gmt_modified = #{gmtModified}</if>
|
||||
<if test="sex != null and sex != ''">and sex = #{sex}</if>
|
||||
<if test="birth != null and birth != ''">and birth = #{birth}</if>
|
||||
<if test="picId != null and picId != ''">and pic_id = #{picId}</if>
|
||||
<if test="liveAddress != null and liveAddress != ''">and live_address = #{liveAddress}</if>
|
||||
<if test="hobby != null and hobby != ''">and hobby = #{hobby}</if>
|
||||
<if test="province != null and province != ''">and province = #{province}</if>
|
||||
<if test="city != null and city != ''">and city = #{city}</if>
|
||||
<if test="district != null and district != ''">and district = #{district}</if>
|
||||
</where>
|
||||
) t
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by user_id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
<select id="countByPerm" resultType="int">
|
||||
select count(*) from (
|
||||
select `user_id`,`username`,`name`,`password`,`dept_id`,`email`,`mobile`,`status`,`user_id_create`,`gmt_create`,`gmt_modified`,`sex`,`birth`,`pic_id`,`live_address`,`hobby`,`province`,`city`,`district`
|
||||
from sys_user
|
||||
<where>
|
||||
<if test="userId != null and userId != ''">and user_id = #{userId}</if>
|
||||
<if test="username != null and username != ''">and username = #{username}</if>
|
||||
<if test="name != null and name != ''">and name = #{name}</if>
|
||||
<if test="password != null and password != ''">and password = #{password}</if>
|
||||
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
|
||||
<if test="email != null and email != ''">and email = #{email}</if>
|
||||
<if test="mobile != null and mobile != ''">and mobile = #{mobile}</if>
|
||||
<if test="status != null and status != ''">and status = #{status}</if>
|
||||
<if test="userIdCreate != null and userIdCreate != ''">and user_id_create = #{userIdCreate}</if>
|
||||
<if test="gmtCreate != null and gmtCreate != ''">and gmt_create = #{gmtCreate}</if>
|
||||
<if test="gmtModified != null and gmtModified != ''">and gmt_modified = #{gmtModified}</if>
|
||||
<if test="sex != null and sex != ''">and sex = #{sex}</if>
|
||||
<if test="birth != null and birth != ''">and birth = #{birth}</if>
|
||||
<if test="picId != null and picId != ''">and pic_id = #{picId}</if>
|
||||
<if test="liveAddress != null and liveAddress != ''">and live_address = #{liveAddress}</if>
|
||||
<if test="hobby != null and hobby != ''">and hobby = #{hobby}</if>
|
||||
<if test="province != null and province != ''">and province = #{province}</if>
|
||||
<if test="city != null and city != ''">and city = #{city}</if>
|
||||
<if test="district != null and district != ''">and district = #{district}</if>
|
||||
</where>
|
||||
) t
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from sys_user
|
||||
<where>
|
||||
<if test="userId != null and userId != ''">and user_id = #{userId}</if>
|
||||
<if test="username != null and username != ''">and username = #{username}</if>
|
||||
<if test="name != null and name != ''">and name = #{name}</if>
|
||||
<if test="password != null and password != ''">and password = #{password}</if>
|
||||
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
|
||||
<if test="email != null and email != ''">and email = #{email}</if>
|
||||
<if test="mobile != null and mobile != ''">and mobile = #{mobile}</if>
|
||||
<if test="status != null and status != ''">and status = #{status}</if>
|
||||
<if test="userIdCreate != null and userIdCreate != ''">and user_id_create = #{userIdCreate}</if>
|
||||
<if test="gmtCreate != null and gmtCreate != ''">and gmt_create = #{gmtCreate}</if>
|
||||
<if test="gmtModified != null and gmtModified != ''">and gmt_modified = #{gmtModified}</if>
|
||||
<if test="sex != null and sex != ''">and sex = #{sex}</if>
|
||||
<if test="birth != null and birth != ''">and birth = #{birth}</if>
|
||||
<if test="picId != null and picId != ''">and pic_id = #{picId}</if>
|
||||
<if test="liveAddress != null and liveAddress != ''">and live_address = #{liveAddress}</if>
|
||||
<if test="hobby != null and hobby != ''">and hobby = #{hobby}</if>
|
||||
<if test="province != null and province != ''">and province = #{province}</if>
|
||||
<if test="city != null and city != ''">and city = #{city}</if>
|
||||
<if test="district != null and district != ''">and district = #{district}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.java2nb.system.domain.UserDO" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user
|
||||
(
|
||||
`username`,
|
||||
`name`,
|
||||
`password`,
|
||||
`dept_id`,
|
||||
`email`,
|
||||
`mobile`,
|
||||
`status`,
|
||||
`user_id_create`,
|
||||
`gmt_create`,
|
||||
`gmt_modified`,
|
||||
`sex`,
|
||||
`birth`,
|
||||
`pic_id`,
|
||||
`live_address`,
|
||||
`hobby`,
|
||||
`province`,
|
||||
`city`,
|
||||
`district`
|
||||
)
|
||||
values
|
||||
(
|
||||
#{username},
|
||||
#{name},
|
||||
#{password},
|
||||
#{deptId},
|
||||
#{email},
|
||||
#{mobile},
|
||||
#{status},
|
||||
#{userIdCreate},
|
||||
#{gmtCreate},
|
||||
#{gmtModified},
|
||||
#{sex},
|
||||
#{birth},
|
||||
#{picId},
|
||||
#{liveAddress},
|
||||
#{hobby},
|
||||
#{province},
|
||||
#{city},
|
||||
#{district}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.java2nb.system.domain.UserDO">
|
||||
update sys_user
|
||||
<set>
|
||||
<if test="username != null">`username` = #{username},</if>
|
||||
<if test="name != null">`name` = #{name},</if>
|
||||
<if test="password != null">`password` = #{password},</if>
|
||||
<if test="deptId != null">`dept_id` = #{deptId},</if>
|
||||
<if test="email != null">`email` = #{email},</if>
|
||||
<if test="mobile != null">`mobile` = #{mobile},</if>
|
||||
<if test="status != null">`status` = #{status},</if>
|
||||
<if test="userIdCreate != null">`user_id_create` = #{userIdCreate},</if>
|
||||
<if test="gmtCreate != null">`gmt_create` = #{gmtCreate},</if>
|
||||
<if test="gmtModified != null">`gmt_modified` = #{gmtModified},</if>
|
||||
<if test="sex != null">`sex` = #{sex},</if>
|
||||
<if test="birth != null">`birth` = #{birth},</if>
|
||||
<if test="picId != null">`pic_id` = #{picId},</if>
|
||||
<if test="liveAddress != null">`live_address` = #{liveAddress},</if>
|
||||
<if test="hobby != null">`hobby` = #{hobby},</if>
|
||||
<if test="province != null">`province` = #{province},</if>
|
||||
<if test="city != null">`city` = #{city},</if>
|
||||
<if test="district != null">`district` = #{district}</if>
|
||||
</set>
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<delete id="remove">
|
||||
delete from sys_user where user_id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from sys_user where user_id in
|
||||
<foreach item="userId" collection="array" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="listAllDept" resultType="long">
|
||||
select DISTINCT dept_id from sys_user
|
||||
</select>
|
||||
|
||||
</mapper>
|
104
novel-admin/src/main/resources/mybatis/system/UserRoleMapper.xml
Normal file
104
novel-admin/src/main/resources/mybatis/system/UserRoleMapper.xml
Normal file
@ -0,0 +1,104 @@
|
||||
<?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.java2nb.system.dao.UserRoleDao">
|
||||
|
||||
<select id="get" resultType="com.java2nb.system.domain.UserRoleDO">
|
||||
select `id`,`user_id`,`role_id` from
|
||||
sys_user_role where id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.java2nb.system.domain.UserRoleDO">
|
||||
select `id`,`user_id`,`role_id` from sys_user_role
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="userId != null and userId != ''"> and user_id = #{userId} </if>
|
||||
<if test="roleId != null and roleId != ''"> and role_id = #{roleId} </if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from sys_user_role
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="userId != null and userId != ''"> and user_id = #{userId} </if>
|
||||
<if test="roleId != null and roleId != ''"> and role_id = #{roleId} </if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.java2nb.system.domain.UserRoleDO"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_user_role
|
||||
(
|
||||
`user_id`,
|
||||
`role_id`
|
||||
)
|
||||
values
|
||||
(
|
||||
#{userId},
|
||||
#{roleId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.java2nb.system.domain.UserRoleDO">
|
||||
update sys_user_role
|
||||
<set>
|
||||
<if test="userId != null">`user_id` = #{userId}, </if>
|
||||
<if test="roleId != null">`role_id` = #{roleId}</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="remove">
|
||||
delete from sys_user_role where id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from sys_user_role where id in
|
||||
<foreach item="id" collection="array" open="(" separator=","
|
||||
close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="listRoleId" resultType="long">
|
||||
select role_id from
|
||||
sys_user_role where
|
||||
user_id=#{userId}
|
||||
</select>
|
||||
|
||||
<delete id="removeByUserId">
|
||||
delete from sys_user_role where user_id=#{userId}
|
||||
</delete>
|
||||
|
||||
<delete id="removeByRoleId">
|
||||
delete from sys_user_role where role_id=#{roleId}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemoveByUserId">
|
||||
delete from sys_user_role where user_id in
|
||||
<foreach item="id" collection="array" open="(" separator=","
|
||||
close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchSave">
|
||||
INSERT INTO sys_user_role(user_id, role_id) values
|
||||
<foreach item="item" index="index" collection="list"
|
||||
separator=",">
|
||||
(#{item.userId},#{item.roleId})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
283
novel-admin/src/main/resources/mybatis/test/OrderMapper.xml
Normal file
283
novel-admin/src/main/resources/mybatis/test/OrderMapper.xml
Normal file
@ -0,0 +1,283 @@
|
||||
<?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.java2nb.test.dao.OrderDao">
|
||||
|
||||
<select id="get" resultType="com.java2nb.test.domain.OrderDO">
|
||||
select `id`,`fb_merchant_code`,`merchant_order_sn`,`order_sn`,`platform_order_no`,`trade_no`,`order_state`,`fn_coupon`,`red_packet`,`total_fee`,`order_price`,`fee`,`body`,`attach`,`store_id`,`cashier_id`,`device_no`,`user_id`,`user_logon_id`,`pay_time`,`pay_channel`,`no_cash_coupon_fee`,`cash_coupon_fee`,`cash_fee`,`sign`,`options`,`create_time`,`push_time`,`push_ip`,`mcht_id`,`sn` from fb_order where id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.java2nb.test.domain.OrderDO">
|
||||
select `id`,`fb_merchant_code`,`merchant_order_sn`,`order_sn`,`platform_order_no`,`trade_no`,`order_state`,`fn_coupon`,`red_packet`,`total_fee`,`order_price`,`fee`,`body`,`attach`,`store_id`,`cashier_id`,`device_no`,`user_id`,`user_logon_id`,`pay_time`,`pay_channel`,`no_cash_coupon_fee`,`cash_coupon_fee`,`cash_fee`,`sign`,`options`,`create_time`,`push_time`,`push_ip`,`mcht_id`,`sn` from fb_order
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="fbMerchantCode != null and fbMerchantCode != ''"> and fb_merchant_code = #{fbMerchantCode} </if>
|
||||
<if test="merchantOrderSn != null and merchantOrderSn != ''"> and merchant_order_sn = #{merchantOrderSn} </if>
|
||||
<if test="orderSn != null and orderSn != ''"> and order_sn = #{orderSn} </if>
|
||||
<if test="platformOrderNo != null and platformOrderNo != ''"> and platform_order_no = #{platformOrderNo} </if>
|
||||
<if test="tradeNo != null and tradeNo != ''"> and trade_no = #{tradeNo} </if>
|
||||
<if test="orderState != null and orderState != ''"> and order_state = #{orderState} </if>
|
||||
<if test="fnCoupon != null and fnCoupon != ''"> and fn_coupon = #{fnCoupon} </if>
|
||||
<if test="redPacket != null and redPacket != ''"> and red_packet = #{redPacket} </if>
|
||||
<if test="totalFee != null and totalFee != ''"> and total_fee = #{totalFee} </if>
|
||||
<if test="orderPrice != null and orderPrice != ''"> and order_price = #{orderPrice} </if>
|
||||
<if test="fee != null and fee != ''"> and fee = #{fee} </if>
|
||||
<if test="body != null and body != ''"> and body = #{body} </if>
|
||||
<if test="attach != null and attach != ''"> and attach = #{attach} </if>
|
||||
<if test="storeId != null and storeId != ''"> and store_id = #{storeId} </if>
|
||||
<if test="cashierId != null and cashierId != ''"> and cashier_id = #{cashierId} </if>
|
||||
<if test="deviceNo != null and deviceNo != ''"> and device_no = #{deviceNo} </if>
|
||||
<if test="userId != null and userId != ''"> and user_id = #{userId} </if>
|
||||
<if test="userLogonId != null and userLogonId != ''"> and user_logon_id = #{userLogonId} </if>
|
||||
<if test="payTime != null and payTime != ''"> and pay_time = #{payTime} </if>
|
||||
<if test="payChannel != null and payChannel != ''"> and pay_channel = #{payChannel} </if>
|
||||
<if test="noCashCouponFee != null and noCashCouponFee != ''"> and no_cash_coupon_fee = #{noCashCouponFee} </if>
|
||||
<if test="cashCouponFee != null and cashCouponFee != ''"> and cash_coupon_fee = #{cashCouponFee} </if>
|
||||
<if test="cashFee != null and cashFee != ''"> and cash_fee = #{cashFee} </if>
|
||||
<if test="sign != null and sign != ''"> and sign = #{sign} </if>
|
||||
<if test="options != null and options != ''"> and options = #{options} </if>
|
||||
<if test="createTime != null and createTime != ''"> and create_time = #{createTime} </if>
|
||||
<if test="pushTime != null and pushTime != ''"> and push_time = #{pushTime} </if>
|
||||
<if test="pushIp != null and pushIp != ''"> and push_ip = #{pushIp} </if>
|
||||
<if test="mchtId != null and mchtId != ''"> and mcht_id = #{mchtId} </if>
|
||||
<if test="sn != null and sn != ''"> and sn = #{sn} </if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sort != null and sort.trim() != ''">
|
||||
order by ${sort} ${order}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="offset != null and limit != null">
|
||||
limit #{offset}, #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from fb_order
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="fbMerchantCode != null and fbMerchantCode != ''"> and fb_merchant_code = #{fbMerchantCode} </if>
|
||||
<if test="merchantOrderSn != null and merchantOrderSn != ''"> and merchant_order_sn = #{merchantOrderSn} </if>
|
||||
<if test="orderSn != null and orderSn != ''"> and order_sn = #{orderSn} </if>
|
||||
<if test="platformOrderNo != null and platformOrderNo != ''"> and platform_order_no = #{platformOrderNo} </if>
|
||||
<if test="tradeNo != null and tradeNo != ''"> and trade_no = #{tradeNo} </if>
|
||||
<if test="orderState != null and orderState != ''"> and order_state = #{orderState} </if>
|
||||
<if test="fnCoupon != null and fnCoupon != ''"> and fn_coupon = #{fnCoupon} </if>
|
||||
<if test="redPacket != null and redPacket != ''"> and red_packet = #{redPacket} </if>
|
||||
<if test="totalFee != null and totalFee != ''"> and total_fee = #{totalFee} </if>
|
||||
<if test="orderPrice != null and orderPrice != ''"> and order_price = #{orderPrice} </if>
|
||||
<if test="fee != null and fee != ''"> and fee = #{fee} </if>
|
||||
<if test="body != null and body != ''"> and body = #{body} </if>
|
||||
<if test="attach != null and attach != ''"> and attach = #{attach} </if>
|
||||
<if test="storeId != null and storeId != ''"> and store_id = #{storeId} </if>
|
||||
<if test="cashierId != null and cashierId != ''"> and cashier_id = #{cashierId} </if>
|
||||
<if test="deviceNo != null and deviceNo != ''"> and device_no = #{deviceNo} </if>
|
||||
<if test="userId != null and userId != ''"> and user_id = #{userId} </if>
|
||||
<if test="userLogonId != null and userLogonId != ''"> and user_logon_id = #{userLogonId} </if>
|
||||
<if test="payTime != null and payTime != ''"> and pay_time = #{payTime} </if>
|
||||
<if test="payChannel != null and payChannel != ''"> and pay_channel = #{payChannel} </if>
|
||||
<if test="noCashCouponFee != null and noCashCouponFee != ''"> and no_cash_coupon_fee = #{noCashCouponFee} </if>
|
||||
<if test="cashCouponFee != null and cashCouponFee != ''"> and cash_coupon_fee = #{cashCouponFee} </if>
|
||||
<if test="cashFee != null and cashFee != ''"> and cash_fee = #{cashFee} </if>
|
||||
<if test="sign != null and sign != ''"> and sign = #{sign} </if>
|
||||
<if test="options != null and options != ''"> and options = #{options} </if>
|
||||
<if test="createTime != null and createTime != ''"> and create_time = #{createTime} </if>
|
||||
<if test="pushTime != null and pushTime != ''"> and push_time = #{pushTime} </if>
|
||||
<if test="pushIp != null and pushIp != ''"> and push_ip = #{pushIp} </if>
|
||||
<if test="mchtId != null and mchtId != ''"> and mcht_id = #{mchtId} </if>
|
||||
<if test="sn != null and sn != ''"> and sn = #{sn} </if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.java2nb.test.domain.OrderDO" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into fb_order
|
||||
(
|
||||
`fb_merchant_code`,
|
||||
`merchant_order_sn`,
|
||||
`order_sn`,
|
||||
`platform_order_no`,
|
||||
`trade_no`,
|
||||
`order_state`,
|
||||
`fn_coupon`,
|
||||
`red_packet`,
|
||||
`total_fee`,
|
||||
`order_price`,
|
||||
`fee`,
|
||||
`body`,
|
||||
`attach`,
|
||||
`store_id`,
|
||||
`cashier_id`,
|
||||
`device_no`,
|
||||
`user_id`,
|
||||
`user_logon_id`,
|
||||
`pay_time`,
|
||||
`pay_channel`,
|
||||
`no_cash_coupon_fee`,
|
||||
`cash_coupon_fee`,
|
||||
`cash_fee`,
|
||||
`sign`,
|
||||
`options`,
|
||||
`create_time`,
|
||||
`push_time`,
|
||||
`push_ip`,
|
||||
`mcht_id`,
|
||||
`sn`
|
||||
)
|
||||
values
|
||||
(
|
||||
#{fbMerchantCode},
|
||||
#{merchantOrderSn},
|
||||
#{orderSn},
|
||||
#{platformOrderNo},
|
||||
#{tradeNo},
|
||||
#{orderState},
|
||||
#{fnCoupon},
|
||||
#{redPacket},
|
||||
#{totalFee},
|
||||
#{orderPrice},
|
||||
#{fee},
|
||||
#{body},
|
||||
#{attach},
|
||||
#{storeId},
|
||||
#{cashierId},
|
||||
#{deviceNo},
|
||||
#{userId},
|
||||
#{userLogonId},
|
||||
#{payTime},
|
||||
#{payChannel},
|
||||
#{noCashCouponFee},
|
||||
#{cashCouponFee},
|
||||
#{cashFee},
|
||||
#{sign},
|
||||
#{options},
|
||||
#{createTime},
|
||||
#{pushTime},
|
||||
#{pushIp},
|
||||
#{mchtId},
|
||||
#{sn}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="saveSelective" parameterType="com.java2nb.test.domain.OrderDO" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into fb_order
|
||||
(
|
||||
<if test="id != null"> `id`, </if>
|
||||
<if test="fbMerchantCode != null"> `fb_merchant_code`, </if>
|
||||
<if test="merchantOrderSn != null"> `merchant_order_sn`, </if>
|
||||
<if test="orderSn != null"> `order_sn`, </if>
|
||||
<if test="platformOrderNo != null"> `platform_order_no`, </if>
|
||||
<if test="tradeNo != null"> `trade_no`, </if>
|
||||
<if test="orderState != null"> `order_state`, </if>
|
||||
<if test="fnCoupon != null"> `fn_coupon`, </if>
|
||||
<if test="redPacket != null"> `red_packet`, </if>
|
||||
<if test="totalFee != null"> `total_fee`, </if>
|
||||
<if test="orderPrice != null"> `order_price`, </if>
|
||||
<if test="fee != null"> `fee`, </if>
|
||||
<if test="body != null"> `body`, </if>
|
||||
<if test="attach != null"> `attach`, </if>
|
||||
<if test="storeId != null"> `store_id`, </if>
|
||||
<if test="cashierId != null"> `cashier_id`, </if>
|
||||
<if test="deviceNo != null"> `device_no`, </if>
|
||||
<if test="userId != null"> `user_id`, </if>
|
||||
<if test="userLogonId != null"> `user_logon_id`, </if>
|
||||
<if test="payTime != null"> `pay_time`, </if>
|
||||
<if test="payChannel != null"> `pay_channel`, </if>
|
||||
<if test="noCashCouponFee != null"> `no_cash_coupon_fee`, </if>
|
||||
<if test="cashCouponFee != null"> `cash_coupon_fee`, </if>
|
||||
<if test="cashFee != null"> `cash_fee`, </if>
|
||||
<if test="sign != null"> `sign`, </if>
|
||||
<if test="options != null"> `options`, </if>
|
||||
<if test="createTime != null"> `create_time`, </if>
|
||||
<if test="pushTime != null"> `push_time`, </if>
|
||||
<if test="pushIp != null"> `push_ip`, </if>
|
||||
<if test="mchtId != null"> `mcht_id`, </if>
|
||||
<if test="sn != null"> `sn` </if>
|
||||
)
|
||||
values
|
||||
(
|
||||
<if test="id != null"> #{id}, </if>
|
||||
<if test="fbMerchantCode != null"> #{fbMerchantCode}, </if>
|
||||
<if test="merchantOrderSn != null"> #{merchantOrderSn}, </if>
|
||||
<if test="orderSn != null"> #{orderSn}, </if>
|
||||
<if test="platformOrderNo != null"> #{platformOrderNo}, </if>
|
||||
<if test="tradeNo != null"> #{tradeNo}, </if>
|
||||
<if test="orderState != null"> #{orderState}, </if>
|
||||
<if test="fnCoupon != null"> #{fnCoupon}, </if>
|
||||
<if test="redPacket != null"> #{redPacket}, </if>
|
||||
<if test="totalFee != null"> #{totalFee}, </if>
|
||||
<if test="orderPrice != null"> #{orderPrice}, </if>
|
||||
<if test="fee != null"> #{fee}, </if>
|
||||
<if test="body != null"> #{body}, </if>
|
||||
<if test="attach != null"> #{attach}, </if>
|
||||
<if test="storeId != null"> #{storeId}, </if>
|
||||
<if test="cashierId != null"> #{cashierId}, </if>
|
||||
<if test="deviceNo != null"> #{deviceNo}, </if>
|
||||
<if test="userId != null"> #{userId}, </if>
|
||||
<if test="userLogonId != null"> #{userLogonId}, </if>
|
||||
<if test="payTime != null"> #{payTime}, </if>
|
||||
<if test="payChannel != null"> #{payChannel}, </if>
|
||||
<if test="noCashCouponFee != null"> #{noCashCouponFee}, </if>
|
||||
<if test="cashCouponFee != null"> #{cashCouponFee}, </if>
|
||||
<if test="cashFee != null"> #{cashFee}, </if>
|
||||
<if test="sign != null"> #{sign}, </if>
|
||||
<if test="options != null"> #{options}, </if>
|
||||
<if test="createTime != null"> #{createTime}, </if>
|
||||
<if test="pushTime != null"> #{pushTime}, </if>
|
||||
<if test="pushIp != null"> #{pushIp}, </if>
|
||||
<if test="mchtId != null"> #{mchtId}, </if>
|
||||
<if test="sn != null"> #{sn} </if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.java2nb.test.domain.OrderDO">
|
||||
update fb_order
|
||||
<set>
|
||||
<if test="fbMerchantCode != null">`fb_merchant_code` = #{fbMerchantCode}, </if>
|
||||
<if test="merchantOrderSn != null">`merchant_order_sn` = #{merchantOrderSn}, </if>
|
||||
<if test="orderSn != null">`order_sn` = #{orderSn}, </if>
|
||||
<if test="platformOrderNo != null">`platform_order_no` = #{platformOrderNo}, </if>
|
||||
<if test="tradeNo != null">`trade_no` = #{tradeNo}, </if>
|
||||
<if test="orderState != null">`order_state` = #{orderState}, </if>
|
||||
<if test="fnCoupon != null">`fn_coupon` = #{fnCoupon}, </if>
|
||||
<if test="redPacket != null">`red_packet` = #{redPacket}, </if>
|
||||
<if test="totalFee != null">`total_fee` = #{totalFee}, </if>
|
||||
<if test="orderPrice != null">`order_price` = #{orderPrice}, </if>
|
||||
<if test="fee != null">`fee` = #{fee}, </if>
|
||||
<if test="body != null">`body` = #{body}, </if>
|
||||
<if test="attach != null">`attach` = #{attach}, </if>
|
||||
<if test="storeId != null">`store_id` = #{storeId}, </if>
|
||||
<if test="cashierId != null">`cashier_id` = #{cashierId}, </if>
|
||||
<if test="deviceNo != null">`device_no` = #{deviceNo}, </if>
|
||||
<if test="userId != null">`user_id` = #{userId}, </if>
|
||||
<if test="userLogonId != null">`user_logon_id` = #{userLogonId}, </if>
|
||||
<if test="payTime != null">`pay_time` = #{payTime}, </if>
|
||||
<if test="payChannel != null">`pay_channel` = #{payChannel}, </if>
|
||||
<if test="noCashCouponFee != null">`no_cash_coupon_fee` = #{noCashCouponFee}, </if>
|
||||
<if test="cashCouponFee != null">`cash_coupon_fee` = #{cashCouponFee}, </if>
|
||||
<if test="cashFee != null">`cash_fee` = #{cashFee}, </if>
|
||||
<if test="sign != null">`sign` = #{sign}, </if>
|
||||
<if test="options != null">`options` = #{options}, </if>
|
||||
<if test="createTime != null">`create_time` = #{createTime}, </if>
|
||||
<if test="pushTime != null">`push_time` = #{pushTime}, </if>
|
||||
<if test="pushIp != null">`push_ip` = #{pushIp}, </if>
|
||||
<if test="mchtId != null">`mcht_id` = #{mchtId}, </if>
|
||||
<if test="sn != null">`sn` = #{sn}</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="remove">
|
||||
delete from fb_order where id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from fb_order where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user