1
13693261870
2024-11-11 3600a4aecf7bf3636a3985b77a65cc7c185afc04
src/main/java/com/se/simu/controller/DbController.java
@@ -1,14 +1,14 @@
package com.se.simu.controller;
import com.se.simu.domain.vo.QueryVo;
import com.se.simu.helper.StringHelper;
import com.se.simu.helper.WebHelper;
import com.se.simu.service.DbService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -32,4 +32,28 @@
            WebHelper.writeJson2Page(res, HttpStatus.BAD_REQUEST, ex.getMessage());
        }
    }
    @ApiOperation(value = "config")
    @GetMapping(value = "/config")
    public void config(HttpServletRequest req, HttpServletResponse res) {
        try {
            dbService.config(req, res);
        } catch (Exception ex) {
            WebHelper.writeJson2Page(res, HttpStatus.BAD_REQUEST, ex.getMessage());
        }
    }
    @ApiOperation(value = "query")
    @PostMapping(value = "/query")
    public void query(@RequestBody QueryVo vo, HttpServletRequest req, HttpServletResponse res) {
        try {
            if (null == vo || StringHelper.isEmpty(vo.getLayerid())) throw new Exception("layerid不能为空");
            vo.setDefault();
            dbService.query(vo, req, res);
        } catch (Exception ex) {
            WebHelper.writeJson2Page(res, HttpStatus.BAD_REQUEST, ex.getMessage());
        }
    }
}