feat: 全量提交

This commit is contained in:
horizons
2022-10-24 07:50:54 +08:00
commit de9157143a
128 changed files with 7493 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
server:
port: 8989
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://www.youlai.tech:3306/youlai_boot?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&allowMultiQueries=true
username: youlai
password: 123456
redis:
database: 6
host: www.youlai.tech
port: 6379
password: 123456
timeout: 10s
lettuce:
pool:
min-idle: 0
max-idle: 8
max-active: 8
max-wait: -1ms
mybatis-plus:
global-config:
db-config:
# 主键ID类型
id-type: none
logic-delete-field: deleted
logic-delete-value: 1
logic-not-delete-value: 0
configuration:
# 驼峰下划线转换
map-underscore-to-camel-case: true
# 这个配置会将执行的sql打印出来在开发或测试的时候可以用
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# 认证配置
auth:
token:
secret_key: SecretKey012345678901234567890123456789012345678901234567890123456789
# token 有效期(单位:秒)
token_validity: 18000

View File

@@ -0,0 +1,45 @@
server:
port: 8989
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://www.youlai.tech:3306/youlai_boot?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&allowMultiQueries=true
username: youlai
password: 123456
redis:
database: 6
host: www.youlai.tech
port: 6379
password: 123456
timeout: 10s
lettuce:
pool:
min-idle: 0
max-idle: 8
max-active: 8
max-wait: -1ms
mybatis-plus:
global-config:
db-config:
# 主键ID类型
id-type: none
logic-delete-field: deleted
logic-delete-value: 1
logic-not-delete-value: 0
configuration:
# 驼峰下划线转换
map-underscore-to-camel-case: true
# 这个配置会将执行的sql打印出来在开发或测试的时候可以用
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# 认证配置
auth:
token:
secret_key: SecretKey012345678901234567890123456789012345678901234567890123456789
# token 有效期(单位:秒)
token_validity: 18000

View File

@@ -0,0 +1,8 @@
spring:
application:
name: youlai-boot
profiles:
active: dev
mvc:
pathmatch:
matching-strategy: ant_path_matcher

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL如果设置为WARN则低于WARN的信息都不会输出 -->
<configuration>
<!-- SpringBoot默认logback的配置 -->
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
<property name="LOG_HOME" value="/logs/${APP_NAME}" />
<!--1. 输出到控制台-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<withJansi>true</withJansi>
<!--此日志appender是为开发使用只配置最低级别控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- 2. 输出到文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 当前记录的日志文档完整路径 -->
<file>${LOG_HOME}/log.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} -%5level ---[%15.15thread] %-40.40logger{39} : %msg%n%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 开发环境输出至控制台 -->
<springProfile name="dev">
<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</root>
</springProfile>
<!-- 生产环境输出至文件 -->
<springProfile name="prod">
<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</root>
</springProfile>
</configuration>

View File

@@ -0,0 +1,24 @@
<?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.youlai.system.mapper.SysDeptMapper">
<resultMap id="BaseResultMap" type="com.youlai.system.pojo.entity.SysDept">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="parentId" column="parent_id" jdbcType="BIGINT"/>
<result property="treePath" column="tree_path" jdbcType="VARCHAR"/>
<result property="sort" column="sort" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="TINYINT"/>
<result property="deleted" column="deleted" jdbcType="TINYINT"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,name,parent_id,
tree_path,sort,status,
deleted,create_time,update_time
</sql>
</mapper>

View File

@@ -0,0 +1,7 @@
<?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.youlai.system.mapper.SysDictItemMapper">
</mapper>

View File

@@ -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.youlai.system.mapper.SysDictTypeMapper">
<resultMap id="BaseResultMap" type="com.youlai.system.pojo.entity.SysDictType">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="code" column="code" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="TINYINT"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,name,code,
status,remark,create_time,
update_time
</sql>
</mapper>

View File

@@ -0,0 +1,70 @@
<?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.youlai.system.mapper.SysMenuMapper">
<!-- 菜单路由映射 -->
<resultMap id="RouteMap" type="com.youlai.system.pojo.po.RoutePO">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="parentId" column="parent_id" jdbcType="BIGINT"/>
<result property="path" column="path" jdbcType="VARCHAR"/>
<result property="component" column="component" jdbcType="VARCHAR"/>
<result property="redirectUrl" column="redirect_url" jdbcType="VARCHAR"/>
<result property="icon" column="icon" jdbcType="VARCHAR"/>
<result property="sort" column="sort" jdbcType="INTEGER"/>
<result property="visible" column="visible" jdbcType="BOOLEAN"/>
<result property="type" column="type" jdbcType="OTHER"/>
<collection property="roles" ofType="string" javaType="list">
<result column="code"/>
</collection>
</resultMap>
<!-- 获取路由列表 -->
<select id="listRoutes" resultMap="RouteMap">
SELECT
t1.id,
t1.name,
t1.parent_id,
t1.path,
t1.component,
t1.icon,
t1.sort,
t1.visible,
t1.redirect_url,
t1.type,
t3.code
FROM
sys_menu t1
LEFT JOIN sys_role_menu t2 ON t1.id = t2.menu_id
LEFT JOIN sys_role t3 ON t2.role_id = t3.id
WHERE
t1.type != '${@com.youlai.system.common.enums.MenuTypeEnum@BUTTON.getValue()}'
ORDER BY t1.sort asc
</select>
<!-- 获取角色拥有的权限集合 -->
<select id="listRolePerms" resultType="java.lang.String">
SELECT
DISTINCT t1.perm
FROM
sys_menu t1
INNER JOIN sys_role_menu t2
INNER JOIN sys_role t3
WHERE
t1.type = '${@com.youlai.system.common.enums.MenuTypeEnum@BUTTON.getValue()}'
AND t1.perm IS NOT NULL
<choose>
<when test="roles!=null and roles.size()>0">
AND t3.CODE IN
<foreach collection="roles" item="role" separator="," open="(" close=")">
#{role}
</foreach>
</when>
<otherwise>
AND t1.id = -1
</otherwise>
</choose>
</select>
</mapper>

View File

@@ -0,0 +1,23 @@
<?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.youlai.system.mapper.SysRoleMapper">
<resultMap id="BaseResultMap" type="com.youlai.system.pojo.entity.SysRole">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="code" column="code" jdbcType="VARCHAR"/>
<result property="sort" column="sort" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="TINYINT"/>
<result property="deleted" column="deleted" jdbcType="TINYINT"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,name,code,
sort,status,deleted,
create_time,update_time
</sql>
</mapper>

View File

@@ -0,0 +1,24 @@
<?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.youlai.system.mapper.SysRoleMenuMapper">
<!-- 获取角色拥有的菜单ID集合(父节点排除) -->
<select id="listMenuIdsByRoleId" resultType="java.lang.Long">
SELECT
rm.menu_id
FROM
sys_role_menu rm
INNER JOIN sys_menu m ON rm.menu_id = m.id
WHERE
rm.role_id = #{roleId}
AND rm.menu_id NOT IN
( SELECT
m.parent_id
FROM
sys_role_menu rm INNER JOIN sys_menu m ON rm.menu_id = m.id
WHERE rm.role_id = #{roleId}
)
</select>
</mapper>

View File

@@ -0,0 +1,142 @@
<?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.youlai.system.mapper.SysUserMapper">
<!-- 用户分页列表 -->
<select id="listUserPages" resultType="com.youlai.system.pojo.po.UserPO">
SELECT
u.id,
u.username,
u.nickname,
u.mobile,
u.gender,
u.avatar,
u.STATUS,
d.NAME AS dept_name,
GROUP_CONCAT( r.NAME ) AS roleNames,
u.create_time
FROM
sys_user u
LEFT JOIN sys_dept d ON u.dept_id = d.id
LEFT JOIN sys_user_role sur ON u.id = sur.user_id
LEFT JOIN sys_role r ON ur.role_id = r.id
<where>
u.deleted = 0
<if test='queryParams.keywords!=null and queryParams.keywords.trim() neq ""'>
AND (
u.username LIKE CONCAT('%',#{queryParams.keywords},'%')
OR u.nickname LIKE CONCAT('%',#{queryParams.keywords},'%')
OR u.mobile LIKE CONCAT('%',#{queryParams.keywords},'%')
)
</if>
<if test='queryParams.status!=null'>
AND u.status = #{queryParams.status}
</if>
<if test='queryParams.deptId!=null'>
AND concat(',',concat(d.tree_path,',',d.id),',') like concat('%,',#{queryParams.deptId},',%')
</if>
</where>
GROUP BY u.id
</select>
<!-- 用户表单信息映射 -->
<resultMap id="UserFormMap" type="com.youlai.system.pojo.po.UserFormPO">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="username" column="username" jdbcType="VARCHAR"/>
<result property="nickname" column="nickname" jdbcType="VARCHAR"/>
<result property="mobile" column="mobile" jdbcType="VARCHAR"/>
<result property="gender" column="gender" jdbcType="TINYINT"/>
<result property="avatar" column="avatar" jdbcType="VARCHAR"/>
<result property="email" column="email" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="BOOLEAN"/>
<result property="deptId" column="dept_id" jdbcType="BIGINT"></result>
<collection
property="roleIds"
column="id"
select="com.youlai.system.mapper.SysUserRoleMapper.listRoleIdsByUserId" >
<result column="role_id" />
</collection>
</resultMap>
<!-- 根据用户ID获取用户详情 -->
<select id="getUserDetail" resultMap="UserFormMap">
SELECT id,
username,
nickname,
mobile,
gender,
avatar,
email,
STATUS,
dept_id
FROM sys_user
WHERE id = #{userId}
AND deleted = 0
</select>
<!-- 用户认证信息映射 -->
<resultMap id="UserAuthMap" type="com.youlai.system.pojo.po.UserAuthInfo">
<id property="userId" column="userId" jdbcType="BIGINT"/>
<result property="username" column="username" jdbcType="VARCHAR"/>
<result property="password" column="password" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="BOOLEAN"/>
<result property="deptId" column="dept_id" jdbcType="BIGINT"></result>
<collection property="roles" ofType="string" javaType="java.util.Set">
<result column="code"></result>
</collection>
</resultMap>
<!-- 根据用户名获取认证信息 -->
<select id="getUserAuthInfo" resultMap="UserAuthMap">
SELECT
t1.id userId,
t1.username,
t1.nickname,
t1.PASSWORD,
t1.STATUS,
t1.dept_id ,
t3.CODE
FROM
sys_user t1
LEFT JOIN sys_user_role t2 ON t2.user_id = t1.id
LEFT JOIN sys_role t3 ON t3.id = t2.role_id
WHERE
t1.username = #{username} AND t1.deleted=0
</select>
<!-- 获取用户导出列表 -->
<select id="listExportUsers" resultType="com.youlai.system.pojo.vo.user.UserExportVO">
SELECT
u.username,
u.nickname,
u.mobile,
CASE u.gender
WHEN 1 THEN '男'
WHEN 2 THEN '女'
ELSE '未知'
END gender,
d.NAME AS dept_name,
u.create_time
FROM
sys_user u
LEFT JOIN sys_dept d ON u.dept_id = d.id
<where>
u.deleted = 0
<if test='keywords!=null and keywords.trim() neq ""'>
AND (u.username LIKE CONCAT('%',#{keywords},'%')
OR u.nickname LIKE CONCAT('%',#{keywords},'%')
OR u.mobile LIKE CONCAT('%',#{keywords},'%'))
</if>
<if test='status!=null'>
AND u.status = #{status}
</if>
<if test='deptId!=null'>
AND concat(',',concat(d.tree_path,',',d.id),',') like concat('%,',#{deptId},',%')
</if>
</where>
GROUP BY u.id
</select>
</mapper>

View File

@@ -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.youlai.system.mapper.SysUserRoleMapper">
<!-- 根据用户ID获取角色ID集合 -->
<select id="listRoleIdsByUserId" resultType="java.lang.Long">
SELECT
role_id
FROM
sys_user_role
WHERE
user_id = #{userId}
</select>
</mapper>