fix
This commit is contained in:
@@ -8,7 +8,6 @@ import com.starry.admin.modules.clerk.module.entity.PlayClerkUserReturnVo;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserTypeEditVo;
|
||||
import com.starry.admin.modules.clerk.module.vo.PlayClerkUserEditVo;
|
||||
import com.starry.admin.modules.clerk.module.vo.PlayClerkUserStateEditVo;
|
||||
import com.starry.admin.modules.clerk.service.IPlayClerkCommodityService;
|
||||
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;
|
||||
@@ -49,7 +48,7 @@ public class PlayClerkUserInfoController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询店员列表
|
||||
* 按照店员分类查询店员列表
|
||||
*/
|
||||
@GetMapping("listAllByTypeId")
|
||||
public R listAllByTypeId(@RequestParam("id") String id) {
|
||||
@@ -58,7 +57,16 @@ public class PlayClerkUserInfoController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改店员类型
|
||||
* 按照店员分组查询店员列表
|
||||
*/
|
||||
@GetMapping("listAllByGroupId")
|
||||
public R listAllByGroupId(@RequestParam("id") String id) {
|
||||
List<PlayClerkUserInfoEntity> list = playClerkUserInfoService.listAllByGroupId(id);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改店员分类
|
||||
*/
|
||||
@PostMapping("editClerkType")
|
||||
public R listByPage(@Validated @RequestBody PlayClerkUserTypeEditVo vo) {
|
||||
@@ -81,6 +89,30 @@ public class PlayClerkUserInfoController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改店员分组
|
||||
*/
|
||||
@PostMapping("editClerkGroup")
|
||||
public R editClerkGroup(@Validated @RequestBody PlayClerkUserTypeEditVo vo) {
|
||||
//先清空当前分类下店员
|
||||
List<PlayClerkUserInfoEntity> list = playClerkUserInfoService.listAllByGroupId(vo.getTypeId());
|
||||
for (PlayClerkUserInfoEntity clerkUserInfo : list) {
|
||||
PlayClerkUserInfoEntity entity = new PlayClerkUserInfoEntity();
|
||||
entity.setId(clerkUserInfo.getId());
|
||||
entity.setGroupId("");
|
||||
playClerkUserInfoService.update(entity);
|
||||
}
|
||||
for (String clerkUserId : vo.getClerkUserIds()) {
|
||||
PlayClerkUserInfoEntity entity = new PlayClerkUserInfoEntity();
|
||||
entity.setId(clerkUserId);
|
||||
entity.setGroupId(vo.getTypeId());
|
||||
playClerkUserInfoService.update(entity);
|
||||
}
|
||||
|
||||
return R.ok("成功");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/simple/list")
|
||||
public R simpleList() {
|
||||
List<PlayClerkUserInfoEntity> clerkList = playClerkUserInfoService.simpleList();
|
||||
|
||||
@@ -37,10 +37,9 @@ public interface IPlayClerkUserInfoService extends IService<PlayClerkUserInfoEnt
|
||||
/**
|
||||
* 根据分组ID查询店员列表
|
||||
*
|
||||
* @param groupId 分组ID
|
||||
* @return 店员列表
|
||||
*/
|
||||
List<PlayClerkUserInfoEntity> selectByGroupId(String groupId);
|
||||
List<PlayClerkUserInfoEntity> listAllByGroupId(String groupId);
|
||||
/**
|
||||
* 查询当前租户店员总数
|
||||
*
|
||||
|
||||
@@ -71,8 +71,9 @@ public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoM
|
||||
return this.baseMapper.selectList(lambdaWrapper);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<PlayClerkUserInfoEntity> selectByGroupId(String groupId) {
|
||||
public List<PlayClerkUserInfoEntity> listAllByGroupId(String groupId) {
|
||||
MPJLambdaWrapper<PlayClerkUserInfoEntity> lambdaWrapper = new MPJLambdaWrapper<>();
|
||||
lambdaWrapper.select(PlayClerkUserInfoEntity::getId, PlayClerkUserInfoEntity::getListingState);
|
||||
lambdaWrapper.eq(PlayClerkUserInfoEntity::getGroupId, groupId);
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 店员分组信息Controller
|
||||
@@ -46,15 +45,21 @@ public class PlayPersonnelGroupInfoController {
|
||||
|
||||
|
||||
/**
|
||||
* 查询店员分组信息列表
|
||||
* 查询店员分类信息列表
|
||||
*/
|
||||
@PostMapping("/listByPage")
|
||||
public R listByPage(@Validated @RequestBody PlayPersonnelGroupInfoQueryVo vo) {
|
||||
IPage<PlayPersonnelGroupInfoReturnVo> list = playClerkGroupInfoService.selectByPage(vo);
|
||||
for (PlayPersonnelGroupInfoReturnVo record : list.getRecords()) {
|
||||
List<PlayClerkUserInfoEntity> clerkUserInfoEntities = playClerkUserInfoService.selectByGroupId(record.getId());
|
||||
List<PlayClerkUserInfoEntity> clerkUserInfoEntities = playClerkUserInfoService.listAllByGroupId(record.getId());
|
||||
record.setTotalEmployeesNumber(clerkUserInfoEntities.size());
|
||||
record.setListingEmployeesNumber(clerkUserInfoEntities.stream().collect(Collectors.toMap(PlayClerkUserInfoEntity::getListingState, PlayClerkUserInfoEntity::getId)).size());
|
||||
Integer listingEmployeesNumber = 0;
|
||||
for (PlayClerkUserInfoEntity clerkUserInfoEntity : clerkUserInfoEntities) {
|
||||
if ("1".equals(clerkUserInfoEntity.getListingState())) {
|
||||
listingEmployeesNumber++;
|
||||
}
|
||||
}
|
||||
record.setListingEmployeesNumber(listingEmployeesNumber);
|
||||
}
|
||||
return R.ok(list);
|
||||
}
|
||||
@@ -101,7 +106,7 @@ public class PlayPersonnelGroupInfoController {
|
||||
@DeleteMapping("/{ids}")
|
||||
public R remove(@PathVariable String[] ids) {
|
||||
for (String id : ids) {
|
||||
List<PlayClerkUserInfoEntity> clerkUserInfoEntities = playClerkUserInfoService.selectByGroupId(id);
|
||||
List<PlayClerkUserInfoEntity> clerkUserInfoEntities = playClerkUserInfoService.listAllByGroupId(id);
|
||||
if (!clerkUserInfoEntities.isEmpty()) {
|
||||
throw new CustomException("分组中存在店员,禁止删除");
|
||||
}
|
||||
|
||||
@@ -3,15 +3,14 @@ package com.starry.admin.modules.personnel.controller;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.modules.personnel.module.vo.PlayPersonnelUserInfoQueryVo;
|
||||
import com.starry.admin.modules.personnel.module.vo.PlayPersonnelUserInfoReturnVo;
|
||||
import com.starry.admin.modules.system.entity.SysUserEntity;
|
||||
import com.starry.admin.modules.system.service.SysUserService;
|
||||
import com.starry.common.result.R;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理员管理Controller
|
||||
@@ -28,7 +27,7 @@ public class PlayPersonnelUserInfoController {
|
||||
|
||||
|
||||
/**
|
||||
* 查询管理员管理信息列表
|
||||
* 分页查询账户信息列表
|
||||
*/
|
||||
@PostMapping("/listByPage")
|
||||
public R listByPage(@Validated @RequestBody PlayPersonnelUserInfoQueryVo vo) {
|
||||
@@ -37,4 +36,14 @@ public class PlayPersonnelUserInfoController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有账户信息列表
|
||||
*/
|
||||
@GetMapping("/listAll")
|
||||
public R listAll() {
|
||||
List<SysUserEntity> list = sysUserService.selectAll();
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -44,6 +44,12 @@ public interface SysUserService extends IService<SysUserEntity> {
|
||||
SysUserEntity selectUserByUserName(String userName);
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有账户
|
||||
*
|
||||
* @return 查询所有账户
|
||||
*/
|
||||
List<SysUserEntity> selectAll();
|
||||
/**
|
||||
* 分页查询用户
|
||||
*
|
||||
|
||||
@@ -62,6 +62,14 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUserEntity
|
||||
private IPlayClerkUserInfoService clerkUserInfoService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<SysUserEntity> selectAll() {
|
||||
LambdaQueryWrapper<SysUserEntity> lambdaWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaWrapper.select(SysUserEntity::getUserId,SysUserEntity::getUserCode);
|
||||
return this.baseMapper.selectList(lambdaWrapper);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<PlayPersonnelUserInfoReturnVo> selectByPage(PlayPersonnelUserInfoQueryVo vo) {
|
||||
MPJLambdaWrapper<SysUserEntity> lambdaWrapper = new MPJLambdaWrapper<>();
|
||||
|
||||
Reference in New Issue
Block a user