Browse Source

增加批量获取评审模版的接口

tags/24080901
WendyYang 1 year ago
parent
commit
406bcb74e5
3 changed files with 22 additions and 5 deletions
  1. +9
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ReviewTemplateSettingsController.java
  2. +8
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ReviewTemplateSettingsManage.java
  3. +5
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/entity/ReviewTemplateSettings.java

+ 9
- 2
pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ReviewTemplateSettingsController.java View File

@@ -12,6 +12,7 @@ import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;


import javax.validation.Valid; import javax.validation.Valid;
import java.util.List;


/** /**
* <p> * <p>
@@ -42,10 +43,16 @@ public class ReviewTemplateSettingsController {
reviewTemplateSettingsManage.saveOrUpdate(req); reviewTemplateSettingsManage.saveOrUpdate(req);
} }


@GetMapping("/template/{templateId}")
@GetMapping("/template")
@ApiModelProperty("根据模版ID获取评审模版") @ApiModelProperty("根据模版ID获取评审模版")
public ReviewTemplateVO getTemplateById(@PathVariable Long templateId) {
public ReviewTemplateVO getTemplateById(@RequestParam Long templateId) {
return reviewTemplateSettingsManage.getReviewTemplateSettings(templateId); return reviewTemplateSettingsManage.getReviewTemplateSettings(templateId);
} }


@GetMapping("/templates")
@ApiModelProperty("(批量)根据模版ID获取评审模版")
public List<ReviewTemplateVO> getTemplateById(@RequestParam List<Long> templateIds) {
return reviewTemplateSettingsManage.listReviewTemplateSettings(templateIds);
}

} }

+ 8
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ReviewTemplateSettingsManage.java View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateSettingsDTO; import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateSettingsDTO;
import com.ningdatech.pmapi.expert.model.entity.ReviewTemplateSettings; import com.ningdatech.pmapi.expert.model.entity.ReviewTemplateSettings;
@@ -16,6 +17,8 @@ import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;


import java.util.List;

/** /**
* <p> * <p>
* ReviewTemplateSettingsManage * ReviewTemplateSettingsManage
@@ -62,6 +65,11 @@ public class ReviewTemplateSettingsManage {
return buildTemplateDetail(settings); return buildTemplateDetail(settings);
} }


public List<ReviewTemplateVO> listReviewTemplateSettings(List<Long> templateIds) {
List<ReviewTemplateSettings> settings = reviewTemplateSettingsService.listByIds(templateIds);
return CollUtils.convert(settings, this::buildTemplateDetail);
}

private ReviewTemplateVO buildTemplateDetail(ReviewTemplateSettings settings) { private ReviewTemplateVO buildTemplateDetail(ReviewTemplateSettings settings) {
if (settings == null) { if (settings == null) {
throw BizException.wrap("模版不存在"); throw BizException.wrap("模版不存在");


+ 5
- 3
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/entity/ReviewTemplateSettings.java View File

@@ -1,8 +1,6 @@
package com.ningdatech.pmapi.expert.model.entity; package com.ningdatech.pmapi.expert.model.entity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -41,12 +39,16 @@ public class ReviewTemplateSettings implements Serializable {
@ApiModelProperty("区域编码") @ApiModelProperty("区域编码")
private String regionCode; private String regionCode;


@TableField(fill = FieldFill.INSERT)
private Long createBy; private Long createBy;


@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updateBy; private Long updateBy;


@TableField(fill = FieldFill.INSERT)
private LocalDateTime createOn; private LocalDateTime createOn;


@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateOn; private LocalDateTime updateOn;


} }

Loading…
Cancel
Save