first commit
This commit is contained in:
102
play-admin/src/main/resources/application-dev.yml
Normal file
102
play-admin/src/main/resources/application-dev.yml
Normal file
@@ -0,0 +1,102 @@
|
||||
# 服务名
|
||||
spring:
|
||||
application:
|
||||
name: admin-tenant
|
||||
|
||||
# druid数据源配置
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
# 配置MySQL的驱动程序类
|
||||
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
|
||||
# 数据库连接地址(以MySql为例)
|
||||
url: jdbc:p6spy:mysql://127.0.0.1:3306/play-with?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
|
||||
# 数据库对应的用户名
|
||||
username: root
|
||||
# 数据库对应的密码
|
||||
password: root
|
||||
druid:
|
||||
enable: true
|
||||
db-type: mysql
|
||||
# 配置监控统计拦截的filters,stat是sql监控,wall是防火墙(如果不添加则监控无效),添加log4j需要引入jar包
|
||||
filters: stat,wall,config
|
||||
# 连接池最大活跃连接数
|
||||
max-active: 100
|
||||
# 连接池初始化连接数量
|
||||
initial-size: 1
|
||||
# 配置获取连接等待超时的时间
|
||||
max-wait: 60000
|
||||
# 连接池最小空闲数
|
||||
min-idle: 1
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 指定空闲连接检查、废弃连接清理、空闲连接池大小调整之间的操作时间间隔
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 指定一个空闲连接最少空闲多久后可被清除
|
||||
min-evictable-idle-time-millis: 300000
|
||||
# 连接是否有效的查询语句
|
||||
validation-query: select 'x'
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
# 打开 PSCache,并且指定每个连接上 PSCache 的大小
|
||||
pool-prepared-statements: true
|
||||
max-open-prepared-statements: 50
|
||||
max-pool-prepared-statement-per-connection-size: 20
|
||||
# 配置 DruidStatFilter
|
||||
web-stat-filter:
|
||||
enabled: true #\u662F\u5426\u542F\u7528StatFilter\u9ED8\u8BA4\u503Ctrue
|
||||
# 排除一些不必要的url,比如.js,/jslib/等
|
||||
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
|
||||
# 过滤规则
|
||||
url-pattern: /*
|
||||
# 配置 DruidStatViewServlet
|
||||
stat-view-servlet:
|
||||
# 手动重置监控数据
|
||||
enabled: true
|
||||
# IP白名单,没有配置或者为空,则允许所有访问
|
||||
allow: 127.0.0.1
|
||||
# IP黑名单,若白名单也存在,则优先使用
|
||||
deny:
|
||||
# 配置druid登录用户名、密码
|
||||
login-username: admin
|
||||
login-password: admin
|
||||
# HTML 中 Reset All 按钮
|
||||
reset-enable: true
|
||||
redis:
|
||||
host: 127.0.0.1 # Redis服务器地址
|
||||
database: 10 # Redis数据库索引(默认为0)
|
||||
port: 6379 # Redis服务器连接端口
|
||||
password: Spinfo@0123
|
||||
timeout: 3000ms # 连接超时时间(毫秒)
|
||||
|
||||
|
||||
|
||||
# 全局日志级别
|
||||
logging:
|
||||
level:
|
||||
root: info
|
||||
|
||||
jwt:
|
||||
tokenHeader: X-Token #JWT存储的请求头
|
||||
tokenHead: Bearer #JWT负载中拿到开头
|
||||
secret: yz-admin-secret #JWT加解密使用的密钥
|
||||
expiration: 3600 #JWT的超期限时间秒(60*60*24)
|
||||
|
||||
# xl自定义配置
|
||||
xl:
|
||||
login:
|
||||
authCode:
|
||||
# 登录验证码是否开启,开发环境配置false方便测试
|
||||
enable: false
|
||||
# 腾讯云cos配置
|
||||
cos:
|
||||
baseUrl: https://admin-125966.cos.ap-guangzhou.myqcloud.com
|
||||
secretId: AKIDdHsLgtxoSs3sWw73lz
|
||||
secretKey: zZxBD0b4QcZGmdFcotm
|
||||
regionName: ap-guangzhou
|
||||
bucketName: admin-125966
|
||||
folderPrefix: /upload
|
||||
|
||||
|
||||
96
play-admin/src/main/resources/application-prod.yml
Normal file
96
play-admin/src/main/resources/application-prod.yml
Normal file
@@ -0,0 +1,96 @@
|
||||
# 服务名
|
||||
spring:
|
||||
application:
|
||||
name: admin-ucenter
|
||||
|
||||
# druid数据源配置
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
# 配置MySQL的驱动程序类
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 数据库连接地址(以MySql为例)
|
||||
url: jdbc:mysql://localhost:3306/admin?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
|
||||
# 数据库对应的用户名
|
||||
username: root
|
||||
# 数据库对应的密码
|
||||
password: root
|
||||
druid:
|
||||
# 配置监控统计拦截的filters,stat是sql监控,wall是防火墙(如果不添加则监控无效),添加log4j需要引入jar包
|
||||
filters: stat,wall,config
|
||||
# 连接池最大活跃连接数
|
||||
max-active: 100
|
||||
# 连接池初始化连接数量
|
||||
initial-size: 1
|
||||
# 配置获取连接等待超时的时间
|
||||
max-wait: 60000
|
||||
# 连接池最小空闲数
|
||||
min-idle: 1
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 指定空闲连接检查、废弃连接清理、空闲连接池大小调整之间的操作时间间隔
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 指定一个空闲连接最少空闲多久后可被清除
|
||||
min-evictable-idle-time-millis: 300000
|
||||
# 连接是否有效的查询语句
|
||||
validation-query: select 'x'
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
# 打开 PSCache,并且指定每个连接上 PSCache 的大小
|
||||
pool-prepared-statements: true
|
||||
max-open-prepared-statements: 50
|
||||
max-pool-prepared-statement-per-connection-size: 20
|
||||
# 配置 DruidStatFilter
|
||||
web-stat-filter:
|
||||
enabled: true #\u662F\u5426\u542F\u7528StatFilter\u9ED8\u8BA4\u503Ctrue
|
||||
# 排除一些不必要的url,比如.js,/jslib/等
|
||||
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
|
||||
# 过滤规则
|
||||
url-pattern: /*
|
||||
# 配置 DruidStatViewServlet
|
||||
stat-view-servlet:
|
||||
# 手动重置监控数据
|
||||
enabled: true
|
||||
# IP白名单,没有配置或者为空,则允许所有访问
|
||||
allow: 127.0.0.1
|
||||
# IP黑名单,若白名单也存在,则优先使用
|
||||
deny:
|
||||
# 配置druid登录用户名、密码
|
||||
login-username: admin
|
||||
login-password: admin
|
||||
# HTML 中 Reset All 按钮
|
||||
reset-enable: true
|
||||
redis:
|
||||
host: localhost # Redis服务器地址
|
||||
database: 0 # Redis数据库索引(默认为0)
|
||||
port: 6379 # Redis服务器连接端口
|
||||
password: yz_admin # Redis服务器连接密码(默认为空)
|
||||
timeout: 3000ms # 连接超时时间(毫秒)
|
||||
|
||||
# 全局日志级别
|
||||
logging:
|
||||
level:
|
||||
root: info
|
||||
|
||||
jwt:
|
||||
tokenHeader: X-Token #JWT存储的请求头
|
||||
tokenHead: Bearer #JWT负载中拿到开头
|
||||
secret: yz-admin-secret #JWT加解密使用的密钥
|
||||
expiration: 3600 #JWT的超期限时间秒(60*60*24)
|
||||
|
||||
# xl自定义配置
|
||||
xl:
|
||||
login:
|
||||
authCode:
|
||||
# 登录验证码是否开启,开发环境配置false方便测试
|
||||
enable: false
|
||||
# 腾讯云cos配置
|
||||
cos:
|
||||
baseUrl: https://admin-125966.cos.ap-guangzhou.myqcloud.com
|
||||
secretId: AKIDdHsLgtxoSs3sWw73lz
|
||||
secretKey: zZxBD0b4QcZGmdFcotm
|
||||
regionName: ap-guangzhou
|
||||
bucketName: admin-125966
|
||||
folderPrefix: /upload
|
||||
36
play-admin/src/main/resources/application.yml
Normal file
36
play-admin/src/main/resources/application.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
server:
|
||||
port: 7002
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
|
||||
# mybatis日志
|
||||
mybatis-plus:
|
||||
global-config:
|
||||
# 逻辑删除
|
||||
db-config:
|
||||
logic-delete-field: deleted # 全局逻辑删除的实体字段名
|
||||
logic-delete-value: 1
|
||||
logic-not-delete-value: 0
|
||||
# xml文件路径,classpath* 代表所有模块的resources目录 classpath 不加星号代表当前模块下的resources目录
|
||||
mapper-locations: classpath*:mapper/**/*.xml
|
||||
|
||||
wx:
|
||||
# 公众号配置
|
||||
mp:
|
||||
configs:
|
||||
- appId: xxxxxxxx
|
||||
secret: xxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
token: xxxxxxxxxx
|
||||
aesKey: xxxxxxxxxxxxxxxxxxxx
|
||||
# 小程序配置
|
||||
ma:
|
||||
configs:
|
||||
- appId: xxxxxxxxxxxxxxxx
|
||||
secret: xxxxxxxxxxxxx
|
||||
# 微信支付商户号,请去微信支付平台申请
|
||||
mchId: 1588227511
|
||||
# 微信支付商户APIv2密钥,请去微信支付平台申请
|
||||
mchKey: xxxxxxxxxxxxxxxxxxxxx
|
||||
# p12证书的位置,可以指定绝对路径,也可以指定类路径(以classpath:开头)
|
||||
keyPath: classpath:apiclient_cert.p12
|
||||
@@ -0,0 +1,91 @@
|
||||
<?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.starry.admin.modules.platform.mapper.SysTenantMapper">
|
||||
<resultMap type="com.starry.admin.modules.platform.entity.SysTenantEntity" id="SysTenantResult">
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result property="tenantType" column="tenant_type"/>
|
||||
<result property="tenantStatus" column="tenant_status"/>
|
||||
<result property="tenantCode" column="tenant_code"/>
|
||||
<result property="tenantName" column="tenant_name"/>
|
||||
<result property="tenantLogo" column="tenant_logo"/>
|
||||
<result property="sortOrder" column="sort_order"/>
|
||||
<result property="homeUrl" column="home_url"/>
|
||||
<result property="phone" column="phone"/>
|
||||
<result property="fax" column="fax"/>
|
||||
<result property="email" column="email"/>
|
||||
<result property="address" column="address"/>
|
||||
<result property="userName" column="user_name"/>
|
||||
<result property="userPwd" column="user_pwd"/>
|
||||
<result property="packageId" column="package_id"/>
|
||||
<result property="tenantTime" column="tenant_time"/>
|
||||
<result property="remarks" column="remarks"/>
|
||||
<result property="updatedTime" column="updated_time"/>
|
||||
<result property="updatedBy" column="updated_by"/>
|
||||
<result property="createdTime" column="created_time"/>
|
||||
<result property="createdBy" column="created_by"/>
|
||||
<result property="deleted" column="deleted"/>
|
||||
<result property="version" column="version"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysTenantVo">
|
||||
select tenant_id,
|
||||
tenant_type,
|
||||
tenant_status,
|
||||
tenant_code,
|
||||
tenant_name,
|
||||
tenant_logo,
|
||||
sort_order,
|
||||
home_url,
|
||||
phone,
|
||||
fax,
|
||||
email,
|
||||
address,
|
||||
user_name,
|
||||
user_pwd,
|
||||
package_id,
|
||||
tenant_time,
|
||||
remarks,
|
||||
updated_time,
|
||||
updated_by,
|
||||
created_time,
|
||||
created_by,
|
||||
deleted,
|
||||
version
|
||||
from sys_tenant
|
||||
</sql>
|
||||
|
||||
<select id="selectSysTenantList" resultType="com.starry.admin.modules.platform.vo.TenantResultVo">
|
||||
<include refid="selectSysTenantVo"/>
|
||||
<where>
|
||||
deleted = 0
|
||||
</where>
|
||||
<if test="vo.tenantName != null and vo.tenantName != ''">
|
||||
AND tenant_name like concat('%', #{vo.tenantName}, '%')
|
||||
</if>
|
||||
<if test="vo.tenantStatus != null and vo.tenantStatus != ''">
|
||||
AND tenant_status = #{vo.tenantStatus}
|
||||
</if>
|
||||
<if test="vo.beginTime != null and vo.beginTime != ''">
|
||||
<!-- 开始时间检索 -->
|
||||
AND date_format(tenant_time,'%y%m%d') >= date_format(#{vo.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="vo.endTime != null and vo.endTime != ''">
|
||||
<!-- 结束时间检索 -->
|
||||
AND date_format(tenant_time,'%y%m%d') <= date_format(#{vo.endTime},'%y%m%d')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectSysTenantByTenantId" parameterType="String" resultMap="SysTenantResult">
|
||||
<include refid="selectSysTenantVo"/>
|
||||
where tenant_id = #{tenantId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteTenantByIds" parameterType="String">
|
||||
delete from sys_tenant where tenant_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?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.starry.admin.modules.platform.mapper.SysTenantPackageMapper">
|
||||
<resultMap type="com.starry.admin.modules.platform.entity.SysTenantPackageEntity" id="SysTenantPackageResult">
|
||||
<result property="packageId" column="package_id"/>
|
||||
<result property="packageName" column="package_name"/>
|
||||
<result property="menuIds" column="menu_ids"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="remarks" column="remarks"/>
|
||||
<result property="updatedTime" column="updated_time"/>
|
||||
<result property="updatedBy" column="updated_by"/>
|
||||
<result property="createdTime" column="created_time"/>
|
||||
<result property="createdBy" column="created_by"/>
|
||||
<result property="deleted" column="deleted"/>
|
||||
<result property="version" column="version"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysTenantPackageVo">
|
||||
select package_id,
|
||||
package_name,
|
||||
menu_ids,
|
||||
status,
|
||||
remarks,
|
||||
updated_time,
|
||||
updated_by,
|
||||
created_time,
|
||||
created_by,
|
||||
deleted,
|
||||
version
|
||||
from sys_tenant_package
|
||||
</sql>
|
||||
|
||||
<select id="selectSysTenantPackageList" resultMap="SysTenantPackageResult">
|
||||
<include refid="selectSysTenantPackageVo"/>
|
||||
<where>
|
||||
deleted = 0
|
||||
</where>
|
||||
<if test="vo.packageName != null and vo.packageName != ''">
|
||||
AND package_name like concat('%', #{vo.packageName}, '%')
|
||||
</if>
|
||||
<if test="vo.status != null and vo.status != ''">
|
||||
AND status = #{vo.status}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectSysTenantPackageByPackageId" parameterType="String" resultMap="SysTenantPackageResult">
|
||||
<include refid="selectSysTenantPackageVo"/>
|
||||
where package_id = #{packageId}
|
||||
</select>
|
||||
|
||||
<select id="getSimpleList" resultType="com.starry.admin.modules.platform.vo.SimplePackage">
|
||||
select package_id as id, package_name as name
|
||||
from sys_tenant_package
|
||||
where deleted = 0
|
||||
and status = '0'
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,82 @@
|
||||
<?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.starry.admin.modules.system.mapper.SysDeptMapper">
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.starry.admin.modules.system.entity.SysDeptEntity">
|
||||
<id column="dept_id" property="deptId"/>
|
||||
<result column="parent_id" property="parentId"/>
|
||||
<result column="ancestors" property="ancestors"/>
|
||||
<result column="dept_name" property="deptName"/>
|
||||
<result column="sort" property="sort"/>
|
||||
<result column="leader" property="leader"/>
|
||||
<result column="phone" property="phone"/>
|
||||
<result column="email" property="email"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="dept_level" property="deptLevel"/>
|
||||
<result column="updated_time" property="updatedTime"/>
|
||||
<result column="updated_by" property="updatedBy"/>
|
||||
<result column="created_time" property="createdTime"/>
|
||||
<result column="created_by" property="createdBy"/>
|
||||
<result column="deleted" property="deleted"/>
|
||||
<result column="version" property="version"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeptVo">
|
||||
select d.dept_id,
|
||||
d.parent_id,
|
||||
d.ancestors,
|
||||
d.dept_name,
|
||||
d.sort,
|
||||
d.leader,
|
||||
d.phone,
|
||||
d.email,
|
||||
d.status,
|
||||
d.dept_level,
|
||||
d.created_by,
|
||||
d.created_time
|
||||
from sys_dept d
|
||||
</sql>
|
||||
|
||||
<select id="selectDeptList" resultMap="BaseResultMap">
|
||||
<include refid="selectDeptVo"/>
|
||||
where d.deleted = 0
|
||||
<if test="dept.deptId != null and dept.deptId != 0">
|
||||
AND d.dept_id = #{dept.deptId}
|
||||
</if>
|
||||
<if test="dept.parentId != null and dept.parentId != 0">
|
||||
AND d.parent_id = #{dept.parentId}
|
||||
</if>
|
||||
<if test="dept.deptName != null and dept.deptName != ''">
|
||||
AND d.dept_name like concat('%', #{dept.deptName}, '%')
|
||||
</if>
|
||||
<if test="dept.status != null and dept.status != ''">
|
||||
AND d.status = #{dept.status}
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${dept.params.dataScope}
|
||||
order by d.parent_id, d.sort
|
||||
</select>
|
||||
|
||||
<select id="selectChildrenDeptById" resultMap="BaseResultMap">
|
||||
select * from sys_dept where deleted = 0 and find_in_set(#{deptId}, ancestors)
|
||||
</select>
|
||||
|
||||
<delete id="deleteDeptByTenantId">
|
||||
delete from sys_dept where tenant_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectDeptListByRoleId" resultType="Long">
|
||||
select d.dept_id
|
||||
from sys_dept d
|
||||
left join sys_role_dept rd on d.dept_id = rd.dept_id
|
||||
where rd.role_id = #{roleId}
|
||||
<if test="deptCheckStrictly">
|
||||
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id =
|
||||
rd.dept_id and rd.role_id = #{roleId})
|
||||
</if>
|
||||
order by d.parent_id, d.sort
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,68 @@
|
||||
<?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.starry.admin.modules.system.mapper.SysDictDataMapper">
|
||||
<resultMap type="com.starry.admin.modules.system.entity.SysDictDataEntity" id="XlDictDataResult">
|
||||
<result property="dictDataId" column="dict_data_id"/>
|
||||
<result property="dictType" column="dict_type"/>
|
||||
<result property="dictLabel" column="dict_label"/>
|
||||
<result property="dictValue" column="dict_value"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="isDefault" column="is_default"/>
|
||||
<result property="listClass" column="list_class"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="updatedTime" column="updated_time"/>
|
||||
<result property="updatedBy" column="updated_by"/>
|
||||
<result property="createdTime" column="created_time"/>
|
||||
<result property="createdBy" column="created_by"/>
|
||||
<result property="deleted" column="deleted"/>
|
||||
<result property="version" column="version"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectXlDictDataVo">
|
||||
select dict_data_id,
|
||||
dict_type,
|
||||
dict_label,
|
||||
dict_value,
|
||||
sort,
|
||||
is_default,
|
||||
list_class,
|
||||
status,
|
||||
remark,
|
||||
updated_time,
|
||||
updated_by,
|
||||
created_time,
|
||||
created_by,
|
||||
deleted,
|
||||
version
|
||||
from sys_dict_data
|
||||
</sql>
|
||||
|
||||
<select id="selectXlDictDataList" resultMap="XlDictDataResult"
|
||||
parameterType="com.starry.admin.modules.system.entity.SysDictDataEntity">
|
||||
<include refid="selectXlDictDataVo"/>
|
||||
<where>
|
||||
<if test="vo.dictType != null and vo.dictType != ''">
|
||||
AND dict_type = #{vo.dictType}
|
||||
</if>
|
||||
<if test="vo.dictLabel != null and vo.dictLabel != ''">
|
||||
AND dict_label like concat('%', #{vo.dictLabel}, '%')
|
||||
</if>
|
||||
<if test="vo.status != null and vo.status != ''">
|
||||
AND status = #{vo.status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectXlDictDataByDictDataId" parameterType="Long" resultMap="XlDictDataResult">
|
||||
<include refid="selectXlDictDataVo"/>
|
||||
where dict_data_id = #{dictDataId}
|
||||
</select>
|
||||
|
||||
<select id="selectDictDataByType" resultMap="XlDictDataResult">
|
||||
<include refid="selectXlDictDataVo"/>
|
||||
where deleted = 0 and status = 0 and dict_type = #{dictType} order by sort asc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?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.starry.admin.modules.system.mapper.SysDictMapper">
|
||||
<resultMap type="com.starry.admin.modules.system.entity.SysDictEntity" id="XlDictResult">
|
||||
<result property="dictId" column="dict_id"/>
|
||||
<result property="dictType" column="dict_type"/>
|
||||
<result property="dictName" column="dict_name"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="updatedTime" column="updated_time"/>
|
||||
<result property="updatedBy" column="updated_by"/>
|
||||
<result property="createdTime" column="created_time"/>
|
||||
<result property="createdBy" column="created_by"/>
|
||||
<result property="deleted" column="deleted"/>
|
||||
<result property="version" column="version"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectXlDictVo">
|
||||
select dict_id,
|
||||
dict_type,
|
||||
dict_name,
|
||||
status,
|
||||
remark,
|
||||
updated_time,
|
||||
updated_by,
|
||||
created_time,
|
||||
created_by,
|
||||
deleted,
|
||||
version
|
||||
from sys_dict
|
||||
</sql>
|
||||
|
||||
<select id="selectXlDictList" resultMap="XlDictResult">
|
||||
<include refid="selectXlDictVo"/>
|
||||
where deleted = 0
|
||||
<if test="sysDictVo.dictName != null and sysDictVo.dictName != ''">
|
||||
AND dict_name like concat('%', #{sysDictVo.dictName}, '%')
|
||||
</if>
|
||||
<if test="sysDictVo.dictType != null and sysDictVo.dictType != ''">
|
||||
AND dict_type = #{sysDictVo.dictType}
|
||||
</if>
|
||||
<if test="sysDictVo.status != null and sysDictVo.status != ''">
|
||||
AND status = #{sysDictVo.status}
|
||||
</if>
|
||||
<if test="sysDictVo.beginTime != null and sysDictVo.beginTime != ''">
|
||||
<!-- 开始时间检索 -->
|
||||
AND date_format(created_time, '%y%m%d') >= date_format(#{sysDictVo.beginTime}, '%y%m%d')
|
||||
</if>
|
||||
<if test="sysDictVo.endTime != null and sysDictVo.endTime != ''">
|
||||
<!-- 结束时间检索 -->
|
||||
AND date_format(created_time, '%y%m%d') <= date_format(#{sysDictVo.endTime}, '%y%m%d')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectXlDictByDictId" parameterType="Long" resultMap="XlDictResult">
|
||||
<include refid="selectXlDictVo"/>
|
||||
where dict_id = #{dictId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -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.starry.admin.modules.system.mapper.SysLoginLogMapper">
|
||||
<resultMap type="com.starry.admin.modules.system.entity.SysLoginLogEntity" id="XlLoginLogResult">
|
||||
<result property="loginId" column="login_id"/>
|
||||
<result property="userCode" column="user_code"/>
|
||||
<result property="ipaddr" column="ipaddr"/>
|
||||
<result property="loginLocation" column="login_location"/>
|
||||
<result property="browser" column="browser"/>
|
||||
<result property="os" column="os"/>
|
||||
<result property="msg" column="msg"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="loginTime" column="login_time"/>
|
||||
<result property="updatedTime" column="updated_time"/>
|
||||
<result property="updatedBy" column="updated_by"/>
|
||||
<result property="createdTime" column="created_time"/>
|
||||
<result property="createdBy" column="created_by"/>
|
||||
<result property="deleted" column="deleted"/>
|
||||
<result property="version" column="version"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectXlLoginLogVo">
|
||||
select login_id,
|
||||
user_code,
|
||||
ipaddr,
|
||||
login_location,
|
||||
browser,
|
||||
os,
|
||||
msg,
|
||||
status,
|
||||
login_time,
|
||||
updated_time,
|
||||
updated_by,
|
||||
created_time,
|
||||
created_by,
|
||||
deleted,
|
||||
version
|
||||
from sys_login_log
|
||||
</sql>
|
||||
|
||||
<select id="selectXlLoginLogList" resultMap="XlLoginLogResult">
|
||||
<include refid="selectXlLoginLogVo"/>
|
||||
<where>
|
||||
deleted = 0
|
||||
</where>
|
||||
<if test="vo.ipaddr != null and vo.ipaddr != ''">
|
||||
AND ipaddr = #{vo.ipaddr}
|
||||
</if>
|
||||
<if test="vo.beginTime != null and vo.beginTime != ''">
|
||||
<!-- 开始时间检索 -->
|
||||
AND date_format(login_time,'%y%m%d') >= date_format(#{vo.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="vo.endTime != null and vo.endTime != ''">
|
||||
<!-- 结束时间检索 -->
|
||||
AND date_format(login_time,'%y%m%d') <= date_format(#{vo.endTime},'%y%m%d')
|
||||
</if>
|
||||
order by login_id desc
|
||||
</select>
|
||||
|
||||
<select id="selectXlLoginLogByLoginId" parameterType="Long" resultMap="XlLoginLogResult">
|
||||
<include refid="selectXlLoginLogVo"/>
|
||||
where login_id = #{loginId}
|
||||
</select>
|
||||
|
||||
<update id="cleanLoginlog">
|
||||
truncate table sys_login_log
|
||||
</update>
|
||||
</mapper>
|
||||
131
play-admin/src/main/resources/mapper/system/SysMenuMapper.xml
Normal file
131
play-admin/src/main/resources/mapper/system/SysMenuMapper.xml
Normal file
@@ -0,0 +1,131 @@
|
||||
<?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.starry.admin.modules.system.mapper.SysMenuMapper">
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.starry.admin.modules.system.entity.SysMenuEntity">
|
||||
<id column="menu_id" property="menuId"/>
|
||||
<result column="menu_name" property="menuName"/>
|
||||
<result column="menu_code" property="menuCode"/>
|
||||
<result column="icon" property="icon"/>
|
||||
<result column="menu_level" property="menuLevel"/>
|
||||
<result column="permission" property="permission"/>
|
||||
<result column="sort" property="sort"/>
|
||||
<result column="parent_id" property="parentId"/>
|
||||
<result column="menu_type" property="menuType"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="path" property="path"/>
|
||||
<result column="component" property="component"/>
|
||||
<result column="router_query" property="routerQuery"/>
|
||||
<result column="is_frame" property="isFrame"/>
|
||||
<result column="visible" property="visible"/>
|
||||
<result column="updated_time" property="updatedTime"/>
|
||||
<result column="updated_by" property="updatedBy"/>
|
||||
<result column="created_time" property="createdTime"/>
|
||||
<result column="created_by" property="createdBy"/>
|
||||
<result column="deleted" property="deleted"/>
|
||||
<result column="version" property="version"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectMenuList" resultType="com.starry.admin.modules.system.entity.SysMenuEntity">
|
||||
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.router_query,m.permission,
|
||||
m.visible, m.status, m.menu_code, m.is_frame, m.menu_type, m.icon, m.sort, m.created_time
|
||||
from sys_menu m
|
||||
<where>
|
||||
<if test="menuName != null and menuName != ''">
|
||||
AND m.menu_name like concat('%', #{menuName}, '%')
|
||||
</if>
|
||||
<if test="visible != null and visible != ''">
|
||||
AND m.visible = #{visible}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND m.status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
order by m.parent_id, m.sort
|
||||
</select>
|
||||
|
||||
<select id="selectMenuListByUserId" resultType="com.starry.admin.modules.system.entity.SysMenuEntity">
|
||||
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.router_query,m.permission,
|
||||
m.visible, m.status, m.menu_code, m.is_frame, m.menu_type, m.icon, m.sort, m.created_time
|
||||
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 ro on ur.role_id = ro.role_id
|
||||
where ur.user_id = #{userId}
|
||||
<if test="menu.menuName != null and menu.menuName != ''">
|
||||
AND m.menu_name like concat('%', #{menu.menuName}, '%')
|
||||
</if>
|
||||
<if test="menu.visible != null and menu.visible != ''">
|
||||
AND m.visible = #{menu.visible}
|
||||
</if>
|
||||
<if test="menu.status != null and menu.status != ''">
|
||||
AND m.status = #{menu.status}
|
||||
</if>
|
||||
order by m.parent_id, m.sort
|
||||
</select>
|
||||
|
||||
<select id="selectMenuListByRoleId" resultType="Long">
|
||||
select m.menu_id
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
where m.deleted = 0
|
||||
and rm.deleted = 0
|
||||
and rm.role_id = #{roleId}
|
||||
<if test="menuCheckStrictly">
|
||||
and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_role_menu rm on m.menu_id =
|
||||
rm.menu_id and rm.role_id = #{roleId})
|
||||
</if>
|
||||
order by m.parent_id, m.sort
|
||||
</select>
|
||||
|
||||
<select id="selectMenuPermsByUserId" resultType="String">
|
||||
select distinct m.permission
|
||||
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.deleted = 0 and rm.deleted = 0 and ur.deleted = 0 and r.deleted = 0
|
||||
and m.status = 0 and r.status = 0 and ur.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectMenuTreeAll" resultMap="BaseResultMap">
|
||||
select distinct m.menu_id,
|
||||
m.parent_id,
|
||||
m.menu_name,
|
||||
m.path,
|
||||
m.component,
|
||||
m.router_query,
|
||||
m.visible,
|
||||
m.status,
|
||||
ifnull(m.permission, '') as permission,
|
||||
m.is_frame,
|
||||
m.menu_type,
|
||||
m.icon,
|
||||
m.sort
|
||||
from sys_menu m
|
||||
where m.deleted = 0
|
||||
and m.menu_type in (0, 1)
|
||||
and m.status = 0
|
||||
order by m.parent_id, m.sort
|
||||
</select>
|
||||
|
||||
<select id="selectMenuTreeByUserId" resultMap="BaseResultMap">
|
||||
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.router_query, m.visible, m.status,
|
||||
ifnull(m.permission,'') as permission, m.is_frame, m.menu_type, m.icon, m.sort
|
||||
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 ur.role_id = r.role_id
|
||||
left join sys_user u on ur.user_id = u.user_id
|
||||
where m.deleted = 0 and rm.deleted = 0 and ur.deleted = 0 and r.deleted = 0 and r.deleted = 0 and u.deleted = 0
|
||||
and u.user_id = #{userId} and m.menu_type in (0, 1) and m.status = 0 AND r.status = 0
|
||||
order by m.parent_id, m.sort
|
||||
</select>
|
||||
|
||||
<select id="selectSimpleMenuList" resultType="com.starry.admin.modules.system.vo.SimpleMenu">
|
||||
select menu_id as id, menu_name as name, parent_id as parentId, menu_type as type
|
||||
from sys_menu
|
||||
where status = 0
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -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="com.starry.admin.modules.system.mapper.SysOperationLogMapper">
|
||||
<resultMap type="com.starry.admin.modules.system.entity.SysOperationLogEntity" id="SysOperLogResult">
|
||||
<result property="operId" column="oper_id"/>
|
||||
<result property="title" column="title"/>
|
||||
<result property="businessType" column="business_type"/>
|
||||
<result property="method" column="method"/>
|
||||
<result property="requestMethod" column="request_method"/>
|
||||
<result property="operatorType" column="operator_type"/>
|
||||
<result property="operName" column="oper_name"/>
|
||||
<result property="operUrl" column="oper_url"/>
|
||||
<result property="operIp" column="oper_ip"/>
|
||||
<result property="operLocation" column="oper_location"/>
|
||||
<result property="operParam" column="oper_param"/>
|
||||
<result property="jsonResult" column="json_result"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="errorMsg" column="error_msg"/>
|
||||
<result property="operTime" column="oper_time"/>
|
||||
<result property="deptName" column="dept_name"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="updatedTime" column="updated_time"/>
|
||||
<result property="updatedBy" column="updated_by"/>
|
||||
<result property="createdTime" column="created_time"/>
|
||||
<result property="createdBy" column="created_by"/>
|
||||
<result property="deleted" column="deleted"/>
|
||||
<result property="version" column="version"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectXlOperLogVo">
|
||||
select oper_id,
|
||||
title,
|
||||
business_type,
|
||||
method,
|
||||
request_method,
|
||||
operator_type,
|
||||
oper_name,
|
||||
oper_url,
|
||||
oper_ip,
|
||||
oper_location,
|
||||
oper_param,
|
||||
json_result,
|
||||
status,
|
||||
error_msg,
|
||||
oper_time,
|
||||
dept_name,
|
||||
dept_id,
|
||||
updated_time,
|
||||
updated_by,
|
||||
created_time,
|
||||
created_by,
|
||||
deleted,
|
||||
version
|
||||
from sys_operation_log
|
||||
</sql>
|
||||
|
||||
<select id="selectXlOperLogList" resultMap="SysOperLogResult">
|
||||
<include refid="selectXlOperLogVo"/>
|
||||
<where>
|
||||
deleted = 0
|
||||
</where>
|
||||
<if test="vo.title != null and vo.title != ''">
|
||||
AND title like concat('%', #{vo.title}, '%')
|
||||
</if>
|
||||
<if test="vo.businessType != null">
|
||||
AND business_type = #{vo.businessType}
|
||||
</if>
|
||||
<if test="vo.businessTypes != null and vo.businessTypes.length > 0">
|
||||
AND business_type in
|
||||
<foreach collection="vo.businessTypes" item="businessType" open="(" separator="," close=")">
|
||||
#{businessType}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="vo.operName != null and vo.operName != ''">
|
||||
AND oper_name like concat('%', #{vo.operName}, '%')
|
||||
</if>
|
||||
<if test="vo.beginTime != null and vo.beginTime != ''">
|
||||
and date_format(oper_time,'%y%m%d') >= date_format(#{vo.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="vo.endTime != null and vo.endTime != ''">
|
||||
and date_format(oper_time,'%y%m%d') <= date_format(#{vo.endTime},'%y%m%d')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectXlOperLogByOperId" parameterType="Long" resultMap="SysOperLogResult">
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?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.starry.admin.modules.system.mapper.SysRoleDeptMapper">
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.starry.admin.modules.system.entity.SysRoleDeptEntity">
|
||||
<id column="role_dept_id" property="roleDeptId"/>
|
||||
<result column="role_id" property="roleId"/>
|
||||
<result column="dept_id" property="deptId"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="updated_time" property="updatedTime"/>
|
||||
<result column="updated_by" property="updatedBy"/>
|
||||
<result column="created_time" property="createdTime"/>
|
||||
<result column="created_by" property="createdBy"/>
|
||||
<result column="deleted" property="deleted"/>
|
||||
<result column="version" property="version"/>
|
||||
</resultMap>
|
||||
|
||||
<delete id="deleteRoleDeptByTenantId">
|
||||
delete from sys_role_dept where tenant_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRoleDeptByRoleId" parameterType="Long">
|
||||
delete from sys_role_dept where role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchRoleDept">
|
||||
insert into sys_role_dept(role_id, dept_id) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.roleId},#{item.deptId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteRoleDept" parameterType="Long">
|
||||
delete from sys_role_dept where role_id in
|
||||
<foreach collection="array" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,81 @@
|
||||
<?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.starry.admin.modules.system.mapper.SysRoleMapper">
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.starry.admin.modules.system.entity.SysRoleEntity">
|
||||
<id column="role_id" property="roleId"/>
|
||||
<result column="role_name" property="roleName"/>
|
||||
<result column="description" property="description"/>
|
||||
<result column="data_scope" property="dataScope"/>
|
||||
<result column="menu_check_strictly" property="menuCheckStrictly"/>
|
||||
<result column="dept_check_strictly" property="deptCheckStrictly"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="updated_time" property="updatedTime"/>
|
||||
<result column="updated_by" property="updatedBy"/>
|
||||
<result column="create_time" property="createdTime"/>
|
||||
<result column="created_by" property="createdBy"/>
|
||||
<result column="deleted" property="deleted"/>
|
||||
<result column="version" property="version"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRoleVo">
|
||||
select distinct r.role_id,
|
||||
r.role_name,
|
||||
r.role_key,
|
||||
r.data_scope,
|
||||
r.menu_check_strictly,
|
||||
r.dept_check_strictly,
|
||||
r.status,
|
||||
r.created_time,
|
||||
r.description
|
||||
from sys_role r
|
||||
left join sys_user_role ur on ur.role_id = r.role_id and ur.deleted = 0
|
||||
left join sys_user u on u.user_id = ur.user_id and u.deleted = 0
|
||||
</sql>
|
||||
|
||||
<select id="selectRoleById" parameterType="Long" resultMap="BaseResultMap">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.deleted = 0
|
||||
and r.role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
<select id="checkRoleNameUnique" parameterType="String" resultMap="BaseResultMap">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.role_name=#{roleName} and r.deleted = 0 limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkRoleKeyUnique" parameterType="String" resultMap="BaseResultMap">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.role_key=#{roleKey} and r.deleted = 0 limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectRolePermissionByUserId" resultMap="BaseResultMap">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.deleted = 0
|
||||
and ur.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectRoleList" resultMap="BaseResultMap">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="queryAdminRole" parameterType="String" resultMap="BaseResultMap">
|
||||
select distinct r.role_id, r.role_name, r.role_key, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
|
||||
r.status, r.description,tenant_id
|
||||
from sys_role r
|
||||
where r.tenant_id = #{tenantId} and r.role_key = 'admin' order by role_id desc
|
||||
</select>
|
||||
|
||||
<delete id="deleteRoleByTenantId">
|
||||
delete from sys_role where tenant_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="countUserRoleByRoleId" resultType="Integer">
|
||||
select count(1) from sys_user_role where role_id=#{roleId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -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="com.starry.admin.modules.system.mapper.SysRoleMenuMapper">
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.starry.admin.modules.system.entity.SysRoleMenuEntity">
|
||||
<id column="role_menu_id" property="roleMenuId"/>
|
||||
<result column="role_id" property="roleId"/>
|
||||
<result column="menu_id" property="menuId"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="updated_time" property="updatedTime"/>
|
||||
<result column="updated_by" property="updatedBy"/>
|
||||
<result column="created_time" property="createdTime"/>
|
||||
<result column="created_by" property="createdBy"/>
|
||||
<result column="deleted" property="deleted"/>
|
||||
<result column="version" property="version"/>
|
||||
</resultMap>
|
||||
|
||||
<delete id="deleteRoleMenuByTenantId" parameterType="String">
|
||||
delete from sys_role_menu where tenant_id = #{tenantId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRoleMenuByTenantIds">
|
||||
delete from sys_role_menu where tenant_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRoleMenu" parameterType="Long">
|
||||
delete from sys_role_menu where role_id in
|
||||
<foreach collection="array" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
151
play-admin/src/main/resources/mapper/system/SysUserMapper.xml
Normal file
151
play-admin/src/main/resources/mapper/system/SysUserMapper.xml
Normal file
@@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.starry.admin.modules.system.mapper.SysUserMapper">
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.starry.admin.modules.system.entity.SysUserEntity">
|
||||
<id column="user_id" property="userId"/>
|
||||
<result column="user_code" property="userCode"/>
|
||||
<result column="pass_word" property="passWord"/>
|
||||
<result column="real_name" property="realName"/>
|
||||
<result column="user_nickname" property="userNickname"/>
|
||||
<result column="user_email" property="userEmail"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="sex" property="sex"/>
|
||||
<result column="mobile" property="mobile"/>
|
||||
<result column="dept_id" property="deptId"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="updated_time" property="updatedTime"/>
|
||||
<result column="updated_by" property="updatedBy"/>
|
||||
<result column="created_time" property="createdTime"/>
|
||||
<result column="created_by" property="createdBy"/>
|
||||
<result column="deleted" property="deleted"/>
|
||||
<result column="version" property="version"/>
|
||||
|
||||
<association property="dept" javaType="com.starry.admin.modules.system.entity.SysDeptEntity">
|
||||
<id column="dept_id" property="deptId"/>
|
||||
<result column="dept_name" property="deptName"/>
|
||||
<result column="leader" property="leader"/>
|
||||
</association>
|
||||
|
||||
<collection property="roles" javaType="java.util.List"
|
||||
ofType="com.starry.admin.modules.system.entity.SysRoleEntity">
|
||||
<id column="role_id" property="roleId"/>
|
||||
<result column="role_name" property="roleName"/>
|
||||
<result column="role_key" property="roleKey"/>
|
||||
<result column="data_scope" property="dataScope"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id,
|
||||
u.real_name,
|
||||
u.user_nickname,
|
||||
u.user_email,
|
||||
u.avatar,
|
||||
u.user_code,
|
||||
u.pass_word,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.status,
|
||||
u.created_time,
|
||||
u.dept_id,
|
||||
u.tenant_id,
|
||||
d.dept_name,
|
||||
r.role_id,
|
||||
r.role_name,
|
||||
r.role_key,
|
||||
r.data_scope,
|
||||
r.status as role_status
|
||||
from sys_user u
|
||||
left join sys_user_role ur on u.user_id = ur.user_id and ur.deleted = 0
|
||||
left join sys_role r on r.role_id = ur.role_id and r.deleted = 0
|
||||
left join sys_dept d on u.dept_id = d.dept_id and d.deleted = 0
|
||||
</sql>
|
||||
|
||||
<select id="selectUserById" resultMap="BaseResultMap">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.deleted = 0
|
||||
and u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectUserList" resultMap="BaseResultMap">
|
||||
select u.user_id,
|
||||
u.real_name,
|
||||
u.user_nickname,
|
||||
u.user_email,
|
||||
u.avatar,
|
||||
u.user_code,
|
||||
u.pass_word,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.status,
|
||||
u.dept_id,
|
||||
u.created_time,
|
||||
d.dept_name,
|
||||
d.leader
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id and d.deleted = 0
|
||||
where u.deleted = 0
|
||||
<if test="user.userId != null and user.userId != 0">
|
||||
AND u.user_id = #{user.userId}
|
||||
</if>
|
||||
<if test="user.userCode != null and user.userCode != ''">
|
||||
AND u.user_code like concat('%', #{user.userCode}, '%')
|
||||
</if>
|
||||
<if test="user.realName != null and user.realName != ''">
|
||||
AND u.real_name like concat('%', #{user.realName}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectUserByUserName" resultMap="BaseResultMap">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_code = #{userName} and u.deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="checkUserNameUnique" parameterType="String" resultType="int">
|
||||
select count(1) from sys_user where user_code = #{userName} and deleted = 0 limit 1
|
||||
</select>
|
||||
|
||||
<delete id="deleteUserByTenantId">
|
||||
delete from sys_user where tenant_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectAllocatedList" resultType="com.starry.admin.modules.system.vo.RoleUserResultVo">
|
||||
select distinct u.user_id, u.dept_id, u.user_code, u.real_name, u.user_email, u.mobile, u.status, u.created_time
|
||||
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
|
||||
where u.deleted = 0 and r.role_id = #{query.roleId}
|
||||
<if test="query.userCode != null and query.userCode != ''">
|
||||
AND u.user_code like concat('%', #{query.userCode}, '%')
|
||||
</if>
|
||||
<if test="query.mobile != null and query.mobile != ''">
|
||||
AND u.mobile like concat('%', #{query.mobile}, '%')
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${query.params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectUnallocatedList" resultType="com.starry.admin.modules.system.vo.RoleUserResultVo">
|
||||
select distinct u.user_id, u.dept_id, u.user_code, u.real_name, u.user_email, u.mobile, u.status, u.created_time
|
||||
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
|
||||
where u.deleted = 0 and (r.role_id != #{query.roleId} or r.role_id IS NULL)
|
||||
and u.user_id not in (select u.user_id from sys_user u inner join sys_user_role ur on u.user_id = ur.user_id and
|
||||
ur.role_id = #{query.roleId})
|
||||
<if test="query.userCode != null and query.userCode != ''">
|
||||
AND u.user_code like concat('%', #{query.userCode}, '%')
|
||||
</if>
|
||||
<if test="query.mobile != null and query.mobile != ''">
|
||||
AND u.mobile like concat('%', #{query.mobile}, '%')
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${query.params.dataScope}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -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="com.starry.admin.modules.system.mapper.SysUserRoleMapper">
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.starry.admin.modules.system.entity.SysUserRoleEntity">
|
||||
<id column="user_role_id" property="userRoleId"/>
|
||||
<result column="role_id" property="roleId"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="updated_time" property="updatedTime"/>
|
||||
<result column="updated_by" property="updatedBy"/>
|
||||
<result column="created_time" property="createdTime"/>
|
||||
<result column="created_by" property="createdBy"/>
|
||||
<result column="deleted" property="deleted"/>
|
||||
<result column="version" property="version"/>
|
||||
</resultMap>
|
||||
|
||||
<delete id="deleteUserRoleByTenantId">
|
||||
delete from sys_user_role where tenant_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserRoleInfo">
|
||||
delete from sys_user_role where user_id=#{userId} and role_id=#{roleId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserRoleInfos">
|
||||
delete from sys_user_role where role_id=#{roleId} and user_id in
|
||||
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
31
play-admin/src/main/resources/spy.properties
Normal file
31
play-admin/src/main/resources/spy.properties
Normal file
@@ -0,0 +1,31 @@
|
||||
#3.2.1以上使用modulelist=com.baomidou.mybatisplus.extension.p6spy.MybatisPlusLogFactory,com.p6spy.engine.outage.P6OutageFactory
|
||||
|
||||
# 自定义日志打印
|
||||
logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger
|
||||
|
||||
#日志输出到控制台
|
||||
appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger
|
||||
|
||||
# 使用日志系统记录 sql
|
||||
#appender=com.p6spy.engine.spy.appender.Slf4JLogger
|
||||
|
||||
# 设置 p6spy driver 代理
|
||||
deregisterdrivers=true
|
||||
|
||||
# 取消JDBC URL前缀
|
||||
useprefix=true
|
||||
|
||||
# 配置记录 Log 例外,可去掉的结果集error,info,batch,debug,statement,commit,rollback,result,resultset.
|
||||
excludecategories=info,debug,result,commit,resultset
|
||||
|
||||
# 日期格式
|
||||
dateformat=yyyy-MM-dd HH:mm:ss
|
||||
|
||||
# 实际驱动可多个
|
||||
#driverlist=org.h2.Driver
|
||||
|
||||
# 是否开启慢SQL记录
|
||||
outagedetection=true
|
||||
|
||||
# 慢SQL记录标准 2 秒
|
||||
outagedetectioninterval=2
|
||||
Reference in New Issue
Block a user