From cfb81c32a55b0d27484b2267735c4fdf1e27d994 Mon Sep 17 00:00:00 2001 From: wulin Date: Wed, 13 Dec 2023 16:40:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0mybatis=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 10244 -> 10244 bytes .../device/DeviceAlarmClockMusicEntity.java | 3 +- .../websocket/api/filter/LogWebFilter.java | 3 +- .../api/handler/BoxWebSocketHandler.java | 6 +- .../customer/http/api/mysql/FieldBean.java | 17 + .../customer/http/api/mysql/MysqlMain.java | 89 ++- .../api/mysql/MysqlUtil2ShowCreateTable.java | 4 +- .../http/api/mysql/MysqlUtil2ShowTables.java | 77 --- .../mysql/mybatis/MysqlUtilTable2Bean.java | 582 ++++++++++++++++++ .../mybatis/MysqlUtilTable2Contoller.java | 150 +++++ .../{ => mybatis}/MysqlUtilTable2Mapper.java | 25 +- .../mysql/mybatis/MysqlUtilTable2Service.java | 243 ++++++++ .../{ => mybatis}/MysqlUtilTable2XML.java | 109 +++- .../MysqlReactorUtilTable2Bean.java} | 10 +- .../MysqlReactorUtilTable2Contoller.java} | 11 +- .../MysqlReactorUtilTable2Service.java} | 6 +- 16 files changed, 1203 insertions(+), 132 deletions(-) delete mode 100644 iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtil2ShowTables.java create mode 100644 iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2Bean.java create mode 100644 iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2Contoller.java rename iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/{ => mybatis}/MysqlUtilTable2Mapper.java (71%) create mode 100644 iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2Service.java rename iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/{ => mybatis}/MysqlUtilTable2XML.java (57%) rename iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/{MysqlUtilTable2Bean.java => reactor/MysqlReactorUtilTable2Bean.java} (97%) rename iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/{MysqlUtilTable2Contoller.java => reactor/MysqlReactorUtilTable2Contoller.java} (97%) rename iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/{MysqlUtilTable2Service.java => reactor/MysqlReactorUtilTable2Service.java} (99%) diff --git a/.DS_Store b/.DS_Store index 1d1bf27c7e9924b0fbac22f66adb7cdc93c48815..6fd82d3aa77c4e53fe540a7311fac6385b04fc1c 100644 GIT binary patch delta 37 scmZn(XbIRbO;E(h*g{9a(8#z}N1@u#$lOpz!O~>%LLrmQ_XO3%0MFeDvj6}9 delta 16 XcmZn(XbIRbO>lCrkjLhGf@)#_I`IZr diff --git a/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/entity/device/DeviceAlarmClockMusicEntity.java b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/entity/device/DeviceAlarmClockMusicEntity.java index cf5d0b3..dd3e173 100644 --- a/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/entity/device/DeviceAlarmClockMusicEntity.java +++ b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/entity/device/DeviceAlarmClockMusicEntity.java @@ -3,7 +3,8 @@ import org.hswebframework.ezorm.rdb.mapping.annotation.Comment; import org.hswebframework.web.crud.annotation.EnableEntityEvent; import org.hswebframework.web.api.crud.entity.GenericEntity; import javax.persistence.Column; -import javax.persistence.Table;import lombok.Data; +import javax.persistence.Table; +import lombok.Data; import java.util.Date; /** *

diff --git a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/filter/LogWebFilter.java b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/filter/LogWebFilter.java index d292f69..39a88f7 100644 --- a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/filter/LogWebFilter.java +++ b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/filter/LogWebFilter.java @@ -3,6 +3,7 @@ package com.qiuguo.iot.box.websocket.api.filter; import com.qiuguo.iot.base.constans.Log4Constans; import com.qiuguo.iot.base.utils.StringUtils; import lombok.extern.slf4j.Slf4j; +import org.apache.skywalking.apm.toolkit.trace.Trace; import org.apache.skywalking.apm.toolkit.webflux.WebFluxSkyWalkingOperators; import org.apache.skywalking.apm.toolkit.webflux.WebFluxSkyWalkingTraceContext; import org.hswebframework.web.logger.ReactiveLogger; @@ -44,7 +45,7 @@ public class LogWebFilter implements WebFilter { public Mono filter(ServerWebExchange exchange, WebFilterChain chain) { long startTime = System.currentTimeMillis(); ServerHttpRequest request = exchange.getRequest(); - String requestId = request.getId();//WebFluxSkyWalkingTraceContext.segmentId(exchange); + String requestId = request.getId();//WebFluxSkyWalkingTraceContext.traceId(exchange); log.info("获取到的traceId:{}", requestId); //String pid = WebFluxSkyWalkingTraceContext.getCorrelation(exchange, Log4Constans.PRINT_LOG_ID).get(); //log.info("获取到的pid:{}", pid); diff --git a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BoxWebSocketHandler.java b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BoxWebSocketHandler.java index ec7ce9f..2e887bd 100644 --- a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BoxWebSocketHandler.java +++ b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BoxWebSocketHandler.java @@ -127,16 +127,20 @@ public class BoxWebSocketHandler implements WebSocketHandler { return webSocketMessage; }).contextWrite(context -> { + + log.info("获取contenxt"); + + Context contextTmp = context.put(Log4Constans.PRINT_LOG_ID, boxSession.getLogId()); return contextTmp; }).then(); - //校验 checkToken(boxSession, linkTime, signature, isBind) .subscribe(); + Mono output = session.send(Flux.create(sink -> boxSession.setSink(sink))).contextWrite(context -> { diff --git a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/FieldBean.java b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/FieldBean.java index 303922d..03c42eb 100644 --- a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/FieldBean.java +++ b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/FieldBean.java @@ -21,6 +21,23 @@ public class FieldBean { private String columnDefault;//mo ren zhi private String isNullAble; + public FieldBean(String field, String type, String comment) { + this.field = field; + this.type = type; + //this.lenth = lenth; + this.comment = comment; + + this.javaCode = MysqlUtil.field2JavaCode(this.field); + this.javaTypeFull = MysqlUtil.type2JavaTypeFull(this.type); + /*if(field.contains("_id") || field.startsWith("id")){ + this.javaTypeFull = "Long"; + }*/ + this.javaType = MysqlUtil.type2JavaType(this.type); + /*if(field.contains("_id") || field.startsWith("id")){ + this.javaType = "Long"; + }*/ + + } public FieldBean(String field, String type, String comment, String extra, String columnKey, String columnType, String columnDefault, String isNullAble) { diff --git a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlMain.java b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlMain.java index c5486c5..fa1364c 100644 --- a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlMain.java +++ b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlMain.java @@ -1,5 +1,9 @@ package com.qiuguo.iot.customer.http.api.mysql; +import com.qiuguo.iot.customer.http.api.mysql.mybatis.*; +import com.qiuguo.iot.customer.http.api.mysql.reactor.MysqlReactorUtilTable2Bean; +import com.qiuguo.iot.customer.http.api.mysql.reactor.MysqlReactorUtilTable2Contoller; +import com.qiuguo.iot.customer.http.api.mysql.reactor.MysqlReactorUtilTable2Service; import org.springframework.util.ResourceUtils; import java.io.File; @@ -14,16 +18,16 @@ public class MysqlMain { public static String save_path = System.getProperty("user.dir"); - public static String mysql_url = "jdbc:mysql://192.168.8.146:30416/qiuguo_iot?useSSL=false&serverZoneId=Asia/Shanghai"; + public static String mysql_url = "jdbc:mysql://192.168.8.101:3306/qiuguo-aigc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8"; public static String pre = ""; - public static String mysql_dbname = "qiuguo_iot"; + public static String mysql_dbname = "qiuguo-aigc"; public static String mysql_username = "root"; - public static String mysql_password = "123456"; + public static String mysql_password = "abd006864e4d14b1"; public static String dto_exclude = ",is_delete,";//生成dto时排除字段,前后都要加英文逗号 public static String req_exclude = ",,";//生成Req时排除字段,前后都要加英文逗号 @@ -59,7 +63,12 @@ public class MysqlMain { } List list = new ArrayList<>(); - list.add(new TablesBean("device_alarm_clock_music")); + list.add(new TablesBean("aigc_opt")); + list.add(new TablesBean("aigc_production")); + list.add(new TablesBean("aigc_template")); + list.add(new TablesBean("aigc_template_type")); + list.add(new TablesBean("aigc_tts")); + list.add(new TablesBean("aigc_tts_type")); //list.add(new TablesBean("system_same_talk")); List list2 = new ArrayList(); @@ -72,24 +81,84 @@ public class MysqlMain { obj.setComment(map.get(tableName)); list2.add(obj); } + //createReactor(list2); + createMybatis(list2); + //createMonongdb(list2); + + + } + public static void createMybatis(List list2){ + String AUTH = "wulin";//作者 + Boolean isSwaggerEnabled = false; + for (int i = 0; i < list2.size(); i++) { + MysqlUtilTable2Bean.printEntity(list2.get(i), AUTH, isSwaggerEnabled); + MysqlUtilTable2Bean.printReq(list2.get(i), AUTH, isSwaggerEnabled); + MysqlUtilTable2Bean.printSearchReq(list2.get(i), AUTH, isSwaggerEnabled); + MysqlUtilTable2Bean.printDto(list2.get(i), AUTH, isSwaggerEnabled); + } + //打印BaseIdReq + TablesBean baseIdBean = new TablesBean("base_id"); + List itemList = new ArrayList<>(); + FieldBean fieldBean = new FieldBean("id", "Long", "数据的id"); + fieldBean.setJavaCode("id"); + fieldBean.setJavaType("Long"); + fieldBean.setJavaTypeFull("java.lang.Long"); + itemList.add(fieldBean); + baseIdBean.setFieldList(itemList); + baseIdBean.setComment("id基本操作请求"); + MysqlUtilTable2Bean.printReq(baseIdBean, AUTH, isSwaggerEnabled); + + baseIdBean = new TablesBean("base_ids"); + itemList = new ArrayList<>(); + fieldBean = new FieldBean("ids", "List", "数据的ids数组[1,2]"); + fieldBean.setJavaCode("ids"); + fieldBean.setJavaType("List"); + fieldBean.setJavaTypeFull("java.lang.Long"); + itemList.add(fieldBean); + baseIdBean.setFieldList(itemList); + baseIdBean.setComment("ids基本操作请求"); + MysqlUtilTable2Bean.printReq(baseIdBean, AUTH, isSwaggerEnabled); + for (int i = 0; i < list2.size(); i++) { - MysqlUtilTable2Bean.printEntity(list2.get(i)); - MysqlUtilTable2Bean.printReq(list2.get(i)); - MysqlUtilTable2Bean.printDto(list2.get(i)); + MysqlUtilTable2Contoller.printController(list2.get(i), isSwaggerEnabled); + } + + + for (int i = 0; i < list2.size(); i++) { + MysqlUtilTable2Mapper.printDao(list2.get(i), AUTH); + } + + for (int i = 0; i < list2.size(); i++) { + MysqlUtilTable2Service.printService(list2.get(i), AUTH); + MysqlUtilTable2Service.printServiceImpl(list2.get(i), AUTH); + } + + for (int i = 0; i < list2.size(); i++) { + MysqlUtilTable2XML.printXMLForMap(list2.get(i)); + } + } + + + public static void createReactor(List list2){ + + + for (int i = 0; i < list2.size(); i++) { + MysqlReactorUtilTable2Bean.printEntity(list2.get(i)); + MysqlReactorUtilTable2Bean.printReq(list2.get(i)); + MysqlReactorUtilTable2Bean.printDto(list2.get(i)); } for (int i = 0; i < list2.size(); i++) { //MysqlUtilTable2Contoller.printController(list2.get(i)); - MysqlUtilTable2Contoller.printReactorController(list2.get(i)); + MysqlReactorUtilTable2Contoller.printReactorController(list2.get(i)); } for (int i = 0; i < list2.size(); i++) { - MysqlUtilTable2Service.printReactorService(list2.get(i)); + MysqlReactorUtilTable2Service.printReactorService(list2.get(i)); } - } } diff --git a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtil2ShowCreateTable.java b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtil2ShowCreateTable.java index d8a707a..ac80999 100644 --- a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtil2ShowCreateTable.java +++ b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtil2ShowCreateTable.java @@ -14,7 +14,7 @@ public class MysqlUtil2ShowCreateTable { public static List readTableDetail(String tableName) { // 驱动程序名 - String driver = /*"file:/D:/java/mysql-connector-java-5.1.45.jar";//*/"com.mysql.jdbc.Driver"; + String driver = /*"file:/D:/java/mysql-connector-java-5.1.45.jar";//*/"com.mysql.cj.jdbc.Driver"; // URL指向要访问的数据库名scutcs // String url = "jdbc:mysql://42.120.16.52:3306/" + database; @@ -110,7 +110,7 @@ public class MysqlUtil2ShowCreateTable { // statement用来执行SQL语句 Statement statement = conn.createStatement(); // 要执行的SQL语句 - String sql = "show table status from " + MysqlMain.mysql_dbname; + String sql = "show table status from `" + MysqlMain.mysql_dbname + "`"; ResultSet rs = statement.executeQuery(sql); while (rs.next()) { // 选择sname这列数据 diff --git a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtil2ShowTables.java b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtil2ShowTables.java deleted file mode 100644 index ff164ba..0000000 --- a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtil2ShowTables.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.qiuguo.iot.customer.http.api.mysql; - -import java.sql.*; -import java.util.ArrayList; -import java.util.List; - -public class MysqlUtil2ShowTables { - public static List showTableNameList() { - - String driver = "com.mysql.jdbc.Driver"; - String url = "jdbc:mysql://121.43.74.40:3300/test?useUnicode=true&characterEncoding=utf-8&autoReconnect=true"; - String user = "root"; - String password = "quyixiao"; - - List list = new ArrayList(); - - try { - Class.forName(driver); - Connection conn = DriverManager.getConnection(url, user, password); - if (conn.isClosed()) { - return null; - } - Statement statement = conn.createStatement(); - list = getTables(conn); // 获取所有表名 - statement.close(); - conn.close(); - } catch (Exception e) { - e.printStackTrace(); - } - - return list; - - } - - public static String convertDatabaseCharsetType(String in, String type) { - String dbUser; - if (in != null) { - if (type.equals("oracle")) { - dbUser = in.toUpperCase(); - } else if (type.equals("postgresql")) { - dbUser = "public"; - } else if (type.equals("mysql")) { - dbUser = null; - } else if (type.equals("mssqlserver")) { - dbUser = null; - } else if (type.equals("db2")) { - dbUser = in.toUpperCase(); - } else { - dbUser = in; - } - } else { - dbUser = "public"; - } - return dbUser; - } - - private static List getTables(Connection conn) throws SQLException { - List list = new ArrayList(); - DatabaseMetaData dbMetData = conn.getMetaData(); - ResultSet rs = dbMetData.getTables(null, - convertDatabaseCharsetType("root", "mysql"), null, - new String[]{"TABLE", "VIEW"}); - - while (rs.next()) { - if (rs.getString(4) != null - && (rs.getString(4).equalsIgnoreCase("TABLE") || rs - .getString(4).equalsIgnoreCase("VIEW"))) { - String tableName = rs.getString(3).toLowerCase(); - TablesBean bean = new TablesBean(tableName); - list.add(bean); - } - } - - return list; - } - -} diff --git a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2Bean.java b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2Bean.java new file mode 100644 index 0000000..c9b7a49 --- /dev/null +++ b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2Bean.java @@ -0,0 +1,582 @@ +package com.qiuguo.iot.customer.http.api.mysql.mybatis; + + + +import com.qiuguo.iot.customer.http.api.mysql.FieldBean; +import com.qiuguo.iot.customer.http.api.mysql.MysqlMain; +import com.qiuguo.iot.customer.http.api.mysql.TablesBean; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +public class MysqlUtilTable2Bean { + /** + * 打印entity的信息 + */ + public static void printSearchReq(TablesBean tableBean, String auth, Boolean isSwagger) { + + boolean hasDate = false; + + List list = tableBean.getFieldList(); + + StringBuffer bf = new StringBuffer(); + + String realName = MysqlMain.pre + tableBean.getSpaceName() + ""; + String fileName = MysqlMain.save_path + "/" + realName + "SearchReq.java"; + + int i = 0; + bf.append(" \n"); + bf.append(" /**\n *当前页码\")\n */\n"); + if(isSwagger) { + bf.append(" @ApiModelProperty(value = \"page\", name = \"当前页码\")\n"); + } + bf.append(" private Integer page = 1;\n"); + bf.append(" /**\n *每页返回条数\n */\n"); + if(isSwagger) { + bf.append(" @ApiModelProperty(value = \"limit\", name = \"每页返回条数\")\n"); + } + bf.append(" private Integer limit = 10;\n"); + bf.append(" /**\n *排序字段\n */\n"); + if(isSwagger) { + bf.append(" @ApiModelProperty(value = \"sort\", name = \"排序字段\")\n"); + } + bf.append(" private String sortField;\n"); + bf.append(" /**\n *排序根据排序字段排序 true:升序 false: 降序\n */\n"); + if(isSwagger) { + bf.append(" @ApiModelProperty(value = \"order\", name = \"排序根据排序字段排序 true:升序 false: 降序\")\n"); + } + bf.append(" private Boolean sortType = true;\n"); + + // 定义声明 + for (FieldBean tb : list) { + if (MysqlMain.req_exclude.contains("," + tb.getField() + ",")) { + continue; + } + String temp = ""; + temp += " /**\n *" + tb.getComment() + "\n */\n"; + if (i == 0) { + + }else{ + if(isSwagger) { + temp += " @ApiModelProperty(value = \"" + tb.getComment() + "\", name = \"" + tb.getJavaCode() + "\")\n"; + } + } + if(tb.getJavaType().equals("Date")){ + temp += " private String " + tb.getJavaCode() + ";"; + }else{ + temp += " private " + tb.getJavaType() + " " + tb.getJavaCode() + ";"; + } + i++; + // System.out.println(temp); + bf.append(temp).append("\n"); + + + if (!hasDate && "Date".equals(tb.getJavaType())) { + hasDate = true; + } + } + + + + + // 定义get set方法 +// for (FieldBean tb : list) { +// if (MysqlMain.req_exclude.contains("," + tb.getField() + ",")) { +// continue; +// } +// String temp = ""; +// temp += " /**\n"; +// temp += " * " + tb.getComment() + " \n"; +// temp += " * @return\n"; +// temp += " */\n"; +// temp += " public " + tb.getJavaType() + " " +// + tb.getJavaCodeForGet() + "() {\n"; +// temp += " return " + tb.getJavaCode() + ";\n"; +// temp += " }"; +// // System.out.println(temp); +// +// bf.append(temp).append("\n"); +// +// temp = ""; +// temp += " /**\n"; +// temp += " * " + tb.getComment() + " \n"; +// temp += " * @param " + tb.getJavaCode() + "\n"; +// temp += " */\n"; +// temp += " public void " + tb.getJavaCodeForSet() + "(" +// + tb.getJavaType() + " " + tb.getJavaCode() + ") {\n"; +// temp += " this." + tb.getJavaCode() + " = " + tb.getJavaCode() +// + ";\n"; +// temp += " }\n"; +// // System.out.println(temp); +// bf.append(temp).append("\n"); +// } + + StringBuilder sb = new StringBuilder(); + + sb.append(" @Override\n"); + sb.append(" public String toString() {\n"); + sb.append(" return \"" + realName + "Req{\" +\n"); + + for (FieldBean tb : list) { + if (MysqlMain.req_exclude.contains("," + tb.getField() + ",")) { + continue; + } + String temp = ""; + sb.append(" \"," + tb.getJavaCode() + "=\" + " + tb.getJavaCode() + " +\n"); + } + sb.append(" \"}\";\n"); + sb.append(" }\n"); + try { + + String content = "package " + MysqlMain.package_name + ";\n"; + if(isSwagger) { + content += "import io.swagger.annotations.ApiModel;\n"; + content += "import io.swagger.annotations.ApiModelProperty;\n"; + } + content += "import lombok.Data;\n"; + + + if (hasDate) { + content += "import java.util.Date;" + "\n"; + } + + + content += "/**\n"; + content += "*

\n"; + content += "*" + tableBean.getComment() + "\n"; + content += "*

"; + content += "* @author " + auth + "\n"; + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + content += "* @since " + format.format(new Date()) + "\n"; + content += "*/\n"; + + content += "\n"; + content += "\n"; + + + + content += "@Data\n"; + if(isSwagger) { + content += "@ApiModel(value = \"" + tableBean.getComment() + "SearchReq\")\n"; + } + content += "public class " + realName + "SearchReq implements java.io.Serializable {\n" + bf.toString(); + content += sb.toString(); + content += "}"; + + FileOutputStream fos = new FileOutputStream(fileName); + + Writer out = new OutputStreamWriter(fos, "UTF-8"); + out.write(content); + out.close(); + fos.close(); + System.out.println("===" + realName + ".java" + "生成"); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void printReq(TablesBean tableBean, String auth, Boolean isSwagger) { + + boolean hasDate = false; + + List list = tableBean.getFieldList(); + + StringBuffer bf = new StringBuffer(); + + String realName = MysqlMain.pre + tableBean.getSpaceName() + ""; + String fileName = MysqlMain.save_path + "/" + realName + "Req.java"; + + int i = 0; + + // 定义声明 + for (FieldBean tb : list) { + if (MysqlMain.req_exclude.contains("," + tb.getField() + ",")) { + continue; + } + String temp = ""; + temp += " /**\n *" + tb.getComment() + "\n */\n"; + if(isSwagger) { + temp += " @ApiModelProperty(value = \"" + tb.getComment() + "\", name = \"" + tb.getJavaCode() + "\")\n"; + } + + if(tb.getJavaType().equals("Date")){ + temp += " private String " + tb.getJavaCode() + ";"; + }else{ + temp += " private " + tb.getJavaType() + " " + tb.getJavaCode() + ";"; + } + + i++; + // System.out.println(temp); + bf.append(temp).append("\n"); + + + if (!hasDate && "Date".equals(tb.getJavaType())) { + hasDate = true; + } + } + + + + + // 定义get set方法 +// for (FieldBean tb : list) { +// if (MysqlMain.req_exclude.contains("," + tb.getField() + ",")) { +// continue; +// } +// String temp = ""; +// temp += " /**\n"; +// temp += " * " + tb.getComment() + " \n"; +// temp += " * @return\n"; +// temp += " */\n"; +// temp += " public " + tb.getJavaType() + " " +// + tb.getJavaCodeForGet() + "() {\n"; +// temp += " return " + tb.getJavaCode() + ";\n"; +// temp += " }"; +// // System.out.println(temp); +// +// bf.append(temp).append("\n"); +// +// temp = ""; +// temp += " /**\n"; +// temp += " * " + tb.getComment() + " \n"; +// temp += " * @param " + tb.getJavaCode() + "\n"; +// temp += " */\n"; +// temp += " public void " + tb.getJavaCodeForSet() + "(" +// + tb.getJavaType() + " " + tb.getJavaCode() + ") {\n"; +// temp += " this." + tb.getJavaCode() + " = " + tb.getJavaCode() +// + ";\n"; +// temp += " }\n"; +// // System.out.println(temp); +// bf.append(temp).append("\n"); +// } + + StringBuilder sb = new StringBuilder(); + + sb.append(" @Override\n"); + sb.append(" public String toString() {\n"); + sb.append(" return \"" + realName + "Req{\" +\n"); + + for (FieldBean tb : list) { + if (MysqlMain.req_exclude.contains("," + tb.getField() + ",")) { + continue; + } + String temp = ""; + sb.append(" \"," + tb.getJavaCode() + "=\" + " + tb.getJavaCode() + " +\n"); + } + sb.append(" \"}\";\n"); + sb.append(" }\n"); + try { + + String content = "package " + MysqlMain.package_name + ";\n"; + content += "import io.swagger.annotations.ApiModel;\n"; + content += "import io.swagger.annotations.ApiModelProperty;\n"; + content += "import lombok.Data;\n"; + + + if (hasDate) { + content += "import java.util.Date;" + "\n"; + } + + + content += "/**\n"; + content += "*

\n"; + content += "*" + tableBean.getComment() + "\n"; + content += "*

"; + + content += "* @author " + auth + "\n"; + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + content += "* @since " + format.format(new Date()) + "\n"; + content += "*/\n"; + + content += "\n"; + content += "\n"; + + + + content += "@Data\n"; + if(isSwagger) { + content += "@ApiModel(value = \"" + tableBean.getComment() + "Req\")\n"; + } + content += "public class " + realName + "Req implements java.io.Serializable {\n" + bf.toString(); + content += sb.toString(); + content += "}"; + + FileOutputStream fos = new FileOutputStream(fileName); + + Writer out = new OutputStreamWriter(fos, "UTF-8"); + out.write(content); + out.close(); + fos.close(); + System.out.println("===" + realName + ".java" + "生成"); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + + + /** + * 打印entity的信息 + */ + public static void printEntity(TablesBean tableBean, String auth, Boolean isSwagger) { + + boolean hasDate = false; + + List list = tableBean.getFieldList(); + + StringBuffer bf = new StringBuffer(); + + String realName = MysqlMain.pre + tableBean.getSpaceName() + ""; + String fileName = MysqlMain.save_path + "/" + realName + ".java"; + + int i = 0; + // 定义声明 + for (FieldBean tb : list) { + String temp = ""; + temp += " /**\n *" + tb.getComment() + "\n */\n"; + if(tb.getJavaCode().equals("marketplaceId")){ + temp = temp; + } + if (i == 0) { + temp += " @TableId(value = \"" + tb.getField() + "\", type = IdType.AUTO)\n"; + }else{ + temp += " @TableField(\"" + tb.getField() + "\")\n"; + if(isSwagger){ + temp += " @ApiModelProperty(value = \"" + tb.getComment() + "\", name = \"" + tb.getJavaCode() + "\")\n"; + } + // + } + temp += " private " + tb.getJavaType() + " " + tb.getJavaCode() + ";"; + i++; + // System.out.println(temp); + bf.append(temp).append("\n"); + + + if (!hasDate && "Date".equals(tb.getJavaType())) { + hasDate = true; + } + } + + + // 定义get set方法 +// for (FieldBean tb : list) { +// String temp = ""; +// temp += " /**\n"; +// temp += " * " + tb.getComment() + " \n"; +// temp += " * @return\n"; +// temp += " */\n"; +// temp += " public " + tb.getJavaType() + " " +// + tb.getJavaCodeForGet() + "() {\n"; +// temp += " return " + tb.getJavaCode() + ";\n"; +// temp += " }"; +// // System.out.println(temp); +// +// bf.append(temp).append("\n"); +// +// temp = ""; +// temp += " /**\n"; +// temp += " * " + tb.getComment() + " \n"; +// temp += " * @param " + tb.getJavaCode() + "\n"; +// temp += " */\n"; +// temp += " public void " + tb.getJavaCodeForSet() + "(" +// + tb.getJavaType() + " " + tb.getJavaCode() + ") {\n"; +// temp += " this." + tb.getJavaCode() + " = " + tb.getJavaCode() +// + ";\n"; +// temp += " }\n"; +// // System.out.println(temp); +// bf.append(temp).append("\n"); +// } + + StringBuilder sb = new StringBuilder(); + + sb.append(" @Override\n"); + sb.append(" public String toString() {\n"); + sb.append(" return \"" + realName + "{\" +\n"); + + for (FieldBean tb : list) { + String temp = ""; + sb.append(" \"," + tb.getJavaCode() + "=\" + " + tb.getJavaCode() + " +\n"); + } + sb.append(" \"}\";\n"); + sb.append(" }\n"); + try { + + String content = "package " + MysqlMain.package_name + ";\n"; + if(isSwagger) { + content += "import io.swagger.annotations.ApiModel;\n"; + content += "import io.swagger.annotations.ApiModelProperty;\n"; + } + content += "import lombok.Data;\nimport com.baomidou.mybatisplus.annotation.IdType;\n" + + "import com.baomidou.mybatisplus.annotation.TableField;\n" + + "import com.baomidou.mybatisplus.annotation.TableId;\n" + + "import com.baomidou.mybatisplus.annotation.TableName;\n"; + + + if (hasDate) { + content += "import java.util.Date;" + "\n"; + } + + + content += "/**\n"; + content += "*

\n"; + content += "*

"; + content += "*" + tableBean.getComment() + "\n"; + content += "* @author " + auth + "\n"; + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + content += "* @since " + format.format(new Date()) + "\n"; + content += "*/\n"; + + content += "\n"; + content += "@Data\n"; + content += "@TableName(" + "\"" + tableBean.getTableName() + "\")\n"; + if(isSwagger) { + content += "@ApiModel(value = \"" + tableBean.getComment() + "\")\n"; + } + content += "public class " + realName + " implements java.io.Serializable {\n" + bf.toString(); + content += sb.toString(); + content += "}"; + + FileOutputStream fos = new FileOutputStream(fileName); + + Writer out = new OutputStreamWriter(fos, "UTF-8"); + out.write(content); + out.close(); + fos.close(); + System.out.println("===" + realName + "Req.java" + "生成"); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void printDto(TablesBean tableBean, String auth, Boolean isSwagger) { + + boolean hasDate = false; + + List list = tableBean.getFieldList(); + + StringBuffer bf = new StringBuffer(); + + String realName = MysqlMain.pre + tableBean.getSpaceName() + ""; + String fileName = MysqlMain.save_path + "/" + realName + "Dto.java"; + //String[] exclude = MysqlMain.dto_exclude.split(","); + //Arrays.stream(exclude).findFirst(); + int i = 0; + // 定义声明 + for (FieldBean tb : list) { + String temp = ""; + temp += " /**\n *" + tb.getComment() + "\n */\n"; + + if (MysqlMain.dto_exclude.contains("," + tb.getField() + ",")) { + continue; + }else if(isSwagger){ + temp += " @ApiModelProperty(value = \"" + tb.getComment() + "\", name = \"" + tb.getJavaCode() + "\")\n"; + } + temp += " private " + tb.getJavaType() + " " + tb.getJavaCode() + ";"; + i++; + // System.out.println(temp); + bf.append(temp).append("\n"); + + + if (!hasDate && "Date".equals(tb.getJavaType())) { + hasDate = true; + } + } + + + // 定义get set方法 +// for (FieldBean tb : list) { +// if (MysqlMain.dto_exclude.contains("," + tb.getField() + ",")) { +// continue; +// } +// String temp = ""; +// temp += " /**\n"; +// temp += " * " + tb.getComment() + " \n"; +// temp += " * @return\n"; +// temp += " */\n"; +// temp += " public " + tb.getJavaType() + " " +// + tb.getJavaCodeForGet() + "() {\n"; +// temp += " return " + tb.getJavaCode() + ";\n"; +// temp += " }"; +// // System.out.println(temp); +// +// bf.append(temp).append("\n"); +// +// temp = ""; +// temp += " /**\n"; +// temp += " * " + tb.getComment() + " \n"; +// temp += " * @param " + tb.getJavaCode() + "\n"; +// temp += " */\n"; +// temp += " public void " + tb.getJavaCodeForSet() + "(" +// + tb.getJavaType() + " " + tb.getJavaCode() + ") {\n"; +// temp += " this." + tb.getJavaCode() + " = " + tb.getJavaCode() +// + ";\n"; +// temp += " }\n"; +// // System.out.println(temp); +// bf.append(temp).append("\n"); +// } + + StringBuilder sb = new StringBuilder(); + + sb.append(" @Override\n"); + sb.append(" public String toString() {\n"); + sb.append(" return \"" + realName + "Dto{\" +\n"); + + for (FieldBean tb : list) { + if (MysqlMain.dto_exclude.contains("," + tb.getField() + ",")) { + continue; + } + String temp = ""; + sb.append(" \"," + tb.getJavaCode() + "=\" + " + tb.getJavaCode() + " +\n"); + } + sb.append(" \"}\";\n"); + sb.append(" }\n"); + try { + + String content = "package " + MysqlMain.package_name + ";\n"; + if(isSwagger) { + content += "import io.swagger.annotations.ApiModel;\n"; + content += "import io.swagger.annotations.ApiModelProperty;\n"; + } + content += "import lombok.Data;\n"; + + + if (hasDate) { + content += "import java.util.Date;" + "\n"; + } + + + content += "/**\n"; + content += "*

\n"; + content += "*

"; + content += "*" + tableBean.getComment() + "\n"; + content += "* @author " + auth + "\n"; + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + content += "* @since " + format.format(new Date()) + "\n"; + content += "*/\n"; + + content += "\n"; + content += "@Data\n"; + if (isSwagger){ + content += "@ApiModel(value = \"" + tableBean.getComment() + "Dto\")\n"; + } + content += "public class " + realName + "Dto {\n" + bf.toString(); + content += sb.toString(); + content += "}"; + + FileOutputStream fos = new FileOutputStream(fileName); + + Writer out = new OutputStreamWriter(fos, "UTF-8"); + out.write(content); + out.close(); + fos.close(); + System.out.println("===" + realName + "Dto.java" + "生成"); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2Contoller.java b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2Contoller.java new file mode 100644 index 0000000..7d18d6b --- /dev/null +++ b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2Contoller.java @@ -0,0 +1,150 @@ +package com.qiuguo.iot.customer.http.api.mysql.mybatis; + +import com.qiuguo.iot.customer.http.api.mysql.FieldBean; +import com.qiuguo.iot.customer.http.api.mysql.MysqlMain; +import com.qiuguo.iot.customer.http.api.mysql.TablesBean; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.List; + +public class MysqlUtilTable2Contoller { + /** + * 打印entity的信息 + */ + public static void printController(TablesBean tableBean, Boolean isSwagger) { + + boolean hasDate = false; + + List list = tableBean.getFieldList(); + + StringBuffer bf = new StringBuffer(); + + String realName = MysqlMain.pre + tableBean.getSpaceName() + ""; + String fileName = MysqlMain.save_path + "/" + realName + "Controller.java"; + + try { + StringBuilder content = new StringBuilder(); + content.append("package com.api.admin.controller;\n"); + content.append("\n"); + content.append("\nimport com.baomidou.mybatisplus.extension.plugins.pagination.Page;\n" + + "import org.springframework.beans.BeanUtils;\n" + + "import com.alibaba.fastjson.JSONObject;\n" + + "import org.springframework.beans.factory.annotation.Autowired;\n" + + "import org.springframework.web.bind.annotation.PostMapping;\n" + + "import org.springframework.web.bind.annotation.RequestBody;\n" + + "import org.springframework.web.bind.annotation.RequestMapping;\n" + + "import org.springframework.web.bind.annotation.RestController;\n"); + content.append("\n"); + content.append("\n"); + content.append("import org.springframework.beans.BeanUtils;\n"); + content.append("import com.alibaba.fastjson.JSONObject;\n"); + content.append("@RestController\n"); + if(isSwagger) { + content.append("@Api(tags = \"" + tableBean.getComment() + "\")\n"); + } + content.append("@RequestMapping(\"/" + tableBean.getJavaName() + "/noAuthorization\")\n"); + content.append("public class " + tableBean.getSpaceName() + "Controller {\n"); + content.append("\n"); + content.append("\n"); + content.append(" @Autowired\n"); + content.append(" private " + tableBean.getSpaceName() + "Service " + tableBean.getJavaName() + "Service;\n"); + content.append("\n"); + content.append("\n"); + content.append(" /**\n *获取列表\")\n */\n"); + content.append(" @PostMapping(\"/list\")\n"); + if(isSwagger) { + content.append(" @ApiOperation(\"获取列表\")\n"); + content.append(" @ApiResponses({@ApiResponse(code = 200, message = \"成功\", response = " + realName + "Dto.class)})\n"); + content.append(" public Response list(@RequestBody @ApiParam " + realName + "SearchReq " + tableBean.getJavaName() + "SearchReq) {\n"); + }else{ + content.append(" public Response list(@RequestBody " + realName + "SearchReq " + tableBean.getJavaName() + "SearchReq) {\n"); + } + + content.append(" Page page = " + tableBean.getJavaName() + "Service.queryPage(" + tableBean.getJavaName() + "SearchReq);\n"); + content.append(" return Response.success(page);\n"); + content.append(" }\n"); + content.append("\n"); + content.append("\n"); + + + content.append(" /**\n *根据ID获取单个\")\n */\n"); + content.append(" @PostMapping(\"/getById\")\n"); + + if(isSwagger) { + content.append(" @ApiOperation(\"根据ID获取单个\")\n"); + content.append(" @ApiResponses({@ApiResponse(code = 200, message = \"成功\", response = " + realName + "Dto.class)})\n"); + content.append(" public Response getById(@RequestBody @ApiParam BaseIdReq baseIdReq) {\n"); + }else{ + content.append(" public Response getById(@RequestBody BaseIdReq baseIdReq) {\n"); + } + + content.append(" " + realName + " " + tableBean.getJavaName() + " = " + tableBean.getJavaName() + "Service.select" + tableBean.getSpaceName() + "ById(baseIdReq.getId());\n"); + content.append(" " + realName + "Dto " + tableBean.getJavaName() + "Dto = new " + realName + "Dto();\n"); + content.append(" BeanUtils.copyProperties(" + tableBean.getJavaName() + ", " + tableBean.getJavaName() + "Dto);\n"); + content.append(" return Response.success(" + tableBean.getJavaName() + "Dto);\n"); + + content.append(" }\n"); + + + /*content.append("\n"); + content.append("\n"); + content.append(" @PostMapping(\"/update\")\n"); + content.append(" public R update(@RequestBody " + tableBean.getSpaceName() + " " + tableBean.getJavaName() + ") {\n"); + content.append(" " + tableBean.getJavaName() + "Service.update" + tableBean.getSpaceName() + "ById(" + tableBean.getJavaName() + ");\n"); + content.append(" return R.ok();\n"); + content.append(" }\n");*/ + content.append("\n"); + content.append("\n"); + content.append(" /**\n *保存\n */\n"); + content.append(" @PostMapping(\"/save\")\n"); + + if(isSwagger) { + content.append(" @ApiOperation(\"保存\")\n"); + content.append(" @ApiResponses({@ApiResponse(code = 200, message = \"成功\", response = Response.class)})\n"); + content.append(" public Response save(@RequestBody @ApiParam " + tableBean.getSpaceName() + "Req " + tableBean.getJavaName() + "Req) {\n"); + }else{ + content.append(" public Response save(@RequestBody " + tableBean.getSpaceName() + "Req " + tableBean.getJavaName() + "Req) {\n"); + } + + content.append(" " + realName + " " + tableBean.getJavaName() + "= new " + realName + "();\n"); + content.append(" BeanUtils.copyProperties(" + tableBean.getJavaName() + "Req, " + tableBean.getJavaName() + ");\n"); + content.append(" if(" + tableBean.getJavaName() + "Req.getId() != null)" + "{\n"); + content.append(" " + tableBean.getJavaName() + "Service.update" + tableBean.getSpaceName() + "ById(" + tableBean.getJavaName() + ");\n"); + content.append(" }else{\n"); + content.append(" " + tableBean.getJavaName() + "Service.insert" + tableBean.getSpaceName() + "(" + tableBean.getJavaName() + ");\n"); + content.append(" }\n"); + content.append(" return Response.success();\n"); + content.append(" }\n"); + content.append("\n"); + content.append("\n"); + content.append(" /**\n *根据ID删除\")\n */\n"); + content.append(" @PostMapping(\"/delete\")\n"); + + if(isSwagger) { + content.append(" @ApiOperation(\"根据ID删除\")\n"); + content.append(" @ApiResponses({@ApiResponse(code = 200, message = \"成功\", response = Response.class)})\n"); + content.append(" public Response delete(@RequestBody @ApiParam BaseIdReq baseIdReq) {\n"); + }else{ + content.append(" public Response delete(@RequestBody BaseIdReq baseIdReq) {\n"); + } + + content.append(" " + tableBean.getJavaName() + "Service.delete" + tableBean.getSpaceName() + "ById(baseIdReq.getId());\n"); + content.append(" return Response.success();\n"); + content.append(" }\n"); + content.append("}\n"); + + FileOutputStream fos = new FileOutputStream(fileName); + + Writer out = new OutputStreamWriter(fos, "UTF-8"); + out.write(content.toString()); + out.close(); + fos.close(); + System.out.println("===" + realName + ".java" + "生成"); + } catch (IOException e) { + e.printStackTrace(); + } finally { + } + } +} diff --git a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtilTable2Mapper.java b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2Mapper.java similarity index 71% rename from iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtilTable2Mapper.java rename to iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2Mapper.java index 8007b76..b160ba7 100644 --- a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtilTable2Mapper.java +++ b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2Mapper.java @@ -1,8 +1,10 @@ -package com.qiuguo.iot.customer.http.api.mysql; - +package com.qiuguo.iot.customer.http.api.mysql.mybatis; +import com.qiuguo.iot.customer.http.api.mysql.FieldBean; +import com.qiuguo.iot.customer.http.api.mysql.MysqlMain; +import com.qiuguo.iot.customer.http.api.mysql.TablesBean; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; @@ -14,7 +16,7 @@ public class MysqlUtilTable2Mapper { public static String TAB = " "; - public static void printDao(TablesBean tableBean) { + public static void printDao(TablesBean tableBean, String auth) { String realName = MysqlMain.pre + tableBean.getSpaceName(); @@ -25,13 +27,14 @@ public class MysqlUtilTable2Mapper { String content = "package com.admin.mapper;\n"; - + content += "import java.util.List;\n"; + content += "import com.baomidou.mybatisplus.plugins.Page;\n"; content += "/**\n"; content += "*

\n"; - content += "* " + tableBean.getComment() + " 服务类\n"; + content += "* " + tableBean.getComment() + " Mapper类\n"; content += "*

\n"; content += "*\n"; - content += "* @author wulin\n"; + content += "* @author " + auth + "\n"; SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); content += "* @since " + format.format(new Date()) + "\n"; content += "*/\n"; @@ -71,6 +74,16 @@ public class MysqlUtilTable2Mapper { content += "\n"; content += "\n"; + content += TAB + "List select" + tableBean.getSpaceName() + "BySearch(@Param(\"page\") Page page, @Param(\"req\")" + tableBean.getSpaceName() + "SearchReq " + tableBean.getJavaName() + "SearchReq);"; + content += "\n"; + content += "\n"; + content += "\n"; + + content += TAB + "List select" + tableBean.getSpaceName() + "BySearchEqual(@Param(\"page\") Page page, @Param(\"req\")" + tableBean.getSpaceName() + "SearchReq " + tableBean.getJavaName() + "SearchReq);"; + content += "\n"; + content += "\n"; + content += "\n"; + content += "}"; FileOutputStream fos = new FileOutputStream(fileName); diff --git a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2Service.java b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2Service.java new file mode 100644 index 0000000..76e1e8d --- /dev/null +++ b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2Service.java @@ -0,0 +1,243 @@ +package com.qiuguo.iot.customer.http.api.mysql.mybatis; + +import com.qiuguo.iot.customer.http.api.mysql.FieldBean; +import com.qiuguo.iot.customer.http.api.mysql.MysqlMain; +import com.qiuguo.iot.customer.http.api.mysql.MysqlUtil; +import com.qiuguo.iot.customer.http.api.mysql.TablesBean; +import cn.hutool.core.util.StrUtil; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.text.SimpleDateFormat; +import java.util.Date; + +public class MysqlUtilTable2Service { + + + public static String TAB = " "; + + public static void printService(TablesBean tableBean, String auth) { + String realName = MysqlMain.pre + tableBean.getSpaceName(); + String realName2 = MysqlMain.pre + tableBean.getSpaceName() + ""; + String fileName = MysqlMain.save_path + "/" + realName + "Service.java"; + + try { + String content = "package com.api.business.service;\n"; + content += "import com.baomidou.mybatisplus.plugins.Page;\n"; + content += "import com.baomidou.mybatisplus.plugins.Page;\n"; + content += "/**\n"; + content += "*

\n"; + content += "* " + tableBean.getComment() + " 服务类\n"; + content += "*

\n"; + content += "*\n"; + content += "* @author " + auth + "\n"; + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + content += "* @since " + format.format(new Date()) + "\n"; + content += "*/\n"; + content += "public interface " + tableBean.getSpaceName() + "Service extends IService<" + tableBean.getSpaceName() + "> {\n"; + content += "\n"; + content += "\n"; + content += "\n"; + + + content += TAB + realName + " select" + realName + "ById(Long id);"; + content += "\n"; + content += "\n"; + content += "\n"; + + content += TAB + "Long insert" + realName + "(" + realName + " " + tableBean.getJavaName() + ");"; + content += "\n"; + content += "\n"; + content += "\n"; + + content += TAB + "int update" + realName + "ById(" + realName + " " + tableBean.getJavaName() + ");"; + content += "\n"; + content += "\n"; + content += "\n"; + + content += TAB + "int updateCover" + realName + "ById(" + realName + " " + tableBean.getJavaName() + ");"; + content += "\n"; + content += "\n"; + content += "\n"; + + content += TAB + "int delete" + tableBean.getSpaceName() + "ById(Long id);"; + content += "\n"; + content += "\n"; + content += "\n"; + + content += TAB + "Page queryPage(" + tableBean.getSpaceName() + "SearchReq " + tableBean.getJavaName() + "SearchReq);"; + content += "\n"; + content += "\n"; + content += "\n"; + + content += TAB + "Page queryPageEqual(" + tableBean.getSpaceName() + "SearchReq " + tableBean.getJavaName() + "SearchReq);"; + content += "\n"; + content += "\n"; + content += "\n"; + + + content += "}"; + + FileOutputStream fos = new FileOutputStream(fileName); + Writer out = new OutputStreamWriter(fos, "UTF-8"); + out.write(content); + out.close(); + fos.close(); + + System.out.println("===" + realName + "Service.java" + "生成"); + // 打开一个写文件器,构造函数中的第二个参数true表示以追加形式写文件 + // FileWriter writer = new FileWriter(fileName, false); + // writer.write(content); + // writer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + public static String captureName(String name) { + if (StrUtil.isNotBlank(name) && name.length() > 0) { + name = name.substring(0, 1).toUpperCase() + name.substring(1); + } + return name; + + } + + public static void printServiceImpl(TablesBean tableBean, String auth) { + String realName = MysqlMain.pre + tableBean.getSpaceName(); + + String realName2 = MysqlMain.pre + tableBean.getSpaceName() + ""; + + String javaName = "" + captureName(tableBean.getJavaName()); + String fileName = MysqlMain.save_path + "/" + realName + "ServiceImpl.java"; + + try { + String content = "package com.admin.service.impl;\n"; + + content += "import com.baomidou.mybatisplus.plugins.Page;\n"; + content += "/**\n"; + content += "*

\n"; + content += "* " + tableBean.getComment() + " 服务实现类\n"; + content += "*

\n"; + content += "*\n"; + content += "* @author " + auth + "\n"; + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + content += "* @since " + format.format(new Date()) + "\n"; + content += "*/\n"; + + content += "\n"; + content += "@Service\n"; + content += "public class " + tableBean.getSpaceName() + "ServiceImpl extends ServiceImpl<" + tableBean.getSpaceName() + "Mapper, " + tableBean.getSpaceName() + "> implements " + tableBean.getSpaceName() + "Service {\n"; + content += "\n"; + content += "\n"; + content += " @Autowired\n"; + content += "\tprivate " + realName + "Mapper " + MysqlUtil.getFirstToLower(javaName) + "Mapper;" + "\n"; + content += "\n"; + content += "\n"; + content += "\n"; + + content += TAB + "@Override\n"; + content += TAB + "public " + realName + " select" + realName + "ById(Long id){\n"; + content += TAB + TAB + "return " + tableBean.getJavaName() + "Mapper." + "select" + realName + "ById(id);\n"; + content += TAB + "}\n"; + content += "\n"; + content += "\n"; + content += "\n"; + content += TAB + "@Override\n"; + content += TAB + "public Long insert" + realName + "(" + realName + " " + tableBean.getJavaName() + "){\n"; + content += TAB + TAB + "return " + tableBean.getJavaName() + "Mapper." + "insert" + realName + "(" + tableBean.getJavaName() + ");\n"; + content += TAB + "}\n"; + content += "\n"; + content += "\n"; + content += "\n"; + content += TAB + "@Override\n"; + content += TAB + "public int update" + realName + "ById(" + realName + " " + tableBean.getJavaName() + "){\n"; + content += TAB + TAB + "return " + tableBean.getJavaName() + "Mapper." + "update" + realName + "ById(" + tableBean.getJavaName() + ");\n"; + content += TAB + "}\n"; + + content += "\n"; + content += "\n"; + content += "\n"; + content += TAB + "@Override\n"; + content += TAB + "public int updateCover" + realName + "ById(" + realName + " " + tableBean.getJavaName() + "){\n"; + content += TAB + TAB + "return " + tableBean.getJavaName() + "Mapper." + "updateCover" + realName + "ById(" + tableBean.getJavaName() + ");\n"; + content += TAB + "}\n"; + content += "\n"; + content += "\n"; + content += "\n"; + content += TAB + "@Override\n"; + content += TAB + "public int delete" + tableBean.getSpaceName() + "ById(Long id){\n"; + content += TAB + TAB + "return " + tableBean.getJavaName() + "Mapper." + "delete" + tableBean.getSpaceName() + "ById(id);\n"; + content += TAB + "}\n"; + content += "\n"; + content += "\n"; + content += "\n"; + + content += TAB + "private String changeParam(String param){\n"; + content += TAB + TAB + "if(param != null){//排序字段不为空时转数据库字段\n"; + content += TAB + TAB + TAB + "Pattern pattern = Pattern.compile(\"\\\\B(\\\\p{Upper})(\\\\p{Lower}*)\");\n"; + content += TAB + TAB + TAB + "Matcher matcher = pattern.matcher(param);\n"; + content += TAB + TAB + TAB + "String replaceAll = matcher.replaceAll(\"_$1$2\");\n"; + content += TAB + TAB + TAB + "String result = replaceAll.toLowerCase();\n"; + content += TAB + TAB + TAB + "return result;\n"; + content += TAB + TAB + "}\n"; + content += TAB + TAB + "return null;\n"; + content += TAB + "}\n"; + content += "\n"; + content += "\n"; + content += "\n"; + + content += TAB + "@Override\n"; + content += TAB + "public Page queryPage(" + tableBean.getSpaceName() + "SearchReq " + tableBean.getJavaName() + "SearchReq){\n"; + content += TAB + TAB + tableBean.getJavaName() + "SearchReq.setSortField(changeParam(" + tableBean.getJavaName() + "SearchReq.getSortField()));//排序字段不为空时转数据库字段\n"; + //下面时mybatis 3.x实现方法, + /*content += TAB + TAB + "PageUtils pageUtils = PageUtils.startPage( " + tableBean.getJavaName() + "SearchReq.getCurrPage(), " + tableBean.getJavaName() + "SearchReq.getPageSize()).doSelect(\n"; + content += TAB + TAB + TAB + "page -> " + tableBean.getJavaName() + "Mapper.select" + tableBean.getSpaceName() + "BySearch(page, " + tableBean.getJavaName() + "SearchReq)\n"; + content += TAB + TAB + ");\n"; + content += TAB + TAB + "return pageUtils;\n";*/ + //下面时mybatis 2.x实现方法 + content += TAB + TAB + "Page pageUtils = new Page( " + tableBean.getJavaName() + "SearchReq.getPage(), " + tableBean.getJavaName() + "SearchReq.getLimit());\n"; + content += TAB + TAB + "pageUtils.setRecords(" + tableBean.getJavaName() + "Mapper.select" + tableBean.getSpaceName() + "BySearch(pageUtils, " + tableBean.getJavaName() + "SearchReq));\n"; + content += TAB + TAB + "return pageUtils;\n"; + content += TAB + "}\n"; + content += "\n"; + content += "\n"; + content += "\n"; + + content += TAB + "@Override\n"; + content += TAB + "public Page queryPageEqual(" + tableBean.getSpaceName() + "SearchReq " + tableBean.getJavaName() + "SearchReq){\n"; + content += TAB + TAB + tableBean.getJavaName() + "SearchReq.setSortField(changeParam(" + tableBean.getJavaName() + "SearchReq.getSortField()));//排序字段不为空时转数据库字段\n"; + //下面时mybatis 3.x实现方法, + /*content += TAB + TAB + "PageUtils pageUtils = PageUtils.startPage( " + tableBean.getJavaName() + "SearchReq.getCurrPage(), " + tableBean.getJavaName() + "SearchReq.getPageSize()).doSelect(\n"; + content += TAB + TAB + TAB + "page -> " + tableBean.getJavaName() + "Mapper.select" + tableBean.getSpaceName() + "BySearch(page, " + tableBean.getJavaName() + "SearchReq)\n"; + content += TAB + TAB + ");\n"; + content += TAB + TAB + "return pageUtils;\n";*/ + //下面时mybatis 2.x实现方法 + content += TAB + TAB + "Page pageUtils = new Page( " + tableBean.getJavaName() + "SearchReq.getPage(), " + tableBean.getJavaName() + "SearchReq.getLimit());\n"; + content += TAB + TAB + "pageUtils.setRecords(" + tableBean.getJavaName() + "Mapper.select" + tableBean.getSpaceName() + "BySearchEqual(pageUtils, " + tableBean.getJavaName() + "SearchReq));\n"; + content += TAB + TAB + "return pageUtils;\n"; + content += TAB + "}\n"; + content += "\n"; + content += "\n"; + content += "\n"; + + + content += "}" + "\n"; + FileOutputStream fos = new FileOutputStream(fileName); + Writer out = new OutputStreamWriter(fos, "UTF-8"); + out.write(content); + out.close(); + fos.close(); + + System.out.println("===" + realName + "ServiceImpl.java" + "生成"); + // 打开一个写文件器,构造函数中的第二个参数true表示以追加形式写文件 + // FileWriter writer = new FileWriter(fileName, false); + // writer.write(content); + // writer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtilTable2XML.java b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2XML.java similarity index 57% rename from iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtilTable2XML.java rename to iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2XML.java index acf2912..a7c8200 100644 --- a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtilTable2XML.java +++ b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/mybatis/MysqlUtilTable2XML.java @@ -1,8 +1,12 @@ -package com.qiuguo.iot.customer.http.api.mysql; +package com.qiuguo.iot.customer.http.api.mysql.mybatis; +import com.qiuguo.iot.customer.http.api.mysql.FieldBean; +import com.qiuguo.iot.customer.http.api.mysql.MysqlMain; +import com.qiuguo.iot.customer.http.api.mysql.TablesBean; + import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; @@ -21,10 +25,10 @@ public class MysqlUtilTable2XML { bf.append("").append("\n"); bf.append("").append("\n"); - bf.append("").append("\n"); + bf.append("").append("\n"); bf.append("\n"); bf.append(" \n"); - bf.append(" \n"); + bf.append(" \n"); List list = bean.getFieldList(); int i = 0; @@ -61,7 +65,7 @@ public class MysqlUtilTable2XML { bf.append("\n"); bf.append("\n"); // 根据ID删除 - bf.append(TAB).append("").append("\n"); bf.append(TAB).append(TAB).append("select * from ").append(bean.getTableName()).append(" where id=#{id} and is_delete = 0 limit 1 ").append("\n"); bf.append(TAB).append("").append("\n"); bf.append("\n"); @@ -69,7 +73,7 @@ public class MysqlUtilTable2XML { ///////////////////////////////////////////////////////////////////////////////////////////////////////// - bf.append(TAB).append("").append("\n"); + bf.append(TAB).append("").append("\n"); bf.append(TAB).append(TAB).append("insert into ").append(bean.getTableName()).append("(").append("\n"); for (i = 0; i < bean.getFieldList().size(); i++) { FieldBean obj = bean.getFieldList().get(i); @@ -104,17 +108,18 @@ public class MysqlUtilTable2XML { ///////////////////////////////////////////////////////////////////////////////////////////////////////// - bf.append(TAB).append("").append("\n"); + bf.append(TAB).append("").append("\n"); bf.append(TAB).append(TAB).append("update").append("\n"); bf.append(TAB).append(TAB).append(TAB).append(bean.getTableName()).append("\n"); bf.append(TAB).append(TAB).append("").append("\n"); - for (i = 0; i < bean.getFieldList().size() - 1; i++) { + bf.append(TAB).append(TAB).append("update_time = now()").append("\n"); + for (i = 0; i < bean.getFieldList().size(); i++) { FieldBean obj = bean.getFieldList().get(i); if ("id".equals(obj.getField().toLowerCase()) || "update_time".equals(obj.getField())) { continue; } - bf.append(TAB).append(TAB).append(TAB).append(""); - bf.append(obj.getField()).append(" = #{").append(obj.getJavaCode()).append("},"); + bf.append(TAB).append(TAB).append(TAB).append(", "); + bf.append(obj.getField()).append(" = #{").append(obj.getJavaCode()).append("}"); bf.append("").append("\n"); } @@ -126,13 +131,13 @@ public class MysqlUtilTable2XML { return; } - FieldBean obj = bean.getFieldList().get(bean.getFieldList().size() - 1); - bf.append(TAB).append(TAB).append(TAB).append(""); - bf.append(obj.getField()).append(" = #{").append(obj.getJavaCode()).append("}"); - bf.append(""); + //FieldBean obj = bean.getFieldList().get(bean.getFieldList().size() - 1); + //bf.append(TAB).append(TAB).append(TAB).append(""); + //bf.append(obj.getField()).append(" = #{").append(obj.getJavaCode()).append("}"); + //bf.append(""); bf.append(TAB).append(TAB).append(TAB).append(TAB).append("\n"); bf.append(TAB).append(TAB).append("").append("\n"); - bf.append(TAB).append(TAB).append(",update_time = now()").append("\n"); + bf.append(TAB).append(TAB).append("where id = #{id}").append("\n"); bf.append(TAB).append("").append("\n"); @@ -143,23 +148,23 @@ public class MysqlUtilTable2XML { bf.append("\n"); bf.append("\n"); - bf.append(TAB).append("").append("\n"); + bf.append(TAB).append("").append("\n"); bf.append(TAB).append(TAB).append("update").append("\n"); bf.append(TAB).append(TAB).append(TAB).append(bean.getTableName()).append(TAB).append("\n"); bf.append(TAB).append(TAB).append("set ").append(TAB).append("\n"); - - for (i = 0; i < bean.getFieldList().size() - 1; i++) { - obj = bean.getFieldList().get(i); + bf.append(TAB).append(TAB).append("update_time = now()").append("\n"); + for (i = 0; i < bean.getFieldList().size(); i++) { + FieldBean obj = bean.getFieldList().get(i); if ("id".equals(obj.getField().toLowerCase()) || "update_time".equals(obj.getField())) { continue; } - bf.append(TAB).append(TAB).append(TAB).append(obj.getField()).append(" = #{").append(obj.getJavaCode()).append("},\n"); + bf.append(TAB).append(TAB).append(TAB).append(", ").append(obj.getField()).append(" = #{").append(obj.getJavaCode()).append("}\n"); } - obj = bean.getFieldList().get(bean.getFieldList().size() - 1); - bf.append(TAB).append(TAB).append(TAB).append(obj.getField()).append(" = #{").append(obj.getJavaCode()).append("}"); + //obj = bean.getFieldList().get(bean.getFieldList().size() - 1); + //bf.append(TAB).append(TAB).append(TAB).append(obj.getField()).append(" = #{").append(obj.getJavaCode()).append("}"); bf.append(TAB).append(TAB).append(TAB).append(TAB).append("\n"); - bf.append(TAB).append(TAB).append(",update_time = now()").append("\n"); + bf.append(TAB).append(TAB).append("where id = #{id}").append("\n"); bf.append(TAB).append("").append("\n"); @@ -168,10 +173,68 @@ public class MysqlUtilTable2XML { bf.append("\n"); // 根据ID删除 bf.append(TAB).append("").append("\n"); - bf.append(TAB).append(TAB).append("update ").append(bean.getTableName()).append(" set is_delete = 1 where id=#{id} limit 1 ").append("\n"); + bf.append(TAB).append(TAB).append("update ").append(bean.getTableName()).append(" set is_delete = 1, update_time = now() where id=#{id} limit 1 ").append("\n"); bf.append(TAB).append("").append("\n"); bf.append("\n"); + bf.append(TAB).append("").append("\n"); + bf.append("\n"); + bf.append("\n"); + + bf.append(TAB).append("").append("\n"); + bf.append("\n"); + bf.append("\n"); + bf.append("").append("\n"); bf.append("\n"); diff --git a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtilTable2Bean.java b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/reactor/MysqlReactorUtilTable2Bean.java similarity index 97% rename from iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtilTable2Bean.java rename to iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/reactor/MysqlReactorUtilTable2Bean.java index 4c59aa5..1e6d3d4 100644 --- a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtilTable2Bean.java +++ b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/reactor/MysqlReactorUtilTable2Bean.java @@ -1,19 +1,23 @@ -package com.qiuguo.iot.customer.http.api.mysql; +package com.qiuguo.iot.customer.http.api.mysql.reactor; +import com.qiuguo.iot.customer.http.api.mysql.FieldBean; +import com.qiuguo.iot.customer.http.api.mysql.MysqlMain; +import com.qiuguo.iot.customer.http.api.mysql.MysqlUtil; +import com.qiuguo.iot.customer.http.api.mysql.TablesBean; + import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; import java.text.SimpleDateFormat; -import java.util.Arrays; import java.util.Date; import java.util.List; -public class MysqlUtilTable2Bean { +public class MysqlReactorUtilTable2Bean { /** * 打印entity的信息 */ diff --git a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtilTable2Contoller.java b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/reactor/MysqlReactorUtilTable2Contoller.java similarity index 97% rename from iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtilTable2Contoller.java rename to iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/reactor/MysqlReactorUtilTable2Contoller.java index ed5efef..d5fdccf 100644 --- a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtilTable2Contoller.java +++ b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/reactor/MysqlReactorUtilTable2Contoller.java @@ -1,11 +1,12 @@ -package com.qiuguo.iot.customer.http.api.mysql; +package com.qiuguo.iot.customer.http.api.mysql.reactor; -import com.qiuguo.iot.data.entity.device.DeviceInfoEntity; -import com.qiuguo.iot.data.resp.device.DeviceInfoResp; -import org.hswebframework.web.api.crud.entity.PagerResult; +import com.qiuguo.iot.customer.http.api.mysql.FieldBean; +import com.qiuguo.iot.customer.http.api.mysql.MysqlMain; +import com.qiuguo.iot.customer.http.api.mysql.MysqlUtil; +import com.qiuguo.iot.customer.http.api.mysql.TablesBean; import java.io.FileOutputStream; import java.io.IOException; @@ -15,7 +16,7 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; -public class MysqlUtilTable2Contoller { +public class MysqlReactorUtilTable2Contoller { public static String TAB = " "; /** * 打印entity的信息 diff --git a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtilTable2Service.java b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/reactor/MysqlReactorUtilTable2Service.java similarity index 99% rename from iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtilTable2Service.java rename to iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/reactor/MysqlReactorUtilTable2Service.java index 9f40a8a..4fe56a5 100644 --- a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlUtilTable2Service.java +++ b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/reactor/MysqlReactorUtilTable2Service.java @@ -1,4 +1,4 @@ -package com.qiuguo.iot.customer.http.api.mysql; +package com.qiuguo.iot.customer.http.api.mysql.reactor; @@ -6,7 +6,7 @@ package com.qiuguo.iot.customer.http.api.mysql; -import org.hswebframework.ezorm.rdb.operator.dml.query.SortOrder; +import com.qiuguo.iot.customer.http.api.mysql.*; import java.io.FileOutputStream; import java.io.IOException; @@ -16,7 +16,7 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; -public class MysqlUtilTable2Service { +public class MysqlReactorUtilTable2Service { public static String TAB = " ";