Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
112Lst
coder_club
提交
8e0bac29
C
coder_club
项目概览
112Lst
/
coder_club
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
coder_club
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
8e0bac29
编写于
4月 20, 2024
作者:
112Lst
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【add】权限模块开发
上级
de4dd5b1
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
1412 addition
and
6 deletion
+1412
-6
club-auth/club-auth-application/club-auth-application-controller/src/main/java/com/lssst/auth/application/controller/PermissionController.java
...sst/auth/application/controller/PermissionController.java
+86
-0
club-auth/club-auth-application/club-auth-application-controller/src/main/java/com/lssst/auth/application/controller/UserController.java
...com/lssst/auth/application/controller/UserController.java
+128
-0
club-auth/club-auth-application/club-auth-application-controller/src/main/java/com/lssst/auth/application/convert/AuthPermissionDTOConverter.java
.../auth/application/convert/AuthPermissionDTOConverter.java
+19
-0
club-auth/club-auth-application/club-auth-application-controller/src/main/java/com/lssst/auth/application/dto/AuthPermissionDTO.java
...ava/com/lssst/auth/application/dto/AuthPermissionDTO.java
+31
-0
club-auth/club-auth-domain/src/main/java/com/lssst/auth/domain/constants/AuthConstant.java
...in/java/com/lssst/auth/domain/constants/AuthConstant.java
+12
-0
club-auth/club-auth-domain/src/main/java/com/lssst/auth/domain/convert/AuthPermissionBOConverter.java
.../lssst/auth/domain/convert/AuthPermissionBOConverter.java
+18
-0
club-auth/club-auth-domain/src/main/java/com/lssst/auth/domain/convert/AuthUserBOConverter.java
...va/com/lssst/auth/domain/convert/AuthUserBOConverter.java
+0
-3
club-auth/club-auth-domain/src/main/java/com/lssst/auth/domain/entity/AuthPermissionBO.java
...n/java/com/lssst/auth/domain/entity/AuthPermissionBO.java
+32
-0
club-auth/club-auth-domain/src/main/java/com/lssst/auth/domain/service/AuthPermissionDomainService.java
...ssst/auth/domain/service/AuthPermissionDomainService.java
+18
-0
club-auth/club-auth-domain/src/main/java/com/lssst/auth/domain/service/AuthUserDomainService.java
.../com/lssst/auth/domain/service/AuthUserDomainService.java
+0
-3
club-auth/club-auth-domain/src/main/java/com/lssst/auth/domain/service/impl/AuthPermissionDomainServiceImpl.java
.../domain/service/impl/AuthPermissionDomainServiceImpl.java
+46
-0
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/entity/AuthPermission.java
...ava/com/lssst/auth/infra/basic/entity/AuthPermission.java
+166
-0
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/entity/AuthUserRole.java
.../java/com/lssst/auth/infra/basic/entity/AuthUserRole.java
+102
-0
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/mapper/AuthPermissionDao.java
.../com/lssst/auth/infra/basic/mapper/AuthPermissionDao.java
+78
-0
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/mapper/AuthUserRoleDao.java
...va/com/lssst/auth/infra/basic/mapper/AuthUserRoleDao.java
+79
-0
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/service/AuthPermissionService.java
...lssst/auth/infra/basic/service/AuthPermissionService.java
+47
-0
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/service/AuthUserRoleService.java
...m/lssst/auth/infra/basic/service/AuthUserRoleService.java
+44
-0
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/service/impl/AuthPermissionServiceImpl.java
...h/infra/basic/service/impl/AuthPermissionServiceImpl.java
+65
-0
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/service/impl/AuthUserRoleServiceImpl.java
...uth/infra/basic/service/impl/AuthUserRoleServiceImpl.java
+67
-0
club-auth/club-auth-infra/src/main/resources/mapper/AuthPermissionDao.xml
...uth-infra/src/main/resources/mapper/AuthPermissionDao.xml
+220
-0
club-auth/club-auth-infra/src/main/resources/mapper/AuthUserRoleDao.xml
...-auth-infra/src/main/resources/mapper/AuthUserRoleDao.xml
+154
-0
未找到文件。
club-auth/club-auth-application/club-auth-application-controller/src/main/java/com/lssst/auth/application/controller/PermissionController.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.application.controller
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.base.Preconditions
;
import
com.lssst.auth.application.convert.AuthPermissionDTOConverter
;
import
com.lssst.auth.application.dto.AuthPermissionDTO
;
import
com.lssst.auth.common.entity.Result
;
import
com.lssst.auth.domain.entity.AuthPermissionBO
;
import
com.lssst.auth.domain.service.AuthPermissionDomainService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
/**
* 权限controller
*/
@RestController
@RequestMapping
(
"/permission/"
)
@Slf4j
public
class
PermissionController
{
@Resource
private
AuthPermissionDomainService
authPermissionDomainService
;
/**
* 新增权限
*/
@RequestMapping
(
"add"
)
public
Result
<
Boolean
>
add
(
@RequestBody
AuthPermissionDTO
authPermissionDTO
)
{
try
{
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"PermissionController.add.dto:{}"
,
JSON
.
toJSONString
(
authPermissionDTO
));
}
Preconditions
.
checkArgument
(!
StringUtils
.
isBlank
(
authPermissionDTO
.
getName
()),
"权限名称不能为空"
);
Preconditions
.
checkNotNull
(
authPermissionDTO
.
getParentId
(),
"权限父id不能为空"
);
AuthPermissionBO
permissionBO
=
AuthPermissionDTOConverter
.
INSTANCE
.
convertDTOToBO
(
authPermissionDTO
);
return
Result
.
ok
(
authPermissionDomainService
.
add
(
permissionBO
));
}
catch
(
Exception
e
)
{
log
.
error
(
"PermissionController.add.error:{}"
,
e
.
getMessage
(),
e
);
return
Result
.
fail
(
"新增权限失败"
);
}
}
/**
* 修改权限
*/
@RequestMapping
(
"update"
)
public
Result
<
Boolean
>
update
(
@RequestBody
AuthPermissionDTO
authPermissionDTO
)
{
try
{
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"PermissionController.update.dto:{}"
,
JSON
.
toJSONString
(
authPermissionDTO
));
}
Preconditions
.
checkNotNull
(
authPermissionDTO
.
getId
(),
"权限id不能为空"
);
AuthPermissionBO
permissionBO
=
AuthPermissionDTOConverter
.
INSTANCE
.
convertDTOToBO
(
authPermissionDTO
);
return
Result
.
ok
(
authPermissionDomainService
.
update
(
permissionBO
));
}
catch
(
Exception
e
)
{
log
.
error
(
"PermissionController.update.error:{}"
,
e
.
getMessage
(),
e
);
return
Result
.
fail
(
"更新权限信息失败"
);
}
}
/**
* 删除权限
*/
@RequestMapping
(
"delete"
)
public
Result
<
Boolean
>
delete
(
@RequestBody
AuthPermissionDTO
authPermissionDTO
)
{
try
{
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"PermissionController.delete.dto:{}"
,
JSON
.
toJSONString
(
authPermissionDTO
));
}
Preconditions
.
checkNotNull
(
authPermissionDTO
.
getId
(),
"权限id不能为空"
);
AuthPermissionBO
permissionBO
=
AuthPermissionDTOConverter
.
INSTANCE
.
convertDTOToBO
(
authPermissionDTO
);
return
Result
.
ok
(
authPermissionDomainService
.
delete
(
permissionBO
));
}
catch
(
Exception
e
)
{
log
.
error
(
"PermissionController.delete.error:{}"
,
e
.
getMessage
(),
e
);
return
Result
.
fail
(
"删除权限信息失败"
);
}
}
}
club-auth/club-auth-application/club-auth-application-controller/src/main/java/com/lssst/auth/application/controller/UserController.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.application.controller
;
import
cn.dev33.satoken.stp.SaTokenInfo
;
import
cn.dev33.satoken.stp.StpUtil
;
import
cn.dev33.satoken.util.SaResult
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.base.Preconditions
;
import
com.lssst.auth.application.convert.AuthUserDTOConverter
;
import
com.lssst.auth.application.dto.AuthUserDTO
;
import
com.lssst.auth.common.entity.Result
;
import
com.lssst.auth.domain.entity.AuthUserBO
;
import
com.lssst.auth.domain.service.AuthUserDomainService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
@RestController
@RequestMapping
(
"/user/"
)
@Slf4j
public
class
UserController
{
@Resource
private
AuthUserDomainService
authUserDomainService
;
/**
* 用户注册
*/
@RequestMapping
(
"register"
)
public
Result
<
Boolean
>
register
(
@RequestBody
AuthUserDTO
authUserDTO
)
{
try
{
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"UserController.register.dto:{}"
,
JSON
.
toJSONString
(
authUserDTO
));
}
checkUserInfo
(
authUserDTO
);
AuthUserBO
authUserBO
=
AuthUserDTOConverter
.
INSTANCE
.
convertDTOToBO
(
authUserDTO
);
return
Result
.
ok
(
authUserDomainService
.
register
(
authUserBO
));
}
catch
(
Exception
e
)
{
log
.
error
(
"UserController.register.error:{}"
,
e
.
getMessage
(),
e
);
return
Result
.
fail
(
"注册用户失败"
);
}
}
/**
* 修改用户信息
*/
@RequestMapping
(
"update"
)
public
Result
<
Boolean
>
update
(
@RequestBody
AuthUserDTO
authUserDTO
)
{
try
{
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"UserController.update.dto:{}"
,
JSON
.
toJSONString
(
authUserDTO
));
}
checkUserInfo
(
authUserDTO
);
AuthUserBO
authUserBO
=
AuthUserDTOConverter
.
INSTANCE
.
convertDTOToBO
(
authUserDTO
);
return
Result
.
ok
(
authUserDomainService
.
update
(
authUserBO
));
}
catch
(
Exception
e
)
{
log
.
error
(
"UserController.update.error:{}"
,
e
.
getMessage
(),
e
);
return
Result
.
fail
(
"更新用户信息失败"
);
}
}
/**
* 删除用户
*/
@RequestMapping
(
"delete"
)
public
Result
<
Boolean
>
delete
(
@RequestBody
AuthUserDTO
authUserDTO
)
{
try
{
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"UserController.delete.dto:{}"
,
JSON
.
toJSONString
(
authUserDTO
));
}
AuthUserBO
authUserBO
=
AuthUserDTOConverter
.
INSTANCE
.
convertDTOToBO
(
authUserDTO
);
return
Result
.
ok
(
authUserDomainService
.
update
(
authUserBO
));
}
catch
(
Exception
e
)
{
log
.
error
(
"UserController.update.error:{}"
,
e
.
getMessage
(),
e
);
return
Result
.
fail
(
"删除用户信息失败"
);
}
}
private
void
checkUserInfo
(
@RequestBody
AuthUserDTO
authUserDTO
)
{
Preconditions
.
checkArgument
(!
StringUtils
.
isBlank
(
authUserDTO
.
getUserName
()),
"用户名不能为空"
);
Preconditions
.
checkArgument
(!
StringUtils
.
isBlank
(
authUserDTO
.
getEmail
()),
"邮件地址不能为空"
);
Preconditions
.
checkArgument
(!
StringUtils
.
isBlank
(
authUserDTO
.
getPassword
()),
"密码不能为空"
);
}
/**
* 用户启用/禁用
*/
@RequestMapping
(
"changeStatus"
)
public
Result
<
Boolean
>
changeStatus
(
@RequestBody
AuthUserDTO
authUserDTO
)
{
try
{
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"UserController.changeStatus.dto:{}"
,
JSON
.
toJSONString
(
authUserDTO
));
}
Preconditions
.
checkNotNull
(
authUserDTO
.
getStatus
(),
"用户状态不能为空"
);
AuthUserBO
authUserBO
=
AuthUserDTOConverter
.
INSTANCE
.
convertDTOToBO
(
authUserDTO
);
return
Result
.
ok
(
authUserDomainService
.
update
(
authUserBO
));
}
catch
(
Exception
e
)
{
log
.
error
(
"UserController.changeStatus.error:{}"
,
e
.
getMessage
(),
e
);
return
Result
.
fail
(
"启用/禁用用户信息失败"
);
}
}
// 测试登录,浏览器访问: http://localhost:8081/user/doLogin?username=zhang&password=123456
@RequestMapping
(
"doLogin"
)
public
SaResult
doLogin
(
String
username
,
String
password
)
{
// 此处仅作模拟示例,真实项目需要从数据库中查询数据进行比对
if
(
"zhang"
.
equals
(
username
)
&&
"123456"
.
equals
(
password
))
{
StpUtil
.
login
(
10001
);
SaTokenInfo
tokenInfo
=
StpUtil
.
getTokenInfo
();
// 第3步,返回给前端
return
SaResult
.
data
(
tokenInfo
);
}
return
SaResult
.
error
(
"登录失败"
);
}
// 查询登录状态,浏览器访问: http://localhost:8081/user/isLogin
@RequestMapping
(
"isLogin"
)
public
String
isLogin
()
{
return
"当前会话是否登录:"
+
StpUtil
.
isLogin
();
}
}
club-auth/club-auth-application/club-auth-application-controller/src/main/java/com/lssst/auth/application/convert/AuthPermissionDTOConverter.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.application.convert
;
import
com.lssst.auth.application.dto.AuthPermissionDTO
;
import
com.lssst.auth.domain.entity.AuthPermissionBO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
/**
* 权限dto转换器
*/
@Mapper
public
interface
AuthPermissionDTOConverter
{
AuthPermissionDTOConverter
INSTANCE
=
Mappers
.
getMapper
(
AuthPermissionDTOConverter
.
class
);
AuthPermissionBO
convertDTOToBO
(
AuthPermissionDTO
authPermissionDTO
);
}
club-auth/club-auth-application/club-auth-application-controller/src/main/java/com/lssst/auth/application/dto/AuthPermissionDTO.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.application.dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* 权限dto
*/
@Data
public
class
AuthPermissionDTO
implements
Serializable
{
private
Long
id
;
private
String
name
;
private
Long
parentId
;
private
Integer
type
;
private
String
menuUrl
;
private
Integer
status
;
private
Integer
show
;
private
String
icon
;
private
String
permissionKey
;
}
club-auth/club-auth-domain/src/main/java/com/lssst/auth/domain/constants/AuthConstant.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.domain.constants
;
/**
* auth服务常量
*/
public
class
AuthConstant
{
public
static
final
String
NORMAL_USER
=
"normal_user"
;
}
club-auth/club-auth-domain/src/main/java/com/lssst/auth/domain/convert/AuthPermissionBOConverter.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.domain.convert
;
import
com.lssst.auth.domain.entity.AuthPermissionBO
;
import
com.lssst.auth.infra.basic.entity.AuthPermission
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
/**
* 权限bo转换器
*/
@Mapper
public
interface
AuthPermissionBOConverter
{
AuthPermissionBOConverter
INSTANCE
=
Mappers
.
getMapper
(
AuthPermissionBOConverter
.
class
);
AuthPermission
convertBOToEntity
(
AuthPermissionBO
authPermissionBO
);
}
club-auth/club-auth-domain/src/main/java/com/lssst/auth/domain/convert/AuthUserBOConverter.java
浏览文件 @
8e0bac29
...
...
@@ -7,9 +7,6 @@ import org.mapstruct.factory.Mappers;
/**
* 用户bo转换器
*
* @author: ChickenWing
* @date: 2023/10/8
*/
@Mapper
public
interface
AuthUserBOConverter
{
...
...
club-auth/club-auth-domain/src/main/java/com/lssst/auth/domain/entity/AuthPermissionBO.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.domain.entity
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* 权限dto
*/
@Data
public
class
AuthPermissionBO
implements
Serializable
{
private
Long
id
;
private
String
name
;
private
Long
parentId
;
private
Integer
type
;
private
String
menuUrl
;
private
Integer
status
;
private
Integer
show
;
private
String
icon
;
private
String
permissionKey
;
}
club-auth/club-auth-domain/src/main/java/com/lssst/auth/domain/service/AuthPermissionDomainService.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.domain.service
;
import
com.lssst.auth.domain.entity.AuthPermissionBO
;
/**
* 角色领域service
*/
public
interface
AuthPermissionDomainService
{
Boolean
add
(
AuthPermissionBO
authPermissionBO
);
Boolean
update
(
AuthPermissionBO
authPermissionBO
);
Boolean
delete
(
AuthPermissionBO
authPermissionBO
);
}
club-auth/club-auth-domain/src/main/java/com/lssst/auth/domain/service/AuthUserDomainService.java
浏览文件 @
8e0bac29
...
...
@@ -6,9 +6,6 @@ import java.util.List;
/**
* 用户领域service
*
* @author: ChickenWing
* @date: 2023/11/1
*/
public
interface
AuthUserDomainService
{
...
...
club-auth/club-auth-domain/src/main/java/com/lssst/auth/domain/service/impl/AuthPermissionDomainServiceImpl.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.domain.service.impl
;
import
com.lssst.auth.common.enums.IsDeletedFlagEnum
;
import
com.lssst.auth.domain.convert.AuthPermissionBOConverter
;
import
com.lssst.auth.domain.entity.AuthPermissionBO
;
import
com.lssst.auth.domain.service.AuthPermissionDomainService
;
import
com.lssst.auth.infra.basic.entity.AuthPermission
;
import
com.lssst.auth.infra.basic.service.AuthPermissionService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
@Service
@Slf4j
public
class
AuthPermissionDomainServiceImpl
implements
AuthPermissionDomainService
{
@Resource
private
AuthPermissionService
authPermissionService
;
@Override
public
Boolean
add
(
AuthPermissionBO
authPermissionBO
)
{
AuthPermission
authPermission
=
AuthPermissionBOConverter
.
INSTANCE
.
convertBOToEntity
(
authPermissionBO
);
authPermission
.
setIsDeleted
(
IsDeletedFlagEnum
.
UN_DELETED
.
getCode
());
Integer
count
=
authPermissionService
.
insert
(
authPermission
);
return
count
>
0
;
}
@Override
public
Boolean
update
(
AuthPermissionBO
authPermissionBO
)
{
AuthPermission
authPermission
=
AuthPermissionBOConverter
.
INSTANCE
.
convertBOToEntity
(
authPermissionBO
);
Integer
count
=
authPermissionService
.
update
(
authPermission
);
return
count
>
0
;
}
@Override
public
Boolean
delete
(
AuthPermissionBO
authPermissionBO
)
{
AuthPermission
authPermission
=
new
AuthPermission
();
authPermission
.
setId
(
authPermissionBO
.
getId
());
authPermission
.
setIsDeleted
(
IsDeletedFlagEnum
.
DELETED
.
getCode
());
Integer
count
=
authPermissionService
.
update
(
authPermission
);
return
count
>
0
;
}
}
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/entity/AuthPermission.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.infra.basic.entity
;
import
java.util.Date
;
import
java.io.Serializable
;
/**
* (AuthPermission)实体类
*
* @author makejava
* @since 2023-11-03 00:45:50
*/
public
class
AuthPermission
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
56518358607843924L
;
private
Long
id
;
private
String
name
;
private
Long
parentId
;
private
Integer
type
;
private
String
menuUrl
;
private
Integer
status
;
private
Integer
show
;
private
String
icon
;
private
String
permissionKey
;
/**
* 创建人
*/
private
String
createdBy
;
/**
* 创建时间
*/
private
Date
createdTime
;
/**
* 更新人
*/
private
String
updateBy
;
/**
* 更新时间
*/
private
Date
updateTime
;
private
Integer
isDeleted
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
Long
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
Long
parentId
)
{
this
.
parentId
=
parentId
;
}
public
Integer
getType
()
{
return
type
;
}
public
void
setType
(
Integer
type
)
{
this
.
type
=
type
;
}
public
String
getMenuUrl
()
{
return
menuUrl
;
}
public
void
setMenuUrl
(
String
menuUrl
)
{
this
.
menuUrl
=
menuUrl
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
Integer
getShow
()
{
return
show
;
}
public
void
setShow
(
Integer
show
)
{
this
.
show
=
show
;
}
public
String
getIcon
()
{
return
icon
;
}
public
void
setIcon
(
String
icon
)
{
this
.
icon
=
icon
;
}
public
String
getPermissionKey
()
{
return
permissionKey
;
}
public
void
setPermissionKey
(
String
permissionKey
)
{
this
.
permissionKey
=
permissionKey
;
}
public
String
getCreatedBy
()
{
return
createdBy
;
}
public
void
setCreatedBy
(
String
createdBy
)
{
this
.
createdBy
=
createdBy
;
}
public
Date
getCreatedTime
()
{
return
createdTime
;
}
public
void
setCreatedTime
(
Date
createdTime
)
{
this
.
createdTime
=
createdTime
;
}
public
String
getUpdateBy
()
{
return
updateBy
;
}
public
void
setUpdateBy
(
String
updateBy
)
{
this
.
updateBy
=
updateBy
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
Integer
getIsDeleted
()
{
return
isDeleted
;
}
public
void
setIsDeleted
(
Integer
isDeleted
)
{
this
.
isDeleted
=
isDeleted
;
}
}
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/entity/AuthUserRole.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.infra.basic.entity
;
import
java.util.Date
;
import
java.io.Serializable
;
/**
* (AuthUserRole)实体类
*/
public
class
AuthUserRole
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
34579360091831908L
;
private
Long
id
;
private
Long
userId
;
private
Long
roleId
;
/**
* 创建人
*/
private
String
createdBy
;
/**
* 创建时间
*/
private
Date
createdTime
;
/**
* 更新人
*/
private
String
updateBy
;
/**
* 更新时间
*/
private
Date
updateTime
;
private
Integer
isDeleted
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
Long
userId
)
{
this
.
userId
=
userId
;
}
public
Long
getRoleId
()
{
return
roleId
;
}
public
void
setRoleId
(
Long
roleId
)
{
this
.
roleId
=
roleId
;
}
public
String
getCreatedBy
()
{
return
createdBy
;
}
public
void
setCreatedBy
(
String
createdBy
)
{
this
.
createdBy
=
createdBy
;
}
public
Date
getCreatedTime
()
{
return
createdTime
;
}
public
void
setCreatedTime
(
Date
createdTime
)
{
this
.
createdTime
=
createdTime
;
}
public
String
getUpdateBy
()
{
return
updateBy
;
}
public
void
setUpdateBy
(
String
updateBy
)
{
this
.
updateBy
=
updateBy
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
Integer
getIsDeleted
()
{
return
isDeleted
;
}
public
void
setIsDeleted
(
Integer
isDeleted
)
{
this
.
isDeleted
=
isDeleted
;
}
}
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/mapper/AuthPermissionDao.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.infra.basic.mapper
;
import
com.lssst.auth.infra.basic.entity.AuthPermission
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.data.domain.Pageable
;
import
java.util.List
;
/**
* (AuthPermission)表数据库访问层
*/
public
interface
AuthPermissionDao
{
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
AuthPermission
queryById
(
Long
id
);
/**
* 查询指定行数据
*
* @param authPermission 查询条件
* @return 对象列表
*/
List
<
AuthPermission
>
queryAllByLimit
(
AuthPermission
authPermission
);
/**
* 统计总行数
*
* @param authPermission 查询条件
* @return 总行数
*/
long
count
(
AuthPermission
authPermission
);
/**
* 新增数据
*
* @param authPermission 实例对象
* @return 影响行数
*/
int
insert
(
AuthPermission
authPermission
);
/**
* 批量新增数据(MyBatis原生foreach方法)
*
* @param entities List<AuthPermission> 实例对象列表
* @return 影响行数
*/
int
insertBatch
(
@Param
(
"entities"
)
List
<
AuthPermission
>
entities
);
/**
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
*
* @param entities List<AuthPermission> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
*/
int
insertOrUpdateBatch
(
@Param
(
"entities"
)
List
<
AuthPermission
>
entities
);
/**
* 修改数据
*
* @param authPermission 实例对象
* @return 影响行数
*/
int
update
(
AuthPermission
authPermission
);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int
deleteById
(
Long
id
);
}
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/mapper/AuthUserRoleDao.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.infra.basic.mapper
;
import
com.lssst.auth.infra.basic.entity.AuthUserRole
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* (AuthUserRole)表数据库访问层
*/
public
interface
AuthUserRoleDao
{
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
AuthUserRole
queryById
(
Long
id
);
/**
* 查询指定行数据
*
* @param authUserRole 查询条件
* @return 对象列表
*/
List
<
AuthUserRole
>
queryAllByLimit
(
AuthUserRole
authUserRole
);
/**
* 统计总行数
*
* @param authUserRole 查询条件
* @return 总行数
*/
long
count
(
AuthUserRole
authUserRole
);
/**
* 新增数据
*
* @param authUserRole 实例对象
* @return 影响行数
*/
int
insert
(
AuthUserRole
authUserRole
);
/**
* 批量新增数据(MyBatis原生foreach方法)
*
* @param entities List<AuthUserRole> 实例对象列表
* @return 影响行数
*/
int
insertBatch
(
@Param
(
"entities"
)
List
<
AuthUserRole
>
entities
);
/**
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
*
* @param entities List<AuthUserRole> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
*/
int
insertOrUpdateBatch
(
@Param
(
"entities"
)
List
<
AuthUserRole
>
entities
);
/**
* 修改数据
*
* @param authUserRole 实例对象
* @return 影响行数
*/
int
update
(
AuthUserRole
authUserRole
);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int
deleteById
(
Long
id
);
}
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/service/AuthPermissionService.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.infra.basic.service
;
import
com.lssst.auth.infra.basic.entity.AuthPermission
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
/**
* (AuthPermission)表服务接口
*/
public
interface
AuthPermissionService
{
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
AuthPermission
queryById
(
Long
id
);
/**
* 新增数据
*
* @param authPermission 实例对象
* @return 实例对象
*/
int
insert
(
AuthPermission
authPermission
);
/**
* 修改数据
*
* @param authPermission 实例对象
* @return 实例对象
*/
int
update
(
AuthPermission
authPermission
);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean
deleteById
(
Long
id
);
}
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/service/AuthUserRoleService.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.infra.basic.service
;
import
com.lssst.auth.infra.basic.entity.AuthUserRole
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
/**
* (AuthUserRole)表服务接口
*/
public
interface
AuthUserRoleService
{
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
AuthUserRole
queryById
(
Long
id
);
/**
* 新增数据
*
* @param authUserRole 实例对象
* @return 实例对象
*/
AuthUserRole
insert
(
AuthUserRole
authUserRole
);
/**
* 修改数据
*
* @param authUserRole 实例对象
* @return 实例对象
*/
AuthUserRole
update
(
AuthUserRole
authUserRole
);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean
deleteById
(
Long
id
);
}
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/service/impl/AuthPermissionServiceImpl.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.infra.basic.service.impl
;
import
com.lssst.auth.infra.basic.entity.AuthPermission
;
import
com.lssst.auth.infra.basic.mapper.AuthPermissionDao
;
import
com.lssst.auth.infra.basic.service.AuthPermissionService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.PageRequest
;
import
javax.annotation.Resource
;
/**
* (AuthPermission)表服务实现类
*/
@Service
(
"authPermissionService"
)
public
class
AuthPermissionServiceImpl
implements
AuthPermissionService
{
@Resource
private
AuthPermissionDao
authPermissionDao
;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public
AuthPermission
queryById
(
Long
id
)
{
return
this
.
authPermissionDao
.
queryById
(
id
);
}
/**
* 新增数据
*
* @param authPermission 实例对象
* @return 实例对象
*/
@Override
public
int
insert
(
AuthPermission
authPermission
)
{
return
this
.
authPermissionDao
.
insert
(
authPermission
);
}
/**
* 修改数据
*
* @param authPermission 实例对象
* @return 实例对象
*/
@Override
public
int
update
(
AuthPermission
authPermission
)
{
return
this
.
authPermissionDao
.
update
(
authPermission
);
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public
boolean
deleteById
(
Long
id
)
{
return
this
.
authPermissionDao
.
deleteById
(
id
)
>
0
;
}
}
club-auth/club-auth-infra/src/main/java/com/lssst/auth/infra/basic/service/impl/AuthUserRoleServiceImpl.java
0 → 100644
浏览文件 @
8e0bac29
package
com.lssst.auth.infra.basic.service.impl
;
import
com.lssst.auth.infra.basic.entity.AuthUserRole
;
import
com.lssst.auth.infra.basic.mapper.AuthUserRoleDao
;
import
com.lssst.auth.infra.basic.service.AuthUserRoleService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.PageRequest
;
import
javax.annotation.Resource
;
/**
* (AuthUserRole)表服务实现类
*/
@Service
(
"authUserRoleService"
)
public
class
AuthUserRoleServiceImpl
implements
AuthUserRoleService
{
@Resource
private
AuthUserRoleDao
authUserRoleDao
;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public
AuthUserRole
queryById
(
Long
id
)
{
return
this
.
authUserRoleDao
.
queryById
(
id
);
}
/**
* 新增数据
*
* @param authUserRole 实例对象
* @return 实例对象
*/
@Override
public
AuthUserRole
insert
(
AuthUserRole
authUserRole
)
{
this
.
authUserRoleDao
.
insert
(
authUserRole
);
return
authUserRole
;
}
/**
* 修改数据
*
* @param authUserRole 实例对象
* @return 实例对象
*/
@Override
public
AuthUserRole
update
(
AuthUserRole
authUserRole
)
{
this
.
authUserRoleDao
.
update
(
authUserRole
);
return
this
.
queryById
(
authUserRole
.
getId
());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public
boolean
deleteById
(
Long
id
)
{
return
this
.
authUserRoleDao
.
deleteById
(
id
)
>
0
;
}
}
club-auth/club-auth-infra/src/main/resources/mapper/AuthPermissionDao.xml
0 → 100644
浏览文件 @
8e0bac29
<?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.lssst.auth.infra.basic.mapper.AuthPermissionDao"
>
<resultMap
type=
"com.lssst.auth.infra.basic.entity.AuthPermission"
id=
"AuthPermissionMap"
>
<result
property=
"id"
column=
"id"
jdbcType=
"INTEGER"
/>
<result
property=
"name"
column=
"name"
jdbcType=
"VARCHAR"
/>
<result
property=
"parentId"
column=
"parent_id"
jdbcType=
"INTEGER"
/>
<result
property=
"type"
column=
"type"
jdbcType=
"INTEGER"
/>
<result
property=
"menuUrl"
column=
"menu_url"
jdbcType=
"VARCHAR"
/>
<result
property=
"status"
column=
"status"
jdbcType=
"INTEGER"
/>
<result
property=
"show"
column=
"show"
jdbcType=
"INTEGER"
/>
<result
property=
"icon"
column=
"icon"
jdbcType=
"VARCHAR"
/>
<result
property=
"permissionKey"
column=
"permission_key"
jdbcType=
"VARCHAR"
/>
<result
property=
"createdBy"
column=
"created_by"
jdbcType=
"VARCHAR"
/>
<result
property=
"createdTime"
column=
"created_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"updateBy"
column=
"update_by"
jdbcType=
"VARCHAR"
/>
<result
property=
"updateTime"
column=
"update_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"isDeleted"
column=
"is_deleted"
jdbcType=
"INTEGER"
/>
</resultMap>
<!--查询单个-->
<select
id=
"queryById"
resultMap=
"AuthPermissionMap"
>
select
id, name, parent_id, type, menu_url, status, show, icon, permission_key, created_by, created_time, update_by, update_time, is_deleted
from auth_permission
where id = #{id}
</select>
<!--查询指定行数据-->
<select
id=
"queryAllByLimit"
resultMap=
"AuthPermissionMap"
>
select
id, name, parent_id, type, menu_url, status, show, icon, permission_key, created_by, created_time, update_by, update_time, is_deleted
from auth_permission
<where>
<if
test=
"id != null"
>
and id = #{id}
</if>
<if
test=
"name != null and name != ''"
>
and name = #{name}
</if>
<if
test=
"parentId != null"
>
and parent_id = #{parentId}
</if>
<if
test=
"type != null"
>
and type = #{type}
</if>
<if
test=
"menuUrl != null and menuUrl != ''"
>
and menu_url = #{menuUrl}
</if>
<if
test=
"status != null"
>
and status = #{status}
</if>
<if
test=
"show != null"
>
and show = #{show}
</if>
<if
test=
"icon != null and icon != ''"
>
and icon = #{icon}
</if>
<if
test=
"permissionKey != null and permissionKey != ''"
>
and permission_key = #{permissionKey}
</if>
<if
test=
"createdBy != null and createdBy != ''"
>
and created_by = #{createdBy}
</if>
<if
test=
"createdTime != null"
>
and created_time = #{createdTime}
</if>
<if
test=
"updateBy != null and updateBy != ''"
>
and update_by = #{updateBy}
</if>
<if
test=
"updateTime != null"
>
and update_time = #{updateTime}
</if>
<if
test=
"isDeleted != null"
>
and is_deleted = #{isDeleted}
</if>
</where>
</select>
<!--统计总行数-->
<select
id=
"count"
resultType=
"java.lang.Long"
>
select count(1)
from auth_permission
<where>
<if
test=
"id != null"
>
and id = #{id}
</if>
<if
test=
"name != null and name != ''"
>
and name = #{name}
</if>
<if
test=
"parentId != null"
>
and parent_id = #{parentId}
</if>
<if
test=
"type != null"
>
and type = #{type}
</if>
<if
test=
"menuUrl != null and menuUrl != ''"
>
and menu_url = #{menuUrl}
</if>
<if
test=
"status != null"
>
and status = #{status}
</if>
<if
test=
"show != null"
>
and show = #{show}
</if>
<if
test=
"icon != null and icon != ''"
>
and icon = #{icon}
</if>
<if
test=
"permissionKey != null and permissionKey != ''"
>
and permission_key = #{permissionKey}
</if>
<if
test=
"createdBy != null and createdBy != ''"
>
and created_by = #{createdBy}
</if>
<if
test=
"createdTime != null"
>
and created_time = #{createdTime}
</if>
<if
test=
"updateBy != null and updateBy != ''"
>
and update_by = #{updateBy}
</if>
<if
test=
"updateTime != null"
>
and update_time = #{updateTime}
</if>
<if
test=
"isDeleted != null"
>
and is_deleted = #{isDeleted}
</if>
</where>
</select>
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into auth_permission(name, parent_id, `type`, menu_url, status, `show`, icon, permission_key, created_by, created_time, update_by, update_time, is_deleted)
values (#{name}, #{parentId}, #{type}, #{menuUrl}, #{status}, #{show}, #{icon}, #{permissionKey}, #{createdBy}, #{createdTime}, #{updateBy}, #{updateTime}, #{isDeleted})
</insert>
<insert
id=
"insertBatch"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into auth_permission(name, parent_id, `type`, menu_url, status, `show`, icon, permission_key, created_by, created_time, update_by, update_time, is_deleted)
values
<foreach
collection=
"entities"
item=
"entity"
separator=
","
>
(#{entity.name}, #{entity.parentId}, #{entity.type}, #{entity.menuUrl}, #{entity.status}, #{entity.show}, #{entity.icon}, #{entity.permissionKey}, #{entity.createdBy}, #{entity.createdTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.isDeleted})
</foreach>
</insert>
<insert
id=
"insertOrUpdateBatch"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into auth_permission(name, parent_id, `type`, menu_url, status, `show`, icon, permission_key, created_by, created_time, update_by, update_time, is_deleted)
values
<foreach
collection=
"entities"
item=
"entity"
separator=
","
>
(#{entity.name}, #{entity.parentId}, #{entity.type}, #{entity.menuUrl}, #{entity.status}, #{entity.show}, #{entity.icon}, #{entity.permissionKey}, #{entity.createdBy}, #{entity.createdTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.isDeleted})
</foreach>
on duplicate key update
name = values(name),
parent_id = values(parent_id),
`type` = values(type),
menu_url = values(menu_url),
status = values(status),
`show` = values(show),
icon = values(icon),
permission_key = values(permission_key),
created_by = values(created_by),
created_time = values(created_time),
update_by = values(update_by),
update_time = values(update_time),
is_deleted = values(is_deleted)
</insert>
<!--通过主键修改数据-->
<update
id=
"update"
>
update auth_permission
<set>
<if
test=
"name != null and name != ''"
>
name = #{name},
</if>
<if
test=
"parentId != null"
>
parent_id = #{parentId},
</if>
<if
test=
"type != null"
>
`type` = #{type},
</if>
<if
test=
"menuUrl != null and menuUrl != ''"
>
menu_url = #{menuUrl},
</if>
<if
test=
"status != null"
>
status = #{status},
</if>
<if
test=
"show != null"
>
`show` = #{show},
</if>
<if
test=
"icon != null and icon != ''"
>
icon = #{icon},
</if>
<if
test=
"permissionKey != null and permissionKey != ''"
>
permission_key = #{permissionKey},
</if>
<if
test=
"createdBy != null and createdBy != ''"
>
created_by = #{createdBy},
</if>
<if
test=
"createdTime != null"
>
created_time = #{createdTime},
</if>
<if
test=
"updateBy != null and updateBy != ''"
>
update_by = #{updateBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"isDeleted != null"
>
is_deleted = #{isDeleted},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete
id=
"deleteById"
>
delete from auth_permission where id = #{id}
</delete>
</mapper>
club-auth/club-auth-infra/src/main/resources/mapper/AuthUserRoleDao.xml
0 → 100644
浏览文件 @
8e0bac29
<?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.lssst.auth.infra.basic.mapper.AuthUserRoleDao"
>
<resultMap
type=
"com.lssst.auth.infra.basic.entity.AuthUserRole"
id=
"AuthUserRoleMap"
>
<result
property=
"id"
column=
"id"
jdbcType=
"INTEGER"
/>
<result
property=
"userId"
column=
"user_id"
jdbcType=
"INTEGER"
/>
<result
property=
"roleId"
column=
"role_id"
jdbcType=
"INTEGER"
/>
<result
property=
"createdBy"
column=
"created_by"
jdbcType=
"VARCHAR"
/>
<result
property=
"createdTime"
column=
"created_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"updateBy"
column=
"update_by"
jdbcType=
"VARCHAR"
/>
<result
property=
"updateTime"
column=
"update_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"isDeleted"
column=
"is_deleted"
jdbcType=
"INTEGER"
/>
</resultMap>
<!--查询单个-->
<select
id=
"queryById"
resultMap=
"AuthUserRoleMap"
>
select
id, user_id, role_id, created_by, created_time, update_by, update_time, is_deleted
from auth_user_role
where id = #{id}
</select>
<!--查询指定行数据-->
<select
id=
"queryAllByLimit"
resultMap=
"AuthUserRoleMap"
>
select
id, user_id, role_id, created_by, created_time, update_by, update_time, is_deleted
from auth_user_role
<where>
<if
test=
"id != null"
>
and id = #{id}
</if>
<if
test=
"userId != null"
>
and user_id = #{userId}
</if>
<if
test=
"roleId != null"
>
and role_id = #{roleId}
</if>
<if
test=
"createdBy != null and createdBy != ''"
>
and created_by = #{createdBy}
</if>
<if
test=
"createdTime != null"
>
and created_time = #{createdTime}
</if>
<if
test=
"updateBy != null and updateBy != ''"
>
and update_by = #{updateBy}
</if>
<if
test=
"updateTime != null"
>
and update_time = #{updateTime}
</if>
<if
test=
"isDeleted != null"
>
and is_deleted = #{isDeleted}
</if>
</where>
</select>
<!--统计总行数-->
<select
id=
"count"
resultType=
"java.lang.Long"
>
select count(1)
from auth_user_role
<where>
<if
test=
"id != null"
>
and id = #{id}
</if>
<if
test=
"userId != null"
>
and user_id = #{userId}
</if>
<if
test=
"roleId != null"
>
and role_id = #{roleId}
</if>
<if
test=
"createdBy != null and createdBy != ''"
>
and created_by = #{createdBy}
</if>
<if
test=
"createdTime != null"
>
and created_time = #{createdTime}
</if>
<if
test=
"updateBy != null and updateBy != ''"
>
and update_by = #{updateBy}
</if>
<if
test=
"updateTime != null"
>
and update_time = #{updateTime}
</if>
<if
test=
"isDeleted != null"
>
and is_deleted = #{isDeleted}
</if>
</where>
</select>
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into auth_user_role(user_id, role_id, created_by, created_time, update_by, update_time, is_deleted)
values (#{userId}, #{roleId}, #{createdBy}, #{createdTime}, #{updateBy}, #{updateTime}, #{isDeleted})
</insert>
<insert
id=
"insertBatch"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into auth_user_role(user_id, role_id, created_by, created_time, update_by, update_time, is_deleted)
values
<foreach
collection=
"entities"
item=
"entity"
separator=
","
>
(#{entity.userId}, #{entity.roleId}, #{entity.createdBy}, #{entity.createdTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.isDeleted})
</foreach>
</insert>
<insert
id=
"insertOrUpdateBatch"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into auth_user_role(user_id, role_id, created_by, created_time, update_by, update_time, is_deleted)
values
<foreach
collection=
"entities"
item=
"entity"
separator=
","
>
(#{entity.userId}, #{entity.roleId}, #{entity.createdBy}, #{entity.createdTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.isDeleted})
</foreach>
on duplicate key update
user_id = values(user_id),
role_id = values(role_id),
created_by = values(created_by),
created_time = values(created_time),
update_by = values(update_by),
update_time = values(update_time),
is_deleted = values(is_deleted)
</insert>
<!--通过主键修改数据-->
<update
id=
"update"
>
update auth_user_role
<set>
<if
test=
"userId != null"
>
user_id = #{userId},
</if>
<if
test=
"roleId != null"
>
role_id = #{roleId},
</if>
<if
test=
"createdBy != null and createdBy != ''"
>
created_by = #{createdBy},
</if>
<if
test=
"createdTime != null"
>
created_time = #{createdTime},
</if>
<if
test=
"updateBy != null and updateBy != ''"
>
update_by = #{updateBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"isDeleted != null"
>
is_deleted = #{isDeleted},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete
id=
"deleteById"
>
delete from auth_user_role where id = #{id}
</delete>
</mapper>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录