完成了第一版
This commit is contained in:
parent
6e5557d8e0
commit
3c48d562a8
|
@ -192,10 +192,10 @@ public class ProjectController {
|
|||
@Operation(summary = "web端管理员添加项目", description = "参数:项目添加请求体,权限:管理员,方法名:addProject")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目管理", content = "web端管理员添加项目")
|
||||
public BaseResponse<Boolean> addProject(@Valid @RequestBody ProjectAddRequest projectAddRequest) {
|
||||
public BaseResponse<Long> addProject(@Valid @RequestBody ProjectAddRequest projectAddRequest) {
|
||||
Project project = commonService.copyProperties(projectAddRequest, Project.class);
|
||||
projectService.save(project);
|
||||
return ResultUtils.success(true);
|
||||
return ResultUtils.success(project.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -75,6 +75,9 @@ public class ProjectDetailController {
|
|||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目明细管理", content = "web端管理员添加项目明细")
|
||||
public BaseResponse<Boolean> addProjectDetail(@Valid @RequestBody ProjectDetailAddRequest projectDetailAddRequest) {
|
||||
Long proId = projectDetailAddRequest.getProjectId();
|
||||
Project pro = projectService.getById(proId);
|
||||
ThrowUtils.throwIf(pro == null, ErrorCode.OPERATION_ERROR, "项目不存在");
|
||||
ProjectDetail projectDetail = commonService.copyProperties(projectDetailAddRequest, ProjectDetail.class);
|
||||
projectDetailService.save(projectDetail);
|
||||
|
||||
|
|
|
@ -13,10 +13,12 @@ import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
|||
import com.greenorange.promotion.model.dto.projectNotification.ProjectNotificationAddRequest;
|
||||
import com.greenorange.promotion.model.dto.projectNotification.ProjectNotificationQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.projectNotification.ProjectNotificationUpdateRequest;
|
||||
import com.greenorange.promotion.model.entity.Project;
|
||||
import com.greenorange.promotion.model.entity.ProjectNotification;
|
||||
import com.greenorange.promotion.model.vo.projectNotification.ProjectNotificationVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.project.ProjectNotificationService;
|
||||
import com.greenorange.promotion.service.project.ProjectService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
|
@ -47,6 +49,9 @@ public class ProjectNotificationController {
|
|||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
@Resource
|
||||
private ProjectService projectService;
|
||||
|
||||
/**
|
||||
* web端管理员添加项目通知
|
||||
* @param projectNotificationAddRequest 项目通知添加请求体
|
||||
|
@ -57,6 +62,9 @@ public class ProjectNotificationController {
|
|||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目通知管理", content = "web端管理员添加项目通知")
|
||||
public BaseResponse<Boolean> addProjectNotification(@Valid @RequestBody ProjectNotificationAddRequest projectNotificationAddRequest) {
|
||||
Long proId = projectNotificationAddRequest.getProjectId();
|
||||
Project pro = projectService.getById(proId);
|
||||
ThrowUtils.throwIf(pro == null, ErrorCode.OPERATION_ERROR, "项目不存在");
|
||||
ProjectNotification projectNotification = commonService.copyProperties(projectNotificationAddRequest, ProjectNotification.class);
|
||||
projectNotificationService.save(projectNotification);
|
||||
return ResultUtils.success(true);
|
||||
|
@ -105,7 +113,6 @@ public class ProjectNotificationController {
|
|||
public BaseResponse<ProjectNotificationVO> queryProjectNotificationById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
ProjectNotification projectNotification = projectNotificationService.getById(id);
|
||||
ThrowUtils.throwIf(projectNotification == null, ErrorCode.OPERATION_ERROR, "当前项目通知不存在");
|
||||
ProjectNotificationVO projectNotificationVO = commonService.copyProperties(projectNotification, ProjectNotificationVO.class);
|
||||
return ResultUtils.success(projectNotificationVO);
|
||||
}
|
||||
|
@ -122,9 +129,7 @@ public class ProjectNotificationController {
|
|||
@SysLog(title = "项目通知管理", content = "web端管理员根据项目id查询项目通知")
|
||||
public BaseResponse<List<ProjectNotificationVO>> queryProjectNotificationByPid(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
LambdaQueryWrapper<ProjectNotification> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ProjectNotification::getProjectId, id);
|
||||
List<ProjectNotification> projectNotificationList = projectNotificationService.list(lambdaQueryWrapper);
|
||||
List<ProjectNotification> projectNotificationList = commonService.findByFieldEqTargetField(ProjectNotification::getProjectId, id, projectNotificationService);
|
||||
List<ProjectNotificationVO> projectNotificationVOS = commonService.convertList(projectNotificationList, ProjectNotificationVO.class);
|
||||
return ResultUtils.success(projectNotificationVOS);
|
||||
}
|
||||
|
|
|
@ -13,10 +13,12 @@ import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
|||
import com.greenorange.promotion.model.dto.promoCode.PromoCodeAddRequest;
|
||||
import com.greenorange.promotion.model.dto.promoCode.PromoCodeQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.promoCode.PromoCodeUpdateRequest;
|
||||
import com.greenorange.promotion.model.entity.Project;
|
||||
import com.greenorange.promotion.model.entity.PromoCode;
|
||||
import com.greenorange.promotion.model.entity.UserInfo;
|
||||
import com.greenorange.promotion.model.vo.promoCode.PromoCodeVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.project.ProjectService;
|
||||
import com.greenorange.promotion.service.project.PromoCodeService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -48,6 +50,9 @@ public class PromoCodeController {
|
|||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
@Resource
|
||||
private ProjectService projectService;
|
||||
|
||||
/**
|
||||
* web端管理员添加推广码
|
||||
* @param promoCodeAddRequest 推广码添加请求体
|
||||
|
@ -58,6 +63,9 @@ public class PromoCodeController {
|
|||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "推广码管理", content = "web端管理员添加推广码")
|
||||
public BaseResponse<Boolean> addPromoCode(@Valid @RequestBody PromoCodeAddRequest promoCodeAddRequest) {
|
||||
Long proId = promoCodeAddRequest.getProjectId();
|
||||
Project pro = projectService.getById(proId);
|
||||
ThrowUtils.throwIf(pro == null, ErrorCode.OPERATION_ERROR, "项目不存在");
|
||||
PromoCode promoCode = commonService.copyProperties(promoCodeAddRequest, PromoCode.class);
|
||||
promoCodeService.save(promoCode);
|
||||
return ResultUtils.success(true);
|
||||
|
@ -127,7 +135,6 @@ public class PromoCodeController {
|
|||
public BaseResponse<PromoCodeVO> queryPromoCodeById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
PromoCode promoCode = promoCodeService.getById(id);
|
||||
ThrowUtils.throwIf(promoCode == null, ErrorCode.OPERATION_ERROR, "当前推广码不存在");
|
||||
PromoCodeVO promoCodeVO = commonService.copyProperties(promoCode, PromoCodeVO.class);
|
||||
return ResultUtils.success(promoCodeVO);
|
||||
}
|
||||
|
|
|
@ -30,10 +30,10 @@ public class ${entityName}Controller {
|
|||
@Operation(summary = "web端管理员添加${entityComment}", description = "参数:${entityComment}添加请求体,权限:管理员,方法名:add${entityName}")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "${entityComment}管理", content = "web端管理员添加${entityComment}")
|
||||
public BaseResponse<Boolean> add${entityName}(@Valid @RequestBody ${entityName}AddRequest ${entityNameLower}AddRequest) {
|
||||
public BaseResponse<Long> add${entityName}(@Valid @RequestBody ${entityName}AddRequest ${entityNameLower}AddRequest) {
|
||||
${entityName} ${entityNameLower} = commonService.copyProperties(${entityNameLower}AddRequest, ${entityName}.class);
|
||||
${entityNameLower}Service.save(${entityNameLower});
|
||||
return ResultUtils.success(true);
|
||||
return ResultUtils.success(${entityNameLower}.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,7 +93,6 @@ public class ${entityName}Controller {
|
|||
public BaseResponse<${entityName}VO> query${entityName}ById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
${entityName} ${entityNameLower} = ${entityNameLower}Service.getById(id);
|
||||
ThrowUtils.throwIf(${entityNameLower} == null, ErrorCode.OPERATION_ERROR, "当前${entityComment}不存在");
|
||||
${entityName}VO ${entityNameLower}VO = commonService.copyProperties(${entityNameLower}, ${entityName}VO.class);
|
||||
return ResultUtils.success(${entityNameLower}VO);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user