Commit 1fd11f80 by guojx

老板接口优化,删除数据库连接

parent 69dd9110
......@@ -9,7 +9,7 @@ import java.util.Date;
* @Author guojx
* @Date 2024/5/17 15:33
*/
public class FreeQueryRecordVO implements Serializable {
public class FreeQueryRecord implements Serializable {
/** 查询定义编号(timestamp) */
protected String id = "";
......
......@@ -7,7 +7,7 @@ import java.util.Date;
* @Author guojx
* @Date 2024/5/17 15:36
*/
public class FreeQuerySourceVO implements Serializable {
public class FreeQuerySource implements Serializable {
/** 自定义查询编号 */
protected String id = "";
......
......@@ -3,22 +3,17 @@ package com.gic.cloud.data.hook.web;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.AuthorizedUser;
import com.gic.cloud.common.api.base.Page;
import com.gic.cloud.data.hook.api.dto.*;
import com.gic.cloud.data.hook.api.entity.FlatQueryExecuteRequest;
import com.gic.cloud.data.hook.api.entity.GeneralResult;
import com.gic.cloud.data.hook.api.service.IFlatQueryResultService;
import com.gic.cloud.data.hook.api.service.IFreeQueryService;
import com.gic.cloud.data.hook.api.service.SearchLogService;
import com.gic.cloud.data.hook.vo.FreeQueryRecordVO;
import com.gic.cloud.data.hook.vo.FreeQuerySourceVO;
import com.gic.cloud.data.hook.vo.FreeQueryRecord;
import com.gic.cloud.data.hook.vo.FreeQuerySource;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.web.common.utils.SessionContextUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
......@@ -59,9 +54,9 @@ public class FreeQueryController {
* @return
*/
@RequestMapping("/free-query-record-list")
public List<FreeQueryRecordVO> freeQueryRecordList(String userId, String fuzzy, HttpServletRequest request, HttpServletResponse response) {
List<FreeQueryRecord> list = this.freeQueryService.getFreeQueryRecordListByUserId(userId, fuzzy); // 限定 10 个/分页
return EntityUtil.changeEntityListNew(FreeQueryRecordVO.class, list);
public List<FreeQueryRecord> freeQueryRecordList(String userId, String fuzzy, HttpServletRequest request, HttpServletResponse response) {
List<com.gic.cloud.data.hook.api.dto.FreeQueryRecord> list = this.freeQueryService.getFreeQueryRecordListByUserId(userId, fuzzy); // 限定 10 个/分页
return EntityUtil.changeEntityListNew(FreeQueryRecord.class, list);
}
/** 创建自定义查询记录
......@@ -73,8 +68,8 @@ public class FreeQueryController {
* @return
*/
@RequestMapping("/create-free-query-record")
public List<FreeQueryRecord> createFreeQueryRecord(String recordId, String userId, String name, String content, HttpServletRequest request, HttpServletResponse response) {
FreeQueryRecord record = new FreeQueryRecord();
public List<com.gic.cloud.data.hook.api.dto.FreeQueryRecord> createFreeQueryRecord(String recordId, String userId, String name, String content, HttpServletRequest request, HttpServletResponse response) {
com.gic.cloud.data.hook.api.dto.FreeQueryRecord record = new com.gic.cloud.data.hook.api.dto.FreeQueryRecord();
record.setId(recordId);
record.setUserId(userId);
record.setName(name);
......@@ -94,8 +89,8 @@ public class FreeQueryController {
* @return
*/
@RequestMapping("/update-free-query-record")
public List<FreeQueryRecord> updateFreeQueryRecord(String userId, String recordId, String name, String content, HttpServletRequest request, HttpServletResponse response) {
FreeQueryRecord preRecord = this.freeQueryService.getFreeQueryRecordByUserIdAndRecordId(userId, recordId);
public List<com.gic.cloud.data.hook.api.dto.FreeQueryRecord> updateFreeQueryRecord(String userId, String recordId, String name, String content, HttpServletRequest request, HttpServletResponse response) {
com.gic.cloud.data.hook.api.dto.FreeQueryRecord preRecord = this.freeQueryService.getFreeQueryRecordByUserIdAndRecordId(userId, recordId);
if (preRecord != null) {
preRecord.setName(name);
preRecord.setContent(content);
......@@ -113,8 +108,8 @@ public class FreeQueryController {
* @return
*/
@RequestMapping("/delete-free-query-record")
public List<FreeQueryRecord> deleteFreeQueryRecord(String userId, String recordId, HttpServletRequest request, HttpServletResponse response) {
FreeQueryRecord preRecord = this.freeQueryService.getFreeQueryRecordByUserIdAndRecordId(userId, recordId);
public List<com.gic.cloud.data.hook.api.dto.FreeQueryRecord> deleteFreeQueryRecord(String userId, String recordId, HttpServletRequest request, HttpServletResponse response) {
com.gic.cloud.data.hook.api.dto.FreeQueryRecord preRecord = this.freeQueryService.getFreeQueryRecordByUserIdAndRecordId(userId, recordId);
if (preRecord != null) {
this.freeQueryService.deleteFreeQueryRecord(recordId);
} // IF OVER
......@@ -130,7 +125,7 @@ public class FreeQueryController {
@RequestMapping("/get-free-query-count")
public GeneralResult getFreeQueryCount(String sql, String enterpriseId, HttpServletRequest request, HttpServletResponse response) {
GeneralResult result = new GeneralResult();
FreeQuerySource freeQuerySource = this.freeQueryService.getFreeQuerySource(SessionContextUtils.getLoginUserEnterpriseId());
com.gic.cloud.data.hook.api.dto.FreeQuerySource freeQuerySource = this.freeQueryService.getFreeQuerySource(SessionContextUtils.getLoginUserEnterpriseId());
if(freeQuerySource != null){
Date expireTime = freeQuerySource.getDbExpiration();
Integer isPrivate = freeQuerySource.getIsPrivate();
......@@ -240,13 +235,13 @@ public class FreeQueryController {
@RequestMapping("/get-custom-database")
public FreeQuerySourceVO getCustomDatabase(){
FreeQuerySource freeQuerySource = this.freeQueryService.getFreeQuerySource(SessionContextUtils.getLoginUserEnterpriseId());
public FreeQuerySource getCustomDatabase(){
com.gic.cloud.data.hook.api.dto.FreeQuerySource freeQuerySource = this.freeQueryService.getFreeQuerySource(SessionContextUtils.getLoginUserEnterpriseId());
if(freeQuerySource == null){
freeQuerySource = new FreeQuerySource();
freeQuerySource = new com.gic.cloud.data.hook.api.dto.FreeQuerySource();
freeQuerySource.setDatabase(this.enterpriseService.getEnterpriseById(SessionContextUtils.getLoginUserEnterpriseId()).getFactoryCode());
}
return EntityUtil.changeEntityNew(FreeQuerySourceVO.class, freeQuerySource);
return EntityUtil.changeEntityNew(FreeQuerySource.class, freeQuerySource);
}
/**
......@@ -256,10 +251,10 @@ public class FreeQueryController {
* @return
*/
@RequestMapping("/get-db-cache")
public FreeQuerySource cache(String a,String b){
public com.gic.cloud.data.hook.api.dto.FreeQuerySource cache(String a, String b){
ServiceResponse<String> stringServiceResponse = this.freeQueryService.testCacheDb(a, b);
System.out.println(JSON.toJSONString(stringServiceResponse));
return new FreeQuerySource();
return new com.gic.cloud.data.hook.api.dto.FreeQuerySource();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment