dev-chenjiajian #1
@ -63,7 +63,8 @@ public class AdminAgentEmployeeRelationController {
|
|||||||
@Operation(summary = "根据代理商ID获取员工列表")
|
@Operation(summary = "根据代理商ID获取员工列表")
|
||||||
@GetMapping("/by-agent/{agentId}")
|
@GetMapping("/by-agent/{agentId}")
|
||||||
@SaCheckPermission("mp:admin:agent:employee:by-agent")
|
@SaCheckPermission("mp:admin:agent:employee:by-agent")
|
||||||
public ResultBean<java.util.List<AgentEmployeeRelationResp>> getByAgent(@PathVariable Integer agentId) {
|
public ResultBean<PageListBean<AgentEmployeeRelationResp>> getByAgent(@PathVariable Integer agentId,
|
||||||
return ResultBean.success(agentEmployeeRelationService.getEmployeeRelationsByAgentId(agentId));
|
@RequestBody @Validated AgentEmployeeRelationQueryReq query) {
|
||||||
|
return ResultBean.success(agentEmployeeRelationService.getEmployeeRelationsByAgentId(agentId, query));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,9 +8,6 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class AgentEmployeeRelationQueryReq extends PageRequest {
|
public class AgentEmployeeRelationQueryReq extends PageRequest {
|
||||||
|
|
||||||
@Schema(description = "代理商名称")
|
|
||||||
private String agentName;
|
|
||||||
|
|
||||||
@Schema(description = "员工名称")
|
@Schema(description = "员工名称")
|
||||||
private String employeeName;
|
private String employeeName;
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
package com.seer.teach.mp.admin.service;
|
package com.seer.teach.mp.admin.service;
|
||||||
|
|
||||||
import com.seer.teach.common.PageListBean;
|
import com.seer.teach.common.PageListBean;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationQueryReq;
|
||||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeSaveReq;
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeSaveReq;
|
||||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeUpdateReq;
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeUpdateReq;
|
||||||
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
||||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationQueryReq;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -56,7 +54,7 @@ public interface IAdminAgentEmployeeRelationService {
|
|||||||
* @param agentId 代理商ID
|
* @param agentId 代理商ID
|
||||||
* @return 员工关联列表
|
* @return 员工关联列表
|
||||||
*/
|
*/
|
||||||
List<AgentEmployeeRelationResp> getEmployeeRelationsByAgentId(Integer agentId);
|
PageListBean<AgentEmployeeRelationResp> getEmployeeRelationsByAgentId(Integer agentId,AgentEmployeeRelationQueryReq query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增代理商员工关联(管理端)
|
* 新增代理商员工关联(管理端)
|
||||||
|
|||||||
@ -22,7 +22,6 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,7 +47,6 @@ public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmploye
|
|||||||
public PageListBean<AgentEmployeeRelationResp> pageList(AgentEmployeeRelationQueryReq query) {
|
public PageListBean<AgentEmployeeRelationResp> pageList(AgentEmployeeRelationQueryReq query) {
|
||||||
Page<MpAgentEmployeeRelationEntity> pageParm = new Page<>(query.getPageNo(), query.getPageSize());
|
Page<MpAgentEmployeeRelationEntity> pageParm = new Page<>(query.getPageNo(), query.getPageSize());
|
||||||
var pageResult = agentEmployeeRelationService.page(pageParm, new LambdaQueryWrapper<>(MpAgentEmployeeRelationEntity.class)
|
var pageResult = agentEmployeeRelationService.page(pageParm, new LambdaQueryWrapper<>(MpAgentEmployeeRelationEntity.class)
|
||||||
.like(Objects.nonNull(query.getAgentName()), MpAgentEmployeeRelationEntity::getAgentName, query.getAgentName())
|
|
||||||
.like(Objects.nonNull(query.getEmployeeName()), MpAgentEmployeeRelationEntity::getEmployeeName, query.getEmployeeName())
|
.like(Objects.nonNull(query.getEmployeeName()), MpAgentEmployeeRelationEntity::getEmployeeName, query.getEmployeeName())
|
||||||
.eq(Objects.nonNull(query.getStatus()), MpAgentEmployeeRelationEntity::getStatus, query.getStatus()));
|
.eq(Objects.nonNull(query.getStatus()), MpAgentEmployeeRelationEntity::getStatus, query.getStatus()));
|
||||||
|
|
||||||
@ -97,11 +95,14 @@ public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmploye
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AgentEmployeeRelationResp> getEmployeeRelationsByAgentId(Integer agentId) {
|
public PageListBean<AgentEmployeeRelationResp> getEmployeeRelationsByAgentId(Integer agentId,AgentEmployeeRelationQueryReq query) {
|
||||||
var relations = agentEmployeeRelationService.getEmployeeRelationsByAgentId(agentId);
|
Page<MpAgentEmployeeRelationEntity> page = new Page<>(query.getPageNo(), query.getPageSize());
|
||||||
return relations.stream()
|
LambdaQueryWrapper<MpAgentEmployeeRelationEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
.map(AdminAgentEmployeeRelationConvert.INSTANCE::convertToResp)
|
wrapper.eq(MpAgentEmployeeRelationEntity::getAgentId, agentId)
|
||||||
.toList();
|
.like(Objects.nonNull(query.getEmployeeName()), MpAgentEmployeeRelationEntity::getEmployeeName, query.getEmployeeName())
|
||||||
|
.eq(Objects.nonNull(query.getStatus()), MpAgentEmployeeRelationEntity::getStatus, query.getStatus());
|
||||||
|
Page<MpAgentEmployeeRelationEntity> pageParm = agentEmployeeRelationService.page(page, wrapper);
|
||||||
|
return PageConverterUtils.convertPageListBean(pageParm, AdminAgentEmployeeRelationConvert.INSTANCE::convertToRespList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user