5 changed files with 100 additions and 28 deletions
@ -0,0 +1,83 @@ |
|||
package com.kms.yg.sz.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import com.kms.yg.sz.domain.BsSgcSzGcda; |
|||
import com.kms.yg.sz.domain.BsSgcSzGcgl; |
|||
import com.kms.yg.sz.service.BsSgcSzGcdaService; |
|||
import com.kms.yg.sz.service.BsSgcSzGcglService; |
|||
import com.shuili.common.core.domain.AjaxResult; |
|||
import lombok.Data; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
@RestController |
|||
@RequestMapping("/sz/contrast") |
|||
public class ContrastController { |
|||
|
|||
@Autowired |
|||
private BsSgcSzGcdaService bsSgcSzGcdaService; |
|||
|
|||
@Autowired |
|||
private BsSgcSzGcglService bsSgcSzGcglService; |
|||
|
|||
|
|||
@GetMapping("/{sluiceCode}") |
|||
public AjaxResult contrast(@PathVariable String sluiceCode) { |
|||
|
|||
ContrastResult contrastResult = new ContrastResult(); |
|||
|
|||
//基本信息
|
|||
//查询当前使用的版本
|
|||
QueryWrapper<BsSgcSzGcda> queryWrapper = Wrappers.query(); |
|||
queryWrapper.isNull("record_lose_efficacy_time"); |
|||
queryWrapper.eq("sluice_code", sluiceCode); |
|||
|
|||
BsSgcSzGcda one = bsSgcSzGcdaService.getOne(queryWrapper); |
|||
|
|||
//查询之前的10个版本
|
|||
QueryWrapper<BsSgcSzGcda> query = Wrappers.query(); |
|||
query.eq("sluice_code", sluiceCode).isNotNull("record_lose_efficacy_time") |
|||
.orderByDesc("record_lose_efficacy_time") |
|||
.last("limit 10"); |
|||
|
|||
List<BsSgcSzGcda> list = bsSgcSzGcdaService.list(query); |
|||
|
|||
list.add(one); |
|||
contrastResult.setJbxx(list); |
|||
|
|||
//工程管理
|
|||
//查询当前版本
|
|||
QueryWrapper<BsSgcSzGcgl> wrapper = new QueryWrapper<>(); |
|||
wrapper.isNull("record_lose_efficacy_time"); |
|||
wrapper.eq("sluice_code", sluiceCode); |
|||
|
|||
BsSgcSzGcgl one1 = bsSgcSzGcglService.getOne(wrapper); |
|||
|
|||
//查询之前的10个版本
|
|||
QueryWrapper<BsSgcSzGcgl> query1 = Wrappers.query(); |
|||
query1.eq("sluice_code", sluiceCode).isNotNull("record_lose_efficacy_time") |
|||
.orderByDesc("record_lose_efficacy_time") |
|||
.last("limit 10"); |
|||
|
|||
List<BsSgcSzGcgl> list1 = bsSgcSzGcglService.list(query1); |
|||
list1.add(one1); |
|||
contrastResult.setGcgl(list1); |
|||
return AjaxResult.success(contrastResult); |
|||
|
|||
} |
|||
|
|||
@Data |
|||
public class ContrastResult { |
|||
private List<BsSgcSzGcda> jbxx; |
|||
|
|||
private List<BsSgcSzGcgl> gcgl; |
|||
|
|||
} |
|||
} |
Loading…
Reference in new issue