Commit f3e116f8 by wuchao

新版本

parent 8b29cad1
package com.chenyang.nse.bussiness.bean;
import com.chenyang.nse.bussiness.dao.table.core.TCoreDatasystemDao;
import com.chenyang.nse.bussiness.entity.orm.table.core.TCoreDatasystem;
import com.chenyang.nse.bussiness.odbc.DbCache;
import com.chenyang.nse.bussiness.service.core.impl.DataSystemServiceImpl;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@Service
@EnableScheduling
public class DataCache {
@Autowired
TCoreDatasystemDao datasystemDao;
@Autowired
DataSystemServiceImpl dataSystemService;
private ExecutorService executorService = Executors.newFixedThreadPool(20);
public static List<DataBase> dataList = new CopyOnWriteArrayList();
@Scheduled(
cron = "0 0/20 * * * ?"
)
public void cacheData() throws InterruptedException {
List<TCoreDatasystem> dataSystemList = this.datasystemDao.queryAll();
for(int i = dataList.size() - 1; i >= 0; --i) {
DataBase dataBase = (DataBase)dataList.get(i);
boolean find = false;
for(TCoreDatasystem datasystem : dataSystemList) {
if (datasystem.getId().equals(dataBase.getDatasystemid())) {
find = true;
break;
}
}
if (!find) {
dataList.remove(dataBase);
}
}
CountDownLatch cdl = new CountDownLatch(dataSystemList.size());
for(TCoreDatasystem datasystem : dataSystemList) {
Runnable cacheThread = null;
Object var11;
if ("HIVE_TDH".equals(datasystem.getDbtype())) {
var11 = new CacheHiveTDH(this.dataSystemService, datasystem, cdl);
} else if ("MONGODB".equals(datasystem.getDbtype())) {
var11 = new CacheMongodb(this.dataSystemService, datasystem, cdl);
} else if ("ES".equals(datasystem.getDbtype())) {
var11 = new CacheElasticSearchThread(this.dataSystemService, datasystem, cdl);
} else {
var11 = new CacheThread(this.dataSystemService, datasystem, cdl);
}
this.executorService.execute((Runnable)var11);
}
cdl.await();
DbCache.sync();
}
}
package com.chenyang.nse.bussiness.controller.console;
import com.chenyang.nse.bussiness.entity.orm.table.console.mapping.TConsoleDatamappingTargetfield;
import com.chenyang.nse.bussiness.entity.vo.ComboboxVO;
import com.chenyang.nse.bussiness.enumeration.datamapping.EdataMappingFlag;
import com.chenyang.nse.bussiness.enumeration.datamapping.EdataMappingType;
import com.chenyang.nse.bussiness.service.console.DataMappingService;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping({"/console/datamapping"})
public class DataMappingController {
@Autowired
private DataMappingService dataMappingService;
@RequestMapping({"", "/"})
public String index(HttpServletRequest request, HttpServletResponse response, Model model) {
return "/console/datamapping";
}
@RequestMapping({"/getdatatype"})
@ResponseBody
public List<ComboboxVO> getdatatype() {
List<ComboboxVO> list = new ArrayList();
for(EdataMappingType em : EdataMappingType.values()) {
ComboboxVO vo = new ComboboxVO(em.getFlag(), em.getName());
list.add(vo);
}
return list;
}
@RequestMapping({"/getdataflag"})
@ResponseBody
public List<ComboboxVO> getdataflag() {
List<ComboboxVO> list = new ArrayList();
for(EdataMappingFlag em : EdataMappingFlag.values()) {
ComboboxVO vo = new ComboboxVO(em.getFlag(), em.getName());
list.add(vo);
}
return list;
}
@RequestMapping({"/getdatamappinginfo"})
@ResponseBody
public List<Map<String, String>> getdatamappinginfo(String sourcesystemtype, String targetsystemtype) {
return this.dataMappingService.getDatamappingInfo(sourcesystemtype, targetsystemtype);
}
@RequestMapping({"/gettargetfield"})
@ResponseBody
public List<ComboboxVO> gettargetfield(String datasystemtype) {
List<TConsoleDatamappingTargetfield> list = this.dataMappingService.getTargetFieldByType(datasystemtype);
List<ComboboxVO> volist = new ArrayList();
for(TConsoleDatamappingTargetfield item : list) {
ComboboxVO vo = new ComboboxVO(item.getId(), item.getFieldname());
volist.add(vo);
}
return volist;
}
@RequestMapping({"/modifydatainfo"})
@ResponseBody
public void modifydatainfo(@RequestParam Map<String, String> map) {
this.dataMappingService.modifyDataInfo(map);
}
}
package com.chenyang.nse.bussiness.controller.core;
import com.chenyang.nse.bussiness.commmon.json.RespHelper;
import com.chenyang.nse.bussiness.commmon.json.Response;
import com.chenyang.nse.bussiness.entity.orm.table.core.TCoreDatadis;
import com.chenyang.nse.bussiness.service.core.DataDisService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping({"/core/datadis"})
public class DataDisController {
@Autowired
private DataDisService dataDisService;
@ResponseBody
@GetMapping({"/queryAll"})
public Response query(String dbtype) {
List<TCoreDatadis> list = this.dataDisService.queryDistByType(dbtype);
return RespHelper.successResp(list);
}
}
package com.chenyang.nse.bussiness.controller.core;
import com.chenyang.nse.bussiness.commmon.json.RespHelper;
import com.chenyang.nse.bussiness.commmon.json.Response;
import com.chenyang.nse.bussiness.dao.PageInfo;
import com.chenyang.nse.bussiness.dao.table.core.TCoreDatasystemDao;
import com.chenyang.nse.bussiness.entity.orm.table.core.TCoreDataPreviewSQL;
import com.chenyang.nse.bussiness.entity.orm.table.core.TCoreDatasystem;
import com.chenyang.nse.bussiness.entity.vo.DataPreviewVO;
import com.chenyang.nse.bussiness.service.core.DataPreviewService;
import com.chenyang.nse.bussiness.tools.jdbc.MongodbTool;
import com.chenyang.nse.bussiness.tools.string.AesTool;
import com.chenyang.nse.bussiness.tools.string.StringTool;
import com.mongodb.MongoClient;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Controller;
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.ResponseBody;
@EnableAsync
@Controller
@RequestMapping({"/core/datapreview"})
public class DataPreviewController {
private static Logger logger = LoggerFactory.getLogger(DataPreviewController.class);
@Autowired
private DataPreviewService dataPreviewService;
@Autowired
private TCoreDatasystemDao tCoreDatasystemDao;
@ResponseBody
@PostMapping({"/query"})
public Response<DataPreviewVO> queryPreviewBysql(@RequestBody DataPreviewVO dataPreviewVO) {
PageInfo pageInfo = new PageInfo();
pageInfo.setPageno(dataPreviewVO.getPage());
pageInfo.setPagesize(dataPreviewVO.getRows());
TCoreDatasystem tCoreDatasystem = (TCoreDatasystem)this.tCoreDatasystemDao.get(dataPreviewVO.getDatasystem_id());
if ("ES".equals(tCoreDatasystem.getDbtype())) {
long s = System.currentTimeMillis();
DataPreviewVO retDataPreviewVO = new DataPreviewVO();
String es = this.dataPreviewService.esQueryDataPreview(tCoreDatasystem, dataPreviewVO.getSql());
long e = System.currentTimeMillis();
retDataPreviewVO.setExecute_time(e - s);
TCoreDataPreviewSQL tcoreDataPreviewSQL = new TCoreDataPreviewSQL();
tcoreDataPreviewSQL.setExesql(dataPreviewVO.getSql());
tcoreDataPreviewSQL.setSchem(dataPreviewVO.getSchema());
tcoreDataPreviewSQL.setDatasystem_id(dataPreviewVO.getDatasystem_id());
tcoreDataPreviewSQL.setId(StringTool.getTablePrimaryKey());
tcoreDataPreviewSQL.setCreatetime(new Date());
String[] sqls = dataPreviewVO.getSql().split("/");
String table_name = sqls[2];
tcoreDataPreviewSQL.setTablename(table_name);
List<String> strings = new ArrayList();
strings.add(es);
retDataPreviewVO.setEsdata(strings);
return RespHelper.<DataPreviewVO>successResp(retDataPreviewVO);
} else if ("MONGODB".equals(tCoreDatasystem.getDbtype())) {
long s = System.currentTimeMillis();
DataPreviewVO retDataPreviewVO = new DataPreviewVO();
long e = System.currentTimeMillis();
retDataPreviewVO.setExecute_time(e - s);
String[] sqls = dataPreviewVO.getSql().split("\\.");
String table_name = sqls[1];
try {
MongoClient client = MongodbTool.connect(tCoreDatasystem.getDbservername(), tCoreDatasystem.getUsername(), AesTool.decrypt(tCoreDatasystem.getPassword(), "ghca"), tCoreDatasystem.getDbip(), Integer.parseInt(tCoreDatasystem.getDbport()), true);
List<String> strings = MongodbTool.findAllDataPreview(client, dataPreviewVO.getSchema(), table_name);
TCoreDataPreviewSQL tcoreDataPreviewSQL = new TCoreDataPreviewSQL();
tcoreDataPreviewSQL.setExesql(dataPreviewVO.getSql());
tcoreDataPreviewSQL.setSchem(dataPreviewVO.getSchema());
tcoreDataPreviewSQL.setDatasystem_id(dataPreviewVO.getDatasystem_id());
tcoreDataPreviewSQL.setId(StringTool.getTablePrimaryKey());
tcoreDataPreviewSQL.setCreatetime(new Date());
tcoreDataPreviewSQL.setTablename(table_name);
String ss = "";
for(int i = 0; i < strings.size(); ++i) {
if (i != 0) {
ss = ss + "," + (String)strings.get(i);
} else {
ss = ss + (String)strings.get(i);
}
}
retDataPreviewVO.setEsdata(strings);
} catch (Exception exception) {
exception.printStackTrace();
}
return RespHelper.<DataPreviewVO>successResp(retDataPreviewVO);
} else {
long s = System.currentTimeMillis();
String sql = dataPreviewVO.getSql();
if (!sql.trim().toLowerCase().startsWith("select")) {
return RespHelper.<DataPreviewVO>errRespStr("只支持查询功能语句!");
} else {
DataPreviewVO retDataPreviewVO = this.dataPreviewService.queryDataPreviewBysql(pageInfo, dataPreviewVO);
long e = System.currentTimeMillis();
retDataPreviewVO.setExecute_time(e - s);
retDataPreviewVO.setPageInfo(pageInfo);
return RespHelper.<DataPreviewVO>successResp(retDataPreviewVO);
}
}
}
@ResponseBody
@PostMapping({"/querySqlHistory"})
public Response<List<TCoreDataPreviewSQL>> querySqlHistory(@RequestBody TCoreDataPreviewSQL coreDataPreviewSQL) {
String datasystem_id = "";
if (!StringUtils.isBlank(coreDataPreviewSQL.getDatasystem_id())) {
datasystem_id = coreDataPreviewSQL.getDatasystem_id();
}
List<TCoreDataPreviewSQL> hisList = this.dataPreviewService.queryDataPreviewHis(datasystem_id);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
hisList.stream().limit(10L).forEach((hist) -> hist.setCreatetimeOfstr(sdf.format(hist.getCreatetime())));
return RespHelper.<List<TCoreDataPreviewSQL>>successResp(hisList);
}
}
package com.chenyang.nse.bussiness.engine.ghca.webservice;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(
name = "dataMaskingByRuleName",
propOrder = {"arg0", "arg1"}
)
public class DataMaskingByRuleName {
protected String arg0;
protected Object arg1;
public String getArg0() {
return this.arg0;
}
public void setArg0(String value) {
this.arg0 = value;
}
public Object getArg1() {
return this.arg1;
}
public void setArg1(Object value) {
this.arg1 = value;
}
}
package com.chenyang.nse.bussiness.engine.ghca.webservice;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(
name = "dataMaskingByRuleNameResponse",
propOrder = {"_return"}
)
public class DataMaskingByRuleNameResponse {
@XmlElement(
name = "return"
)
protected Object _return;
public Object getReturn() {
return this._return;
}
public void setReturn(Object value) {
this._return = value;
}
}
package com.chenyang.nse.bussiness.engine.ghca.webservice;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(
name = "dataMaskingListByRuleNameResponse",
propOrder = {"_return"}
)
public class DataMaskingListByRuleNameResponse {
@XmlElement(
name = "return"
)
protected List<Object> _return;
public List<Object> getReturn() {
if (this._return == null) {
this._return = new ArrayList();
}
return this._return;
}
}
package com.chenyang.nse.bussiness.entity.orm.table.core;
import java.util.Date;
public class DataareaSecretkeyRelationVo {
private String encryption_name;
private String secret_key_name;
private String enc_name;
private String encryption_id;
private String secretkey_id;
private String dataarea_id;
private String defaulttype;
private Date createtime;
private Date updatetime;
private String createuser;
private String updateuser;
private String id;
private String flag;
private String note;
public String getEncryption_name() {
return this.encryption_name;
}
public void setEncryption_name(String encryption_name) {
this.encryption_name = encryption_name;
}
public String getSecret_key_name() {
return this.secret_key_name;
}
public void setSecret_key_name(String secret_key_name) {
this.secret_key_name = secret_key_name;
}
public String getEnc_name() {
return this.enc_name;
}
public void setEnc_name(String enc_name) {
this.enc_name = enc_name;
}
public String getEncryption_id() {
return this.encryption_id;
}
public void setEncryption_id(String encryption_id) {
this.encryption_id = encryption_id;
}
public String getSecretkey_id() {
return this.secretkey_id;
}
public void setSecretkey_id(String secretkey_id) {
this.secretkey_id = secretkey_id;
}
public String getDataarea_id() {
return this.dataarea_id;
}
public void setDataarea_id(String dataarea_id) {
this.dataarea_id = dataarea_id;
}
public String getDefaulttype() {
return this.defaulttype;
}
public void setDefaulttype(String defaulttype) {
this.defaulttype = defaulttype;
}
public Date getCreatetime() {
return this.createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
public Date getUpdatetime() {
return this.updatetime;
}
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
}
public String getCreateuser() {
return this.createuser;
}
public void setCreateuser(String createuser) {
this.createuser = createuser;
}
public String getUpdateuser() {
return this.updateuser;
}
public void setUpdateuser(String updateuser) {
this.updateuser = updateuser;
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getFlag() {
return this.flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getNote() {
return this.note;
}
public void setNote(String note) {
this.note = note;
}
}
package com.chenyang.nse.bussiness.entity.vo;
import java.util.List;
public class DataGridFlagVO<E> {
private long total;
private List<E> rows;
private Integer flag;
public DataGridFlagVO() {
}
public DataGridFlagVO(long total, List<E> rows) {
this.total = total;
this.rows = rows;
}
public long getTotal() {
return this.total;
}
public void setTotal(long total) {
this.total = total;
}
public List<E> getRows() {
return this.rows;
}
public void setRows(List<E> rows) {
this.rows = rows;
}
public Integer getFlag() {
return this.flag;
}
public void setFlag(Integer flag) {
this.flag = flag;
}
}
package com.chenyang.nse.bussiness.entity.vo;
import java.util.List;
public class DataGridVO<E> {
private long total;
private List<E> rows;
public DataGridVO() {
}
public DataGridVO(long total, List<E> rows) {
this.total = total;
this.rows = rows;
}
public long getTotal() {
return this.total;
}
public void setTotal(long total) {
this.total = total;
}
public List<E> getRows() {
return this.rows;
}
public void setRows(List<E> rows) {
this.rows = rows;
}
}
package com.chenyang.nse.bussiness.entity.vo;
import java.util.Date;
public class DataProjectVO {
private String id;
private String flag;
private String note;
private String project;
private Date createtime;
private String createuser;
private String crud;
private String updateuserid;
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getFlag() {
return this.flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getNote() {
return this.note;
}
public void setNote(String note) {
this.note = note;
}
public String getProject() {
return this.project;
}
public void setProject(String project) {
this.project = project;
}
public Date getCreatetime() {
return this.createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
public String getCreateuser() {
return this.createuser;
}
public void setCreateuser(String createuser) {
this.createuser = createuser;
}
public String getCrud() {
return this.crud;
}
public void setCrud(String crud) {
this.crud = crud;
}
public String getUpdateuserid() {
return this.updateuserid;
}
public void setUpdateuserid(String updateuserid) {
this.updateuserid = updateuserid;
}
}
package com.chenyang.nse.bussiness.entity.vo;
public class DataScopeEntity {
String schemaName;
String tableName;
String columnName;
String scopeName;
String sensitiveLevel;
String sensitiveName;
String dataareaName;
String classifyid;
String levelid;
String isAuto;
public String getSchemaName() {
return this.schemaName;
}
public String getTableName() {
return this.tableName;
}
public String getColumnName() {
return this.columnName;
}
public String getScopeName() {
return this.scopeName;
}
public String getSensitiveLevel() {
return this.sensitiveLevel;
}
public String getSensitiveName() {
return this.sensitiveName;
}
public String getDataareaName() {
return this.dataareaName;
}
public String getClassifyid() {
return this.classifyid;
}
public String getLevelid() {
return this.levelid;
}
public String getIsAuto() {
return this.isAuto;
}
public void setSchemaName(final String schemaName) {
this.schemaName = schemaName;
}
public void setTableName(final String tableName) {
this.tableName = tableName;
}
public void setColumnName(final String columnName) {
this.columnName = columnName;
}
public void setScopeName(final String scopeName) {
this.scopeName = scopeName;
}
public void setSensitiveLevel(final String sensitiveLevel) {
this.sensitiveLevel = sensitiveLevel;
}
public void setSensitiveName(final String sensitiveName) {
this.sensitiveName = sensitiveName;
}
public void setDataareaName(final String dataareaName) {
this.dataareaName = dataareaName;
}
public void setClassifyid(final String classifyid) {
this.classifyid = classifyid;
}
public void setLevelid(final String levelid) {
this.levelid = levelid;
}
public void setIsAuto(final String isAuto) {
this.isAuto = isAuto;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
} else if (!(o instanceof DataScopeEntity)) {
return false;
} else {
DataScopeEntity other = (DataScopeEntity)o;
if (!other.canEqual(this)) {
return false;
} else {
Object this$schemaName = this.getSchemaName();
Object other$schemaName = other.getSchemaName();
if (this$schemaName == null) {
if (other$schemaName != null) {
return false;
}
} else if (!this$schemaName.equals(other$schemaName)) {
return false;
}
Object this$tableName = this.getTableName();
Object other$tableName = other.getTableName();
if (this$tableName == null) {
if (other$tableName != null) {
return false;
}
} else if (!this$tableName.equals(other$tableName)) {
return false;
}
Object this$columnName = this.getColumnName();
Object other$columnName = other.getColumnName();
if (this$columnName == null) {
if (other$columnName != null) {
return false;
}
} else if (!this$columnName.equals(other$columnName)) {
return false;
}
Object this$scopeName = this.getScopeName();
Object other$scopeName = other.getScopeName();
if (this$scopeName == null) {
if (other$scopeName != null) {
return false;
}
} else if (!this$scopeName.equals(other$scopeName)) {
return false;
}
Object this$sensitiveLevel = this.getSensitiveLevel();
Object other$sensitiveLevel = other.getSensitiveLevel();
if (this$sensitiveLevel == null) {
if (other$sensitiveLevel != null) {
return false;
}
} else if (!this$sensitiveLevel.equals(other$sensitiveLevel)) {
return false;
}
Object this$sensitiveName = this.getSensitiveName();
Object other$sensitiveName = other.getSensitiveName();
if (this$sensitiveName == null) {
if (other$sensitiveName != null) {
return false;
}
} else if (!this$sensitiveName.equals(other$sensitiveName)) {
return false;
}
Object this$dataareaName = this.getDataareaName();
Object other$dataareaName = other.getDataareaName();
if (this$dataareaName == null) {
if (other$dataareaName != null) {
return false;
}
} else if (!this$dataareaName.equals(other$dataareaName)) {
return false;
}
Object this$classifyid = this.getClassifyid();
Object other$classifyid = other.getClassifyid();
if (this$classifyid == null) {
if (other$classifyid != null) {
return false;
}
} else if (!this$classifyid.equals(other$classifyid)) {
return false;
}
Object this$levelid = this.getLevelid();
Object other$levelid = other.getLevelid();
if (this$levelid == null) {
if (other$levelid != null) {
return false;
}
} else if (!this$levelid.equals(other$levelid)) {
return false;
}
Object this$isAuto = this.getIsAuto();
Object other$isAuto = other.getIsAuto();
if (this$isAuto == null) {
if (other$isAuto != null) {
return false;
}
} else if (!this$isAuto.equals(other$isAuto)) {
return false;
}
return true;
}
}
}
protected boolean canEqual(final Object other) {
return other instanceof DataScopeEntity;
}
public int hashCode() {
int PRIME = 59;
int result = 1;
Object $schemaName = this.getSchemaName();
result = result * 59 + ($schemaName == null ? 43 : $schemaName.hashCode());
Object $tableName = this.getTableName();
result = result * 59 + ($tableName == null ? 43 : $tableName.hashCode());
Object $columnName = this.getColumnName();
result = result * 59 + ($columnName == null ? 43 : $columnName.hashCode());
Object $scopeName = this.getScopeName();
result = result * 59 + ($scopeName == null ? 43 : $scopeName.hashCode());
Object $sensitiveLevel = this.getSensitiveLevel();
result = result * 59 + ($sensitiveLevel == null ? 43 : $sensitiveLevel.hashCode());
Object $sensitiveName = this.getSensitiveName();
result = result * 59 + ($sensitiveName == null ? 43 : $sensitiveName.hashCode());
Object $dataareaName = this.getDataareaName();
result = result * 59 + ($dataareaName == null ? 43 : $dataareaName.hashCode());
Object $classifyid = this.getClassifyid();
result = result * 59 + ($classifyid == null ? 43 : $classifyid.hashCode());
Object $levelid = this.getLevelid();
result = result * 59 + ($levelid == null ? 43 : $levelid.hashCode());
Object $isAuto = this.getIsAuto();
result = result * 59 + ($isAuto == null ? 43 : $isAuto.hashCode());
return result;
}
public String toString() {
return "DataScopeEntity(schemaName=" + this.getSchemaName() + ", tableName=" + this.getTableName() + ", columnName=" + this.getColumnName() + ", scopeName=" + this.getScopeName() + ", sensitiveLevel=" + this.getSensitiveLevel() + ", sensitiveName=" + this.getSensitiveName() + ", dataareaName=" + this.getDataareaName() + ", classifyid=" + this.getClassifyid() + ", levelid=" + this.getLevelid() + ", isAuto=" + this.getIsAuto() + ")";
}
}
package com.chenyang.nse.bussiness.entity.vo.datamap;
import com.chenyang.nse.bussiness.entity.orm.table.core.datamap.TCoreDatamapTable;
import com.chenyang.nse.bussiness.entity.orm.table.core.datamap.TCoreDatamapTablerelation;
import java.util.List;
public class DataMapVO {
private String tablecount;
private String fkcount;
private List<TCoreDatamapTable> nodes;
private List<TCoreDatamapTablerelation> edges;
public DataMapVO() {
}
public DataMapVO(String tablecount, String fkcount, List<TCoreDatamapTable> nodes, List<TCoreDatamapTablerelation> edges) {
this.tablecount = tablecount;
this.fkcount = fkcount;
this.nodes = nodes;
this.edges = edges;
}
public String getTablecount() {
return this.tablecount;
}
public void setTablecount(String tablecount) {
this.tablecount = tablecount;
}
public String getFkcount() {
return this.fkcount;
}
public void setFkcount(String fkcount) {
this.fkcount = fkcount;
}
public List<TCoreDatamapTable> getNodes() {
return this.nodes;
}
public void setNodes(List<TCoreDatamapTable> nodes) {
this.nodes = nodes;
}
public List<TCoreDatamapTablerelation> getEdges() {
return this.edges;
}
public void setEdges(List<TCoreDatamapTablerelation> edges) {
this.edges = edges;
}
public String toString() {
return "TableRelationVO [tablecount=" + this.tablecount + ", fkcount=" + this.fkcount + ", nodes=" + this.nodes + ", edges=" + this.edges + "]";
}
public int hashCode() {
int prime = 31;
int result = 1;
result = 31 * result + (this.edges == null ? 0 : this.edges.hashCode());
result = 31 * result + (this.fkcount == null ? 0 : this.fkcount.hashCode());
result = 31 * result + (this.nodes == null ? 0 : this.nodes.hashCode());
result = 31 * result + (this.tablecount == null ? 0 : this.tablecount.hashCode());
return result;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
} else if (obj == null) {
return false;
} else if (this.getClass() != obj.getClass()) {
return false;
} else {
DataMapVO other = (DataMapVO)obj;
if (this.edges == null) {
if (other.edges != null) {
return false;
}
} else if (!this.edges.equals(other.edges)) {
return false;
}
if (this.fkcount == null) {
if (other.fkcount != null) {
return false;
}
} else if (!this.fkcount.equals(other.fkcount)) {
return false;
}
if (this.nodes == null) {
if (other.nodes != null) {
return false;
}
} else if (!this.nodes.equals(other.nodes)) {
return false;
}
if (this.tablecount == null) {
if (other.tablecount != null) {
return false;
}
} else if (!this.tablecount.equals(other.tablecount)) {
return false;
}
return true;
}
}
}
package com.chenyang.nse.bussiness.init;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.chenyang.nse.bussiness.entity.vo.ReturnInterfaceDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
@Component
@Order(3)
@RequestMapping({"datainitload"})
public class DataInitLoad implements ApplicationRunner {
public static boolean initCacheFlag = false;
@Value("${classify.classifyEnable}")
boolean classifyEnable;
@Value("${classify.url}")
String classifyIpAndPort;
@Value("${classify.classifyName}")
String classifyName;
@Value("${classify.levelName}")
String levelName;
public static final int PAGE_SIZE = 10000;
public void run(ApplicationArguments args) throws Exception {
(new Thread(() -> {
try {
if (this.classifyEnable) {
try {
this.initClassifyInfos();
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
})).start();
}
@RequestMapping({"initClassifyInfos"})
public void initClassifyInfos() {
try {
this.initClassifyAndLevel();
} catch (Exception e) {
e.printStackTrace();
}
this.initColumnAndClassifyAndLevelAndAreaRelation();
}
public void initClassifyAndLevel() {
String classifyUrl = this.classifyIpAndPort + this.classifyName;
String levelUrl = this.classifyIpAndPort + this.levelName;
String jsonBody = "{\"edition_id\": \"1\",\"type\":\"0\"}";
String jsonBody2 = "{\"edition_id\": \"1\",\"type\":\"1\"}";
try {
String classifyRes = sendHttpPost(classifyUrl, jsonBody);
Map classifyMap = (Map)JSON.parse(classifyRes);
List<Map<String, Object>> classifyList = (List)classifyMap.get("data");
StaticDatasPool.allCtrlClassifyList = classifyList;
String levelRes = sendHttpPost(levelUrl, jsonBody);
Map levelMap = (Map)JSON.parse(levelRes);
List<Map> levelList = (List)levelMap.get("data");
StaticDatasPool.allCtrlLevelList = levelList;
String classifyRes2 = sendHttpPost(classifyUrl, jsonBody2);
Map classifyMap2 = (Map)JSON.parse(classifyRes2);
List<Map> classifyList2 = (List)classifyMap2.get("data");
StaticDatasPool.allColumnClassifyList = classifyList2;
String levelRes2 = sendHttpPost(levelUrl, jsonBody2);
Map levelMap2 = (Map)JSON.parse(levelRes2);
List<Map> levelList2 = (List)levelMap2.get("data");
StaticDatasPool.allColumnLevelList = levelList2;
} catch (Exception e) {
e.printStackTrace();
}
}
public static String sendHttpPost(String url, String JSONBody) throws Exception {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("Content-Type", "application/json");
httpPost.setEntity(new StringEntity(JSONBody));
CloseableHttpResponse response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
String responseContent = EntityUtils.toString(entity, "UTF-8");
response.close();
httpClient.close();
return responseContent;
}
public void initColumnAndClassifyAndLevelAndAreaRelation() {
String url = this.classifyIpAndPort + "/core/datascope/getScopeAndSensitiveInfo";
String jsonBody = "";
try {
String classifyRes = sendHttpPost(url, jsonBody);
Map result = (Map)JSON.parse(classifyRes);
Map map = (Map)result.get("data");
List<ReturnInterfaceDate> list = new ArrayList();
if (map != null && map.size() > 0) {
list = JSON.parseArray(JSONObject.toJSONString(map.get("allInfo")), ReturnInterfaceDate.class);
}
StaticDatasPool.columnAndClassifyAndLevelAndAreaRelationList = list;
} catch (Exception e) {
e.printStackTrace();
}
}
public void changeColumnAndClassifyAndLevelAndAreaRelation(String dataSystemId, String schemaName, String tableName, String columnName) {
String url = this.classifyIpAndPort + "/core/datascope/getScopeAndSensitiveInfoForPush";
String jsonBody = "{\"dataSystemId\": \"" + dataSystemId + "\",\"schemaName\": \"" + schemaName + "\",\"tableName\": \"" + tableName + "\",\"columnName\": \"" + columnName + "\"}";
try {
String classifyRes = sendHttpPost(url, jsonBody);
Map result = (Map)JSON.parse(classifyRes);
Map map = (Map)result.get("data");
List<ReturnInterfaceDate> list = (List)map.get("list");
StaticDatasPool.columnAndClassifyAndLevelAndAreaRelationList = list;
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.chenyang.nse.bussiness.kms.controller;
import com.chenyang.nse.bussiness.kms.model.Kms;
import com.chenyang.nse.bussiness.kms.service.KmsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"kms"})
public class DataKeyController {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
protected KmsService kmsService;
@RequestMapping({"datakey"})
public String dataKey() {
return this.kmsService.createDataKey(Kms.MasterKey.getInstance().getKeyid(), this.kmsService.obtainAccessToken(this.kmsService.obtainChallengeCode()));
}
}
package com.chenyang.nse.bussiness.service.console.impl;
import com.chenyang.nse.bussiness.dao.table.console.mapping.TConsoleDatamappingInfoDao;
import com.chenyang.nse.bussiness.dao.table.console.mapping.TConsoleDatamappingTargetfieldDao;
import com.chenyang.nse.bussiness.entity.orm.table.console.mapping.TConsoleDatamappingInfo;
import com.chenyang.nse.bussiness.entity.orm.table.console.mapping.TConsoleDatamappingTargetfield;
import com.chenyang.nse.bussiness.service.console.DataMappingService;
import java.util.List;
import java.util.Map;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
public class DataMappingServiceImpl implements DataMappingService {
@Autowired
private TConsoleDatamappingInfoDao tConsoleDatamappingInfoDao;
@Autowired
private TConsoleDatamappingTargetfieldDao tConsoleDatamappingTargetfieldDao;
public List<Map<String, String>> getDatamappingInfo(String sourcesystemtype, String targetsystemtype) {
List<Map<String, String>> list = this.tConsoleDatamappingInfoDao.getDatamappingInfo(sourcesystemtype, targetsystemtype);
return list;
}
public List<TConsoleDatamappingTargetfield> getTargetFieldByType(String datasystemtype) {
List<TConsoleDatamappingTargetfield> list = this.tConsoleDatamappingTargetfieldDao.queryAll("fieldname", true, new Criterion[]{Restrictions.eq("datasystemtype", datasystemtype)});
return list;
}
public void modifyDataInfo(Map<String, String> map) {
String id = (String)map.get("id");
String sourcefieldid = (String)map.get("sourcefieldid");
String flag = (String)map.get("flag");
String targetfieldid = (String)map.get("targetfieldid");
String targetlength = (String)map.get("targetlength");
String targetdecimal = (String)map.get("targetdecimal");
String targetsystemtype = (String)map.get("targetsystemtype");
String note = (String)map.get("note");
TConsoleDatamappingInfo tConsoleDatamappingInfo = new TConsoleDatamappingInfo();
if (id != "" && id != null) {
tConsoleDatamappingInfo.setId(id);
}
tConsoleDatamappingInfo.setSourcefieldid(sourcefieldid);
tConsoleDatamappingInfo.setFlag(flag);
tConsoleDatamappingInfo.setTargetfieldid(targetfieldid);
tConsoleDatamappingInfo.setTargetlength(flag.equals("1") ? targetlength : "");
tConsoleDatamappingInfo.setTargetdecimal(flag.equals("1") ? targetdecimal : "");
tConsoleDatamappingInfo.setTargetsystemtype(targetsystemtype);
tConsoleDatamappingInfo.setNote(note);
this.tConsoleDatamappingInfoDao.saveOrUpdate(tConsoleDatamappingInfo);
}
}
package com.chenyang.nse.bussiness.service.core;
import com.chenyang.nse.bussiness.dao.PageInfo;
import com.chenyang.nse.bussiness.entity.orm.table.core.TCoreDataPreviewSQL;
import com.chenyang.nse.bussiness.entity.orm.table.core.TCoreDatasystem;
import com.chenyang.nse.bussiness.entity.vo.DataPreviewVO;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
public interface DataPreviewService {
DataPreviewVO queryDataPreviewBysql(PageInfo pageInfo, DataPreviewVO dataPreviewVO);
List<TCoreDataPreviewSQL> queryDataPreviewHis(String datasystem_id);
String esQueryDataPreview(TCoreDatasystem tCoreDatasystem, String essql);
}
package com.chenyang.nse.bussiness.service.core;
import com.chenyang.nse.bussiness.dao.PageInfo;
import com.chenyang.nse.bussiness.entity.orm.table.core.fieldscope.view.TNumDatasystem;
import com.chenyang.nse.bussiness.entity.orm.table.core.fieldscope.view.TNumDescription;
import com.chenyang.nse.bussiness.entity.orm.table.core.fieldscope.view.TNumProject;
import com.chenyang.nse.bussiness.entity.orm.table.core.fieldscope.view.TNumSchema;
import com.chenyang.nse.bussiness.entity.orm.table.core.fieldscope.view.TNumTable;
import java.util.List;
public interface DataScopeCharsService {
List<TNumProject> getProjectlistRuleReport(PageInfo pageInfo, String project_name, String type);
List<TNumDescription> getDescriptionlistRuleReport(PageInfo pageInfo, String project_name, String description_name, String type);
List<TNumDatasystem> getDatasystemlistRuleReport(PageInfo pageInfo, String project_name, String description_name, String datasystem_name, String type);
List<TNumSchema> getSchemalistRuleReport(PageInfo pageInfo, String project_name, String description_name, String datasystem_name, String schema_name, String type);
List<TNumTable> getTablelistRuleReport(PageInfo pageInfo, String project_name, String description_name, String datasystem_name, String schema_name, String table_name, String type);
}
package com.chenyang.nse.bussiness.service.core.backup;
import com.chenyang.nse.bussiness.entity.vo.dataproject.TCoreDataBackUpVO;
public interface DataBackUpService {
String checkTable(TCoreDataBackUpVO params);
void dataSync(TCoreDataBackUpVO params);
}
package com.chenyang.nse.bussiness.service.info.db;
import com.power.xml.entity.ColumnInfo;
import java.sql.Connection;
import java.util.List;
import java.util.Map;
public interface DatabaseTool {
String ImportMethod();
String ExportMethod();
Map TargetParameter_normal();
Map TargetParameter_normal1();
Map TargetParameter_notNormal();
List<StringBuffer> SynTriggersParam(Connection s_conn, Map map);
List<StringBuffer> SynFunctionParam(Connection s_conn, Map map);
List<StringBuffer> SynProcedureParam(Connection s_conn, Map map);
ColumnInfo getPwc_columnInfo_target(Map map);
ColumnInfo getPwc_columnInfo_source(Map map);
List<StringBuffer> SynViewParam(Connection srcconn, Map map);
String SynConstraintParam(Connection srcconn, Map map);
String SynPartition(Connection s_conn, Map map);
Map TargetParameter_normalEM();
}
package com.chenyang.nse.bussiness.webtools.entity.vo;
public class DatabaseVO {
private String id;
private String fingerprint;
private String host;
private String schema;
private String port;
private String username;
private String password;
private String dbtype;
private String datasystemname;
private String plaintext;
private String desensitize;
public DatabaseVO(String id, String fingerprint, String host, String schema, String port, String username, String password, String dbtype, String datasystemname) {
this.id = id;
this.fingerprint = fingerprint;
this.host = host;
this.schema = schema;
this.port = port;
this.username = username;
this.password = password;
this.dbtype = dbtype;
this.datasystemname = datasystemname;
}
public String getId() {
return this.id;
}
public String getFingerprint() {
return this.fingerprint;
}
public String getHost() {
return this.host;
}
public String getSchema() {
return this.schema;
}
public String getPort() {
return this.port;
}
public String getUsername() {
return this.username;
}
public String getPassword() {
return this.password;
}
public String getDbtype() {
return this.dbtype;
}
public String getDatasystemname() {
return this.datasystemname;
}
public String getPlaintext() {
return this.plaintext;
}
public String getDesensitize() {
return this.desensitize;
}
public void setId(final String id) {
this.id = id;
}
public void setFingerprint(final String fingerprint) {
this.fingerprint = fingerprint;
}
public void setHost(final String host) {
this.host = host;
}
public void setSchema(final String schema) {
this.schema = schema;
}
public void setPort(final String port) {
this.port = port;
}
public void setUsername(final String username) {
this.username = username;
}
public void setPassword(final String password) {
this.password = password;
}
public void setDbtype(final String dbtype) {
this.dbtype = dbtype;
}
public void setDatasystemname(final String datasystemname) {
this.datasystemname = datasystemname;
}
public void setPlaintext(final String plaintext) {
this.plaintext = plaintext;
}
public void setDesensitize(final String desensitize) {
this.desensitize = desensitize;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
} else if (!(o instanceof DatabaseVO)) {
return false;
} else {
DatabaseVO other = (DatabaseVO)o;
if (!other.canEqual(this)) {
return false;
} else {
Object this$id = this.getId();
Object other$id = other.getId();
if (this$id == null) {
if (other$id != null) {
return false;
}
} else if (!this$id.equals(other$id)) {
return false;
}
Object this$fingerprint = this.getFingerprint();
Object other$fingerprint = other.getFingerprint();
if (this$fingerprint == null) {
if (other$fingerprint != null) {
return false;
}
} else if (!this$fingerprint.equals(other$fingerprint)) {
return false;
}
Object this$host = this.getHost();
Object other$host = other.getHost();
if (this$host == null) {
if (other$host != null) {
return false;
}
} else if (!this$host.equals(other$host)) {
return false;
}
Object this$schema = this.getSchema();
Object other$schema = other.getSchema();
if (this$schema == null) {
if (other$schema != null) {
return false;
}
} else if (!this$schema.equals(other$schema)) {
return false;
}
Object this$port = this.getPort();
Object other$port = other.getPort();
if (this$port == null) {
if (other$port != null) {
return false;
}
} else if (!this$port.equals(other$port)) {
return false;
}
Object this$username = this.getUsername();
Object other$username = other.getUsername();
if (this$username == null) {
if (other$username != null) {
return false;
}
} else if (!this$username.equals(other$username)) {
return false;
}
Object this$password = this.getPassword();
Object other$password = other.getPassword();
if (this$password == null) {
if (other$password != null) {
return false;
}
} else if (!this$password.equals(other$password)) {
return false;
}
Object this$dbtype = this.getDbtype();
Object other$dbtype = other.getDbtype();
if (this$dbtype == null) {
if (other$dbtype != null) {
return false;
}
} else if (!this$dbtype.equals(other$dbtype)) {
return false;
}
Object this$datasystemname = this.getDatasystemname();
Object other$datasystemname = other.getDatasystemname();
if (this$datasystemname == null) {
if (other$datasystemname != null) {
return false;
}
} else if (!this$datasystemname.equals(other$datasystemname)) {
return false;
}
Object this$plaintext = this.getPlaintext();
Object other$plaintext = other.getPlaintext();
if (this$plaintext == null) {
if (other$plaintext != null) {
return false;
}
} else if (!this$plaintext.equals(other$plaintext)) {
return false;
}
Object this$desensitize = this.getDesensitize();
Object other$desensitize = other.getDesensitize();
if (this$desensitize == null) {
if (other$desensitize != null) {
return false;
}
} else if (!this$desensitize.equals(other$desensitize)) {
return false;
}
return true;
}
}
}
protected boolean canEqual(final Object other) {
return other instanceof DatabaseVO;
}
public int hashCode() {
int PRIME = 59;
int result = 1;
Object $id = this.getId();
result = result * 59 + ($id == null ? 43 : $id.hashCode());
Object $fingerprint = this.getFingerprint();
result = result * 59 + ($fingerprint == null ? 43 : $fingerprint.hashCode());
Object $host = this.getHost();
result = result * 59 + ($host == null ? 43 : $host.hashCode());
Object $schema = this.getSchema();
result = result * 59 + ($schema == null ? 43 : $schema.hashCode());
Object $port = this.getPort();
result = result * 59 + ($port == null ? 43 : $port.hashCode());
Object $username = this.getUsername();
result = result * 59 + ($username == null ? 43 : $username.hashCode());
Object $password = this.getPassword();
result = result * 59 + ($password == null ? 43 : $password.hashCode());
Object $dbtype = this.getDbtype();
result = result * 59 + ($dbtype == null ? 43 : $dbtype.hashCode());
Object $datasystemname = this.getDatasystemname();
result = result * 59 + ($datasystemname == null ? 43 : $datasystemname.hashCode());
Object $plaintext = this.getPlaintext();
result = result * 59 + ($plaintext == null ? 43 : $plaintext.hashCode());
Object $desensitize = this.getDesensitize();
result = result * 59 + ($desensitize == null ? 43 : $desensitize.hashCode());
return result;
}
public String toString() {
return "DatabaseVO(id=" + this.getId() + ", fingerprint=" + this.getFingerprint() + ", host=" + this.getHost() + ", schema=" + this.getSchema() + ", port=" + this.getPort() + ", username=" + this.getUsername() + ", password=" + this.getPassword() + ", dbtype=" + this.getDbtype() + ", datasystemname=" + this.getDatasystemname() + ", plaintext=" + this.getPlaintext() + ", desensitize=" + this.getDesensitize() + ")";
}
}
<?xml version="1.0" encoding="UTF-8"?>
<sqls>
<select id="querySearchregexList">
SELECT
a.id,
a.createtime,
a.createuser,
a.dataarea,
b.flag,
b.icon,
b.id as ruleid,
b.`name`,
b.regex,
b.ruleexample,
b.ruleargument,
b.note,
b.defaulttype,
b.discoverway,
b.selectdatafield,
b.dictionaryClass,
b.matchingway,
b.remark
FROM
t_core_dataarea a left JOIN
t_console_searchregex b on
a.id = b.dataarea_id
where b.name is not null
and a.dataarea like :dataarea
and b.name like :rulename
ORDER BY b.dataarea_id,defaulttype desc
</select>
<select id="queryAllSearchregexCount">
SELECT
count(*)
FROM
t_core_dataarea a,
t_console_searchregex b
WHERE
a.tid = b.dataarea_id
and a.dataarea like :dataarea
and b.name like :rulename
</select>
<select id="querySearchregexById">
SELECT
a.id,
a.createtime,
a.createuser,
a.dataarea,
b.flag,
b.icon,
b.id as ruleid,
b.`name`,
b.regex,
b.ruleexample,
b.ruleargument,
b.note,
b.defaulttype,
b.discoverway,
b.selectdatafield,
b.dictionaryClass,
b.matchingway,
b.remark
FROM
t_core_dataarea a left JOIN
t_console_searchregex b on
a.id = b.dataarea_id
where b.id=:id
</select>
<select id="querySensitiveregexList">
SELECT
a.tid,
a.dataarea,
b.tid AS ruleid,
b.mappletname,
b.mappletname2,
b.mappletname3,
b.subjectarea,
b.subjectarea2,
b.subjectarea3,
b.ruledemo,
b.`name`,
b.note,
b.defaulttype
from t_core_dataarea a
LEFT JOIN t_core_masking_ruleinfo b
on a.tid=b.dataarea_id
where b.`name` is not null
and a.dataarea like :dataarea
and b.name like :rulename
ORDER BY b.dataarea_id
</select>
<select id="querySensitiveregexListnorulename">
SELECT
a.tid,
a.dataarea,
b.tid AS ruleid,
b.mappletname,
b.mappletname2,
b.mappletname3,
b.subjectarea,
b.subjectarea2,
b.subjectarea3,
b.ruledemo,
b.`name`,
b.note,
b.defaulttype,
b.defaultrule
from t_core_dataarea a
LEFT JOIN t_core_masking_ruleinfo b
on a.tid=b.dataarea_id
where
-- b.`name` is not null
1=1
and a.dataarea like :dataarea
ORDER BY a.areatype ASC ,a.createtime desc
</select>
<select id="queryAllSensitiveregexCount">
SELECT
count(*)
from t_core_dataarea a
LEFT JOIN t_core_masking_ruleinfo b
on a.tid=b.dataarea_id
where b.`name` is not null
and a.dataarea like :dataarea
and b.name like :rulename
</select>
<select id="queryRuleCount">
SELECT SUM(ROWNO) from(
(select count(*) ROWNO from t_console_searchregex a
where a.dataarea_id=:dataareaId)
union all
(select count(*) ROWNO from t_core_masking_ruleinfo b
where b.dataarea_id=:dataareaId))as c
</select>
<select id="querySearchregexbyprojectid">
SELECT
a.id,
a.createtime,
a.createuser,
a.dataarea,
b.flag,
b.icon,
b.id as ruleid,
b.`name`,
b.regex,
b.ruleexample,
b.ruleargument,
b.note,
b.defaulttype,
b.discoverway,
b.selectdatafield,
b.dictionaryClass,
b.matchingway,
b.remark
FROM
t_core_dataarea a left JOIN
t_console_searchregex b on
a.id = b.dataarea_id left JOIN
t_core_project_findrule c on
b.id = c.rule_id
where b.name is not null
and c.project_id =:projectid
ORDER BY b.dataarea_id
</select>
</sqls>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<sqls>
<!-- 查询数据地图表名列表 -->
<select id="queryUserMapTableName">
SELECT
maptable.tablename
FROM
t_core_datamap_usermap usermap
LEFT JOIN t_core_datamap_table maptable ON usermap.tableid = maptable.id
WHERE
usermap.datamapid = :datamapid
AND usermap.userid = :userid
</select>
<!-- 查询数据地图中私人订制地图中的数据系统id -->
<select id="queryUserMapDataSystemId">
SELECT DISTINCT
(datasystem.id) datasystemid
FROM
t_core_datamap_usermap usermap
LEFT JOIN t_core_datamap datamap ON usermap.datamapid = datamap.id
LEFT JOIN t_core_datasystem datasystem ON datamap.datasystemid = datasystem.id
WHERE
usermap.userid = :userid
</select>
<!-- 查询数据地图中私人订制地图制定数据系统下的schema列表 -->
<select id="queryUserMapSchema">
SELECT DISTINCT
(datamap.dbschema) schemaname
FROM
t_core_datamap_usermap usermap
LEFT JOIN t_core_datamap datamap ON usermap.datamapid = datamap.id
LEFT JOIN t_core_datasystem datasystem ON datamap.datasystemid = datasystem.id
WHERE
usermap.userid = :userid
AND datamap.datasystemid = :datasystemid
</select>
</sqls>
<?xml version="1.0" encoding="UTF-8"?>
<sql>
<select id="getDatamappingInfo">
select
info.id as id,
ds.id as sourcefieldid,
ds.fieldname as sourcefieldname,
info.flag as flag,
dt.id as targetfieldid,
dt.fieldname as targetfieldname,
info.targetlength as targetlength,
info.targetdecimal as targetdecimal,
info.note as note
from
t_console_datamapping_sourcefield ds left join t_console_datamapping_info info on
(
ds.id = info.sourcefieldid and info.targetsystemtype = :targetsystemtype
) left join t_console_datamapping_targetfield dt on
(
dt.id = info.targetfieldid
)
where
ds.datasystemtype = :sourcesystemtype
order by
ds.fieldname
</select>
</sql>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论