小bug
This commit is contained in:
parent
35063a87df
commit
ff4156d965
|
|
@ -38,7 +38,6 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||||
os.write(b, 0, length);
|
os.write(b, 0, length);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println(e);
|
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
if (os != null) {
|
if (os != null) {
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,6 @@ public class Config {
|
||||||
private static String profile;
|
private static String profile;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setProfile(String profile){
|
|
||||||
Config.profile = profile;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static String getProfile() {
|
public static String getProfile() {
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -167,11 +167,9 @@ public class GenController extends GenBaseController {
|
||||||
@GetMapping("/download/{tableName}")
|
@GetMapping("/download/{tableName}")
|
||||||
public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException {
|
public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException {
|
||||||
byte[] data = genTableService.downloadCode(tableName);
|
byte[] data = genTableService.downloadCode(tableName);
|
||||||
|
|
||||||
genCode(response, data);
|
genCode(response, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成代码(自定义路径)
|
* 生成代码(自定义路径)
|
||||||
*/
|
*/
|
||||||
|
|
@ -217,6 +215,7 @@ public class GenController extends GenBaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将bytes流写入到本地
|
* 将bytes流写入到本地
|
||||||
|
*
|
||||||
* @param bytes
|
* @param bytes
|
||||||
*/
|
*/
|
||||||
public boolean compress(byte[] bytes) {
|
public boolean compress(byte[] bytes) {
|
||||||
|
|
|
||||||
|
|
@ -559,6 +559,8 @@ public class GenTableServiceImpl implements GenTableService {
|
||||||
} else if (GenStringUtils.isEmpty(genTable.getSubTableFkName())) {
|
} else if (GenStringUtils.isEmpty(genTable.getSubTableFkName())) {
|
||||||
throw new GenCustomException("子表关联的外键名不能为空");
|
throw new GenCustomException("子表关联的外键名不能为空");
|
||||||
}
|
}
|
||||||
|
} else if (GenConstants.TPL_ASS.equals(genTable.getTplCategory())) {
|
||||||
|
// todo 规则校验
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ public class QueryServiceImpl implements QueryService {
|
||||||
try {
|
try {
|
||||||
int uqrenewal = uniQueryDao.updateUniQuery(uniQuery);
|
int uqrenewal = uniQueryDao.updateUniQuery(uniQuery);
|
||||||
if (uqrenewal > 0) {
|
if (uqrenewal > 0) {
|
||||||
if (uniQuery.getUniCons() != null) {
|
if (uniQuery.getUniCons() != null && uniQuery.getUniCons().size() > 0) {
|
||||||
queryDao.deleteUniCon(uniQuery.getId());
|
queryDao.deleteUniCon(uniQuery.getId());
|
||||||
Integer ucrenewal = queryDao.insertUniCon(uniQuery.getUniCons());
|
Integer ucrenewal = queryDao.insertUniCon(uniQuery.getUniCons());
|
||||||
if (ucrenewal == 0) {
|
if (ucrenewal == 0) {
|
||||||
|
|
@ -123,16 +123,19 @@ public class QueryServiceImpl implements QueryService {
|
||||||
try {
|
try {
|
||||||
StringBuilder sql = new StringBuilder(uniQuery.getUqSql().toLowerCase());
|
StringBuilder sql = new StringBuilder(uniQuery.getUqSql().toLowerCase());
|
||||||
List<UniCon> uniConList = uniQuery.getUniCons();
|
List<UniCon> uniConList = uniQuery.getUniCons();
|
||||||
if (sql.toString().contains("insert") || sql.toString().contains("delete ") || sql.toString().contains("update ") || sql.toString().contains("drop ") || sql.toString().contains("database ") || sql.toString().contains("create ") || sql.toString().contains("view ") || sql.toString().contains("alter ")) {
|
if (sql.toString().contains("insert") || sql.toString().contains("delete ") || sql.toString().contains("update ") ||
|
||||||
return new GenServerResult<>(false, "sql语句含有insert,delete,update,drop,database,view,alter等特殊字符!");
|
sql.toString().contains("drop ") || sql.toString().contains("database ") || sql.toString().contains("create ") ||
|
||||||
|
sql.toString().contains("view ") || sql.toString().contains("alter ")|| sql.toString().contains("gen_")) {
|
||||||
|
return new GenServerResult<>(false, "sql语句含有insert,delete,update,drop,database,view,alter,gen_等特殊字符!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uniConList.size() > 0) {
|
if (uniConList.size() > 0) {
|
||||||
sql.append(" where 1 = 1");
|
sql.append(" where 1 = 1");
|
||||||
for (UniCon uniCon : uniConList) {
|
for (UniCon uniCon : uniConList) {
|
||||||
|
if(!uniCon.getUcMock().equals("")){
|
||||||
sql.append(conversionPreview(uniCon));
|
sql.append(conversionPreview(uniCon));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
List<Map<String, Object>> dataMap = queryDao.UniQuery(sql.toString());
|
List<Map<String, Object>> dataMap = queryDao.UniQuery(sql.toString());
|
||||||
return new GenServerResult<>(true, dataMap);
|
return new GenServerResult<>(true, dataMap);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue