init
This commit is contained in:
28
admin/admin-biz/src/main/resources/bootstrap-dev.yml
Normal file
28
admin/admin-biz/src/main/resources/bootstrap-dev.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
# Spring
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
# server-addr: 10.7.127.185:38848
|
||||
server-addr: 162.14.111.170:8848
|
||||
|
||||
namespace: gary
|
||||
|
||||
|
||||
|
||||
dubbo:
|
||||
registry:
|
||||
parameters:
|
||||
namespace: dubbo-gary
|
||||
|
||||
seata:
|
||||
service:
|
||||
grouplist:
|
||||
seata-server: 10.7.127.185:8091
|
||||
registry:
|
||||
nacos:
|
||||
namespace: dev
|
||||
config:
|
||||
apollo:
|
||||
namespace: seata-config
|
||||
22
admin/admin-biz/src/main/resources/bootstrap-pro.yml
Normal file
22
admin/admin-biz/src/main/resources/bootstrap-pro.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
# Spring
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: nacos.fateverse.svc.cluster.local:8848
|
||||
|
||||
seata:
|
||||
service:
|
||||
grouplist:
|
||||
seata-server: seataio.fateverse.svc.cluster.local:8091
|
||||
registry:
|
||||
nacos:
|
||||
namespace: pro
|
||||
config:
|
||||
apollo:
|
||||
namespace: seata-pro
|
||||
|
||||
management:
|
||||
server:
|
||||
port: 9595
|
||||
75
admin/admin-biz/src/main/resources/bootstrap.yml
Normal file
75
admin/admin-biz/src/main/resources/bootstrap.yml
Normal file
@@ -0,0 +1,75 @@
|
||||
# Tomcat
|
||||
server:
|
||||
port: 9010
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: admin
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 192.168.101.108:8848
|
||||
username: nacos
|
||||
password: nacos
|
||||
namespace: ${spring.profiles.active}
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
file-extension: yaml
|
||||
namespace: ${spring.profiles.active}
|
||||
shared-configs:
|
||||
- data-id: application-${spring.profiles.active}.yaml
|
||||
refresh: true
|
||||
|
||||
encrypt:
|
||||
secretKey: 1234567890abcdef
|
||||
|
||||
dubbo:
|
||||
application:
|
||||
name: dubbo-${spring.application.name}
|
||||
protocol:
|
||||
name: dubbo
|
||||
port: -1
|
||||
registry:
|
||||
address: nacos://${spring.cloud.nacos.discovery.server-addr}
|
||||
username: ${spring.cloud.nacos.discovery.username}
|
||||
password: ${spring.cloud.nacos.discovery.password}
|
||||
parameters:
|
||||
namespace: dubbo-${spring.profiles.active}
|
||||
|
||||
|
||||
seata:
|
||||
application-id: ${spring.application.name}
|
||||
tx-service-group: default_tx_group
|
||||
service:
|
||||
grouplist:
|
||||
seata-server: 10.7.127.185:8091
|
||||
registry:
|
||||
type: nacos
|
||||
nacos:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
username: ${spring.cloud.nacos.discovery.username}
|
||||
password: ${spring.cloud.nacos.discovery.password}
|
||||
group: SEATA_GROUP
|
||||
namespace: dev
|
||||
config:
|
||||
type: nacos
|
||||
nacos:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
username: ${spring.cloud.nacos.discovery.username}
|
||||
password: ${spring.cloud.nacos.discovery.password}
|
||||
group: SEATA_GROUP
|
||||
namespace: seata-config
|
||||
client:
|
||||
undo:
|
||||
log-serialization: kryo
|
||||
data-validation: true
|
||||
rm:
|
||||
report-retry-count: 5
|
||||
table-meta-check-enable: false
|
||||
112
admin/admin-biz/src/main/resources/mapper/ConfigMapper.xml
Normal file
112
admin/admin-biz/src/main/resources/mapper/ConfigMapper.xml
Normal file
@@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.fateverse.admin.mapper.ConfigMapper">
|
||||
|
||||
<resultMap id="ConfigResult" type="cn.fateverse.admin.entity.Config">
|
||||
<id column="config_id" property="configId"/>
|
||||
<result column="config_name" property="configName"/>
|
||||
<result column="config_key" property="configKey"/>
|
||||
<result column="config_value" property="configValue"/>
|
||||
<result column="config_type" property="configType"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectConfigVo">
|
||||
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark from sys_config
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
<select id="selectList" resultMap="ConfigResult">
|
||||
<include refid="selectConfigVo"/>
|
||||
<where>
|
||||
<if test="configName != null and configName != ''"> and config_name like concat('%', #{configName}, '%')</if>
|
||||
<if test="configKey != null and configKey != ''"> and config_key like concat('%', #{configKey}, '%')</if>
|
||||
<if test="configType != null "> and config_type = #{configType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectListPage" resultType="cn.fateverse.admin.entity.Config">
|
||||
<include refid="selectConfigVo"/>
|
||||
<where>
|
||||
config_id >= (select config_id from sys_config
|
||||
<where>
|
||||
<if test="query.configName != null and query.configName != ''"> and config_name like concat('%', #{query.configName}, '%')</if>
|
||||
<if test="query.configKey != null and query.configKey != ''"> and config_key like concat('%', #{query.configKey}, '%')</if>
|
||||
<if test="query.configType != null "> and config_type = #{query.configType}</if>
|
||||
</where> limit #{start},1)
|
||||
<if test="query.configName != null and query.configName != ''"> and config_name like concat('%', #{query.configName}, '%')</if>
|
||||
<if test="query.configKey != null and query.configKey != ''"> and config_key like concat('%', #{query.configKey}, '%')</if>
|
||||
<if test="query.configType != null "> and config_type = #{query.configType}</if>
|
||||
limit #{size}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectById" resultMap="ConfigResult">
|
||||
<include refid="selectConfigVo"/>
|
||||
where config_id = #{configId}
|
||||
</select>
|
||||
<select id="selectCount" resultType="java.lang.Long">
|
||||
select count(*) from sys_config
|
||||
<where>
|
||||
<if test="query.configName != null and query.configName != ''"> and config_name like concat('%', #{query.configName}, '%')</if>
|
||||
<if test="query.configKey != null and query.configKey != ''"> and config_key like concat('%', #{query.configKey}, '%')</if>
|
||||
<if test="query.configType != null "> and config_type = #{query.configType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insert" >
|
||||
insert into sys_config
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="configName != null">config_name,</if>
|
||||
<if test="configKey != null">config_key,</if>
|
||||
<if test="configValue != null">config_value,</if>
|
||||
<if test="configType != null">config_type,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null ">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="configName != null">#{configName},</if>
|
||||
<if test="configKey != null">#{configKey},</if>
|
||||
<if test="configValue != null">#{configValue},</if>
|
||||
<if test="configType != null">#{configType},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null ">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update sys_config
|
||||
<set>
|
||||
<if test="configName != null">config_name = #{configName},</if>
|
||||
<if test="configKey != null">config_key = #{configKey},</if>
|
||||
<if test="configValue != null">config_value = #{configValue},</if>
|
||||
<if test="configType != null">config_type = #{configType},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null ">update_time = #{updateTime},</if>
|
||||
</set>
|
||||
where config_id = #{configId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete from sys_config
|
||||
where config_id = #{configId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBatchByIdList" parameterType="Integer">
|
||||
delete from sys_config
|
||||
where config_id in
|
||||
<foreach collection="list" open="(" close=")" separator="," item="configId">
|
||||
#{configId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
183
admin/admin-biz/src/main/resources/mapper/DeptMapper.xml
Normal file
183
admin/admin-biz/src/main/resources/mapper/DeptMapper.xml
Normal file
@@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.fateverse.admin.mapper.DeptMapper">
|
||||
|
||||
<sql id="selectSql">
|
||||
select dept_id,
|
||||
parent_id,
|
||||
ancestors,
|
||||
dept_name,
|
||||
order_num,
|
||||
leader,
|
||||
leader_id,
|
||||
phone,
|
||||
email,
|
||||
state,
|
||||
del_flag,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
from sys_dept
|
||||
</sql>
|
||||
|
||||
<select id="selectList" resultType="cn.fateverse.admin.entity.Dept">
|
||||
<include refid="selectSql"/>
|
||||
<where>
|
||||
<if test="deptName != null and deptName != ''"> and dept_name like concat('%',#{deptName},'%')</if>
|
||||
<if test="state != null"> and `state` = #{state}</if>
|
||||
</where>
|
||||
order by parent_id, order_num
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultType="cn.fateverse.admin.entity.Dept">
|
||||
select d.dept_id,
|
||||
d.parent_id,
|
||||
d.ancestors,
|
||||
d.dept_name,
|
||||
d.order_num,
|
||||
d.leader,
|
||||
d.leader_id,
|
||||
d.phone,
|
||||
d.email,
|
||||
d.state,
|
||||
d.del_flag,
|
||||
d.create_by,
|
||||
d.create_time,
|
||||
d.update_by,
|
||||
d.update_time
|
||||
from sys_dept d
|
||||
left join sys_dept p on p.dept_id = d.parent_id
|
||||
where d.dept_id = #{deptId}
|
||||
</select>
|
||||
|
||||
<select id="selectExclude" resultType="cn.fateverse.admin.entity.Dept">
|
||||
<include refid="selectSql"/>
|
||||
where dept_id != #{deptId} and parent_id != #{deptId}
|
||||
</select>
|
||||
|
||||
<select id="selectChildrenById" parameterType="Long" resultType="cn.fateverse.admin.entity.Dept">
|
||||
<include refid="selectSql"/>
|
||||
where find_in_set(#{deptId}, ancestors)
|
||||
</select>
|
||||
|
||||
<select id="selectByDeptNameAndParentId" resultType="cn.fateverse.admin.entity.Dept">
|
||||
<include refid="selectSql"/>
|
||||
where dept_name = #{deptName} and parent_id = #{parentId} limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectListByDeptParentId" resultType="cn.fateverse.admin.entity.Dept">
|
||||
<include refid="selectSql"/>
|
||||
where parent_id = #{parentId}
|
||||
</select>
|
||||
|
||||
<select id="selectChildCountByDeptId" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from sys_dept
|
||||
where parent_id = #{deptId}
|
||||
and del_flag = '0'
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectExistUserCount" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from sys_user
|
||||
where dept_id = #{deptId}
|
||||
and del_flag = '0'
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectDeptNameListByParentId" resultType="java.lang.String">
|
||||
select dept_name from sys_dept where parent_id = #{parentId}
|
||||
</select>
|
||||
|
||||
<select id="selectByIds" resultType="cn.fateverse.admin.entity.Dept">
|
||||
<include refid="selectSql"/>
|
||||
where dept_id in
|
||||
<foreach collection="list" item="deptId" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
insert into sys_dept
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||
<if test="deptName != null and deptName != ''">dept_name,</if>
|
||||
<if test="ancestors != null and ancestors != ''">ancestors,</if>
|
||||
<if test="orderNum != null and orderNum != ''">order_num,</if>
|
||||
<if test="leader != null and leader != ''">leader,</if>
|
||||
<if test="leaderId != null ">leader_id,</if>
|
||||
<if test="phone != null and phone != ''">phone,</if>
|
||||
<if test="email != null and email != ''">email,</if>
|
||||
<if test="state != null">state,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
||||
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
||||
<if test="deptName != null and deptName != ''">#{deptName},</if>
|
||||
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
|
||||
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
|
||||
<if test="leader != null and leader != ''">#{leader},</if>
|
||||
<if test="leaderId != null ">#{leaderId},</if>
|
||||
<if test="phone != null and phone != ''">#{phone},</if>
|
||||
<if test="email != null and email != ''">#{email},</if>
|
||||
<if test="state != null">#{state},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update sys_dept
|
||||
<set>
|
||||
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
||||
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
|
||||
<if test="ancestors != null">ancestors = #{ancestors},</if>
|
||||
<if test="orderNum != null">order_num = #{orderNum},</if>
|
||||
<if test="leader != null">leader = #{leader},</if>
|
||||
<if test="leaderId != null">leader_id = #{leaderId},</if>
|
||||
<if test="phone != null">phone = #{phone},</if>
|
||||
<if test="email != null">email = #{email},</if>
|
||||
<if test="state != null">state = #{state},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</set>
|
||||
where dept_id = #{deptId}
|
||||
</update>
|
||||
|
||||
<update id="updateChildren" parameterType="java.util.List">
|
||||
update sys_dept set ancestors =
|
||||
<foreach collection="depts" item="item" index="index"
|
||||
separator=" " open="case dept_id" close="end">
|
||||
when #{item.deptId} then #{item.ancestors}
|
||||
</foreach>
|
||||
where dept_id in
|
||||
<foreach collection="depts" item="item" index="index"
|
||||
separator="," open="(" close=")">
|
||||
#{item.deptId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateState">
|
||||
update sys_dept
|
||||
<set>
|
||||
<if test="state != null and state != ''">state = #{state},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</set>
|
||||
where dept_id in (${ancestors})
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
delete
|
||||
from sys_dept
|
||||
where dept_id = #{deptId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
127
admin/admin-biz/src/main/resources/mapper/DictDataMapper.xml
Normal file
127
admin/admin-biz/src/main/resources/mapper/DictDataMapper.xml
Normal 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="cn.fateverse.admin.mapper.DictDataMapper">
|
||||
|
||||
<resultMap id="DictDataResult" type="cn.fateverse.admin.entity.DictData">
|
||||
<id column="dict_code" property="dictCode"/>
|
||||
<result column="dict_sort" property="dictSort"/>
|
||||
<result column="dict_label" property="dictLabel"/>
|
||||
<result column="dict_value" property="dictValue"/>
|
||||
<result column="dict_type" property="dictType"/>
|
||||
<result column="is_type" property="isType"/>
|
||||
<result column="list_class" property="listClass"/>
|
||||
<result column="theme" property="theme"/>
|
||||
<result column="is_default" property="isDefault"/>
|
||||
<result column="state" property="state"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectDictData">
|
||||
select dict_code, dict_sort, dict_label, dict_value, dict_type, is_type, list_class, theme, is_default, state, create_by, create_time, update_by, update_time, remark
|
||||
from sys_dict_data
|
||||
</sql>
|
||||
|
||||
<select id="selectList" resultMap="DictDataResult">
|
||||
<include refid="selectDictData"/>
|
||||
<where>
|
||||
<if test="dictType != null and dictType != ''">and dict_type = #{dictType} </if>
|
||||
<if test="dictLabel != null and dictLabel != ''">and dict_label like concat('%', #{dictLabel},'%')</if>
|
||||
<if test="state != null and state != ''">and state = #{state}</if>
|
||||
</where>
|
||||
order by dict_sort asc
|
||||
</select>
|
||||
|
||||
<select id="selectByCode" resultMap="DictDataResult">
|
||||
<include refid="selectDictData"/>
|
||||
where dict_code = #{dictCode}
|
||||
</select>
|
||||
<select id="selectCacheList" resultMap="DictDataResult">
|
||||
select dd.dict_code, dd.dict_sort, dd.dict_label, dd.dict_value, dd.dict_type, dd.is_type, dd.list_class, dd.theme, dd.is_default, dd.state, dd.create_by, dd.create_time, dd.update_by, dd.update_time, dd.remark
|
||||
from sys_dict_data dd
|
||||
left join sys_dict_type dt on dd.dict_type = dt.dict_type
|
||||
where dd.state = '1' and dt.state = '1'
|
||||
order by dd.dict_sort asc
|
||||
</select>
|
||||
<select id="selectByType" resultType="cn.fateverse.admin.entity.DictData">
|
||||
<include refid="selectDictData"/>
|
||||
where dict_type = #{dictType} and state = '1'
|
||||
</select>
|
||||
<select id="selectCountByType" resultType="java.lang.Integer">
|
||||
select count(1) from sys_dict_data where dict_type = #{dictType}
|
||||
</select>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyProperty="dictCode" keyColumn="dict_code">
|
||||
insert into sys_dict_data
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="dictSort != null">dict_sort,</if>
|
||||
<if test="dictLabel != null and dictLabel != ''">dict_label,</if>
|
||||
<if test="dictValue != null and dictValue != ''">dict_value,</if>
|
||||
<if test="dictType != null and dictType != ''">dict_type,</if>
|
||||
<if test="isType != null and isType != ''">is_type,</if>
|
||||
<if test="listClass != null and listClass != ''">list_class,</if>
|
||||
<if test="theme != null and theme != ''">theme,</if>
|
||||
<if test="isDefault != null and isDefault != ''">is_default,</if>
|
||||
<if test="state != null and state != ''">state,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dictSort != null">#{dictSort},</if>
|
||||
<if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
|
||||
<if test="dictValue != null and dictValue != ''">#{dictValue},</if>
|
||||
<if test="dictType != null and dictType != ''">#{dictType},</if>
|
||||
<if test="isType != null and isType != ''">#{isType},</if>
|
||||
<if test="listClass != null and listClass != ''">#{listClass},</if>
|
||||
<if test="theme != null and theme != ''">#{theme},</if>
|
||||
<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
|
||||
<if test="state != null and state != ''">#{state},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update sys_dict_data
|
||||
<set>
|
||||
<if test="dictSort != null">dict_sort = #{dictSort},</if>
|
||||
<if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
|
||||
<if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
|
||||
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
|
||||
<if test="isType != null">is_type = #{isType},</if>
|
||||
<if test="listClass != null and listClass != ''">list_class = #{listClass},</if>
|
||||
<if test="theme != null and theme != ''">theme = #{theme},</if>
|
||||
<if test="isDefault != null">is_default = #{isDefault},</if>
|
||||
<if test="state != null and state != ''">state = #{state},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</set>
|
||||
where dict_code = #{dictCode}
|
||||
</update>
|
||||
|
||||
<update id="updateByDictType">
|
||||
update sys_dict_data set dict_type = #{dictType} where dict_type = #{newDictType}
|
||||
</update>
|
||||
|
||||
<delete id="deleteByCode">
|
||||
delete
|
||||
from sys_dict_data
|
||||
where dict_code = #{dictCode}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBatch">
|
||||
delete
|
||||
from sys_dict_data
|
||||
where dict_code in
|
||||
<foreach collection="list" open="(" close=")" separator="," item="dictCode">
|
||||
#{dictCode}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
94
admin/admin-biz/src/main/resources/mapper/DictTypeMapper.xml
Normal file
94
admin/admin-biz/src/main/resources/mapper/DictTypeMapper.xml
Normal file
@@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.fateverse.admin.mapper.DictTypeMapper">
|
||||
|
||||
<resultMap id="DictTypeResult" type="cn.fateverse.admin.entity.DictType">
|
||||
<id property="dictId" column="dict_id"/>
|
||||
<result property="dictName" column="dict_name"/>
|
||||
<result property="dictType" column="dict_type"/>
|
||||
<result property="state" column="state"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<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="selectDict">
|
||||
select dict_id,
|
||||
dict_name,
|
||||
dict_type,
|
||||
state,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark
|
||||
from sys_dict_type
|
||||
</sql>
|
||||
|
||||
<select id="selectList" resultMap="DictTypeResult">
|
||||
<include refid="selectDict"/>
|
||||
<where>
|
||||
<if test="dictName != null and dictName != ''">and dict_name like concat('%',#{dictName},'%')</if>
|
||||
<if test="dictType != null and dictType != ''">and dict_type like concat('%',#{dictType},'%')</if>
|
||||
<if test="state != null and state != ''">and state = #{state}</if>
|
||||
<if test="startTime != null and endTime != null">
|
||||
and create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="startTime != null and endTime != null">
|
||||
and create_time >= #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectByDictId" resultMap="DictTypeResult">
|
||||
<include refid="selectDict"/>
|
||||
where dict_id = #{dictId}
|
||||
</select>
|
||||
<select id="selectByDictType" resultMap="DictTypeResult">
|
||||
<include refid="selectDict"/>
|
||||
where dict_type = #{dictType}
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
insert into sys_dict_type
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="dictName != null and dictName != ''"> dict_name, </if>
|
||||
<if test="dictType != null and dictType != ''"> dict_type, </if>
|
||||
<if test="state != null and state != ''"> state, </if>
|
||||
<if test="remark != null and remark != ''"> remark, </if>
|
||||
<if test="createBy != null and createBy != ''"> create_by, </if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dictName != null and dictName != ''"> #{dictName}, </if>
|
||||
<if test="dictType != null and dictType != ''"> #{dictType}, </if>
|
||||
<if test="state != null and state != ''"> #{state}, </if>
|
||||
<if test="remark != null and remark != ''"> #{remark}, </if>
|
||||
<if test="createBy != null and createBy != ''"> #{createBy}, </if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update sys_dict_type
|
||||
<set>
|
||||
<if test="dictName != null and dictName != ''"> dict_name = #{dictName}, </if>
|
||||
<if test="dictType != null and dictType != ''"> dict_type = #{dictType}, </if>
|
||||
<if test="state != null and state != ''"> state = #{state}, </if>
|
||||
<if test="remark != null and remark != ''"> remark = #{remark}, </if>
|
||||
<if test="updateBy != null and updateBy != ''"> update_by = #{updateBy}, </if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</set>
|
||||
where dict_id = #{dictId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete from sys_dict_type where dict_id = #{dictId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
89
admin/admin-biz/src/main/resources/mapper/IpBackMapper.xml
Normal file
89
admin/admin-biz/src/main/resources/mapper/IpBackMapper.xml
Normal file
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.fateverse.admin.mapper.IpBackMapper">
|
||||
|
||||
<sql id="selectIPBack">
|
||||
select id,
|
||||
ip_addr,
|
||||
type,
|
||||
mark,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
from sys_ip_back
|
||||
</sql>
|
||||
|
||||
<select id="selectList" resultType="cn.fateverse.admin.entity.IpBack">
|
||||
<include refid="selectIPBack"/>
|
||||
<where>
|
||||
<if test="ipAddr != null and ipAddr != ''">ip_addr like concat('%', #{ipAddr}, '%')</if>
|
||||
<if test="type != null and type != ''">type = type</if>
|
||||
<if test="startTime != null and endTime != null">
|
||||
and create_time between #{startTime} and #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectById" resultType="cn.fateverse.admin.entity.IpBack">
|
||||
<include refid="selectIPBack"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="selectByIds" resultType="cn.fateverse.admin.entity.IpBack">
|
||||
<include refid="selectIPBack"/>
|
||||
where id in
|
||||
<foreach collection="list" open="(" close=")" separator="," item="id">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectListStartEnd" resultType="cn.fateverse.admin.entity.IpBack">
|
||||
<include refid="selectIPBack"/>
|
||||
limit #{start} , #{end}
|
||||
</select>
|
||||
<select id="selectByIdaddr" resultType="cn.fateverse.admin.entity.IpBack">
|
||||
<include refid="selectIPBack"/>
|
||||
where ip_addr = #{ipAddr}
|
||||
</select>
|
||||
<select id="selectIpv4Count" resultType="cn.fateverse.admin.entity.IpBack">
|
||||
select count(*) from sys_ip_back where type = 'ipv4'
|
||||
</select>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
insert into sys_ip_back
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="ipAddr != null and ipAddr != ''">ip_addr ,</if>
|
||||
<if test="type != null and type != ''">type ,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="ipAddr != null and ipAddr != ''">#{ipAddr},</if>
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update sys_ip_back
|
||||
<set>
|
||||
<if test="ipAddr != null and ipAddr != ''">ip_addr = #{ipAddr},</if>
|
||||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
delete
|
||||
from sys_ip_back
|
||||
where id in
|
||||
<foreach collection="list" open="(" close=")" separator="," item="id">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
268
admin/admin-biz/src/main/resources/mapper/MenuMapper.xml
Normal file
268
admin/admin-biz/src/main/resources/mapper/MenuMapper.xml
Normal file
@@ -0,0 +1,268 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.fateverse.admin.mapper.MenuMapper">
|
||||
|
||||
<resultMap type="cn.fateverse.admin.entity.Menu" id="MenuResult">
|
||||
<id property="menuId" column="menu_id"/>
|
||||
<result property="menuName" column="menu_name"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="orderNum" column="order_num"/>
|
||||
<result property="path" column="path"/>
|
||||
<result property="component" column="component"/>
|
||||
<result property="isFrame" column="is_frame"/>
|
||||
<result property="isCache" column="is_cache"/>
|
||||
<result property="menuType" column="menu_type"/>
|
||||
<result property="visible" column="visible"/>
|
||||
<result property="state" column="state"/>
|
||||
<result property="perms" column="perms"/>
|
||||
<result property="icon" column="icon"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMenuVo">
|
||||
select menu_id,
|
||||
menu_name,
|
||||
parent_id,
|
||||
menu_type,
|
||||
order_num,
|
||||
`path`,
|
||||
path_params,
|
||||
is_frame,
|
||||
component,
|
||||
is_cache,
|
||||
no_redirect,
|
||||
breadcrumb,
|
||||
`visible`,
|
||||
state,
|
||||
ifnull(perms, '') as perms,
|
||||
icon,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark
|
||||
from sys_menu
|
||||
</sql>
|
||||
|
||||
<select id="selectList" resultMap="MenuResult">
|
||||
<include refid="selectMenuVo"/>
|
||||
<where>
|
||||
<if test="menuName != null and menuName != ''">and menu_name like concat('%',#{menuName},'%')</if>
|
||||
<if test="state != null and state != ''">and state = #{state}</if>
|
||||
<if test="excludeId != null ">and menu_id != #{excludeId} and parent_id != #{excludeId}</if>
|
||||
<if test="button">and menu_type in ('D', 'M')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectListByUserId" resultType="cn.fateverse.admin.entity.Menu">
|
||||
<include refid="selectMenuVo"/>
|
||||
<where>
|
||||
<if test="userId != null">and user_id = #{userId}</if>
|
||||
<if test="menuName != null and menuName != ''">and menu_name like concat('%',#{menuName},'%')</if>
|
||||
<if test="state != null and state != ''">and state = #{state}</if>
|
||||
<if test="excludeId != null ">and menu_id != #{excludeId} and parent_id != #{excludeId}</if>
|
||||
<if test="button">and menu_type in ('D', 'M')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMenuPermsByUserId" parameterType="Long" resultType="java.lang.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
|
||||
left join sys_role r on r.role_id = ur.role_id
|
||||
where m.state = '1'
|
||||
and r.state = '1'
|
||||
and ur.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="MenuResult">
|
||||
<include refid="selectMenuVo"/>
|
||||
where menu_id = #{menuId}
|
||||
</select>
|
||||
|
||||
<!--第一个select则是通过sys_role_menu,映射表获取到角色对应的菜单列表,第二个select则是去除掉里面的parentId,去除原因为前端组件联动效果影响-->
|
||||
<select id="selectCheckedMenuIdByRoleId" resultType="java.lang.Long">
|
||||
select distinct m.menu_id
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on rm.menu_id = m.menu_id
|
||||
where rm.role_id = #{roleId}
|
||||
and m.menu_id not in
|
||||
(select distinct m.parent_id
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on rm.menu_id = m.menu_id
|
||||
where rm.role_id = #{roleId})
|
||||
</select>
|
||||
|
||||
<select id="selectRouterMenuList" resultType="cn.fateverse.admin.entity.Menu">
|
||||
select menu_id, menu_name, parent_id, menu_type, order_num, `path`, path_params, component,is_frame, is_cache, no_redirect,
|
||||
breadcrumb, `visible`, state, perms ,order_num, icon, create_by, create_time, update_by, update_time, remark
|
||||
from sys_menu
|
||||
where menu_type in ('D', 'M')
|
||||
and state = '1'
|
||||
</select>
|
||||
|
||||
<select id="selectRouterMenuListByUserId" resultType="cn.fateverse.admin.entity.Menu">
|
||||
select distinct m.menu_id,
|
||||
m.menu_name,
|
||||
m.parent_id,
|
||||
m.order_num,
|
||||
m.path,
|
||||
m.path_params,
|
||||
m.component,
|
||||
m.no_redirect,
|
||||
m.breadcrumb,
|
||||
m.is_frame,
|
||||
m.is_cache,
|
||||
m.menu_type,
|
||||
m.visible,
|
||||
m.state,
|
||||
m.order_num,
|
||||
ifnull(m.perms, '') as perms,
|
||||
m.icon,
|
||||
m.create_by,
|
||||
m.create_time,
|
||||
m.update_by,
|
||||
m.update_time,
|
||||
m.remark
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on rm.menu_id = m.menu_id
|
||||
left join sys_role r on r.role_id = rm.role_id
|
||||
left join sys_user_role ur on ur.role_id = r.role_id
|
||||
where
|
||||
ur.user_id = #{userId}
|
||||
and m.menu_type in ('D', 'M')
|
||||
and m.state = '1'
|
||||
and r.state = '1'
|
||||
order by m.parent_id, m.order_num
|
||||
</select>
|
||||
|
||||
<select id="selectByUserId" resultType="cn.fateverse.admin.entity.Menu">
|
||||
select distinct m.menu_id,
|
||||
m.menu_name,
|
||||
m.parent_id,
|
||||
m.order_num,
|
||||
m.path,
|
||||
m.path_params,
|
||||
m.component,
|
||||
m.is_frame,
|
||||
m.is_cache,
|
||||
m.no_redirect,
|
||||
m.breadcrumb,
|
||||
m.menu_type,
|
||||
m.visible,
|
||||
m.state,
|
||||
ifnull(m.perms, '') as perms,
|
||||
m.icon,
|
||||
m.create_by,
|
||||
m.create_time,
|
||||
m.update_by,
|
||||
m.update_time,
|
||||
m.remark
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on rm.menu_id = m.menu_id
|
||||
left join sys_role r on r.role_id = rm.role_id
|
||||
left join sys_user_role ur on ur.role_id = rm.role_id
|
||||
where ur.user_id = #{userId}
|
||||
and r.state = '1'
|
||||
order by m.parent_id, m.order_num
|
||||
</select>
|
||||
|
||||
<select id="selectCheckedMenuIdByUserId" resultType="java.lang.Long">
|
||||
select distinct rm.menu_id
|
||||
from sys_role_menu rm
|
||||
left join sys_role r on r.role_id = rm.role_id
|
||||
left join sys_user_role ur on ur.role_id = rm.role_id
|
||||
where ur.user_id = #{userId}
|
||||
and r.state = '1'
|
||||
</select>
|
||||
|
||||
<select id="selectAllMenuId" resultType="java.lang.Long">
|
||||
select menu_id
|
||||
from sys_menu
|
||||
</select>
|
||||
|
||||
<select id="selectCountByParentId" resultType="java.lang.Integer">
|
||||
select count(*) from sys_menu where parent_id = #{menuId}
|
||||
</select>
|
||||
|
||||
<select id="selectByPerms" resultType="cn.fateverse.admin.entity.Menu">
|
||||
<include refid="selectMenuVo"/>
|
||||
where perms = #{perms}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyColumn="menu_id" keyProperty="menuId">
|
||||
insert into sys_menu
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="menuName != null and menuName != ''">menu_name,</if>
|
||||
<if test="parentId != null">parent_id,</if>
|
||||
<if test="orderNum != null">order_num,</if>
|
||||
<if test="path != null and path != ''">`path`,</if>
|
||||
<if test="pathParams != null and pathParams != ''">path_params,</if>
|
||||
<if test="component != null and component != ''">component,</if>
|
||||
<if test="isFrame != null and isFrame != ''">is_frame,</if>
|
||||
<if test="isCache != null and isCache != ''">is_cache,</if>
|
||||
<if test="menuType != null and menuType != ''">menu_type,</if>
|
||||
<if test="state != null and state != ''">state,</if>
|
||||
<if test="visible != null and visible != ''">`visible`,</if>
|
||||
<if test="perms != null and perms != ''">perms,</if>
|
||||
<if test="icon != null and icon != ''">icon,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="menuName != null and menuName != ''">#{menuName},</if>
|
||||
<if test="parentId != null">#{parentId},</if>
|
||||
<if test="orderNum != null">#{orderNum},</if>
|
||||
<if test="path != null and path != ''">#{path},</if>
|
||||
<if test="pathParams != null and pathParams != ''">#{pathParams},</if>
|
||||
<if test="component != null and component != ''">#{component},</if>
|
||||
<if test="isFrame != null and isFrame != ''">#{isFrame},</if>
|
||||
<if test="isCache != null and isCache != ''">#{isCache},</if>
|
||||
<if test="menuType != null and menuType != ''">#{menuType},</if>
|
||||
<if test="state != null and state != ''">#{state},</if>
|
||||
<if test="visible != null and visible != ''">#{visible},</if>
|
||||
<if test="perms != null and perms != ''">#{perms},</if>
|
||||
<if test="icon != null and icon != ''">#{icon},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update sys_menu
|
||||
<set>
|
||||
<if test="menuName != null and menuName != ''">menu_name = #{menuName},</if>
|
||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||
<if test="orderNum != null">order_num = #{orderNum},</if>
|
||||
<if test="path != null and path != ''">`path` = #{path},</if>
|
||||
<if test="pathParams != null and pathParams != ''">path_params = #{pathParams},</if>
|
||||
<if test="component != null and component != ''">component = #{component},</if>
|
||||
<if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if>
|
||||
<if test="isCache != null and isCache != ''">is_cache = #{isCache},</if>
|
||||
<if test="menuType != null and menuType != ''">menu_type = #{menuType},</if>
|
||||
<if test="state != null and state != ''">state = #{state},</if>
|
||||
<if test="visible != null and visible != ''">`visible` = #{visible},</if>
|
||||
<if test="perms != null and perms != ''">perms = #{perms},</if>
|
||||
<if test="icon != null and icon != ''">icon = #{icon},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</set>
|
||||
where menu_id = #{menuId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from sys_menu
|
||||
where menu_id = #{menuId}
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
86
admin/admin-biz/src/main/resources/mapper/PostMapper.xml
Normal file
86
admin/admin-biz/src/main/resources/mapper/PostMapper.xml
Normal 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="cn.fateverse.admin.mapper.PostMapper">
|
||||
|
||||
<sql id="PostList">
|
||||
select post_id,
|
||||
post_code,
|
||||
post_name,
|
||||
post_sort,
|
||||
state,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark
|
||||
from sys_post
|
||||
</sql>
|
||||
|
||||
<select id="selectList" resultType="cn.fateverse.admin.entity.Post">
|
||||
<include refid="PostList"/>
|
||||
<where>
|
||||
<if test="postCode != null and postCode != ''">and post_code like concat('%',#{postCode},'%')</if>
|
||||
<if test="postName != null and postName != ''">and post_name like concat('%',#{postName},'%')</if>
|
||||
<if test="state != null and state != ''">and state = #{state}</if>
|
||||
</where>
|
||||
order by post_sort
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultType="cn.fateverse.admin.entity.Post">
|
||||
<include refid="PostList"/>
|
||||
where post_id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectByPostCode" resultType="cn.fateverse.admin.entity.Post">
|
||||
<include refid="PostList"/>
|
||||
where post_code = #{postCode} limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectByPostName" resultType="cn.fateverse.admin.entity.Post">
|
||||
<include refid="PostList"/>
|
||||
where post_name = #{postName} limit 1
|
||||
</select>
|
||||
<select id="hasUserByPostId" resultType="java.lang.Integer">
|
||||
select count(*) from sys_user_post where post_id = #{postId}
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
insert into sys_post
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="postCode != null and postCode != ''">post_code,</if>
|
||||
<if test="postName != null and postName != ''">post_name,</if>
|
||||
<if test="postSort != null and postSort != ''">post_sort,</if>
|
||||
<if test="state != null and state != ''">state,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="postCode != null and postCode != ''">#{postCode},</if>
|
||||
<if test="postName != null and postName != ''">#{postName},</if>
|
||||
<if test="postSort != null and postSort != ''">#{postSort},</if>
|
||||
<if test="state != null and state != ''">#{state},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update sys_post
|
||||
<set>
|
||||
<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
|
||||
<if test="postName != null and postName != ''">post_name = #{postName},</if>
|
||||
<if test="postSort != null and postSort != ''">post_sort = #{postSort},</if>
|
||||
<if test="state != null and state != ''">state = #{state},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</set>
|
||||
where post_id = #{postId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete from sys_post where post_id = #{postId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
133
admin/admin-biz/src/main/resources/mapper/RoleMapper.xml
Normal file
133
admin/admin-biz/src/main/resources/mapper/RoleMapper.xml
Normal file
@@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.fateverse.admin.mapper.RoleMapper">
|
||||
|
||||
<sql id="selectSql">
|
||||
select role_id,
|
||||
role_name,
|
||||
role_key,
|
||||
role_sort,
|
||||
data_scope,
|
||||
`state`,
|
||||
del_flag,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark,
|
||||
role_type
|
||||
from sys_role
|
||||
</sql>
|
||||
|
||||
<select id="selectList" resultType="cn.fateverse.admin.entity.Role">
|
||||
<include refid="selectSql"/>
|
||||
<where>
|
||||
<if test="roleName != null and roleName != ''"> and role_name like concat('%',#{roleName} ,'%')</if>
|
||||
<if test="roleKey != null and roleKey != ''"> and role_key like concat('%',#{roleKey} ,'%')</if>
|
||||
<if test="state != null and state != ''"> and state = #{state}</if>
|
||||
<if test="startTime != null and endTime != null">
|
||||
and create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="startTime != null and endTime != null">
|
||||
and create_time <= #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectById" resultType="cn.fateverse.admin.entity.Role">
|
||||
<include refid="selectSql"/>
|
||||
where role_id = #{roleId}
|
||||
</select>
|
||||
<select id="hasUserByRoleId" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from sys_role r
|
||||
inner join sys_user_role ur on ur.role_id = r.role_id
|
||||
where r.role_id = #{roleId}
|
||||
limit 1
|
||||
</select>
|
||||
<select id="selectByRoleName" resultType="cn.fateverse.admin.entity.Role">
|
||||
<include refid="selectSql"/>
|
||||
where role_name = #{roleName} limit 0,1
|
||||
</select>
|
||||
<select id="selectByRoleKey" resultType="cn.fateverse.admin.entity.Role">
|
||||
<include refid="selectSql"/>
|
||||
where role_key = #{roleKey} limit 0,1
|
||||
</select>
|
||||
|
||||
<select id="selectByIds" resultType="cn.fateverse.admin.entity.Role">
|
||||
<include refid="selectSql"/>
|
||||
where role_id in
|
||||
<foreach collection="list" open="(" separator="," close=")" item="roleId">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectListByMenuId" resultType="cn.fateverse.admin.entity.Role">
|
||||
<include refid="selectSql"/>
|
||||
<where>
|
||||
<if test="roleName != null and roleName != ''">and role_name like concat('%',#{roleName} ,'%')</if>
|
||||
<if test="roleKey != null and roleKey != ''">and role_key like concat('%',#{roleKey} ,'%')</if>
|
||||
<if test="menuId != null"> and role_id in (select role_id from sys_role_menu where menu_id = #{menuId})</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="searchListExcludeMenuId" resultType="cn.fateverse.admin.entity.Role">
|
||||
<include refid="selectSql"/>
|
||||
<where>
|
||||
<if test="roleName != null and roleName != ''">and role_name like concat('%',#{roleName} ,'%')</if>
|
||||
<if test="roleKey != null and roleKey != ''">and role_key like concat('%',#{roleKey} ,'%')</if>
|
||||
<if test="menuId != null"> and role_id not in (select role_id from sys_role_menu where menu_id = #{menuId})</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyColumn="role_id" keyProperty="roleId">
|
||||
insert into sys_role
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="roleName != null and roleName != ''">role_name,</if>
|
||||
<if test="roleKey != null and roleKey != ''">role_key,</if>
|
||||
<if test="roleSort != null">role_sort,</if>
|
||||
<if test="state != null and state != ''">state,</if>
|
||||
<if test="dataScope != null and dataScope != ''">data_scope,</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="roleName != null and roleName != ''">#{roleName},</if>
|
||||
<if test="roleKey != null and roleKey != ''">#{roleKey},</if>
|
||||
<if test="roleSort != null">#{roleSort},</if>
|
||||
<if test="state != null and state != ''">#{state},</if>
|
||||
<if test="dataScope != null and dataScope != ''">#{dataScope},</if>
|
||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update sys_role
|
||||
<set>
|
||||
<if test="roleName != null and roleName != ''">role_name = #{roleName},</if>
|
||||
<if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if>
|
||||
<if test="roleSort != null">role_sort = #{roleSort},</if>
|
||||
<if test="state != null and state != ''">state=#{state},</if>
|
||||
<if test="dataScope != null and dataScope != ''">data_scope=#{dataScope},</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag=#{delFlag},</if>
|
||||
<if test="remark != null and remark != ''">remark=#{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</set>
|
||||
where role_id = #{roleId}
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="delete">
|
||||
delete from sys_role where role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
39
admin/admin-biz/src/main/resources/mapper/RoleMenuMapper.xml
Normal file
39
admin/admin-biz/src/main/resources/mapper/RoleMenuMapper.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.fateverse.admin.mapper.RoleMenuMapper">
|
||||
|
||||
<select id="selectMenuIdsByRoleId" resultType="java.lang.Long">
|
||||
select menu_id from sys_role_menu where role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
<insert id="batch">
|
||||
insert into sys_role_menu (role_id, menu_id)
|
||||
values
|
||||
<foreach collection="list" item="roleMenu" separator=",">
|
||||
(#{roleMenu.roleId},#{roleMenu.menuId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByRoleId">
|
||||
delete from sys_role_menu where role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByMenuId">
|
||||
delete from sys_role_menu where menu_id = #{menuId}
|
||||
</delete>
|
||||
|
||||
<delete id="unBindMenu">
|
||||
delete from sys_role_menu
|
||||
where menu_id = #{menuId}
|
||||
and role_id in
|
||||
<foreach collection="roleIds" item="roleId" separator="," open="(" close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="unBindAllMenu">
|
||||
delete from sys_role_menu where menu_id = #{menuId}
|
||||
</delete>
|
||||
</mapper>
|
||||
327
admin/admin-biz/src/main/resources/mapper/UserMapper.xml
Normal file
327
admin/admin-biz/src/main/resources/mapper/UserMapper.xml
Normal file
@@ -0,0 +1,327 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.fateverse.admin.mapper.UserMapper">
|
||||
|
||||
<resultMap type="cn.fateverse.admin.entity.User" id="UserResult">
|
||||
<id property="userId" column="user_id"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="userName" column="user_name"/>
|
||||
<result property="nickName" column="nick_name"/>
|
||||
<result property="email" column="email"/>
|
||||
<result property="phoneNumber" column="phone_number"/>
|
||||
<result property="sex" column="sex"/>
|
||||
<result property="avatar" column="avatar"/>
|
||||
<result property="password" column="password"/>
|
||||
<result property="state" column="state"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="loginIp" column="login_ip"/>
|
||||
<result property="loginDate" column="login_date"/>
|
||||
<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="userType" column="user_type"/>
|
||||
<result property="openId" column="open_id"/>
|
||||
<result property="unionId" column="union_id"/>
|
||||
<association property="dept" column="dept_id" javaType="cn.fateverse.admin.entity.Dept" resultMap="deptResult"/>
|
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="deptResult" type="cn.fateverse.admin.entity.Dept">
|
||||
<id property="deptId" column="dept_id"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="deptName" column="dept_name"/>
|
||||
<result property="ancestors" column="ancestors"/>
|
||||
<result property="orderNum" column="order_num"/>
|
||||
<result property="leader" column="leader"/>
|
||||
<result property="leaderId" column="leader_id"/>
|
||||
<result property="state" column="dept_state"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="RoleResult" type="cn.fateverse.admin.entity.Role">
|
||||
<id property="roleId" column="role_id"/>
|
||||
<result property="roleName" column="role_name"/>
|
||||
<result property="roleKey" column="role_key"/>
|
||||
<result property="roleSort" column="role_sort"/>
|
||||
<result property="dataScope" column="data_scope"/>
|
||||
<result property="state" column="role_state"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserDetail">
|
||||
select u.user_id,
|
||||
u.dept_id,
|
||||
u.user_name,
|
||||
u.nick_name,
|
||||
u.email,
|
||||
u.avatar,
|
||||
u.phone_number,
|
||||
u.password,
|
||||
u.sex,
|
||||
u.state,
|
||||
u.del_flag,
|
||||
u.login_ip,
|
||||
u.login_date,
|
||||
u.create_by,
|
||||
u.create_time,
|
||||
u.remark,
|
||||
u.union_id,
|
||||
u.open_id,
|
||||
u.user_type,
|
||||
d.dept_id,
|
||||
d.parent_id,
|
||||
d.dept_name,
|
||||
d.order_num,
|
||||
d.ancestors,
|
||||
d.leader,
|
||||
d.leader_id,
|
||||
d.state as dept_state,
|
||||
r.role_id,
|
||||
r.role_name,
|
||||
r.role_key,
|
||||
r.role_sort,
|
||||
r.data_scope,
|
||||
r.state as role_state
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
left join sys_role r on r.role_id = ur.role_id
|
||||
</sql>
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id,
|
||||
u.user_name,
|
||||
u.nick_name,
|
||||
u.phone_number,
|
||||
u.state,
|
||||
u.create_time,
|
||||
u.email,
|
||||
d.dept_name,
|
||||
u.user_type,
|
||||
u.sex,
|
||||
u.avatar
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
</sql>
|
||||
|
||||
<sql id="selectUser">
|
||||
select user_id,
|
||||
dept_id,
|
||||
user_name,
|
||||
nick_name,
|
||||
user_type,
|
||||
email,
|
||||
phone_number,
|
||||
sex,
|
||||
avatar,
|
||||
state,
|
||||
del_flag,
|
||||
login_ip,
|
||||
login_date,
|
||||
open_id,
|
||||
union_id,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark
|
||||
from sys_user
|
||||
</sql>
|
||||
|
||||
<select id="selectByUserName" parameterType="String" resultMap="UserResult">
|
||||
<include refid="selectUserDetail"/>
|
||||
where u.user_name = #{userName} limit 0,1
|
||||
</select>
|
||||
|
||||
<select id="selectList" resultType="cn.fateverse.admin.vo.UserVo">
|
||||
<include refid="selectUserVo"/>
|
||||
<where>
|
||||
u.del_flag = '0'
|
||||
<if test="userName != null and userName != ''">and u.user_name like concat('%', #{userName}, '%')</if>
|
||||
<if test="phoneNumber != null and phoneNumber != ''">and u.phone_number like
|
||||
concat('%',#{phoneNumber},'%')
|
||||
</if>
|
||||
<if test="state != null and state != ''">and u.state = #{state}</if>
|
||||
<if test="startTime != null and endTime != null">
|
||||
and u.create_time between #{startTime} and #{endTime}
|
||||
</if>
|
||||
<if test="deptId != null">
|
||||
and (u.dept_id = #{deptId} or u.dept_id in ( select t.dept_id from sys_dept t where
|
||||
find_in_set(#{deptId}, ancestors) ))
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUserByUserId" resultMap="UserResult">
|
||||
<include refid="selectUserDetail"/>
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectUserListByExcludeRoleId" resultType="cn.fateverse.admin.vo.UserVo">
|
||||
<include refid="selectUserVo"/>
|
||||
<where>
|
||||
and u.user_id not in (select user_id from sys_user_role where role_id = #{roleId})
|
||||
<if test="userName != null and userName != ''">and u.user_name like concat('%', #{userName}, '%')</if>
|
||||
<if test="phoneNumber != null and phoneNumber != ''">and u.phone_number like
|
||||
concat('%',#{phoneNumber},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUserListByExcludePostId" resultType="cn.fateverse.admin.vo.UserVo">
|
||||
<include refid="selectUserVo"/>
|
||||
<where>
|
||||
and u.user_id not in (select user_id from sys_user_post where post_id = #{postId})
|
||||
<if test="userName != null and userName != ''">and u.user_name like concat('%', #{userName}, '%')</if>
|
||||
<if test="phoneNumber != null and phoneNumber != ''">and u.phone_number like
|
||||
concat('%',#{phoneNumber},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUserListByRoleId" resultType="cn.fateverse.admin.vo.UserVo">
|
||||
<include refid="selectUserVo"/>
|
||||
left join sys_user_role ur on ur.user_id = u.user_id
|
||||
<where>
|
||||
and ur.role_id = #{roleId}
|
||||
<if test="userName != null and userName != ''">and u.user_name like concat('%', #{userName}, '%')</if>
|
||||
<if test="phoneNumber != null and phoneNumber != ''">and u.phone_number like
|
||||
concat('%',#{phoneNumber},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUserListByRoleIds" resultType="cn.fateverse.admin.vo.UserVo">
|
||||
select distinct u.user_id,u.user_name,u.nick_name,u.phone_number,u.state,u.create_time,u.email,
|
||||
d.dept_name,u.user_type,u.sex,u.avatar,ur.role_id
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user_role ur on ur.user_id = u.user_id
|
||||
where ur.role_id in
|
||||
<foreach collection="list" item="roleId" index="index" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectUserListByPostId" resultType="cn.fateverse.admin.vo.UserVo">
|
||||
<include refid="selectUserVo"/>
|
||||
left join sys_user_post up on up.user_id = u.user_id
|
||||
<where>
|
||||
<if test="postId != null">and up.post_id = #{postId}</if>
|
||||
<if test="userName != null and userName != ''">and u.user_name like concat('%', #{userName}, '%')</if>
|
||||
<if test="phoneNumber != null and phoneNumber != ''">and u.phone_number like
|
||||
concat('%',#{phoneNumber},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUserInfoByUserName" resultType="cn.fateverse.admin.entity.User">
|
||||
<include refid="selectUser"/>
|
||||
where user_name = #{userName}
|
||||
</select>
|
||||
|
||||
<select id="selectByPhoneNum" resultType="cn.fateverse.admin.entity.User">
|
||||
<include refid="selectUser"/>
|
||||
where phone_number = #{phoneNumber}
|
||||
</select>
|
||||
|
||||
<select id="selectByEmail" resultType="cn.fateverse.admin.entity.User">
|
||||
<include refid="selectUser"/>
|
||||
where email = #{email} limit 0,1
|
||||
</select>
|
||||
<select id="selectUserByUserIds" resultType="cn.fateverse.admin.vo.UserVo">
|
||||
select distinct u.user_id,u.user_name,u.nick_name,u.phone_number,u.state,u.create_time,u.email,
|
||||
d.dept_name,u.user_type,u.sex,u.avatar
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.user_id in
|
||||
<foreach collection="list" item="userId" index="index" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectUserByDeptIds" resultType="cn.fateverse.admin.vo.UserVo">
|
||||
select distinct u.user_id,u.user_name,u.nick_name,u.phone_number,u.state,u.create_time,
|
||||
d.dept_name,u.user_type,u.sex,u.avatar,d.dept_id as leaderDeptId
|
||||
from sys_user u
|
||||
left join sys_dept d on u.user_id = d.leader_id
|
||||
where d.dept_id in
|
||||
<foreach collection="list" item="deptId" index="index" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectAllUserIds" resultType="java.lang.Long">
|
||||
select user_id
|
||||
from sys_user
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insert" parameterType="cn.fateverse.admin.entity.UserBase" useGeneratedKeys="true" keyProperty="userId"
|
||||
keyColumn="user_id">
|
||||
insert into sys_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deptId != null">dept_id ,</if>
|
||||
<if test="userName != null and userName != ''">user_name,</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name,</if>
|
||||
<if test="email != null and email != ''">email,</if>
|
||||
<if test="phoneNumber != null and phoneNumber != ''">phone_number,</if>
|
||||
<if test="sex != null and sex != ''">sex,</if>
|
||||
<if test="avatar != null and avatar != ''">avatar,</if>
|
||||
<if test="password != null and password != ''">`password`,</if>
|
||||
<if test="state != null and state != ''">state,</if>
|
||||
<if test="unionId != null and unionId != ''">union_id,</if>
|
||||
<if test="openId != null and openId != ''">open_id,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="userName != null and userName != ''">#{userName},</if>
|
||||
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
||||
<if test="email != null and email != ''">#{email},</if>
|
||||
<if test="phoneNumber != null and phoneNumber != ''">#{phoneNumber},</if>
|
||||
<if test="sex != null and sex != ''">#{sex},</if>
|
||||
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
||||
<if test="password != null and password != ''">#{password},</if>
|
||||
<if test="state != null and state != ''">#{state},</if>
|
||||
<if test="unionId != null and unionId != ''">#{unionId},</if>
|
||||
<if test="openId != null and openId != ''">#{openId},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update sys_user
|
||||
<set>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
||||
<if test="email != null and email != ''">email = #{email},</if>
|
||||
<if test="phoneNumber != null and phoneNumber != ''">phone_number = #{phoneNumber},</if>
|
||||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||
<if test="password != null and password != ''">`password` = #{password},</if>
|
||||
<if test="state != null and state != ''">state = #{state},</if>
|
||||
<if test="unionId != null and unionId != ''">union_id = #{unionId},</if>
|
||||
<if test="openId != null and openId != ''">open_id = #{openId},</if>
|
||||
<if test="city != null and city != ''">city = #{city},</if>
|
||||
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
|
||||
<if test="loginDate != null">login_date = #{loginDate},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</set>
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<!-- update sys_user set state = '2', del_flag = '1' where user_id = #{userId} -->
|
||||
<update id="deleteByUserId">
|
||||
delete
|
||||
from sys_user
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
</mapper>
|
||||
34
admin/admin-biz/src/main/resources/mapper/UserPostMapper.xml
Normal file
34
admin/admin-biz/src/main/resources/mapper/UserPostMapper.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.fateverse.admin.mapper.UserPostMapper">
|
||||
|
||||
|
||||
<insert id="batchInsert">
|
||||
insert into sys_user_post (user_id, post_id) VALUES
|
||||
<foreach collection="list" separator="," item="userPost">
|
||||
(#{userPost.userId},#{userPost.postId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByUserId">
|
||||
delete from sys_user_post where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
<delete id="removeBind">
|
||||
delete from sys_user_post where post_id = #{postId}
|
||||
and user_id in
|
||||
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="removeBindByPostId">
|
||||
delete from sys_user_post where post_id = #{postId}
|
||||
</delete>
|
||||
|
||||
<select id="selectPostIdListByUserId" resultType="java.lang.Long">
|
||||
select post_id from sys_user_post where user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
35
admin/admin-biz/src/main/resources/mapper/UserRoleMapper.xml
Normal file
35
admin/admin-biz/src/main/resources/mapper/UserRoleMapper.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.fateverse.admin.mapper.UserRoleMapper">
|
||||
|
||||
|
||||
<insert id="batchInsert">
|
||||
insert into sys_user_role (user_id, role_id) values
|
||||
<foreach collection="list" separator="," item="userRole">
|
||||
(#{userRole.userId},#{userRole.roleId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="bind">
|
||||
insert into sys_user_role (user_id, role_id) values
|
||||
(#{userId},#{roleId})
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByUserId">
|
||||
delete from sys_user_role where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByRoleId">
|
||||
delete from sys_user_role where role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
<delete id="unBind">
|
||||
delete from sys_user_role where role_id = #{roleId}
|
||||
and user_id in
|
||||
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user