新增客服/组长/管理员对应的用户角色信息
This commit is contained in:
@@ -11,12 +11,6 @@ import com.starry.admin.modules.clerk.module.vo.PlayClerkUserStateEditVo;
|
||||
import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService;
|
||||
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
||||
import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
|
||||
import com.starry.admin.modules.system.entity.SysRoleEntity;
|
||||
import com.starry.admin.modules.system.entity.SysUserEntity;
|
||||
import com.starry.admin.modules.system.entity.SysUserRoleEntity;
|
||||
import com.starry.admin.modules.system.service.SysRoleService;
|
||||
import com.starry.admin.modules.system.service.SysUserRoleService;
|
||||
import com.starry.admin.modules.system.service.SysUserService;
|
||||
import com.starry.admin.modules.weichat.entity.clerk.PlayClerkUserInfoQueryVo;
|
||||
import com.starry.admin.modules.weichat.entity.clerk.PlayClerkUserInfoResultVo;
|
||||
import com.starry.common.annotation.Log;
|
||||
@@ -44,12 +38,6 @@ public class PlayClerkUserInfoController {
|
||||
@Resource
|
||||
private IPlayClerkUserInfoService playClerkUserInfoService;
|
||||
|
||||
@Resource
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@Resource
|
||||
private SysUserRoleService userRoleService;
|
||||
|
||||
/**
|
||||
* 查询店员列表
|
||||
*/
|
||||
@@ -120,12 +108,6 @@ public class PlayClerkUserInfoController {
|
||||
entity.setId(clerkUserId);
|
||||
entity.setGroupId(vo.getTypeId());
|
||||
playClerkUserInfoService.update(entity);
|
||||
|
||||
SysRoleEntity role = sysRoleService.selectByRoleKey("leader");
|
||||
SysUserRoleEntity userEntity = new SysUserRoleEntity();
|
||||
userEntity.setUserId(clerkUserId);
|
||||
userEntity.setRoleId(role.getRoleId());
|
||||
// userRoleService.saveBatch(userEntity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
package com.starry.admin.modules.personnel.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.common.exception.CustomException;
|
||||
import com.starry.admin.modules.personnel.module.entity.PlayPersonnelAdminInfoEntity;
|
||||
import com.starry.admin.modules.personnel.module.vo.*;
|
||||
import com.starry.admin.modules.personnel.module.vo.PlayPersonnelAdminInfoEditAddInfoVo;
|
||||
import com.starry.admin.modules.personnel.module.vo.PlayPersonnelAdminInfoEditBaseInfoVo;
|
||||
import com.starry.admin.modules.personnel.module.vo.PlayPersonnelAdminInfoQueryVo;
|
||||
import com.starry.admin.modules.personnel.module.vo.PlayPersonnelAdminInfoReturnVo;
|
||||
import com.starry.admin.modules.personnel.service.IPlayPersonnelAdminInfoService;
|
||||
import com.starry.admin.modules.system.entity.SysUserEntity;
|
||||
import com.starry.admin.modules.system.service.SysRoleService;
|
||||
import com.starry.admin.modules.system.service.SysUserRoleService;
|
||||
import com.starry.admin.modules.system.service.SysUserService;
|
||||
import com.starry.common.annotation.Log;
|
||||
import com.starry.common.enums.BusinessType;
|
||||
@@ -33,6 +39,13 @@ public class PlayPersonnelAdminInfoController {
|
||||
private SysUserService sysUserService;
|
||||
|
||||
|
||||
@Resource
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@Resource
|
||||
private SysUserRoleService userRoleService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询管理员管理信息列表
|
||||
*/
|
||||
@@ -57,12 +70,21 @@ public class PlayPersonnelAdminInfoController {
|
||||
@Log(title = "管理员管理信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/createBaseInfo")
|
||||
public R createBaseInfo(@Validated @RequestBody PlayPersonnelAdminInfoEditAddInfoVo vo) {
|
||||
//校验对应用户是否存在
|
||||
SysUserEntity sysUserEntity = sysUserService.selectUserById(vo.getSysUserId());
|
||||
//校验当前用户是否已经是组长
|
||||
PlayPersonnelAdminInfoEntity groupInfoEntity = playPersonnelAdminInfoService.selectByUserId(vo.getSysUserId());
|
||||
if (groupInfoEntity != null) {
|
||||
throw new CustomException("当前账号已经是管理员,无法重复添加");
|
||||
}
|
||||
//添加管理员
|
||||
PlayPersonnelAdminInfoEntity entity = ConvertUtil.entityToVo(vo, PlayPersonnelAdminInfoEntity.class);
|
||||
entity.setSysUserCode(sysUserEntity.getUserCode());
|
||||
entity.setAddTime(LocalDateTime.now());
|
||||
boolean success = playPersonnelAdminInfoService.create(entity);
|
||||
if (success) {
|
||||
//新建管理员后,添加对应的用户角色权限
|
||||
userRoleService.addUserRole(vo.getSysUserId(), sysRoleService.selectByRoleKey("operator").getRoleId());
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("添加失败");
|
||||
@@ -74,12 +96,20 @@ public class PlayPersonnelAdminInfoController {
|
||||
@Log(title = "管理员管理信息", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/updateBaseInfo")
|
||||
public R updateBaseInfo(@Validated @RequestBody PlayPersonnelAdminInfoEditBaseInfoVo vo) {
|
||||
|
||||
//校验对应用户是否存在
|
||||
SysUserEntity sysUserEntity = sysUserService.selectUserById(vo.getSysUserId());
|
||||
//校验当前用户是否已经是组长
|
||||
PlayPersonnelAdminInfoEntity adminInfoEntity = playPersonnelAdminInfoService.selectByUserId(vo.getSysUserId());
|
||||
if (adminInfoEntity != null && !adminInfoEntity.getId().equals(vo.getId())) {
|
||||
throw new CustomException("当前账号已经是管理员,无法重复添加");
|
||||
}
|
||||
PlayPersonnelAdminInfoEntity entity = ConvertUtil.entityToVo(vo, PlayPersonnelAdminInfoEntity.class);
|
||||
entity.setSysUserCode(sysUserEntity.getUserCode());
|
||||
boolean success = playPersonnelAdminInfoService.update(entity);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
//新建管理员后,添加对应的用户角色权限
|
||||
userRoleService.addUserRole(vo.getSysUserId(), sysRoleService.selectByRoleKey("operator").getRoleId());
|
||||
}
|
||||
return R.error("修改失败");
|
||||
}
|
||||
@@ -91,6 +121,15 @@ public class PlayPersonnelAdminInfoController {
|
||||
@Log(title = "管理员管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R remove(@PathVariable String[] ids) {
|
||||
return R.ok(playPersonnelAdminInfoService.deletePlayPersonnelAdminInfoByIds(ids));
|
||||
Long ruleId = sysRoleService.selectByRoleKey("leader").getRoleId();
|
||||
for (String id : ids) {
|
||||
// 判断数据是否存在
|
||||
PlayPersonnelAdminInfoEntity entity = playPersonnelAdminInfoService.selectPlayPersonnelAdminInfoById(id);
|
||||
//删除管理员
|
||||
playPersonnelAdminInfoService.deletePlayPersonnelAdminInfoById(id);
|
||||
//删除对应的权限信息
|
||||
userRoleService.delUserRole(entity.getSysUserId(), ruleId);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,11 +11,14 @@ import com.starry.admin.modules.personnel.module.vo.PlayPersonnelGroupInfoQueryV
|
||||
import com.starry.admin.modules.personnel.module.vo.PlayPersonnelGroupInfoReturnVo;
|
||||
import com.starry.admin.modules.personnel.service.IPlayPersonnelGroupInfoService;
|
||||
import com.starry.admin.modules.system.entity.SysUserEntity;
|
||||
import com.starry.admin.modules.system.service.SysRoleService;
|
||||
import com.starry.admin.modules.system.service.SysUserRoleService;
|
||||
import com.starry.admin.modules.system.service.SysUserService;
|
||||
import com.starry.common.annotation.Log;
|
||||
import com.starry.common.enums.BusinessType;
|
||||
import com.starry.common.result.R;
|
||||
import com.starry.common.utils.ConvertUtil;
|
||||
import com.starry.common.utils.IdUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -44,6 +47,13 @@ public class PlayPersonnelGroupInfoController {
|
||||
private SysUserService sysUserService;
|
||||
|
||||
|
||||
@Resource
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@Resource
|
||||
private SysUserRoleService userRoleService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询店员分类信息列表
|
||||
*/
|
||||
@@ -71,13 +81,23 @@ public class PlayPersonnelGroupInfoController {
|
||||
@Log(title = "店员分组信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/createBaseInfo")
|
||||
public R createBaseInfo(@Validated @RequestBody PlayPersonnelGroupInfoEditAddInfoVo vo) {
|
||||
//校验对应用户是否存在
|
||||
SysUserEntity sysUserEntity = sysUserService.selectUserById(vo.getSysUserId());
|
||||
//校验当前用户是否已经是组长
|
||||
PlayPersonnelGroupInfoEntity groupInfoEntity = playClerkGroupInfoService.selectByUserId(vo.getSysUserId());
|
||||
if (groupInfoEntity != null) {
|
||||
throw new CustomException("当前账号已经是组长,无法重复添加");
|
||||
}
|
||||
//添加组长配置
|
||||
PlayPersonnelGroupInfoEntity entity = ConvertUtil.entityToVo(vo, PlayPersonnelGroupInfoEntity.class);
|
||||
entity.setId(IdUtils.getUuid());
|
||||
entity.setSysUserCode(sysUserEntity.getUserCode());
|
||||
entity.setAddTime(LocalDateTime.now());
|
||||
boolean success = playClerkGroupInfoService.create(entity);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
//新建组长后,添加对应的用户角色权限
|
||||
userRoleService.addUserRole(vo.getSysUserId(), sysRoleService.selectByRoleKey("leader").getRoleId());
|
||||
return R.ok("成功");
|
||||
}
|
||||
return R.error("添加失败");
|
||||
}
|
||||
@@ -89,11 +109,19 @@ public class PlayPersonnelGroupInfoController {
|
||||
@PostMapping(value = "/updateBaseInfo")
|
||||
public R updateBaseInfo(@Validated @RequestBody PlayPersonnelGroupInfoEditBaseInfoVo vo) {
|
||||
SysUserEntity sysUserEntity = sysUserService.selectUserById(vo.getSysUserId());
|
||||
//校验当前用户是否已经是组长
|
||||
PlayPersonnelGroupInfoEntity groupInfoEntity = playClerkGroupInfoService.selectByUserId(vo.getSysUserId());
|
||||
//校验当前用户是否已经是组长,只有当前用户不为组长时
|
||||
if (groupInfoEntity != null && !groupInfoEntity.getId().equals(vo.getId())) {
|
||||
throw new CustomException("当前账号已经是组长,无法重复添加");
|
||||
}
|
||||
PlayPersonnelGroupInfoEntity entity = ConvertUtil.entityToVo(vo, PlayPersonnelGroupInfoEntity.class);
|
||||
entity.setSysUserCode(sysUserEntity.getUserCode());
|
||||
boolean success = playClerkGroupInfoService.update(entity);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
//新建组长后,添加对应的用户角色权限
|
||||
userRoleService.addUserRole(vo.getSysUserId(), sysRoleService.selectByRoleKey("leader").getRoleId());
|
||||
return R.ok("成功");
|
||||
}
|
||||
return R.error("修改失败");
|
||||
}
|
||||
@@ -111,6 +139,16 @@ public class PlayPersonnelGroupInfoController {
|
||||
throw new CustomException("分组中存在店员,禁止删除");
|
||||
}
|
||||
}
|
||||
return R.ok(playClerkGroupInfoService.deletePlayClerkGroupInfoByIds(ids));
|
||||
Long ruleId = sysRoleService.selectByRoleKey("leader").getRoleId();
|
||||
for (String id : ids) {
|
||||
// 判断数据是否存在
|
||||
PlayPersonnelGroupInfoEntity entity = playClerkGroupInfoService.selectPlayClerkGroupInfoById(id);
|
||||
//删除组长
|
||||
playClerkGroupInfoService.deletePlayClerkGroupInfoById(id);
|
||||
//删除对应的权限信息
|
||||
userRoleService.delUserRole(entity.getSysUserId(), ruleId);
|
||||
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.starry.admin.modules.personnel.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.common.exception.CustomException;
|
||||
import com.starry.admin.modules.personnel.module.entity.PlayPersonnelWaiterInfoEntity;
|
||||
import com.starry.admin.modules.personnel.module.vo.PlayPersonnelWaiterInfoEditAddInfoVo;
|
||||
import com.starry.admin.modules.personnel.module.vo.PlayPersonnelWaiterInfoEditBaseInfoVo;
|
||||
@@ -8,6 +9,8 @@ import com.starry.admin.modules.personnel.module.vo.PlayPersonnelWaiterInfoQuery
|
||||
import com.starry.admin.modules.personnel.module.vo.PlayPersonnelWaiterInfoReturnVo;
|
||||
import com.starry.admin.modules.personnel.service.IPlayPersonnelWaiterInfoService;
|
||||
import com.starry.admin.modules.system.entity.SysUserEntity;
|
||||
import com.starry.admin.modules.system.service.SysRoleService;
|
||||
import com.starry.admin.modules.system.service.SysUserRoleService;
|
||||
import com.starry.admin.modules.system.service.SysUserService;
|
||||
import com.starry.common.annotation.Log;
|
||||
import com.starry.common.enums.BusinessType;
|
||||
@@ -35,6 +38,13 @@ public class PlayPersonnelWaiterInfoController {
|
||||
private SysUserService sysUserService;
|
||||
|
||||
|
||||
@Resource
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@Resource
|
||||
private SysUserRoleService userRoleService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询客服信息列表
|
||||
*/
|
||||
@@ -50,12 +60,21 @@ public class PlayPersonnelWaiterInfoController {
|
||||
@Log(title = "客服管理信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/createBaseInfo")
|
||||
public R createBaseInfo(@Validated @RequestBody PlayPersonnelWaiterInfoEditAddInfoVo vo) {
|
||||
//校验对应用户是否存在
|
||||
SysUserEntity sysUserEntity = sysUserService.selectUserById(vo.getSysUserId());
|
||||
//校验当前用户是否已经是组长
|
||||
PlayPersonnelWaiterInfoEntity waiterInfoEntity = playClerkWaiterInfoService.selectByUserId(vo.getSysUserId());
|
||||
if (waiterInfoEntity != null) {
|
||||
throw new CustomException("当前账号已经是客服,无法重复添加");
|
||||
}
|
||||
|
||||
PlayPersonnelWaiterInfoEntity entity = ConvertUtil.entityToVo(vo, PlayPersonnelWaiterInfoEntity.class);
|
||||
entity.setSysUserCode(sysUserEntity.getUserCode());
|
||||
entity.setAddTime(LocalDateTime.now());
|
||||
boolean success = playClerkWaiterInfoService.create(entity);
|
||||
if (success) {
|
||||
//新建客服后,添加对应的用户角色权限
|
||||
userRoleService.addUserRole(vo.getSysUserId(), sysRoleService.selectByRoleKey("waiter").getRoleId());
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("添加失败");
|
||||
@@ -67,11 +86,22 @@ public class PlayPersonnelWaiterInfoController {
|
||||
@Log(title = "客服管理信息", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/updateBaseInfo")
|
||||
public R updateBaseInfo(@Validated @RequestBody PlayPersonnelWaiterInfoEditBaseInfoVo vo) {
|
||||
|
||||
//校验对应用户是否存在
|
||||
SysUserEntity sysUserEntity = sysUserService.selectUserById(vo.getSysUserId());
|
||||
//校验当前用户是否已经是组长
|
||||
PlayPersonnelWaiterInfoEntity waiterInfoEntity = playClerkWaiterInfoService.selectByUserId(vo.getSysUserId());
|
||||
if (waiterInfoEntity != null && !waiterInfoEntity.getId().equals(vo.getId())) {
|
||||
throw new CustomException("当前账号已经是客服,无法重复添加");
|
||||
}
|
||||
|
||||
|
||||
PlayPersonnelWaiterInfoEntity entity = ConvertUtil.entityToVo(vo, PlayPersonnelWaiterInfoEntity.class);
|
||||
entity.setSysUserCode(sysUserEntity.getUserCode());
|
||||
boolean success = playClerkWaiterInfoService.update(entity);
|
||||
if (success) {
|
||||
//新建客服后,添加对应的用户角色权限
|
||||
userRoleService.addUserRole(vo.getSysUserId(), sysRoleService.selectByRoleKey("waiter").getRoleId());
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("修改失败");
|
||||
@@ -84,6 +114,16 @@ public class PlayPersonnelWaiterInfoController {
|
||||
@Log(title = "客服信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R remove(@PathVariable String[] ids) {
|
||||
return R.ok(playClerkWaiterInfoService.deletePlayClerkWaiterInfoByIds(ids));
|
||||
Long ruleId = sysRoleService.selectByRoleKey("leader").getRoleId();
|
||||
for (String id : ids) {
|
||||
// 判断数据是否存在
|
||||
PlayPersonnelWaiterInfoEntity entity = playClerkWaiterInfoService.selectPlayClerkWaiterInfoById(id);
|
||||
//删除客服
|
||||
playClerkWaiterInfoService.deletePlayClerkWaiterInfoById(id);
|
||||
//删除对应的权限信息
|
||||
userRoleService.delUserRole(entity.getSysUserId(), ruleId);
|
||||
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,18 @@ import com.starry.admin.modules.personnel.module.vo.PlayPersonnelAdminInfoReturn
|
||||
* @since 2024-06-14
|
||||
*/
|
||||
public interface IPlayPersonnelAdminInfoService extends IService<PlayPersonnelAdminInfoEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 查询店员分组信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 店员分组信息
|
||||
*/
|
||||
PlayPersonnelAdminInfoEntity selectByUserId(String userId);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询管理员管理
|
||||
*
|
||||
@@ -58,7 +70,6 @@ public interface IPlayPersonnelAdminInfoService extends IService<PlayPersonnelAd
|
||||
* 删除管理员管理信息
|
||||
*
|
||||
* @param id 管理员管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayPersonnelAdminInfoById(String id);
|
||||
void deletePlayPersonnelAdminInfoById(String id);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,14 @@ public interface IPlayPersonnelGroupInfoService extends IService<PlayPersonnelGr
|
||||
*/
|
||||
PlayPersonnelGroupInfoEntity selectPlayClerkGroupInfoById(String id);
|
||||
|
||||
/**
|
||||
* 查询店员分组信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 店员分组信息
|
||||
*/
|
||||
PlayPersonnelGroupInfoEntity selectByUserId(String userId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询店员分组信息列表
|
||||
@@ -71,7 +79,6 @@ public interface IPlayPersonnelGroupInfoService extends IService<PlayPersonnelGr
|
||||
* 删除店员分组信息信息
|
||||
*
|
||||
* @param id 店员分组信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayClerkGroupInfoById(String id);
|
||||
void deletePlayClerkGroupInfoById(String id);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,15 @@ import com.starry.admin.modules.personnel.module.vo.PlayPersonnelWaiterInfoRetur
|
||||
* @since 2024-06-14
|
||||
*/
|
||||
public interface IPlayPersonnelWaiterInfoService extends IService<PlayPersonnelWaiterInfoEntity> {
|
||||
|
||||
/**
|
||||
* 查询店员客服信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 店员分组信息
|
||||
*/
|
||||
PlayPersonnelWaiterInfoEntity selectByUserId(String userId);
|
||||
|
||||
/**
|
||||
* 查询客服信息
|
||||
*
|
||||
@@ -58,7 +67,6 @@ public interface IPlayPersonnelWaiterInfoService extends IService<PlayPersonnelW
|
||||
* 删除客服信息信息
|
||||
*
|
||||
* @param id 客服信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayClerkWaiterInfoById(String id);
|
||||
void deletePlayClerkWaiterInfoById(String id);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.starry.admin.modules.personnel.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -27,6 +28,14 @@ public class PlayPersonnelAdminInfoServiceImpl extends ServiceImpl<PlayPersonnel
|
||||
@Resource
|
||||
private PlayPersonnelAdminInfoMapper playPersonnelAdminInfoMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public PlayPersonnelAdminInfoEntity selectByUserId(String userId) {
|
||||
LambdaQueryWrapper<PlayPersonnelAdminInfoEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PlayPersonnelAdminInfoEntity::getSysUserId, userId);
|
||||
return this.baseMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询管理员管理
|
||||
*
|
||||
@@ -88,10 +97,9 @@ public class PlayPersonnelAdminInfoServiceImpl extends ServiceImpl<PlayPersonnel
|
||||
* 删除管理员管理信息
|
||||
*
|
||||
* @param id 管理员管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayPersonnelAdminInfoById(String id) {
|
||||
return playPersonnelAdminInfoMapper.deleteById(id);
|
||||
public void deletePlayPersonnelAdminInfoById(String id) {
|
||||
playPersonnelAdminInfoMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,13 @@ public class PlayPersonnelGroupInfoServiceImpl extends ServiceImpl<PlayPersonnel
|
||||
return this.baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayPersonnelGroupInfoEntity selectByUserId(String userId) {
|
||||
LambdaQueryWrapper<PlayPersonnelGroupInfoEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PlayPersonnelGroupInfoEntity::getSysUserId, userId);
|
||||
return this.baseMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlayPersonnelGroupInfoEntity> selectAll() {
|
||||
return this.baseMapper.selectList(new LambdaQueryWrapper<>());
|
||||
@@ -95,10 +102,9 @@ public class PlayPersonnelGroupInfoServiceImpl extends ServiceImpl<PlayPersonnel
|
||||
* 删除店员分组信息信息
|
||||
*
|
||||
* @param id 店员分组信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayClerkGroupInfoById(String id) {
|
||||
return playClerkGroupInfoMapper.deleteById(id);
|
||||
public void deletePlayClerkGroupInfoById(String id) {
|
||||
playClerkGroupInfoMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.starry.admin.modules.personnel.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -27,6 +28,14 @@ public class PlayPersonnelWaiterInfoServiceImpl extends ServiceImpl<PlayPersonne
|
||||
@Resource
|
||||
private PlayPersonnelWaiterInfoMapper playClerkWaiterInfoMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public PlayPersonnelWaiterInfoEntity selectByUserId(String userId) {
|
||||
LambdaQueryWrapper<PlayPersonnelWaiterInfoEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PlayPersonnelWaiterInfoEntity::getSysUserId, userId);
|
||||
return this.baseMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询客服信息
|
||||
*
|
||||
@@ -89,10 +98,9 @@ public class PlayPersonnelWaiterInfoServiceImpl extends ServiceImpl<PlayPersonne
|
||||
* 删除客服信息信息
|
||||
*
|
||||
* @param id 客服信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayClerkWaiterInfoById(String id) {
|
||||
return playClerkWaiterInfoMapper.deleteById(id);
|
||||
public void deletePlayClerkWaiterInfoById(String id) {
|
||||
playClerkWaiterInfoMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,21 @@ import com.starry.admin.modules.system.entity.SysUserRoleEntity;
|
||||
public interface SysUserRoleService extends IService<SysUserRoleEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 删除用户角色信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param roleId 角色ID
|
||||
*/
|
||||
void delUserRole(String userId, Long roleId);
|
||||
|
||||
|
||||
/**
|
||||
* 新增用户角色信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param roleId 角色ID
|
||||
*/
|
||||
void addUserRole(String userId, Long roleId);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.starry.admin.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.starry.admin.modules.system.entity.SysUserRoleEntity;
|
||||
import com.starry.admin.modules.system.mapper.SysUserRoleMapper;
|
||||
@@ -17,4 +18,31 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRoleEntity> implements SysUserRoleService {
|
||||
|
||||
|
||||
@Override
|
||||
public void delUserRole(String userId, Long roleId) {
|
||||
LambdaQueryWrapper<SysUserRoleEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysUserRoleEntity::getUserId, userId);
|
||||
queryWrapper.eq(SysUserRoleEntity::getRoleId, roleId);
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addUserRole(String userId, Long roleId) {
|
||||
LambdaQueryWrapper<SysUserRoleEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysUserRoleEntity::getUserId, userId);
|
||||
queryWrapper.eq(SysUserRoleEntity::getRoleId, roleId);
|
||||
SysUserRoleEntity userRole = this.baseMapper.selectOne(queryWrapper);
|
||||
if (userRole == null) {
|
||||
userRole = new SysUserRoleEntity();
|
||||
userRole.setUserId(userId);
|
||||
userRole.setRoleId(roleId);
|
||||
this.baseMapper.insert(userRole);
|
||||
} else {
|
||||
userRole.setUserId(userId);
|
||||
userRole.setRoleId(roleId);
|
||||
this.baseMapper.updateById(userRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user