dji-cloud-api module add

This commit is contained in:
2024-12-23 16:21:22 +08:00
parent 42ab5d5730
commit 6619d9183f
1339 changed files with 139221 additions and 0 deletions
@@ -0,0 +1,67 @@
spring:
datasource:
url: jdbc:mysql://${zlt.datasource.ip}:3306/user-center?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
username: ${zlt.datasource.username}
password: ${zlt.datasource.password}
driver-class-name: com.mysql.cj.jdbc.Driver
mybatis-plus:
mapper-locations: classpath:/mapper/*Mapper.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.central.common.model
global-config:
db-config:
id-type: auto
springdoc:
group-configs:
- group: 'default'
paths-to-match: '/**'
packages-to-scan: com.central.tourist.controller
knife4j:
enable: true
setting:
swagger-model-name: 用户中心接口文档
zlt:
cache-manager:
configs:
- key: menu
second: 300
- key: user
second: 1800
#多租户配置
tenant:
enable: true
ignoreTables:
- sys_user
- sys_role_user
- sys_role_menu
ignoreSqls:
# 用户关联角色时,显示所有角色
- com.central.user.mapper.SysRoleMapper.findAll
# 用户列表显示用户所关联的所有角色
- com.central.user.mapper.SysUserRoleMapper.findRolesByUserIds
# 数据权限
datascope:
enabled: false
ignoreTables:
- sys_role_user
- sys_role_menu
includeSqls:
# 用户列表
- com.central.user.mapper.SysUserMapper.findList
# 角色列表
- com.central.user.mapper.SysRoleMapper.findList
# 菜单列表
- com.central.user.mapper.SysMenuMapper.selectList
#审计日志
# audit-log:
# enabled: true
# log-type: db
# datasource:
# driver-class-name: com.mysql.cj.jdbc.Driver
# jdbc-url: jdbc:mysql://${zlt.datasource.ip}:3306/logger-center?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
# username: ${zlt.datasource.username}
# password: ${zlt.datasource.password}
@@ -0,0 +1,11 @@
server:
port: 7000
spring:
application:
name: user-center
# cloud:
# nacos:
# discovery:
# metadata:
# version: zlt
@@ -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.SysMenuMapper">
<select id="findByUserId" 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_user ru on ru.role_id = r.role_id
where ru.user_id = #{userId}
<if test="type != null">
and t.type = #{type}
</if>
and t.hidden = 0
ORDER BY sort ASC
</select>
</mapper>
@@ -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="com.central.user.mapper.SysRoleMapper">
<sql id="Column_List">
id,
code,
name,
create_time,
update_time,
tenant_id,
data_scope
</sql>
<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 <include refid="Column_List"/>
from sys_role t
<include refid="where" />
order by t.create_time desc
</select>
<select id="findAll" resultType="com.central.common.model.SysRole">
select <include refid="Column_List"/>
from sys_role
order by create_time desc
</select>
</mapper>
@@ -0,0 +1,49 @@
<?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>
and t.hidden = 0
ORDER BY sort ASC
</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,21 @@
<?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>
<select id="findRolesByUserId" resultType="com.central.common.model.SysRole">
select r.* from sys_role r
inner join sys_role_user ru on r.id = ru.role_id and ru.user_id = #{userId}
</select>
</mapper>