This commit is contained in:
admin
2024-06-17 01:16:51 +08:00
parent f20d34b509
commit 0f7a5f5b9b
7 changed files with 76 additions and 16 deletions

View File

@@ -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("分组中存在店员,禁止删除");
}

View File

@@ -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);
}
}