init project v1.0.0
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://${zlt.datasource.ip}:3306/user-center?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull
|
||||
username: ${zlt.datasource.username}
|
||||
password: ${zlt.datasource.password}
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
|
||||
redis:
|
||||
host: ${zlt.redis.host}
|
||||
port: ${zlt.redis.port}
|
||||
timeout: ${zlt.redis.timeout}
|
||||
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath:/mapper/*Mapper.xml
|
||||
#实体扫描,多个package用逗号或者分号分隔
|
||||
typeAliasesPackage: com.central.common.model
|
||||
global-config:
|
||||
db-config:
|
||||
id-type: auto
|
||||
|
||||
zlt:
|
||||
swagger:
|
||||
enabled: true
|
||||
title: 用户中心
|
||||
description: 用户中心接口文档
|
||||
version: 1.0
|
||||
base-package: com.central.user.controller
|
||||
cache-manager:
|
||||
configs:
|
||||
- key: menu
|
||||
second: 600
|
||||
- key: user
|
||||
second: 1800
|
||||
@@ -0,0 +1,14 @@
|
||||
server:
|
||||
port: 7000
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: user-center
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
server-addr: ${zlt.nacos.server-addr}
|
||||
file-extension: yml
|
||||
shared-dataids: common.yml
|
||||
discovery:
|
||||
server-addr: ${zlt.nacos.server-addr}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?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.central.user.mapper.SysMenuMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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.central.user.mapper.SysPermissionMapper">
|
||||
|
||||
<sql id="where">
|
||||
<where>
|
||||
<if test="permission != null and permission != ''">
|
||||
and t.permission like concat('%', #{permission}, '%')
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
and t.name like concat('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="searchKey != null and searchKey != ''">
|
||||
and t.name like concat('%', #{searchKey}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
<select id="count" resultType="int">
|
||||
select count(*) from sys_permission t
|
||||
<include refid="where" />
|
||||
</select>
|
||||
|
||||
<select id="findList" resultType="com.central.common.model.SysPermission">
|
||||
select * from sys_permission t
|
||||
<include refid="where" />
|
||||
order by t.id desc
|
||||
<!--<if test="start != null and start >= 0 and length != null and length > 0">-->
|
||||
<!--limit #{start}, #{length}-->
|
||||
<!--</if>-->
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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.central.user.mapper.SysRoleMapper">
|
||||
<sql id="where">
|
||||
<where>
|
||||
<if test="r.name != null and r.name != ''">
|
||||
and t.name like concat('%', #{r.name}, '%')
|
||||
</if>
|
||||
|
||||
<if test="r.searchKey != null and r.searchKey != '' and r.searchKey=='name'">
|
||||
and t.name like concat('%', #{r.searchValue}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="findList" resultType="com.central.common.model.SysRole">
|
||||
select * from sys_role t
|
||||
<include refid="where" />
|
||||
order by t.id desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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.central.user.mapper.SysRoleMenuMapper">
|
||||
|
||||
<update id="delete">
|
||||
delete from sys_role_menu
|
||||
<where>
|
||||
<if test="roleId != null">
|
||||
and role_id = #{roleId}
|
||||
</if>
|
||||
<if test="menuId != null">
|
||||
and menu_id = #{menuId}
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<select id="findMenusByRoleIds" resultType="com.central.common.model.SysMenu">
|
||||
select distinct t.* from sys_menu t
|
||||
inner join sys_role_menu r on r.menu_id = t.id
|
||||
where
|
||||
r.role_id in
|
||||
<foreach collection="roleIds" index="index" item="roleId"
|
||||
open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
<if test="type != null">
|
||||
and t.type = #{type}
|
||||
</if>
|
||||
ORDER BY sort ASC
|
||||
</select>
|
||||
|
||||
<select id="findMenusByRoleCodes" resultType="com.central.common.model.SysMenu">
|
||||
select distinct t.* from sys_menu t
|
||||
inner join sys_role_menu r on r.menu_id = t.id
|
||||
inner join sys_role rl on rl.id = r.role_id
|
||||
where
|
||||
rl.code in
|
||||
<foreach collection="roleCodes" index="index" item="roleCode"
|
||||
open="(" separator="," close=")">
|
||||
#{roleCode}
|
||||
</foreach>
|
||||
<if test="type != null">
|
||||
and t.type = #{type}
|
||||
</if>
|
||||
ORDER BY sort ASC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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.central.user.mapper.SysRolePermissionMapper">
|
||||
|
||||
<delete id="deleteRolePermission">
|
||||
delete from sys_role_permission
|
||||
<where>
|
||||
<if test="roleId != null">
|
||||
and roleId = #{roleId}
|
||||
</if>
|
||||
<if test="permissionId != null">
|
||||
and permissionId = #{permissionId}
|
||||
</if>
|
||||
</where>
|
||||
</delete>
|
||||
|
||||
<select id="findPermissionsByRoleIds" resultType="com.central.common.model.SysPermission">
|
||||
select p.* from
|
||||
sys_permission p
|
||||
inner join sys_role_permission rp on
|
||||
p.id = rp.permissionId
|
||||
<where>
|
||||
rp.roleId in
|
||||
<foreach collection="roleIds" item="roleId" open="("
|
||||
separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,43 @@
|
||||
<?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.central.user.mapper.SysUserMapper">
|
||||
<sql id="where">
|
||||
<where>
|
||||
t.is_del=0
|
||||
<if test="u.id != null and u.id != ''">
|
||||
and t.id like concat('%', #{u.id}, '%')
|
||||
</if>
|
||||
<if test="u.username != null and u.username != ''">
|
||||
and t.username like concat('%', #{u.username}, '%')
|
||||
</if>
|
||||
<if test="u.nickname != null and u.nickname != ''">
|
||||
and t.nickname like concat('%', #{u.nickname}, '%')
|
||||
</if>
|
||||
<if test="u.enabled != null and u.enabled != ''">
|
||||
and t.enabled = #{u.enabled}
|
||||
</if>
|
||||
<if test="u.type != null and u.type != ''">
|
||||
and t.type = #{u.type}
|
||||
</if>
|
||||
<if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='user_id'">
|
||||
and t.id like concat('%', #{u.searchValue}, '%')
|
||||
</if>
|
||||
<if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='username'">
|
||||
and t.username like concat('%', #{u.searchValue}, '%')
|
||||
</if>
|
||||
<if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='nick_name'">
|
||||
and t.nickname like concat('%', #{u.searchValue}, '%')
|
||||
</if>
|
||||
<if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='mobile'">
|
||||
and t.mobile like concat('%', #{u.searchValue}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="findList" resultType="com.central.common.model.SysUser">
|
||||
select * from sys_user t
|
||||
<include refid="where" />
|
||||
order by t.id desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?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.central.user.mapper.SysUserRoleMapper">
|
||||
<delete id="deleteUserRole">
|
||||
delete from sys_role_user
|
||||
<where>
|
||||
<if test="userId != null">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="roleId != null">
|
||||
and role_id = #{roleId}
|
||||
</if>
|
||||
</where>
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user