| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.TDept; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.AssetMain; |
| | | import com.ruoyi.system.query.AssetRepairRequestListQuery; |
| | | import com.ruoyi.system.query.AssetStatisticsListQuery; |
| | | import com.ruoyi.system.service.AssetMainService; |
| | | import com.ruoyi.system.service.AssetRepairRecordService; |
| | | import com.ruoyi.system.service.TDeptService; |
| | | import com.ruoyi.system.vo.AssetRepairRequestVO; |
| | | import com.ruoyi.system.vo.AssetStatisticsVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/asset-repair-request") |
| | | public class AssetRepairRequestController { |
| | | @Api(tags = {"资产报修"}) |
| | | |
| | | public class AssetRepairRequestController { |
| | | @Resource |
| | | private AssetRepairRecordService assetRepairRecordService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private TDeptService deptService; |
| | | @Resource |
| | | private AssetMainService assetMainService; |
| | | |
| | | @ApiOperation("资产报修分页列表") |
| | | @PostMapping("/pageList") |
| | | public R<PageInfo<AssetRepairRequestVO>> pageList(@RequestBody AssetRepairRequestListQuery query) { |
| | | String deptId = tokenService.getLoginUser().getDeptId(); |
| | | List<Integer> deptIds = deptService.getAllSubDeptIds(deptId); |
| | | if (deptIds.isEmpty()) { |
| | | return R.ok(new PageInfo<>()); |
| | | } else { |
| | | query.setDeptIds(deptIds); |
| | | } |
| | | List<Integer> assetMainIds = assetMainService.lambdaQuery().in(AssetMain::getOwnershipDeptId, deptIds).list() |
| | | .stream().map(AssetMain::getId).collect(Collectors.toList()); |
| | | if (assetMainIds.isEmpty()){ |
| | | return R.ok(new PageInfo<>()); |
| | | } |
| | | query.setAssetMainIds(assetMainIds); |
| | | return R.ok(assetRepairRecordService.pageList(query)); |
| | | } |
| | | } |
| | | |