Skip to content

Commit

Permalink
🐛修复不存在识别码跳转空白页的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mewhz committed Nov 9, 2021
1 parent 92704bf commit e7c598c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/main/java/com/mewhz/paste/controller/ListController.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,17 @@ public String list(@RequestParam(value = "id", required = false) String id ){

List<Entity> list = codeSQL.findIdentifyingCode(id);

if (list.size() == 0) {
return "<h1>未找到该识别码</h1>";
}

for (Entity e : list){
html.append(summaryBegin);
html.append(e.get("date"));
html.append(" ");
html.append(e.get("time_id"));
html.append(" ");
html.append(e.get("remark"));
html.append(summaryEnd);
html.append(e.get("type"));
html.append("\">");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/mewhz/paste/utils/CodeSQL.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public List<Entity> findCode(String timeId){
public List<Entity> findIdentifyingCode(String identifying){
List<Entity> identifyingCodes = null;
try{
identifyingCodes = Db.use().query("select text, type, date, code.time_id\n" +
identifyingCodes = Db.use().query("select text, type, date, code.time_id, remark\n" +
"from code inner join identifying_code\n" +
" on code.time_id = identifying_code.time_id\n" +
" where identifying = ?", identifying);
Expand Down
7 changes: 0 additions & 7 deletions src/test/java/com/mewhz/paste/Main.java

This file was deleted.

0 comments on commit e7c598c

Please sign in to comment.