店员分类
This commit is contained in:
@@ -2,6 +2,7 @@ package com.starry.admin.modules.clerk.controller;
|
||||
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkTypeInfoEntity;
|
||||
import com.starry.admin.modules.clerk.module.vo.PlayClerkTypeInfoAddVo;
|
||||
import com.starry.admin.modules.clerk.module.vo.PlayClerkTypeInfoQueryVo;
|
||||
import com.starry.admin.modules.clerk.service.IPlayClerkTypeInfoService;
|
||||
import com.starry.common.annotation.Log;
|
||||
import com.starry.common.enums.BusinessType;
|
||||
@@ -32,14 +33,14 @@ public class PlayClerkTypeInfoController {
|
||||
return R.ok(playClerkTypeInfoService.selectByAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店员分类信息详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public R getInfo(@PathVariable("id") String id) {
|
||||
return R.ok(playClerkTypeInfoService.selectPlayClerkTypeInfoById(id));
|
||||
@PostMapping("/listByPage")
|
||||
public R listByPage(@Validated @RequestBody PlayClerkTypeInfoQueryVo vo) {
|
||||
return R.ok(playClerkTypeInfoService.selectByPage(vo));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* 新增店员分类信息
|
||||
*/
|
||||
|
||||
@@ -5,13 +5,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserQueryVo;
|
||||
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;
|
||||
import com.starry.admin.modules.play.service.IPlayUserInfoService;
|
||||
import com.starry.admin.modules.weichat.entity.clerk.PlayClerkUserInfoQueryVo;
|
||||
import com.starry.admin.modules.weichat.entity.clerk.PlayClerkUserInfoResultVo;
|
||||
import com.starry.common.annotation.Log;
|
||||
@@ -34,16 +34,11 @@ import java.util.List;
|
||||
@RequestMapping("/clerk/user")
|
||||
public class PlayClerkUserInfoController {
|
||||
|
||||
@Resource
|
||||
private IPlayUserInfoService playUserInfoService;
|
||||
@Resource
|
||||
private IPlayCustomUserInfoService customUserInfoService;
|
||||
@Resource
|
||||
private IPlayClerkUserInfoService playClerkUserInfoService;
|
||||
|
||||
@Resource
|
||||
private IPlayClerkCommodityService clerkCommodityService;
|
||||
|
||||
/**
|
||||
* 查询店员列表
|
||||
*/
|
||||
@@ -53,6 +48,39 @@ public class PlayClerkUserInfoController {
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询店员列表
|
||||
*/
|
||||
@GetMapping("listAllByTypeId")
|
||||
public R listAllByTypeId(@RequestParam("id") String id) {
|
||||
List<PlayClerkUserInfoEntity> list = playClerkUserInfoService.listAllByTypeId(id);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改店员类型
|
||||
*/
|
||||
@PostMapping("editClerkType")
|
||||
public R listByPage(@Validated @RequestBody PlayClerkUserTypeEditVo vo) {
|
||||
//先清空当前分类下店员
|
||||
List<PlayClerkUserInfoEntity> list = playClerkUserInfoService.listAllByTypeId(vo.getTypeId());
|
||||
for (PlayClerkUserInfoEntity clerkUserInfo : list) {
|
||||
PlayClerkUserInfoEntity entity = new PlayClerkUserInfoEntity();
|
||||
entity.setId(clerkUserInfo.getId());
|
||||
entity.setTypeId("");
|
||||
playClerkUserInfoService.update(entity);
|
||||
}
|
||||
for (String clerkUserId : vo.getClerkUserIds()) {
|
||||
PlayClerkUserInfoEntity entity = new PlayClerkUserInfoEntity();
|
||||
entity.setId(clerkUserId);
|
||||
entity.setTypeId(vo.getTypeId());
|
||||
playClerkUserInfoService.update(entity);
|
||||
}
|
||||
|
||||
return R.ok("成功");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/simple/list")
|
||||
public R simpleList() {
|
||||
List<PlayClerkUserInfoEntity> clerkList = playClerkUserInfoService.simpleList();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.starry.admin.modules.clerk.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkTypeInfoEntity;
|
||||
|
||||
/**
|
||||
@@ -10,7 +10,7 @@ import com.starry.admin.modules.clerk.module.entity.PlayClerkTypeInfoEntity;
|
||||
* @author admin
|
||||
* @since 2024-05-31
|
||||
*/
|
||||
public interface PlayClerkTypeInfoMapper extends BaseMapper<PlayClerkTypeInfoEntity> {
|
||||
public interface PlayClerkTypeInfoMapper extends MPJBaseMapper<PlayClerkTypeInfoEntity> {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.starry.admin.modules.clerk.module.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店员对象 play_clerk_user_info
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-30
|
||||
*/
|
||||
@Data
|
||||
public class PlayClerkUserTypeEditVo {
|
||||
|
||||
|
||||
/**
|
||||
* 店员分类ID
|
||||
*/
|
||||
@NotNull(message = "类型不能为空")
|
||||
private String typeId;
|
||||
|
||||
/**
|
||||
* 店员列表
|
||||
*/
|
||||
@NotNull(message = "店员列表不能为空")
|
||||
private List<String> clerkUserIds;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.starry.admin.modules.clerk.module.vo;
|
||||
|
||||
import com.starry.common.domain.BasePageEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @since 2024/6/16 下午6:51
|
||||
**/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class PlayClerkTypeInfoQueryVo extends BasePageEntity {
|
||||
|
||||
|
||||
private String id;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.starry.admin.modules.clerk.module.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @since 2024/6/16 下午6:51
|
||||
**/
|
||||
@Data
|
||||
public class PlayClerkTypeInfoReturnVo {
|
||||
|
||||
private String id;
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 是否在首页显示(0:不显示,1:显示)
|
||||
*/
|
||||
private String homeDisplayed;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
|
||||
/**
|
||||
* 店员数
|
||||
*/
|
||||
private Integer clerkNumber;
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.starry.admin.modules.clerk.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkTypeInfoEntity;
|
||||
import com.starry.admin.modules.clerk.module.vo.PlayClerkTypeInfoQueryVo;
|
||||
import com.starry.admin.modules.clerk.module.vo.PlayClerkTypeInfoReturnVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -31,11 +33,11 @@ public interface IPlayClerkTypeInfoService extends IService<PlayClerkTypeInfoEnt
|
||||
|
||||
/**
|
||||
* 查询店员分类信息列表
|
||||
*
|
||||
* @param playClerkTypeInfo 店员分类信息
|
||||
* @param vo 店员分类信息
|
||||
* @return 店员分类信息集合
|
||||
*/
|
||||
IPage<PlayClerkTypeInfoEntity> selectPlayClerkTypeInfoByPage(PlayClerkTypeInfoEntity playClerkTypeInfo);
|
||||
IPage<PlayClerkTypeInfoReturnVo> selectByPage(PlayClerkTypeInfoQueryVo vo);
|
||||
|
||||
|
||||
/**
|
||||
* 新增店员分类信息
|
||||
|
||||
@@ -26,13 +26,21 @@ import java.util.List;
|
||||
public interface IPlayClerkUserInfoService extends IService<PlayClerkUserInfoEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 根据分组ID查询店员列表
|
||||
*
|
||||
* @param typeId 分类ID
|
||||
* @return 店员列表
|
||||
*/
|
||||
List<PlayClerkUserInfoEntity> listAllByTypeId(String typeId);
|
||||
|
||||
/**
|
||||
* 根据分组ID查询店员列表
|
||||
*
|
||||
* @param groupId 分组ID
|
||||
* @return 店员列表
|
||||
*/
|
||||
List<PlayClerkUserInfoEntity> selecyByGroupId(String groupId);
|
||||
List<PlayClerkUserInfoEntity> selectByGroupId(String groupId);
|
||||
/**
|
||||
* 查询当前租户店员总数
|
||||
*
|
||||
|
||||
@@ -5,9 +5,13 @@ 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;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.starry.admin.modules.clerk.mapper.PlayClerkTypeInfoMapper;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkTypeInfoEntity;
|
||||
import com.starry.admin.modules.clerk.module.vo.PlayClerkTypeInfoQueryVo;
|
||||
import com.starry.admin.modules.clerk.module.vo.PlayClerkTypeInfoReturnVo;
|
||||
import com.starry.admin.modules.clerk.service.IPlayClerkTypeInfoService;
|
||||
import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService;
|
||||
import com.starry.common.utils.IdUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -23,9 +27,13 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
public class PlayClerkTypeInfoServiceImpl extends ServiceImpl<PlayClerkTypeInfoMapper, PlayClerkTypeInfoEntity> implements IPlayClerkTypeInfoService {
|
||||
|
||||
@Resource
|
||||
private PlayClerkTypeInfoMapper playClerkTypeInfoMapper;
|
||||
|
||||
@Resource
|
||||
private IPlayClerkUserInfoService playClerkUserInfoService;
|
||||
|
||||
/**
|
||||
* 查询店员分类信息
|
||||
*
|
||||
@@ -46,13 +54,18 @@ public class PlayClerkTypeInfoServiceImpl extends ServiceImpl<PlayClerkTypeInfoM
|
||||
/**
|
||||
* 查询店员分类信息列表
|
||||
*
|
||||
* @param playClerkTypeInfo 店员分类信息
|
||||
* @param vo 店员分类信息
|
||||
* @return 店员分类信息
|
||||
*/
|
||||
@Override
|
||||
public IPage<PlayClerkTypeInfoEntity> selectPlayClerkTypeInfoByPage(PlayClerkTypeInfoEntity playClerkTypeInfo) {
|
||||
Page<PlayClerkTypeInfoEntity> page = new Page<>(1, 10);
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<PlayClerkTypeInfoEntity>());
|
||||
public IPage<PlayClerkTypeInfoReturnVo> selectByPage(PlayClerkTypeInfoQueryVo vo) {
|
||||
MPJLambdaWrapper<PlayClerkTypeInfoEntity> lambdaWrapper = new MPJLambdaWrapper<>();
|
||||
lambdaWrapper.orderByAsc(PlayClerkTypeInfoEntity::getSort);
|
||||
IPage<PlayClerkTypeInfoReturnVo> page = this.baseMapper.selectJoinPage(new Page<>(vo.getPageNum(), vo.getPageSize()), PlayClerkTypeInfoReturnVo.class, lambdaWrapper);
|
||||
for (PlayClerkTypeInfoReturnVo record : page.getRecords()) {
|
||||
record.setClerkNumber(playClerkUserInfoService.listAllByTypeId(record.getId()).size());
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.starry.admin.modules.clerk.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.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
@@ -65,7 +64,15 @@ public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoM
|
||||
|
||||
|
||||
@Override
|
||||
public List<PlayClerkUserInfoEntity> selecyByGroupId(String groupId) {
|
||||
public List<PlayClerkUserInfoEntity> listAllByTypeId(String typeId) {
|
||||
MPJLambdaWrapper<PlayClerkUserInfoEntity> lambdaWrapper = new MPJLambdaWrapper<>();
|
||||
lambdaWrapper.select(PlayClerkUserInfoEntity::getId);
|
||||
lambdaWrapper.eq(PlayClerkUserInfoEntity::getTypeId, typeId);
|
||||
return this.baseMapper.selectList(lambdaWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlayClerkUserInfoEntity> selectByGroupId(String groupId) {
|
||||
MPJLambdaWrapper<PlayClerkUserInfoEntity> lambdaWrapper = new MPJLambdaWrapper<>();
|
||||
lambdaWrapper.select(PlayClerkUserInfoEntity::getId, PlayClerkUserInfoEntity::getListingState);
|
||||
lambdaWrapper.eq(PlayClerkUserInfoEntity::getGroupId, groupId);
|
||||
@@ -429,7 +436,10 @@ public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoM
|
||||
|
||||
@Override
|
||||
public List<PlayClerkUserInfoEntity> simpleList() {
|
||||
LambdaQueryWrapper<PlayClerkUserInfoEntity> wrapper = Wrappers.lambdaQuery(PlayClerkUserInfoEntity.class).eq(PlayClerkUserInfoEntity::getDeleted, 0).select(PlayClerkUserInfoEntity::getId, PlayClerkUserInfoEntity::getNickname, PlayClerkUserInfoEntity::getAvatar).orderByDesc(PlayClerkUserInfoEntity::getId);
|
||||
return this.list(wrapper);
|
||||
LambdaQueryWrapper<PlayClerkUserInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(PlayClerkUserInfoEntity::getDeleted, 0);
|
||||
lambdaQueryWrapper.select(PlayClerkUserInfoEntity::getId, PlayClerkUserInfoEntity::getNickname, PlayClerkUserInfoEntity::getAvatar, PlayClerkUserInfoEntity::getTypeId, PlayClerkUserInfoEntity::getGroupId);
|
||||
lambdaQueryWrapper.orderByDesc(PlayClerkUserInfoEntity::getId);
|
||||
return this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class PlayPersonnelGroupInfoController {
|
||||
public R listByPage(@Validated @RequestBody PlayPersonnelGroupInfoQueryVo vo) {
|
||||
IPage<PlayPersonnelGroupInfoReturnVo> list = playClerkGroupInfoService.selectByPage(vo);
|
||||
for (PlayPersonnelGroupInfoReturnVo record : list.getRecords()) {
|
||||
List<PlayClerkUserInfoEntity> clerkUserInfoEntities = playClerkUserInfoService.selecyByGroupId(record.getId());
|
||||
List<PlayClerkUserInfoEntity> clerkUserInfoEntities = playClerkUserInfoService.selectByGroupId(record.getId());
|
||||
record.setTotalEmployeesNumber(clerkUserInfoEntities.size());
|
||||
record.setListingEmployeesNumber(clerkUserInfoEntities.stream().collect(Collectors.toMap(PlayClerkUserInfoEntity::getListingState, PlayClerkUserInfoEntity::getId)).size());
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class PlayPersonnelGroupInfoController {
|
||||
@DeleteMapping("/{ids}")
|
||||
public R remove(@PathVariable String[] ids) {
|
||||
for (String id : ids) {
|
||||
List<PlayClerkUserInfoEntity> clerkUserInfoEntities = playClerkUserInfoService.selecyByGroupId(id);
|
||||
List<PlayClerkUserInfoEntity> clerkUserInfoEntities = playClerkUserInfoService.selectByGroupId(id);
|
||||
if (!clerkUserInfoEntities.isEmpty()) {
|
||||
throw new CustomException("分组中存在店员,禁止删除");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user