Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
wangjiahao 2022-08-25 14:20:12 +08:00
commit b58691a76c
3 changed files with 17 additions and 5 deletions

View File

@ -957,7 +957,6 @@ public class DataSetTableService {
public void checkVariable(final String sql) throws Exception { public void checkVariable(final String sql) throws Exception {
String tmpSql = removeVariables(sql); String tmpSql = removeVariables(sql);
System.out.println(tmpSql);
if (tmpSql.contains(SubstitutedParams)) { if (tmpSql.contains(SubstitutedParams)) {
throw new Exception(Translator.get("I18N_SQL_variable_limit")); throw new Exception(Translator.get("I18N_SQL_variable_limit"));
} }

View File

@ -6,6 +6,7 @@ import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.utils.BeanUtils; import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.DeFileUtils; import io.dataease.commons.utils.DeFileUtils;
import io.dataease.commons.utils.DeLogUtils; import io.dataease.commons.utils.DeLogUtils;
import io.dataease.commons.utils.Md5Utils;
import io.dataease.dto.DriverDTO; import io.dataease.dto.DriverDTO;
import io.dataease.dto.SysLogDTO; import io.dataease.dto.SysLogDTO;
import io.dataease.i18n.Translator; import io.dataease.i18n.Translator;
@ -99,7 +100,7 @@ public class DriverService {
public List<DeDriverDetails> listDriverDetails(String driverId) { public List<DeDriverDetails> listDriverDetails(String driverId) {
DeDriverDetailsExample example = new DeDriverDetailsExample(); DeDriverDetailsExample example = new DeDriverDetailsExample();
example.createCriteria().andDeDriverIdEqualTo(driverId); example.createCriteria().andDeDriverIdEqualTo(driverId);
return deDriverDetailsMapper.selectByExampleWithBLOBs(example); return deDriverDetailsMapper.selectByExample(example);
} }
public void deleteDriverFile(String driverFileId) throws Exception{ public void deleteDriverFile(String driverFileId) throws Exception{
@ -108,7 +109,11 @@ public class DriverService {
if(deDriver == null){ if(deDriver == null){
throw new Exception(Translator.get("I18N_DRIVER_NOT_FOUND")); throw new Exception(Translator.get("I18N_DRIVER_NOT_FOUND"));
} }
DeFileUtils.deleteFile(DRIVER_PATH + deDriverDetails.getDeDriverId() + "/" + deDriverDetails.getFileName()); if(deDriverDetails.getIsTransName()){
DeFileUtils.deleteFile(DRIVER_PATH + deDriverDetails.getDeDriverId() + "/" + deDriverDetails.getFileName());
}else {
DeFileUtils.deleteFile(DRIVER_PATH + deDriverDetails.getDeDriverId() + "/" + deDriverDetails.getTransName());
}
SysLogDTO sysLogDTO = DeLogUtils.buildLog(SysLogConstants.OPERATE_TYPE.DELETE, SysLogConstants.SOURCE_TYPE.DRIVER_FILE, deDriverDetails.getId(), deDriverDetails.getDeDriverId(), null, null); SysLogDTO sysLogDTO = DeLogUtils.buildLog(SysLogConstants.OPERATE_TYPE.DELETE, SysLogConstants.SOURCE_TYPE.DRIVER_FILE, deDriverDetails.getId(), deDriverDetails.getDeDriverId(), null, null);
DeLogUtils.save(sysLogDTO); DeLogUtils.save(sysLogDTO);
deDriverDetailsMapper.deleteByPrimaryKey(driverFileId); deDriverDetailsMapper.deleteByPrimaryKey(driverFileId);
@ -122,8 +127,11 @@ public class DriverService {
throw new Exception(Translator.get("I18N_DRIVER_NOT_FOUND")); throw new Exception(Translator.get("I18N_DRIVER_NOT_FOUND"));
} }
String filename = file.getOriginalFilename(); String filename = file.getOriginalFilename();
if(!filename.endsWith(".jar")){
throw new Exception("File is not jar!");
}
String dirPath = DRIVER_PATH + driverId + "/"; String dirPath = DRIVER_PATH + driverId + "/";
String filePath = dirPath + filename; String filePath = dirPath + Md5Utils.md5(filename) + ".jar";
saveFile(file, dirPath, filePath); saveFile(file, dirPath, filePath);
List<String> jdbcList = new ArrayList<>(); List<String> jdbcList = new ArrayList<>();
@ -135,6 +143,8 @@ public class DriverService {
deDriverDetails.setVersion(version); deDriverDetails.setVersion(version);
deDriverDetails.setFileName(filename); deDriverDetails.setFileName(filename);
deDriverDetails.setDriverClass(String.join(",", jdbcList)); deDriverDetails.setDriverClass(String.join(",", jdbcList));
deDriverDetails.setIsTransName(true);
deDriverDetails.setTransName(Md5Utils.md5(filename) + ".jar");
DeDriverDetailsExample deDriverDetailsExample = new DeDriverDetailsExample(); DeDriverDetailsExample deDriverDetailsExample = new DeDriverDetailsExample();
deDriverDetailsExample.createCriteria().andDeDriverIdEqualTo(driverId).andFileNameEqualTo(filename); deDriverDetailsExample.createCriteria().andDeDriverIdEqualTo(driverId).andFileNameEqualTo(filename);

View File

@ -40,4 +40,7 @@ update `sys_menu` set icon = 'plugins-new' where `menu_id` = 101;
update `sys_menu` set icon = 'sys-setting' where `menu_id` = 700; update `sys_menu` set icon = 'sys-setting' where `menu_id` = 700;
update `sys_menu` set icon = 'sys-param' where `menu_id` = 6; update `sys_menu` set icon = 'sys-param' where `menu_id` = 6;
update `sys_menu` set icon = 'display-setting' where `menu_id` = 710; update `sys_menu` set icon = 'display-setting' where `menu_id` = 710;
COMMIT; COMMIT;
ALTER TABLE `de_driver_details` ADD COLUMN `is_trans_name` TINYINT(1) NULL AFTER `driver_class`;
ALTER TABLE `de_driver_details` ADD COLUMN `trans_name` VARCHAR(255) NULL AFTER `driver_class`;