Przeglądaj źródła

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

tags/24080901
WendyYang 1 rok temu
rodzic
commit
406bcb74e5
3 zmienionych plików z 22 dodań i 5 usunięć
  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 Wyświetl plik

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

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

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

@GetMapping("/template/{templateId}")
@GetMapping("/template")
@ApiModelProperty("根据模版ID获取评审模版")
public ReviewTemplateVO getTemplateById(@PathVariable Long templateId) {
public ReviewTemplateVO getTemplateById(@RequestParam Long 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 Wyświetl plik

@@ -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.toolkit.Wrappers;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateSettingsDTO;
import com.ningdatech.pmapi.expert.model.entity.ReviewTemplateSettings;
@@ -16,6 +17,8 @@ import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
* <p>
* ReviewTemplateSettingsManage
@@ -62,6 +65,11 @@ public class ReviewTemplateSettingsManage {
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) {
if (settings == null) {
throw BizException.wrap("模版不存在");


+ 5
- 3
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/entity/ReviewTemplateSettings.java Wyświetl plik

@@ -1,8 +1,6 @@
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.ApiModelProperty;
import lombok.Data;
@@ -41,12 +39,16 @@ public class ReviewTemplateSettings implements Serializable {
@ApiModelProperty("区域编码")
private String regionCode;

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

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

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

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

}

Ładowanie…
Anuluj
Zapisz