Newer
Older
huludao / src / main / java / com / newfiber / modules / inspection / controller / ManPumpstationController.java
package com.newfiber.modules.inspection.controller;

import com.newfiber.common.bean.PageRequestObject;
import com.newfiber.common.bean.PageResultObject;
import com.newfiber.common.bean.ResultObj;
import com.newfiber.common.constant.ResultCode;
import com.newfiber.modules.inspection.entity.ManPumpstation;
import com.newfiber.modules.inspection.service.EquInfoService;
import com.newfiber.modules.inspection.service.ManPumpstationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
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;

/**
 * @description: 泵站基础信息控制层
 * @author: 张鸿志
 * @date: 2020/12/14 9:45
 * @version: v1.0
 */
@RestController
@RequestMapping("/manPump")
@Api(value = "ManPumpstationController",tags = "泵站基础信息控制层")
public class ManPumpstationController {

    @Autowired
    private ManPumpstationService manPumpstationService;

    @Resource
    private EquInfoService equInfoService;

    @PostMapping("/queryPage")
    @ApiOperation("分页条件查询泵站基础信息数据")
    public ResultObj<PageResultObject<ManPumpstation>> queryPage(@RequestBody PageRequestObject<String> pageRequestObject){
        return new ResultObj<>(ResultCode.OK,manPumpstationService.queryPage(pageRequestObject));
    }

    @PostMapping("/list")
    @ApiOperation("列表条件查询泵站基础信息数据")
    public ResultObj<List<ManPumpstation>> list(){
        List<ManPumpstation> manPumpstationList = manPumpstationService.listTree();
        for(ManPumpstation manPumpstation : manPumpstationList){
            manPumpstation.setEquName(manPumpstation.getPumpName());
            manPumpstation.setEquInfoEntityList(equInfoService.getByPumpNo(manPumpstation.getPumpNo()));
        }
        return new ResultObj<>(ResultCode.OK, manPumpstationList);
    }

}