forked from gzzfw/backEnd/gz-dyh

liyj
2024-09-24 3d2deb17015b1234198871de31bb272f6cf79c78
dyh-service/dyh-sys/src/main/java/cn/huge/module/grid/controller/GridCompanyController.java
@@ -1,23 +1,29 @@
package cn.huge.module.grid.controller;
import cn.huge.base.common.bo.R;
import cn.huge.base.common.utils.ObjectUtils;
import cn.huge.base.common.utils.ReturnFailUtils;
import cn.huge.base.common.utils.ReturnSucUtils;
import cn.huge.module.grid.domain.dto.GridCompanyDTO;
import cn.huge.module.grid.domain.vo.GridCompanyVo;
import cn.huge.module.grid.domain.vo.GridTokenVo;
import cn.huge.module.grid.domain.vo.GridUserVo;
import cn.huge.module.grid.service.GridCompanyService;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/api/thrid/grid/company")
public class GridCompanyController {
    @Autowired(required = false)
    private HttpServletRequest request;
    @Resource
    private GridCompanyService gridCompanyService;
@@ -25,4 +31,34 @@
    public R<GridCompanyDTO> getCompanyList(@RequestBody GridCompanyVo gridCompanyVo) throws Exception {
        return gridCompanyService.getCompanyList(gridCompanyVo);
    }
    /**
     * 条件分页查询
     * @url {ctx}/api/thrid/grid/company/pageQuery
     * @param page 页码
     * @param size 每页数量
     * @return Object
     */
    @GetMapping("/pageQuery")
    public Object pageQuery(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size) {
        try {
            Map<String, Object> terms = Maps.newHashMap();
            GridCompanyVo gridCompanyVo = new GridCompanyVo();
            String integratedQuery = request.getParameter("integratedQuery");
            gridCompanyVo.setIntegratedQuery(integratedQuery);
            String state = request.getParameter("state");
            if(ObjectUtils.isNotEmpty(state)){
                gridCompanyVo.setState(Integer.valueOf(state));
            }
            String gridCode = request.getParameter("gridCode");
            gridCompanyVo.setGridCode(gridCode);
            gridCompanyVo.setPage(page);
            gridCompanyVo.setPageSize(size);
            gridCompanyVo.setNeedCount(true);
            return ReturnSucUtils.getRepInfo( "处理成功", gridCompanyService.pageQuery(gridCompanyVo));
        } catch (Exception e) {
            log.error("Controller接口[GridCompanyController.pageQuery]请求异常:"+e, e);
            return ReturnFailUtils.getRepInfo();
        }
    }
}