提交 fe30d6e5 authored 作者: 133's avatar 133

Merge branch 'master' of git.yfzx.zjtys.com.cn:matrix/device-back into dev

package com.tykj.dev.device.library.subject.vo;
import com.tykj.dev.misc.base.CustomPage;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -16,10 +17,7 @@ import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DeviceSelectIdsVo {
private Integer page;
private Integer size;
public class DeviceSelectIdsVo extends CustomPage {
private List<Integer> ids;
}
......@@ -8,10 +8,15 @@ package com.tykj.dev.statistical.controller;
* @createTime 2020年10月16日 14:53:00
*/
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.file.util.ArrayUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.*;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.DeviceModelSort;
import com.tykj.dev.misc.utils.PageUtil;
......@@ -22,9 +27,11 @@ import com.tykj.dev.statistical.vo.DeviceStatistics;
import com.tykj.dev.statistical.vo.ScrappedDestroyedRetiredVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.hibernate.mapping.Array;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
......@@ -51,6 +58,9 @@ public class StatisticalController {
@Autowired
private DeviceLibraryService deviceLibraryService;
@Autowired
DeviceLibraryDao deviceLibraryDao;
// @Autowired
// private ConfigCache configCache;
......@@ -248,19 +258,22 @@ public class StatisticalController {
@ApiOperation(value = "根据装备id查询装备详情", notes = "根据装备id查询装备详情")
@PostMapping("/selectByIds2")
public List<DeviceLibrary> selectByIds2(@RequestBody DeviceSelectIdsVo deviceSelectIdsVo){
List<DeviceLibrary> byIds = deviceLibraryService.findByIds(deviceSelectIdsVo.getIds());
byIds.forEach(DeviceLibrary::setConfigName);
// List<ScrappedVos> scrappedVosArrayList = new ArrayList<>();
ScrappedVos scrappedVos = new ScrappedVos();
// byIds.forEach(
// deviceLibrary -> {
// BeanUtils.copyProperties(deviceLibrary,scrappedVos);
// scrappedVosArrayList.add(scrappedVos);
// }
// );
return byIds;
public ResponseEntity selectByIds2(@RequestBody DeviceSelectIdsVo deviceSelectIdsVo){
Page<DeviceLibrary> byIds = deviceLibraryDao.findAll(getFindRetiredSpecification(deviceSelectIdsVo),deviceSelectIdsVo.getPageable()).map(DeviceLibrary::setConfigName);
return ResponseEntity.ok(byIds);
}
private Specification<DeviceLibrary> getFindRetiredSpecification(DeviceSelectIdsVo deviceSelectIdsVo) {
PredicateBuilder<DeviceLibrary> predicateBuilder = Specifications.and();
// List<Integer> leftStatus=new ArrayList<>();
// leftStatus.add(com.tykj.dev.config.base.DeviceLifeStatus.RETIRED.id);
if (deviceSelectIdsVo.getIds()!= null&&deviceSelectIdsVo.getIds().size()!=0) {
predicateBuilder.in("id",deviceSelectIdsVo.getIds().toArray());
}
return predicateBuilder.build();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论