fix:修改活动参与管理的新增和修改详情接口更改
This commit is contained in:
parent
1a33d1cef2
commit
495ce97ce7
@ -33,6 +33,13 @@ public class MpAgentEmployeeRelationEntity extends BaseEntity {
|
|||||||
@TableField("employee_user_id")
|
@TableField("employee_user_id")
|
||||||
private Integer employeeUserId;
|
private Integer employeeUserId;
|
||||||
|
|
||||||
|
|
||||||
|
@TableField("agent_name")
|
||||||
|
private String agentName;
|
||||||
|
|
||||||
|
@TableField("employee_name")
|
||||||
|
private String employeeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 员工职位
|
* 员工职位
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -6,20 +6,14 @@ import com.seer.teach.common.ResultBean;
|
|||||||
import com.seer.teach.common.annotation.LogPrint;
|
import com.seer.teach.common.annotation.LogPrint;
|
||||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationQueryReq;
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationQueryReq;
|
||||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeSaveReq;
|
||||||
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
||||||
import com.seer.teach.mp.admin.service.IAdminAgentEmployeeRelationService;
|
import com.seer.teach.mp.admin.service.IAdminAgentEmployeeRelationService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
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;
|
|
||||||
|
|
||||||
@LogPrint
|
@LogPrint
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@ -37,10 +31,17 @@ public class AdminAgentEmployeeRelationController {
|
|||||||
return ResultBean.success(agentEmployeeRelationService.pageList(query));
|
return ResultBean.success(agentEmployeeRelationService.pageList(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "创建或更新代理商员工关联")
|
@Operation(summary = "新增代理商员工关联")
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
@SaCheckPermission("mp:admin:agent:employee:save")
|
@SaCheckPermission("mp:admin:agent:employee:save")
|
||||||
public ResultBean<Boolean> save(@Valid @RequestBody AgentEmployeeRelationReq request) {
|
public ResultBean<Boolean> save(@RequestBody @Validated AgentEmployeeSaveReq request) {
|
||||||
|
return ResultBean.success(agentEmployeeRelationService.save(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "更新代理商员工关联")
|
||||||
|
@PostMapping("/update")
|
||||||
|
@SaCheckPermission("mp:admin:agent:employee:update")
|
||||||
|
public ResultBean<Boolean> update(@RequestBody @Validated AgentEmployeeRelationReq request) {
|
||||||
return ResultBean.success(agentEmployeeRelationService.saveOrUpdateRelation(request));
|
return ResultBean.success(agentEmployeeRelationService.saveOrUpdateRelation(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,11 +8,11 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class AgentEmployeeRelationQueryReq extends PageRequest {
|
public class AgentEmployeeRelationQueryReq extends PageRequest {
|
||||||
|
|
||||||
@Schema(description = "代理商ID")
|
@Schema(description = "代理商名称")
|
||||||
private Integer agentId;
|
private String agentName;
|
||||||
|
|
||||||
@Schema(description = "员工用户ID")
|
@Schema(description = "员工名称")
|
||||||
private Integer employeeUserId;
|
private String employeeName;
|
||||||
|
|
||||||
@Schema(description = "员工状态:0-禁用,1-启用")
|
@Schema(description = "员工状态:0-禁用,1-启用")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(name = "AgentEmployeeSaveReq", description = "新增代理商员工请求参数")
|
||||||
|
public class AgentEmployeeSaveReq {
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "代理商名称")
|
||||||
|
@NotNull(message = "代理商名称不能为空")
|
||||||
|
private String agentName;
|
||||||
|
|
||||||
|
@Schema(description = "员工名称")
|
||||||
|
@NotNull(message = "员工名称不能为空")
|
||||||
|
private String employeeName;
|
||||||
|
|
||||||
|
@Schema(description = "员工职位")
|
||||||
|
private String position;
|
||||||
|
|
||||||
|
@Schema(description = "员工状态:0-禁用,1-启用")
|
||||||
|
private Integer status = 1;
|
||||||
|
}
|
||||||
@ -14,9 +14,15 @@ public class AgentEmployeeRelationResp {
|
|||||||
@Schema(description = "代理商ID")
|
@Schema(description = "代理商ID")
|
||||||
private Integer agentId;
|
private Integer agentId;
|
||||||
|
|
||||||
|
@Schema(description = "代理商名称")
|
||||||
|
private String agentName;
|
||||||
|
|
||||||
@Schema(description = "员工用户ID")
|
@Schema(description = "员工用户ID")
|
||||||
private Integer employeeUserId;
|
private Integer employeeUserId;
|
||||||
|
|
||||||
|
@Schema(description = "员工名称")
|
||||||
|
private String employeeName;
|
||||||
|
|
||||||
@Schema(description = "员工职位")
|
@Schema(description = "员工职位")
|
||||||
private String position;
|
private String position;
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.seer.teach.mp.admin.convert;
|
|||||||
|
|
||||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationQueryReq;
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationQueryReq;
|
||||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeSaveReq;
|
||||||
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
||||||
import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity;
|
import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
@ -21,4 +22,6 @@ public interface AdminAgentEmployeeRelationConvert {
|
|||||||
AgentEmployeeRelationResp convertToResp(MpAgentEmployeeRelationEntity entity);
|
AgentEmployeeRelationResp convertToResp(MpAgentEmployeeRelationEntity entity);
|
||||||
|
|
||||||
List<AgentEmployeeRelationResp> convertToRespList(List<MpAgentEmployeeRelationEntity> mpAgentEmployeeRelationEntities);
|
List<AgentEmployeeRelationResp> convertToRespList(List<MpAgentEmployeeRelationEntity> mpAgentEmployeeRelationEntities);
|
||||||
|
|
||||||
|
MpAgentEmployeeRelationEntity convert(AgentEmployeeSaveReq request);
|
||||||
}
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
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.AgentEmployeeSaveReq;
|
||||||
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 com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationQueryReq;
|
||||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
|
||||||
@ -56,4 +57,11 @@ public interface IAdminAgentEmployeeRelationService {
|
|||||||
* @return 员工关联列表
|
* @return 员工关联列表
|
||||||
*/
|
*/
|
||||||
List<AgentEmployeeRelationResp> getEmployeeRelationsByAgentId(Integer agentId);
|
List<AgentEmployeeRelationResp> getEmployeeRelationsByAgentId(Integer agentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增代理商员工关联(管理端)
|
||||||
|
* @param request 新增代理商员工关联请求对象
|
||||||
|
* @return 新增是否成功
|
||||||
|
*/
|
||||||
|
boolean save(AgentEmployeeSaveReq request);
|
||||||
}
|
}
|
||||||
@ -3,14 +3,19 @@ package com.seer.teach.mp.admin.service.impl;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.seer.teach.common.PageListBean;
|
import com.seer.teach.common.PageListBean;
|
||||||
|
import com.seer.teach.common.enums.ResultCodeEnum;
|
||||||
|
import com.seer.teach.common.utils.AssertUtils;
|
||||||
import com.seer.teach.common.utils.PageConverterUtils;
|
import com.seer.teach.common.utils.PageConverterUtils;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeSaveReq;
|
||||||
import com.seer.teach.mp.admin.service.IAdminAgentEmployeeRelationService;
|
import com.seer.teach.mp.admin.service.IAdminAgentEmployeeRelationService;
|
||||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationQueryReq;
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationQueryReq;
|
||||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
|
||||||
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
||||||
import com.seer.teach.mp.admin.convert.AdminAgentEmployeeRelationConvert;
|
import com.seer.teach.mp.admin.convert.AdminAgentEmployeeRelationConvert;
|
||||||
import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity;
|
import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentEntity;
|
||||||
import com.seer.teach.mp.service.IMpAgentEmployeeRelationService;
|
import com.seer.teach.mp.service.IMpAgentEmployeeRelationService;
|
||||||
|
import com.seer.teach.mp.service.IMpAgentService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -31,12 +36,14 @@ public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmploye
|
|||||||
|
|
||||||
private final IMpAgentEmployeeRelationService agentEmployeeRelationService;
|
private final IMpAgentEmployeeRelationService agentEmployeeRelationService;
|
||||||
|
|
||||||
|
private final IMpAgentService mpAgentService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
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)
|
||||||
.eq(Objects.nonNull(query.getAgentId()), MpAgentEmployeeRelationEntity::getAgentId, query.getAgentId())
|
.like(Objects.nonNull(query.getAgentName()), MpAgentEmployeeRelationEntity::getAgentName, query.getAgentName())
|
||||||
.eq(Objects.nonNull(query.getEmployeeUserId()), MpAgentEmployeeRelationEntity::getEmployeeUserId, query.getEmployeeUserId())
|
.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()));
|
||||||
|
|
||||||
return PageConverterUtils.convertPageListBean(pageResult, AdminAgentEmployeeRelationConvert.INSTANCE::convertToRespList);
|
return PageConverterUtils.convertPageListBean(pageResult, AdminAgentEmployeeRelationConvert.INSTANCE::convertToRespList);
|
||||||
@ -66,4 +73,12 @@ public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmploye
|
|||||||
.map(AdminAgentEmployeeRelationConvert.INSTANCE::convertToResp)
|
.map(AdminAgentEmployeeRelationConvert.INSTANCE::convertToResp)
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean save(AgentEmployeeSaveReq request) {
|
||||||
|
AssertUtils.isNull(request.getAgentName(), ResultCodeEnum.AGENT_EMPLOYEE_ALREADY_EXISTS);
|
||||||
|
MpAgentEmployeeRelationEntity relation = AdminAgentEmployeeRelationConvert.INSTANCE.convert(request);
|
||||||
|
Integer agentId = mpAgentService.lambdaQuery().eq(MpAgentEntity::getAgentName, request.getAgentName()).one().getId();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -25,6 +25,8 @@ CREATE TABLE `mp_agent_employee_relation` (
|
|||||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '关联ID',
|
`id` int NOT NULL AUTO_INCREMENT COMMENT '关联ID',
|
||||||
`agent_id` int NOT NULL COMMENT '代理商ID(对应user表的ID)',
|
`agent_id` int NOT NULL COMMENT '代理商ID(对应user表的ID)',
|
||||||
`employee_user_id` int NOT NULL COMMENT '员工用户ID(对应user表的ID)',
|
`employee_user_id` int NOT NULL COMMENT '员工用户ID(对应user表的ID)',
|
||||||
|
`agent_name` varchar(50) COMMENT '代理商名称',
|
||||||
|
`employee_name` varchar(50) COMMENT '员工名称',
|
||||||
`position` varchar(50) COMMENT '员工职位',
|
`position` varchar(50) COMMENT '员工职位',
|
||||||
`status` tinyint NOT NULL DEFAULT '1' COMMENT '员工状态:0-禁用,1-启用',
|
`status` tinyint NOT NULL DEFAULT '1' COMMENT '员工状态:0-禁用,1-启用',
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user