package com.qianwen.mdc.controller.plant; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; 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 com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.qianwen.mdc.common.OpResult; import com.qianwen.mdc.dto.plant.PlantDTO; import com.qianwen.mdc.dto.plant.PlantQueryDTO; import com.qianwen.mdc.service.plant.PlantQueryService; import com.qianwen.mdc.service.sysaccount.AccountTokenService; /** * 设备查询控制器 */ @RestController @CrossOrigin @RequestMapping(value = "/plant") public class PlantQueryController { @Autowired private AccountTokenService accountTokenService; @Autowired private PlantQueryService queryService; public static final Logger logger = LoggerFactory.getLogger(PlantQueryController.class); /** * 全部车间列表 * @param request * @return */ @GetMapping(value = "/list") public OpResult> list() { try { return OpResult.success(queryService.list()); }catch(Exception ex) { logger.error("查询厂房列表失败",ex); return OpResult.fail(ex.getMessage()); } } @PostMapping(value = "/pageQuery") public OpResult> pageQuery(@RequestBody PlantQueryDTO dto) { try { return OpResult.success(queryService.pageQuery(dto)); }catch(Exception e) { logger.error("机床分页查询异常",e); return OpResult.fail(e.getMessage()); } } }