Commit e04109c1 by guojx

获取数据库连接接口调整

parent 1fd11f80
package com.gic.cloud.data.hook.vo;
import java.io.Serializable;
import java.util.Date;
/**
* @Author guojx
* @Date 2024/5/17 15:36
*/
public class FreeQuerySource implements Serializable {
/** 自定义查询编号 */
protected String id = "";
/** 自定义查询编号
* @return
*/
public String getId() {
return id;
}
/** 自定义查询编号
* @param id
*/
public void setId(String id) {
this.id = id;
}
/** 商户编号 */
protected String enterpriseId = "";
/** 商户编号
* @return
*/
public String getEnterpriseId() {
return enterpriseId;
}
/** 商户编号
* @param enterpriseId
*/
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
/** 商户名称 */
protected String enterpriseName = "";
/** 商户名称
* @return
*/
public String getEnterpriseName() {
return enterpriseName;
}
/** 商户名称
* @param enterpriseName
*/
public void setEnterpriseName(String enterpriseName) {
this.enterpriseName = enterpriseName;
}
private Integer isPrivate = 0;
private Date dbExpiration;
public Integer getIsPrivate() {
return isPrivate;
}
public void setIsPrivate(Integer isPrivate) {
this.isPrivate = isPrivate;
}
public Date getDbExpiration() {
return dbExpiration;
}
public void setDbExpiration(Date dbExpiration) {
this.dbExpiration = dbExpiration;
}
}
...@@ -8,7 +8,6 @@ import com.gic.cloud.data.hook.api.entity.GeneralResult; ...@@ -8,7 +8,6 @@ import com.gic.cloud.data.hook.api.entity.GeneralResult;
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.FreeQueryRecord; 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.commons.util.EntityUtil;
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;
...@@ -125,7 +124,7 @@ public class FreeQueryController { ...@@ -125,7 +124,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();
com.gic.cloud.data.hook.api.dto.FreeQuerySource freeQuerySource = this.freeQueryService.getFreeQuerySource(SessionContextUtils.getLoginUserEnterpriseId()); 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();
...@@ -236,11 +235,16 @@ public class FreeQueryController { ...@@ -236,11 +235,16 @@ public class FreeQueryController {
@RequestMapping("/get-custom-database") @RequestMapping("/get-custom-database")
public FreeQuerySource getCustomDatabase(){ public FreeQuerySource getCustomDatabase(){
com.gic.cloud.data.hook.api.dto.FreeQuerySource freeQuerySource = this.freeQueryService.getFreeQuerySource(SessionContextUtils.getLoginUserEnterpriseId()); FreeQuerySource freeQuerySource = this.freeQueryService.getFreeQuerySource(SessionContextUtils.getLoginUserEnterpriseId());
if(freeQuerySource == null){ if(freeQuerySource == null){
freeQuerySource = new com.gic.cloud.data.hook.api.dto.FreeQuerySource(); freeQuerySource = new FreeQuerySource();
freeQuerySource.setDatabase(this.enterpriseService.getEnterpriseById(SessionContextUtils.getLoginUserEnterpriseId()).getFactoryCode()); freeQuerySource.setDatabase(this.enterpriseService.getEnterpriseById(SessionContextUtils.getLoginUserEnterpriseId()).getFactoryCode());
} }
if (freeQuerySource != null) {
freeQuerySource.setUrl(null);
freeQuerySource.setUsername(null);
freeQuerySource.setPassword(null);
}
return EntityUtil.changeEntityNew(FreeQuerySource.class, freeQuerySource); return EntityUtil.changeEntityNew(FreeQuerySource.class, freeQuerySource);
} }
...@@ -251,10 +255,10 @@ public class FreeQueryController { ...@@ -251,10 +255,10 @@ public class FreeQueryController {
* @return * @return
*/ */
@RequestMapping("/get-db-cache") @RequestMapping("/get-db-cache")
public com.gic.cloud.data.hook.api.dto.FreeQuerySource cache(String a, String b){ public 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 com.gic.cloud.data.hook.api.dto.FreeQuerySource(); return new 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