Commit 1fd11f80 by guojx

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

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