小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);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.out.println(e);
|
||||
throw e;
|
||||
} finally {
|
||||
if (os != null) {
|
||||
|
|
|
|||
|
|
@ -21,13 +21,6 @@ public class Config {
|
|||
private static String profile;
|
||||
|
||||
|
||||
|
||||
|
||||
public void setProfile(String profile){
|
||||
Config.profile = profile;
|
||||
}
|
||||
|
||||
|
||||
public static String getProfile() {
|
||||
return profile;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,9 +72,9 @@ public class GenController extends GenBaseController {
|
|||
List<GenTable> tables = genTableService.selectGenTableAll();
|
||||
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(talbleId);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("info" , table);
|
||||
map.put("rows" , list);
|
||||
map.put("tables" , tables);
|
||||
map.put("info", table);
|
||||
map.put("rows", list);
|
||||
map.put("tables", tables);
|
||||
return AjaxResult.success(map);
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ public class GenController extends GenBaseController {
|
|||
* 导入表结构(保存)
|
||||
*/
|
||||
@PreAuthorize("@hchyun.hasPermi('tool:gen:list')")
|
||||
@Log(title = "代码生成" , businessType = GenBusinessType.IMPORT)
|
||||
@Log(title = "代码生成", businessType = GenBusinessType.IMPORT)
|
||||
@PostMapping("/importTable")
|
||||
public AjaxResult importTableSave(String tables) {
|
||||
String[] tableNames = Convert.toStrArray(tables);
|
||||
|
|
@ -121,7 +121,7 @@ public class GenController extends GenBaseController {
|
|||
* 修改保存代码生成业务
|
||||
*/
|
||||
@PreAuthorize("@hchyun.hasPermi('tool:gen:edit')")
|
||||
@Log(title = "代码生成" , businessType = GenBusinessType.UPDATE)
|
||||
@Log(title = "代码生成", businessType = GenBusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult editSave(@Validated @RequestBody GenTable genTable) {
|
||||
genTableService.validateEdit(genTable);
|
||||
|
|
@ -133,7 +133,7 @@ public class GenController extends GenBaseController {
|
|||
* 删除代码生成
|
||||
*/
|
||||
@PreAuthorize("@hchyun.hasPermi('tool:gen:remove')")
|
||||
@Log(title = "代码生成" , businessType = GenBusinessType.DELETE)
|
||||
@Log(title = "代码生成", businessType = GenBusinessType.DELETE)
|
||||
@DeleteMapping("/{tableIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] tableIds) {
|
||||
try {
|
||||
|
|
@ -163,20 +163,18 @@ public class GenController extends GenBaseController {
|
|||
* 生成代码(下载方式)
|
||||
*/
|
||||
@PreAuthorize("@hchyun.hasPermi('tool:gen:code')")
|
||||
@Log(title = "代码生成" , businessType = GenBusinessType.GENCODE)
|
||||
@Log(title = "代码生成", businessType = GenBusinessType.GENCODE)
|
||||
@GetMapping("/download/{tableName}")
|
||||
public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException {
|
||||
byte[] data = genTableService.downloadCode(tableName);
|
||||
|
||||
genCode(response, data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成代码(自定义路径)
|
||||
*/
|
||||
@PreAuthorize("@hchyun.hasPermi('tool:gen:code')")
|
||||
@Log(title = "代码生成" , businessType = GenBusinessType.GENCODE)
|
||||
@Log(title = "代码生成", businessType = GenBusinessType.GENCODE)
|
||||
@GetMapping("/genCode/{tableName}")
|
||||
public AjaxResult genCode(@PathVariable("tableName") String tableName) {
|
||||
boolean start = genTableService.generatorCode(tableName);
|
||||
|
|
@ -191,7 +189,7 @@ public class GenController extends GenBaseController {
|
|||
* 同步数据库
|
||||
*/
|
||||
@PreAuthorize("@hchyun.hasPermi('tool:gen:edit')")
|
||||
@Log(title = "代码生成" , businessType = GenBusinessType.UPDATE)
|
||||
@Log(title = "代码生成", businessType = GenBusinessType.UPDATE)
|
||||
@GetMapping("/synchDb/{tableName}")
|
||||
public AjaxResult synchDb(@PathVariable("tableName") String tableName) {
|
||||
genTableService.synchDb(tableName);
|
||||
|
|
@ -202,7 +200,7 @@ public class GenController extends GenBaseController {
|
|||
* 批量生成代码
|
||||
*/
|
||||
@PreAuthorize("@hchyun.hasPermi('tool:gen:code')")
|
||||
@Log(title = "代码生成" , businessType = GenBusinessType.GENCODE)
|
||||
@Log(title = "代码生成", businessType = GenBusinessType.GENCODE)
|
||||
@GetMapping("/batchGenCode")
|
||||
public void batchGenCode(HttpServletResponse response, String tables) throws IOException {
|
||||
String[] tableNames = Convert.toStrArray(tables);
|
||||
|
|
@ -217,11 +215,12 @@ public class GenController extends GenBaseController {
|
|||
|
||||
/**
|
||||
* 将bytes流写入到本地
|
||||
*
|
||||
* @param bytes
|
||||
*/
|
||||
public boolean compress(byte[] bytes) {
|
||||
try {
|
||||
String dir = Config.getProfile()+"/hchyun.zip";
|
||||
String dir = Config.getProfile() + "/hchyun.zip";
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(dir);
|
||||
fileOutputStream.write(bytes);
|
||||
fileOutputStream.flush();
|
||||
|
|
@ -268,10 +267,10 @@ public class GenController extends GenBaseController {
|
|||
*/
|
||||
private void genCode(HttpServletResponse response, byte[] data) throws IOException {
|
||||
response.reset();
|
||||
response.addHeader("Access-Control-Allow-Origin" , "*");
|
||||
response.addHeader("Access-Control-Expose-Headers" , "Content-Disposition");
|
||||
response.setHeader("Content-Disposition" , "attachment; filename=\"hchyun.zip\"");
|
||||
response.addHeader("Content-Length" , "" + data.length);
|
||||
response.addHeader("Access-Control-Allow-Origin", "*");
|
||||
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"hchyun.zip\"");
|
||||
response.addHeader("Content-Length", "" + data.length);
|
||||
response.setContentType("application/octet-stream; charset=UTF-8");
|
||||
IOUtils.write(data, response.getOutputStream());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -559,6 +559,8 @@ public class GenTableServiceImpl implements GenTableService {
|
|||
} else if (GenStringUtils.isEmpty(genTable.getSubTableFkName())) {
|
||||
throw new GenCustomException("子表关联的外键名不能为空");
|
||||
}
|
||||
} else if (GenConstants.TPL_ASS.equals(genTable.getTplCategory())) {
|
||||
// todo 规则校验
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class QueryServiceImpl implements QueryService {
|
|||
try {
|
||||
int uqrenewal = uniQueryDao.updateUniQuery(uniQuery);
|
||||
if (uqrenewal > 0) {
|
||||
if (uniQuery.getUniCons() != null) {
|
||||
if (uniQuery.getUniCons() != null && uniQuery.getUniCons().size() > 0) {
|
||||
queryDao.deleteUniCon(uniQuery.getId());
|
||||
Integer ucrenewal = queryDao.insertUniCon(uniQuery.getUniCons());
|
||||
if (ucrenewal == 0) {
|
||||
|
|
@ -123,14 +123,17 @@ public class QueryServiceImpl implements QueryService {
|
|||
try {
|
||||
StringBuilder sql = new StringBuilder(uniQuery.getUqSql().toLowerCase());
|
||||
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 ")) {
|
||||
return new GenServerResult<>(false, "sql语句含有insert,delete,update,drop,database,view,alter等特殊字符!");
|
||||
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 ")|| sql.toString().contains("gen_")) {
|
||||
return new GenServerResult<>(false, "sql语句含有insert,delete,update,drop,database,view,alter,gen_等特殊字符!");
|
||||
}
|
||||
|
||||
if (uniConList.size() > 0) {
|
||||
sql.append(" where 1 = 1");
|
||||
for (UniCon uniCon : uniConList) {
|
||||
sql.append(conversionPreview(uniCon));
|
||||
if(!uniCon.getUcMock().equals("")){
|
||||
sql.append(conversionPreview(uniCon));
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Map<String, Object>> dataMap = queryDao.UniQuery(sql.toString());
|
||||
|
|
|
|||
Loading…
Reference in New Issue