Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
b3b3b815
提交
b3b3b815
authored
3月 02, 2019
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加管理员分配角色
上级
36f62b24
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
137 行增加
和
3 行删除
+137
-3
AdminController.java
...er/mall/admin/application/controller/AdminController.java
+25
-0
RoleConvert.java
...n/iocoder/mall/admin/application/convert/RoleConvert.java
+5
-0
AdminService.java
...src/main/java/cn/iocoder/mall/admin/api/AdminService.java
+5
-0
RoleService.java
.../src/main/java/cn/iocoder/mall/admin/api/RoleService.java
+3
-0
AdminRoleMapper.java
.../main/java/cn/iocoder/mall/admin/dao/AdminRoleMapper.java
+3
-0
RoleMapper.java
...l/src/main/java/cn/iocoder/mall/admin/dao/RoleMapper.java
+4
-0
AdminServiceImpl.java
.../java/cn/iocoder/mall/admin/service/AdminServiceImpl.java
+38
-1
RoleServiceImpl.java
...n/java/cn/iocoder/mall/admin/service/RoleServiceImpl.java
+15
-0
AdminRoleMapper.xml
...ervice-impl/src/main/resources/mapper/AdminRoleMapper.xml
+10
-0
RoleMapper.xml
...min-service-impl/src/main/resources/mapper/RoleMapper.xml
+18
-2
CollectionUtil.java
...java/cn/iocoder/common/framework/util/CollectionUtil.java
+11
-0
没有找到文件。
admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/controller/AdminController.java
浏览文件 @
b3b3b815
...
@@ -3,6 +3,7 @@ package cn.iocoder.mall.admin.application.controller;
...
@@ -3,6 +3,7 @@ package cn.iocoder.mall.admin.application.controller;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.admin.api.AdminService
;
import
cn.iocoder.mall.admin.api.AdminService
;
import
cn.iocoder.mall.admin.api.ResourceService
;
import
cn.iocoder.mall.admin.api.ResourceService
;
import
cn.iocoder.mall.admin.api.RoleService
;
import
cn.iocoder.mall.admin.api.bo.AdminPageBO
;
import
cn.iocoder.mall.admin.api.bo.AdminPageBO
;
import
cn.iocoder.mall.admin.api.bo.ResourceBO
;
import
cn.iocoder.mall.admin.api.bo.ResourceBO
;
import
cn.iocoder.mall.admin.api.constant.ResourceConstants
;
import
cn.iocoder.mall.admin.api.constant.ResourceConstants
;
...
@@ -14,6 +15,7 @@ import cn.iocoder.mall.admin.application.convert.ResourceConvert;
...
@@ -14,6 +15,7 @@ import cn.iocoder.mall.admin.application.convert.ResourceConvert;
import
cn.iocoder.mall.admin.application.vo.AdminMenuTreeNodeVO
;
import
cn.iocoder.mall.admin.application.vo.AdminMenuTreeNodeVO
;
import
cn.iocoder.mall.admin.application.vo.AdminPageVO
;
import
cn.iocoder.mall.admin.application.vo.AdminPageVO
;
import
cn.iocoder.mall.admin.application.vo.AdminVO
;
import
cn.iocoder.mall.admin.application.vo.AdminVO
;
import
cn.iocoder.mall.admin.application.vo.RoleVO
;
import
cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder
;
import
cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder
;
import
com.alibaba.dubbo.config.annotation.Reference
;
import
com.alibaba.dubbo.config.annotation.Reference
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -34,6 +36,8 @@ public class AdminController {
...
@@ -34,6 +36,8 @@ public class AdminController {
private
ResourceService
resourceService
;
private
ResourceService
resourceService
;
@Reference
(
validation
=
"true"
)
@Reference
(
validation
=
"true"
)
private
AdminService
adminService
;
private
AdminService
adminService
;
@Reference
(
validation
=
"true"
)
private
RoleService
roleService
;
// =========== 当前管理员相关的资源 API ===========
// =========== 当前管理员相关的资源 API ===========
...
@@ -136,4 +140,24 @@ public class AdminController {
...
@@ -136,4 +140,24 @@ public class AdminController {
return
adminService
.
deleteAdmin
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
id
);
return
adminService
.
deleteAdmin
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
id
);
}
}
@GetMapping
(
"/role_list"
)
@ApiOperation
(
value
=
"指定管理员拥有的角色列表"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"管理员编号"
,
required
=
true
,
example
=
"1"
)
public
CommonResult
<
List
<
RoleVO
>>
roleList
(
@RequestParam
(
"id"
)
Integer
id
)
{
// return RoleConvert.INSTANCE.convert()
// TODO 需要讨论下 api 提供的方式
return
null
;
}
@PostMapping
(
"/assign_role"
)
@ApiOperation
(
value
=
"分配给管理员角色"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"管理员编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"roleIds"
,
value
=
"角色编号集合"
,
required
=
true
,
example
=
"1,2,3"
),
})
public
CommonResult
<
Boolean
>
assignRole
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"roleIds"
)
Set
<
Integer
>
roleIds
)
{
return
adminService
.
assignRole
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
id
,
roleIds
);
}
}
}
\ No newline at end of file
admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/convert/RoleConvert.java
浏览文件 @
b3b3b815
...
@@ -9,6 +9,8 @@ import org.mapstruct.Mapper;
...
@@ -9,6 +9,8 @@ import org.mapstruct.Mapper;
import
org.mapstruct.Mappings
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
@Mapper
@Mapper
public
interface
RoleConvert
{
public
interface
RoleConvert
{
...
@@ -17,6 +19,9 @@ public interface RoleConvert {
...
@@ -17,6 +19,9 @@ public interface RoleConvert {
@Mappings
({})
@Mappings
({})
RoleVO
convert
(
RoleBO
roleBO
);
RoleVO
convert
(
RoleBO
roleBO
);
@Mappings
({})
List
<
RoleVO
>
convert
(
List
<
RoleBO
>
roleBO
);
@Mappings
({})
@Mappings
({})
CommonResult
<
RoleVO
>
convert
(
CommonResult
<
RoleBO
>
resourceBO
);
CommonResult
<
RoleVO
>
convert
(
CommonResult
<
RoleBO
>
resourceBO
);
...
...
admin/admin-service-api/src/main/java/cn/iocoder/mall/admin/api/AdminService.java
浏览文件 @
b3b3b815
...
@@ -7,6 +7,8 @@ import cn.iocoder.mall.admin.api.dto.AdminAddDTO;
...
@@ -7,6 +7,8 @@ import cn.iocoder.mall.admin.api.dto.AdminAddDTO;
import
cn.iocoder.mall.admin.api.dto.AdminPageDTO
;
import
cn.iocoder.mall.admin.api.dto.AdminPageDTO
;
import
cn.iocoder.mall.admin.api.dto.AdminUpdateDTO
;
import
cn.iocoder.mall.admin.api.dto.AdminUpdateDTO
;
import
java.util.Set
;
public
interface
AdminService
{
public
interface
AdminService
{
CommonResult
<
AdminPageBO
>
getAdminPage
(
AdminPageDTO
adminPageDTO
);
CommonResult
<
AdminPageBO
>
getAdminPage
(
AdminPageDTO
adminPageDTO
);
...
@@ -19,4 +21,6 @@ public interface AdminService {
...
@@ -19,4 +21,6 @@ public interface AdminService {
CommonResult
<
Boolean
>
deleteAdmin
(
Integer
adminId
,
Integer
updateAdminId
);
CommonResult
<
Boolean
>
deleteAdmin
(
Integer
adminId
,
Integer
updateAdminId
);
CommonResult
<
Boolean
>
assignRole
(
Integer
adminId
,
Integer
updateAdminId
,
Set
<
Integer
>
roleIds
);
}
}
\ No newline at end of file
admin/admin-service-api/src/main/java/cn/iocoder/mall/admin/api/RoleService.java
浏览文件 @
b3b3b815
...
@@ -7,12 +7,15 @@ import cn.iocoder.mall.admin.api.dto.RoleAddDTO;
...
@@ -7,12 +7,15 @@ import cn.iocoder.mall.admin.api.dto.RoleAddDTO;
import
cn.iocoder.mall.admin.api.dto.RolePageDTO
;
import
cn.iocoder.mall.admin.api.dto.RolePageDTO
;
import
cn.iocoder.mall.admin.api.dto.RoleUpdateDTO
;
import
cn.iocoder.mall.admin.api.dto.RoleUpdateDTO
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
public
interface
RoleService
{
public
interface
RoleService
{
CommonResult
<
RolePageBO
>
getRolePage
(
RolePageDTO
rolePageDTO
);
CommonResult
<
RolePageBO
>
getRolePage
(
RolePageDTO
rolePageDTO
);
CommonResult
<
List
<
RoleBO
>>
getRoleList
(
Integer
adminId
);
CommonResult
<
RoleBO
>
addRole
(
Integer
adminId
,
RoleAddDTO
roleAddDTO
);
CommonResult
<
RoleBO
>
addRole
(
Integer
adminId
,
RoleAddDTO
roleAddDTO
);
CommonResult
<
Boolean
>
updateRole
(
Integer
adminId
,
RoleUpdateDTO
roleUpdateDTO
);
CommonResult
<
Boolean
>
updateRole
(
Integer
adminId
,
RoleUpdateDTO
roleUpdateDTO
);
...
...
admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dao/AdminRoleMapper.java
浏览文件 @
b3b3b815
...
@@ -15,4 +15,6 @@ public interface AdminRoleMapper {
...
@@ -15,4 +15,6 @@ public interface AdminRoleMapper {
int
updateToDeletedByRoleId
(
@Param
(
"roleId"
)
Integer
roleId
);
int
updateToDeletedByRoleId
(
@Param
(
"roleId"
)
Integer
roleId
);
void
insertList
(
@Param
(
"adminRoleDOs"
)
List
<
AdminRoleDO
>
adminRoleDOs
);
}
}
\ No newline at end of file
admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/dao/RoleMapper.java
浏览文件 @
b3b3b815
...
@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Param;
...
@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Param;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
@Repository
@Repository
public
interface
RoleMapper
{
public
interface
RoleMapper
{
...
@@ -21,4 +22,6 @@ public interface RoleMapper {
...
@@ -21,4 +22,6 @@ public interface RoleMapper {
Integer
selectCountByNameLike
(
@Param
(
"name"
)
String
name
);
Integer
selectCountByNameLike
(
@Param
(
"name"
)
String
name
);
List
<
RoleDO
>
selectListByIds
(
@Param
(
"ids"
)
Set
<
Integer
>
ids
);
}
}
\ No newline at end of file
admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/AdminServiceImpl.java
浏览文件 @
b3b3b815
...
@@ -16,6 +16,7 @@ import cn.iocoder.mall.admin.dao.AdminMapper;
...
@@ -16,6 +16,7 @@ import cn.iocoder.mall.admin.dao.AdminMapper;
import
cn.iocoder.mall.admin.dao.AdminRoleMapper
;
import
cn.iocoder.mall.admin.dao.AdminRoleMapper
;
import
cn.iocoder.mall.admin.dataobject.AdminDO
;
import
cn.iocoder.mall.admin.dataobject.AdminDO
;
import
cn.iocoder.mall.admin.dataobject.AdminRoleDO
;
import
cn.iocoder.mall.admin.dataobject.AdminRoleDO
;
import
cn.iocoder.mall.admin.dataobject.RoleDO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -23,6 +24,8 @@ import org.springframework.util.DigestUtils;
...
@@ -23,6 +24,8 @@ import org.springframework.util.DigestUtils;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
@Service
@Service
@com
.
alibaba
.
dubbo
.
config
.
annotation
.
Service
@com
.
alibaba
.
dubbo
.
config
.
annotation
.
Service
...
@@ -32,8 +35,11 @@ public class AdminServiceImpl implements AdminService {
...
@@ -32,8 +35,11 @@ public class AdminServiceImpl implements AdminService {
private
AdminMapper
adminMapper
;
private
AdminMapper
adminMapper
;
@Autowired
@Autowired
private
AdminRoleMapper
adminRoleMapper
;
private
AdminRoleMapper
adminRoleMapper
;
@Autowired
@Autowired
private
OAuth2ServiceImpl
oAuth2Service
;
private
OAuth2ServiceImpl
oAuth2Service
;
@Autowired
private
RoleServiceImpl
roleService
;
public
CommonResult
<
AdminDO
>
validAdmin
(
String
username
,
String
password
)
{
public
CommonResult
<
AdminDO
>
validAdmin
(
String
username
,
String
password
)
{
AdminDO
admin
=
adminMapper
.
selectByUsername
(
username
);
AdminDO
admin
=
adminMapper
.
selectByUsername
(
username
);
...
@@ -143,10 +149,11 @@ public class AdminServiceImpl implements AdminService {
...
@@ -143,10 +149,11 @@ public class AdminServiceImpl implements AdminService {
if
(
admin
==
null
)
{
if
(
admin
==
null
)
{
return
ServiceExceptionUtil
.
error
(
AdminErrorCodeEnum
.
ADMIN_USERNAME_NOT_REGISTERED
.
getCode
());
return
ServiceExceptionUtil
.
error
(
AdminErrorCodeEnum
.
ADMIN_USERNAME_NOT_REGISTERED
.
getCode
());
}
}
// 只有禁用的账号才可以删除
if
(
AdminDO
.
STATUS_ENABLE
.
equals
(
admin
.
getStatus
()))
{
if
(
AdminDO
.
STATUS_ENABLE
.
equals
(
admin
.
getStatus
()))
{
return
ServiceExceptionUtil
.
error
(
AdminErrorCodeEnum
.
ADMIN_DELETE_ONLY_DISABLE
.
getCode
());
return
ServiceExceptionUtil
.
error
(
AdminErrorCodeEnum
.
ADMIN_DELETE_ONLY_DISABLE
.
getCode
());
}
}
//
只有禁用的账号才可以删除
//
标记删除 AdminDO
AdminDO
updateAdmin
=
new
AdminDO
().
setId
(
updateAdminId
);
AdminDO
updateAdmin
=
new
AdminDO
().
setId
(
updateAdminId
);
updateAdmin
.
setDeleted
(
BaseDO
.
DELETED_YES
);
updateAdmin
.
setDeleted
(
BaseDO
.
DELETED_YES
);
adminMapper
.
update
(
updateAdmin
);
adminMapper
.
update
(
updateAdmin
);
...
@@ -157,6 +164,36 @@ public class AdminServiceImpl implements AdminService {
...
@@ -157,6 +164,36 @@ public class AdminServiceImpl implements AdminService {
return
CommonResult
.
success
(
true
);
return
CommonResult
.
success
(
true
);
}
}
@Override
@Transactional
public
CommonResult
<
Boolean
>
assignRole
(
Integer
adminId
,
Integer
updateAdminId
,
Set
<
Integer
>
roleIds
)
{
// 校验账号存在
AdminDO
admin
=
adminMapper
.
selectById
(
updateAdminId
);
if
(
admin
==
null
)
{
return
ServiceExceptionUtil
.
error
(
AdminErrorCodeEnum
.
ADMIN_USERNAME_NOT_REGISTERED
.
getCode
());
}
// 校验是否有不存在的角色
List
<
RoleDO
>
roles
=
roleService
.
getRoles
(
roleIds
);
if
(
roles
.
size
()
!=
roleIds
.
size
())
{
return
ServiceExceptionUtil
.
error
(
AdminErrorCodeEnum
.
ROLE_ASSIGN_RESOURCE_NOT_EXISTS
.
getCode
());
}
// TODO 芋艿,这里先简单实现。即方式是,删除老的分配的角色关系,然后添加新的分配的角色关系
// 标记管理员角色源关系都为删除
adminRoleMapper
.
updateToDeletedByRoleId
(
updateAdminId
);
// 创建 RoleResourceDO 数组,并插入到数据库
if
(!
roleIds
.
isEmpty
())
{
List
<
AdminRoleDO
>
adminRoleDOs
=
roleIds
.
stream
().
map
(
roleId
->
{
AdminRoleDO
roleResource
=
new
AdminRoleDO
().
setAdminId
(
updateAdminId
).
setRoleId
(
roleId
);
roleResource
.
setCreateTime
(
new
Date
()).
setDeleted
(
BaseDO
.
DELETED_NO
);
return
roleResource
;
}).
collect
(
Collectors
.
toList
());
adminRoleMapper
.
insertList
(
adminRoleDOs
);
}
// TODO 插入操作日志
// 返回成功
return
CommonResult
.
success
(
true
);
}
private
String
encodePassword
(
String
password
)
{
private
String
encodePassword
(
String
password
)
{
return
DigestUtils
.
md5DigestAsHex
(
password
.
getBytes
());
return
DigestUtils
.
md5DigestAsHex
(
password
.
getBytes
());
}
}
...
...
admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/RoleServiceImpl.java
浏览文件 @
b3b3b815
package
cn
.
iocoder
.
mall
.
admin
.
service
;
package
cn
.
iocoder
.
mall
.
admin
.
service
;
import
cn.iocoder.common.framework.dataobject.BaseDO
;
import
cn.iocoder.common.framework.dataobject.BaseDO
;
import
cn.iocoder.common.framework.util.CollectionUtil
;
import
cn.iocoder.common.framework.util.ServiceExceptionUtil
;
import
cn.iocoder.common.framework.util.ServiceExceptionUtil
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.admin.api.RoleService
;
import
cn.iocoder.mall.admin.api.RoleService
;
...
@@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -60,6 +62,11 @@ public class RoleServiceImpl implements RoleService {
...
@@ -60,6 +62,11 @@ public class RoleServiceImpl implements RoleService {
return
CommonResult
.
success
(
rolePage
);
return
CommonResult
.
success
(
rolePage
);
}
}
@Override
public
CommonResult
<
List
<
RoleBO
>>
getRoleList
(
Integer
adminId
)
{
return
null
;
}
@Override
@Override
public
CommonResult
<
RoleBO
>
addRole
(
Integer
adminId
,
RoleAddDTO
roleAddDTO
)
{
public
CommonResult
<
RoleBO
>
addRole
(
Integer
adminId
,
RoleAddDTO
roleAddDTO
)
{
// TODO 芋艿,角色名是否要唯一呢?貌似一般系统都是允许的。
// TODO 芋艿,角色名是否要唯一呢?貌似一般系统都是允许的。
...
@@ -136,4 +143,11 @@ public class RoleServiceImpl implements RoleService {
...
@@ -136,4 +143,11 @@ public class RoleServiceImpl implements RoleService {
return
CommonResult
.
success
(
true
);
return
CommonResult
.
success
(
true
);
}
}
public
List
<
RoleDO
>
getRoles
(
Set
<
Integer
>
roleIds
)
{
if
(
CollectionUtil
.
isEmpty
(
roleIds
))
{
return
Collections
.
emptyList
();
}
return
roleMapper
.
selectListByIds
(
roleIds
);
}
}
}
\ No newline at end of file
admin/admin-service-impl/src/main/resources/mapper/AdminRoleMapper.xml
浏览文件 @
b3b3b815
...
@@ -32,4 +32,13 @@
...
@@ -32,4 +32,13 @@
AND deleted = 0
AND deleted = 0
</update>
</update>
<insert
id=
"insertList"
>
INSERT INTO admin_role (
admin_id, role_id, create_time, deleted
) VALUES
<foreach
collection=
"adminRoleDOs"
item=
"adminRole"
separator=
","
>
(#{adminRole.adminId}, #{adminRole.roleId}, #{adminRole.createTime}, #{adminRole.deleted})
</foreach>
</insert>
</mapper>
</mapper>
\ No newline at end of file
admin/admin-service-impl/src/main/resources/mapper/RoleMapper.xml
浏览文件 @
b3b3b815
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.iocoder.mall.admin.dao.RoleMapper"
>
<mapper
namespace=
"cn.iocoder.mall.admin.dao.RoleMapper"
>
<sql
id=
"FIELDS"
>
id, name, create_time
</sql>
<insert
id=
"insert"
parameterType=
"RoleDO"
useGeneratedKeys=
"true"
keyColumn=
"id"
keyProperty=
"id"
>
<insert
id=
"insert"
parameterType=
"RoleDO"
useGeneratedKeys=
"true"
keyColumn=
"id"
keyProperty=
"id"
>
INSERT INTO role (
INSERT INTO role (
name, create_time, deleted
name, create_time, deleted
...
@@ -25,7 +29,7 @@
...
@@ -25,7 +29,7 @@
<select
id=
"selectById"
parameterType=
"Integer"
resultType=
"RoleDO"
>
<select
id=
"selectById"
parameterType=
"Integer"
resultType=
"RoleDO"
>
SELECT
SELECT
id, name, create_time
<include
refid=
"FIELDS"
/>
FROM role
FROM role
WHERE id = #{id}
WHERE id = #{id}
AND deleted = 0
AND deleted = 0
...
@@ -33,7 +37,7 @@
...
@@ -33,7 +37,7 @@
<select
id=
"selectListByNameLike"
resultType=
"RoleDO"
>
<select
id=
"selectListByNameLike"
resultType=
"RoleDO"
>
SELECT
SELECT
id, name, create_time
<include
refid=
"FIELDS"
/>
FROM role
FROM role
<where>
<where>
<if
test=
"name != null"
>
<if
test=
"name != null"
>
...
@@ -56,4 +60,15 @@
...
@@ -56,4 +60,15 @@
</where>
</where>
</select>
</select>
<select
id=
"selectListByIds"
resultType=
"RoleDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM resource
WHERE id IN
<foreach
item=
"id"
collection=
"ids"
separator=
","
open=
"("
close=
")"
index=
""
>
#{id}
</foreach>
AND deleted = 0
</select>
</mapper>
</mapper>
\ No newline at end of file
common/common-framework/src/main/java/cn/iocoder/common/framework/util/CollectionUtil.java
0 → 100644
浏览文件 @
b3b3b815
package
cn
.
iocoder
.
common
.
framework
.
util
;
import
java.util.Collection
;
public
class
CollectionUtil
{
public
static
boolean
isEmpty
(
Collection
collection
)
{
return
collection
==
null
||
collection
.
isEmpty
();
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论