准备开始迁移管理员相关模块
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package cn.iocoder.mall.systemservice.enums.admin;
|
||||
|
||||
import cn.iocoder.common.framework.core.IntArrayValuable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 管理员的状态枚举
|
||||
*/
|
||||
public enum AdminStatusEnum implements IntArrayValuable {
|
||||
|
||||
ACTIVE(1, "在职"),
|
||||
INACTIVE(2, "离职");
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(AdminStatusEnum::getStatus).toArray();
|
||||
|
||||
/**
|
||||
* 在职状态
|
||||
*/
|
||||
private final Integer status;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
AdminStatusEnum(Integer status, String name) {
|
||||
this.status = status;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.iocoder.mall.systemservice.enums.permission;
|
||||
|
||||
/**
|
||||
* Resource 编号枚举
|
||||
*/
|
||||
public enum ResourceIdEnum {
|
||||
|
||||
/**
|
||||
* 根节点
|
||||
*/
|
||||
ROOT(0);
|
||||
|
||||
private final Integer id;
|
||||
|
||||
ResourceIdEnum(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package cn.iocoder.mall.systemservice.enums.permission;
|
||||
|
||||
import cn.iocoder.common.framework.core.IntArrayValuable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Resource 类型枚举
|
||||
*/
|
||||
public enum ResourceTypeEnum implements IntArrayValuable {
|
||||
|
||||
MENU(1, "菜单"),
|
||||
BUTTON(2, "按钮");
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ResourceTypeEnum::getType).toArray();
|
||||
|
||||
/**
|
||||
* 资源类型
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 资源类型名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
ResourceTypeEnum(Integer type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.mall.systemservice.enums.permission;
|
||||
|
||||
public enum RoleCodeEnum {
|
||||
|
||||
SUPER_ADMIN("SUPER_ADMIN"), // 超级管理员
|
||||
;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
private final String code;
|
||||
|
||||
RoleCodeEnum(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.mall.systemservice.enums.permission;
|
||||
|
||||
public enum RoleTypeEnum {
|
||||
|
||||
/**
|
||||
* 内置角色
|
||||
*/
|
||||
SYSTEM(1),
|
||||
/**
|
||||
* 自定义角色
|
||||
*/
|
||||
CUSTOM(2);
|
||||
|
||||
private final Integer type;
|
||||
|
||||
RoleTypeEnum(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.systemservice.enums.admin.AdminStatusEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 管理员实体
|
||||
*/
|
||||
@TableName(value = "admin")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class AdminDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 管理员编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 真实名字
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 部门编号
|
||||
*
|
||||
* 关联 {@link DepartmentDO#getId()}
|
||||
*/
|
||||
private Integer departmentId;
|
||||
/**
|
||||
* 在职状态
|
||||
*
|
||||
* 枚举 {@link AdminStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 登陆账号
|
||||
*/
|
||||
private String username;
|
||||
/**
|
||||
* 经过加密的密码串
|
||||
*/
|
||||
private String password;
|
||||
/**
|
||||
* {@link #password} 的盐
|
||||
*/
|
||||
private String passwordSalt;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 部门实体
|
||||
*/
|
||||
@TableName(value = "department")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class DepartmentDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 部门编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 排序值
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 父级部门编号
|
||||
*
|
||||
* 外键 {@link #id}
|
||||
*/
|
||||
private Integer pid;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.system.biz.dataobject.account.AccountDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* {@link AccountDO} 和 {@link RoleDO} 的关联表
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("account_role")
|
||||
public class AccountRoleDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 账号编号
|
||||
*
|
||||
* 关联 {@link AccountDO#getId()}
|
||||
*/
|
||||
private Integer accountId;
|
||||
/**
|
||||
* 角色编号
|
||||
*
|
||||
* 关联 {@link RoleDO#getId()}
|
||||
*/
|
||||
private Integer roleId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.system.biz.enums.authorization.ResourceTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 资源实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName(value = "resource")
|
||||
public class ResourceDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 资源编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 菜单名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 权限标识
|
||||
*
|
||||
* 一般格式为:${系统}:${模块}:${操作}
|
||||
* 例如说:system:admin:add,即 system 服务的添加管理员。
|
||||
*
|
||||
* 当我们把该 ResourceDO 赋予给角色后,意味着该角色有该资源:
|
||||
* - 对于后端,配合 @RequiresPermissions 注解,配置 API 接口需要该权限,从而对 API 接口进行权限控制。
|
||||
* - 对于前端,配合前端标签,配置按钮是否展示,避免用户没有该权限时,结果可以看到该操作。
|
||||
*/
|
||||
private String permission;
|
||||
/**
|
||||
* 资源类型
|
||||
*
|
||||
* 关联 {@link ResourceTypeEnum}
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 父级资源编号
|
||||
*
|
||||
* 关联:{@link ResourceDO#getId()}
|
||||
*/
|
||||
private Integer pid;
|
||||
/**
|
||||
* 前端路由
|
||||
*
|
||||
* 目前当且仅当资源类型为 {@link ResourceTypeEnum#MENU} 时,才会生效
|
||||
*/
|
||||
private String route;
|
||||
/**
|
||||
* 菜单图标
|
||||
*
|
||||
* 目前当且仅当资源类型为 {@link ResourceTypeEnum#MENU} 时,才会生效
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.system.biz.enums.authorization.RoleCodeEnum;
|
||||
import cn.iocoder.mall.system.biz.enums.authorization.RoleTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 角色实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("role")
|
||||
public class RoleDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 角色编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 角色名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 角色编码
|
||||
*
|
||||
* 关联 {@link RoleCodeEnum}
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 角色类型
|
||||
*
|
||||
* 关联 {@link RoleTypeEnum}
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* {@link RoleDO} 和 {@link ResourceDO} 的关联表
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("role_resource")
|
||||
public class RoleResourceDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 角色编号(外键:{@link RoleDO}
|
||||
*/
|
||||
private Integer roleId;
|
||||
/**
|
||||
* 资源编号(外键:{@link ResourceDO}
|
||||
*/
|
||||
private Integer resourceId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.mapper.admin;
|
||||
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin.AdminDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface AdminMapper extends BaseMapper<AdminDO> {
|
||||
|
||||
default AdminDO selectByUsername(String username) {
|
||||
return selectOne(new QueryWrapper<AdminDO>()
|
||||
.eq("username", username)
|
||||
);
|
||||
}
|
||||
|
||||
// default IPage<AdminDO> selectPage(AdminPageDTO adminPageDTO) {
|
||||
// return selectPage(new Page<>(adminPageDTO.getPageNo(), adminPageDTO.getPageSize()),
|
||||
// new QueryWrapperX<AdminDO>().likeIfPresent("name", adminPageDTO.getName())
|
||||
// .eqIfPresent("department_id", adminPageDTO.getDepartmentId()));
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.mapper.permission;
|
||||
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission.AccountRoleDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface AccountRoleMapper extends BaseMapper<AccountRoleDO> {
|
||||
|
||||
default List<AccountRoleDO> selectByAccountId(Integer accountId) {
|
||||
return selectList(new QueryWrapper<AccountRoleDO>().eq("account_id", accountId));
|
||||
}
|
||||
|
||||
default List<AccountRoleDO> selectListByAccountIds(Collection<Integer> accountIds) {
|
||||
return selectList(new QueryWrapper<AccountRoleDO>().in("account_id", accountIds));
|
||||
}
|
||||
|
||||
default int deleteByAccountId(Integer accountId) {
|
||||
return delete(new QueryWrapper<AccountRoleDO>().eq("account_id", accountId));
|
||||
}
|
||||
|
||||
default int deleteByRoleId(Integer roleId) {
|
||||
return delete(new QueryWrapper<AccountRoleDO>().eq("role_id", roleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量插入。因为 MyBaits Plus 的批量插入是基于 Service 实现,所以只好写 XML
|
||||
*
|
||||
* @param accountRoleDOs 数组
|
||||
*/
|
||||
int insertList(@Param("accountRoleDOs") List<AccountRoleDO> accountRoleDOs);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.mapper.permission;
|
||||
|
||||
import cn.iocoder.mall.mybatis.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission.ResourceDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface ResourceMapper extends BaseMapper<ResourceDO> {
|
||||
|
||||
default ResourceDO selectByPermission(String permission) {
|
||||
return selectOne(new QueryWrapper<ResourceDO>().eq("permission", permission));
|
||||
}
|
||||
|
||||
default ResourceDO selectByPidAndName(Integer pid, String name) {
|
||||
return selectOne(new QueryWrapperX<ResourceDO>().eqIfPresent("pid", pid)
|
||||
.eqIfPresent("name", name));
|
||||
}
|
||||
|
||||
default List<ResourceDO> selectListByPermissions(Collection<String> permissions) {
|
||||
return selectList(new QueryWrapper<ResourceDO>().in("permission", permissions));
|
||||
}
|
||||
|
||||
default List<ResourceDO> selectListByIdsAndType(Collection<Integer> ids, Integer type) {
|
||||
return selectList(new QueryWrapperX<ResourceDO>().inIfPresent("id", ids)
|
||||
.eqIfPresent("type", type));
|
||||
}
|
||||
|
||||
default int selectCountByIdsAndType(Collection<Integer> ids, Integer type) {
|
||||
return selectCount(new QueryWrapperX<ResourceDO>().inIfPresent("id", ids)
|
||||
.eqIfPresent("type", type));
|
||||
}
|
||||
|
||||
default int selectCountByPid(Integer pid) {
|
||||
return selectCount(new QueryWrapper<ResourceDO>().eq("pid", pid));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.mapper.permission;
|
||||
|
||||
import cn.iocoder.mall.mybatis.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission.RoleDO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface RoleMapper extends BaseMapper<RoleDO> {
|
||||
|
||||
// default IPage<RoleDO> selectPage(RolePageDTO rolePageDTO) {
|
||||
// return selectPage(new Page<>(rolePageDTO.getPageNo(), rolePageDTO.getPageSize()),
|
||||
// new QueryWrapperX<RoleDO>().likeIfPresent("name", rolePageDTO.getName()));
|
||||
// }
|
||||
|
||||
default List<RoleDO> selectListByIds(Collection<Integer> ids) {
|
||||
return selectList(new QueryWrapperX<RoleDO>().inIfPresent("id", ids));
|
||||
}
|
||||
|
||||
default RoleDO selectByName(String name) {
|
||||
return selectOne(new QueryWrapperX<RoleDO>().eqIfPresent("name", name));
|
||||
}
|
||||
|
||||
default RoleDO selectByCode(String code) {
|
||||
return selectOne(new QueryWrapperX<RoleDO>().eqIfPresent("code", code));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.mapper.permission;
|
||||
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission.RoleResourceDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface RoleResourceMapper extends BaseMapper<RoleResourceDO> {
|
||||
|
||||
/**
|
||||
* 批量插入。因为 MyBaits Plus 的批量插入是基于 Service 实现,所以只好写 XML
|
||||
*
|
||||
* @param roleResources 数组
|
||||
*/
|
||||
int insertList(@Param("roleResources") List<RoleResourceDO> roleResources);
|
||||
|
||||
default List<RoleResourceDO> selectListByResourceId(Integer resourceId) {
|
||||
return selectList(new QueryWrapper<RoleResourceDO>().eq("resource_id", resourceId));
|
||||
}
|
||||
|
||||
default List<RoleResourceDO> selectListByResourceIds(Collection<Integer> resourceIds) {
|
||||
return selectList(new QueryWrapper<RoleResourceDO>().in("resource_id", resourceIds));
|
||||
}
|
||||
|
||||
default List<RoleResourceDO> selectListByRoleId(Integer roleId) {
|
||||
return selectList(new QueryWrapper<RoleResourceDO>().eq("role_id", roleId));
|
||||
}
|
||||
|
||||
default List<RoleResourceDO> selectListByRoleIds(Collection<Integer> roleIds) {
|
||||
return selectList(new QueryWrapper<RoleResourceDO>().in("role_id", roleIds));
|
||||
}
|
||||
|
||||
default int deleteByResourceId(Integer resourceId) {
|
||||
return delete(new QueryWrapper<RoleResourceDO>().eq("resource_id", resourceId));
|
||||
}
|
||||
|
||||
default int deleteByRoleId(Integer roleId) {
|
||||
return delete(new QueryWrapper<RoleResourceDO>().eq("role_id", roleId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?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="cn.iocoder.mall.systemservice.dal.mysql.mapper.permission.AccountRoleMapper">
|
||||
|
||||
<insert id="insertList">
|
||||
INSERT INTO account_role (
|
||||
account_id, role_id, create_time, deleted
|
||||
) VALUES
|
||||
<foreach collection="accountRoleDOs" item="accountRole" separator=",">
|
||||
(#{accountRole.accountId}, #{accountRole.roleId}, #{accountRole.createTime}, #{accountRole.deleted})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?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="cn.iocoder.mall.systemservice.dal.mysql.mapper.permission.RoleResourceMapper">
|
||||
|
||||
<insert id="insertList">
|
||||
INSERT INTO role_resource (
|
||||
resource_id, role_id, create_time, deleted
|
||||
) VALUES
|
||||
<foreach collection="roleResources" item="roleResource" separator=",">
|
||||
(#{roleResource.resourceId}, #{roleResource.roleId}, #{roleResource.createTime}, #{roleResource.deleted})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user