diff --git a/dsUtils/src/main/java/com/dsideal/Code/WxRecordController.txt b/dsUtils/src/main/java/com/dsideal/Code/WxRecordController.txt index 34c66562..4d8d2961 100644 --- a/dsUtils/src/main/java/com/dsideal/Code/WxRecordController.txt +++ b/dsUtils/src/main/java/com/dsideal/Code/WxRecordController.txt @@ -1,10 +1,12 @@ +/* 下面代码开始维护维修记录表 */ + //增加维修记录表 @Before({POST.class}) //@JwtCheckInterface({}) //@EmptyInterface({""}) //@IsNumericInterface({}) public void addWxRecord(int station_id , String station_name , int equipmentId , String equipmentName , int connectorId , String connectorNo , String wx_openid , int status_id , int type_id , String type_name , String memo ){ - wm.addWxRecord(station_id , station_name , equipmentId , equipmentName , connectorId , connectorNo , wx_openid , status_id , type_id , type_name , memo ,) + ym.addWxRecord(station_id , station_name , equipmentId , equipmentName , connectorId , connectorNo , wx_openid , status_id , type_id , type_name , memo ); renderJson(RetKit.renderSuccess()); } @@ -14,7 +16,7 @@ //@EmptyInterface({""}) //@IsNumericInterface({"id"}) public void delWxRecordById(int id){ - wm.delWxRecordById(id); + ym.delWxRecordById(id); renderJson(RetKit.renderSuccess()); } @@ -24,7 +26,7 @@ //@EmptyInterface({""}) //@IsNumericInterface({"id"}) public void updateWxRecordById(int id,int station_id , String station_name , int equipmentId , String equipmentName , int connectorId , String connectorNo , String wx_openid , int status_id , int type_id , String type_name , String memo ){ - wm.updateWxRecordById(station_id , station_name , equipmentId , equipmentName , connectorId , connectorNo , wx_openid , status_id , type_id , type_name , memo ,); + ym.updateWxRecordById(id,station_id , station_name , equipmentId , equipmentName , connectorId , connectorNo , wx_openid , status_id , type_id , type_name , memo ); renderJson(RetKit.renderSuccess()); } @@ -34,7 +36,7 @@ //@EmptyInterface({""}) //@IsNumericInterface({"id"}) public void getWxRecordById(int id){ - renderJson(RetKit.renderSuccess(wm.getWxRecordById(id))); + renderJson(RetKit.renderSuccess(ym.getWxRecordById(id))); } //分页查询维修记录表 @@ -42,7 +44,7 @@ //@JwtCheckInterface({}) //@EmptyInterface({""}) public void getWxRecordList(int pageNum, int pageSize){ - Page listPage = wm.getWxRecordList(pageNum, pageSize); + Page listPage = ym.getWxRecordList(pageNum, pageSize); renderJson(RetKit.renderSuccess(listPage)); } diff --git a/dsUtils/src/main/java/com/dsideal/Code/WxRecordModel.txt b/dsUtils/src/main/java/com/dsideal/Code/WxRecordModel.txt index 7de790d3..a50bebf3 100644 --- a/dsUtils/src/main/java/com/dsideal/Code/WxRecordModel.txt +++ b/dsUtils/src/main/java/com/dsideal/Code/WxRecordModel.txt @@ -24,8 +24,8 @@ //修改维修记录表 public void updateWxRecordById(int id,int station_id , String station_name , int equipmentId , String equipmentName , int connectorId , String connectorNo , String wx_openid , int status_id , int type_id , String type_name , String memo ){ - String sql="update t_wx_record set station_id= ?,station_name= ?,equipmentId= ?,equipmentName= ?,connectorId= ?,connectorNo= ?,wx_openid= ?,status_id= ?,create_time= ?,type_id= ?,type_name= ?,memo= ? where id=?"; - Db.update(sql,station_id , station_name , equipmentId , equipmentName , connectorId , connectorNo , wx_openid , status_id , create_time , type_id , type_name , memo , id); + String sql="update t_wx_record set station_id= ?,station_name= ?,equipmentId= ?,equipmentName= ?,connectorId= ?,connectorNo= ?,wx_openid= ?,status_id= ?,create_time= DateTime.now(),type_id= ?,type_name= ?,memo= ? where id=?"; + Db.update(sql,station_id , station_name , equipmentId , equipmentName , connectorId , connectorNo , wx_openid , status_id , type_id , type_name , memo , id); } //单条查询维修记录表 @@ -36,6 +36,8 @@ //分页查询维修记录表 public Page getWxRecordList(int pageNum, int pageSize){ - String sql1="select * " String sql2="fromt_wx_record " return Db.paginate(pageNum, pageSize, sql1,sql2); + String sql1="select * "; + String sql2="fromt_wx_record "; + return Db.paginate(pageNum, pageSize, sql1,sql2); } diff --git a/dsUtils/src/main/java/com/dsideal/Code/新建文本文档.txt b/dsUtils/src/main/java/com/dsideal/Code/新建文本文档.txt deleted file mode 100644 index 6be8ee01..00000000 --- a/dsUtils/src/main/java/com/dsideal/Code/新建文本文档.txt +++ /dev/null @@ -1,6 +0,0 @@ - - -Controller -RetKit.renderSuccess("操作成功")-->RetKit.renderSuccess() - -stage_id 这个不知道是从哪里来的 diff --git a/dsUtils/src/main/java/com/dsideal/Tools/GenerateCode.java b/dsUtils/src/main/java/com/dsideal/Tools/GenerateCode.java index 8c61b648..64204759 100644 --- a/dsUtils/src/main/java/com/dsideal/Tools/GenerateCode.java +++ b/dsUtils/src/main/java/com/dsideal/Tools/GenerateCode.java @@ -206,6 +206,9 @@ public class GenerateCode { fullParameters = fullParameters.substring(0, fullParameters.length() - 1); } parameters = parameters.substring(0, parameters.length() - 1); + if (parameters.endsWith(",")) { + parameters = parameters.substring(0, parameters.length() - 1); + } //后缀名称 String beanNameWithoutT = jo.getStr("beanNameWithoutT"); if (beanNameWithoutT.startsWith("T")) { @@ -222,6 +225,8 @@ public class GenerateCode { StringBuilder sb = new StringBuilder(); //sb.append("//-------------------下面是Controller部分-------------------\n"); + sb.append("/* 下面代码开始维护" + comment + " */\n"); + sb.append("\n"); //1、增加 sb.append(" //增加" + comment + "\n"); sb.append(" @Before({POST.class})\n"); @@ -229,7 +234,7 @@ public class GenerateCode { sb.append(" //@EmptyInterface({\"\"})\n"); sb.append(" //@IsNumericInterface({})\n"); sb.append(" public void add" + beanNameWithoutT + "(" + fullParameters + "){\n"); - sb.append(" " + PropKit.get("daoName") + ".add" + beanNameWithoutT + "(" + parameters + ")\n"); + sb.append(" " + PropKit.get("daoName") + ".add" + beanNameWithoutT + "(" + parameters + ");\n"); sb.append(" renderJson(RetKit.renderSuccess());\n"); sb.append(" }\n"); @@ -253,7 +258,7 @@ public class GenerateCode { sb.append(" //@EmptyInterface({\"\"})\n"); sb.append(" //@IsNumericInterface({\"id\"})\n"); sb.append(" public void update" + beanNameWithoutT + "ById(" + key_type + " " + key + "," + fullParameters + "){\n"); - sb.append(" " + PropKit.get("daoName") + ".update" + beanNameWithoutT + "ById(" + parameters + ");\n"); + sb.append(" " + PropKit.get("daoName") + ".update" + beanNameWithoutT + "ById(" + key + "," + parameters + ");\n"); sb.append(" renderJson(RetKit.renderSuccess());\n"); sb.append(" }\n"); sb.append("\n"); @@ -312,13 +317,19 @@ public class GenerateCode { sb.append(" public void update" + beanNameWithoutT + "ById(" + key_type + " " + key + "," + fullParameters + "){\n"); sb.append(" String sql=\"update " + table + " set "); for (Map.Entry entry : fields.entrySet()) { - sb.append(entry.getKey() + "= ?,"); + if (!entry.getKey().equals("create_time")) { + sb.append(entry.getKey() + "= ?,"); + } else { + sb.append(entry.getKey() + "= DateTime.now(),"); + } } sb = sb.deleteCharAt(sb.length() - 1); sb.append(" where " + key + "=?\";\n"); sb.append(" Db.update(sql,"); for (Map.Entry entry : fields.entrySet()) { - sb.append(entry.getKey() + " , "); + if(!entry.getKey().equals("create_time")){ + sb.append(entry.getKey() + " , "); + } } sb.append(key); sb.append(");\n"); @@ -335,8 +346,8 @@ public class GenerateCode { //5、分页查询 sb.append(" //分页查询" + comment + "\n"); sb.append(" public Page get" + beanNameWithoutT + "List(int pageNum, int pageSize){\n"); - sb.append(" String sql1=\"select * \""); - sb.append(" String sql2=\"from" + table + " \""); + sb.append(" String sql1=\"select * \";\n"); + sb.append(" String sql2=\"from" + table + " \";\n"); sb.append(" return Db.paginate(pageNum, pageSize, sql1,sql2);\n"); sb.append(" }\n"); sb.append("\n"); diff --git a/dsUtils/src/main/resources/application.properties b/dsUtils/src/main/resources/application.properties index 1629d3f0..3bfc9789 100644 --- a/dsUtils/src/main/resources/application.properties +++ b/dsUtils/src/main/resources/application.properties @@ -11,7 +11,7 @@ beanPath=D:/dsWork/dsProject/dsUtils/src/main/java/com/dsideal/Code tableName=t_wx_record # dao的名称 -daoName=wm +daoName=ym diff --git a/dsUtils/target/classes/application.properties b/dsUtils/target/classes/application.properties index 1629d3f0..3bfc9789 100644 --- a/dsUtils/target/classes/application.properties +++ b/dsUtils/target/classes/application.properties @@ -11,7 +11,7 @@ beanPath=D:/dsWork/dsProject/dsUtils/src/main/java/com/dsideal/Code tableName=t_wx_record # dao的名称 -daoName=wm +daoName=ym