From daa3b6ee427cf23e46c273f031e9a3f00dfefce8 Mon Sep 17 00:00:00 2001 From: YUJT Date: Mon, 18 Apr 2022 17:04:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90=E4=B8=9A=E5=8A=A1=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=9B=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/renren/utils/GenUtils.java | 415 +++++++++--------- .../src/main/resources/generator.properties | 2 +- .../resources/template/Controller.java.vm | 2 +- .../src/main/resources/template/DTO.java.vm | 2 +- .../main/resources/template/Service.java.vm | 2 +- .../resources/template/ServiceImpl.java.vm | 2 +- .../power/dto/axis/PowerAxisLeaderDTO.java | 89 ++++ .../power/dto/axis/PowerAxisTagDTO.java | 84 ++++ .../pli-power-base-server/pom.xml | 4 +- .../controller/PowerAxisLeaderController.java | 82 ++++ .../controller/PowerAxisTagController.java | 82 ++++ .../modules/axis/dao/PowerAxisLeaderDao.java | 16 + .../modules/axis/dao/PowerAxisTagDao.java | 16 + .../axis/entity/PowerAxisLeaderEntity.java | 59 +++ .../axis/entity/PowerAxisTagEntity.java | 54 +++ .../axis/excel/PowerAxisLeaderExcel.java | 60 +++ .../modules/axis/excel/PowerAxisTagExcel.java | 57 +++ .../axis/redis/PowerAxisLeaderRedis.java | 30 ++ .../modules/axis/redis/PowerAxisTagRedis.java | 30 ++ .../axis/service/PowerAxisLeaderService.java | 78 ++++ .../axis/service/PowerAxisTagService.java | 79 ++++ .../impl/PowerAxisLeaderServiceImpl.java | 87 ++++ .../service/impl/PowerAxisTagServiceImpl.java | 87 ++++ .../mapper/poweraxis/PowerAxisLeaderDao.xml | 24 + .../mapper/poweraxis/PowerAxisTagDao.xml | 23 + pom.xml | 2 +- 26 files changed, 1258 insertions(+), 210 deletions(-) create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/PowerAxisLeaderDTO.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/PowerAxisTagDTO.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisLeaderController.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisTagController.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisLeaderDao.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisTagDao.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/entity/PowerAxisLeaderEntity.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/entity/PowerAxisTagEntity.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/excel/PowerAxisLeaderExcel.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/excel/PowerAxisTagExcel.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/redis/PowerAxisLeaderRedis.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/redis/PowerAxisTagRedis.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisLeaderService.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisTagService.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisLeaderServiceImpl.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisLeaderDao.xml create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisTagDao.xml diff --git a/epmet-cloud-generator/src/main/java/io/renren/utils/GenUtils.java b/epmet-cloud-generator/src/main/java/io/renren/utils/GenUtils.java index e6571fe..e871fac 100644 --- a/epmet-cloud-generator/src/main/java/io/renren/utils/GenUtils.java +++ b/epmet-cloud-generator/src/main/java/io/renren/utils/GenUtils.java @@ -43,206 +43,217 @@ import java.util.zip.ZipOutputStream; */ public class GenUtils { - public static List getTemplates(){ - List templates = new ArrayList<>(); - templates.add("template/Entity.java.vm"); - templates.add("template/Dao.java.vm"); - templates.add("template/Dao.xml.vm"); - templates.add("template/Service.java.vm"); - templates.add("template/ServiceImpl.java.vm"); - templates.add("template/Controller.java.vm"); - templates.add("template/Excel.java.vm"); - templates.add("template/Redis.java.vm"); - templates.add("template/DTO.java.vm"); - templates.add("template/index.vue.vm"); - templates.add("template/add-or-update.vue.vm"); - return templates; - } - - /** - * 生成代码 - */ - public static void generatorCode(Map table, - List> columns, ZipOutputStream zip){ - //配置信息 - Configuration config = getConfig(); - boolean hasBigDecimal = false; - //表信息 - TableEntity tableEntity = new TableEntity(); - tableEntity.setTableName(table.get("tableName")); - tableEntity.setComments(table.get("tableComment")); - //表名转换成Java类名 - String className = tableToJava(tableEntity.getTableName(), config.getString("tablePrefix")); - tableEntity.setClassName(className); - tableEntity.setClassname(StringUtils.uncapitalize(className)); - - //列信息 - List columsList = new ArrayList<>(); - for(Map column : columns){ - ColumnEntity columnEntity = new ColumnEntity(); - columnEntity.setColumnName(column.get("columnName")); - columnEntity.setDataType(column.get("dataType")); - columnEntity.setComments(column.get("columnComment")); - columnEntity.setExtra(column.get("extra")); - - //列名转换成Java属性名 - String attrName = columnToJava(columnEntity.getColumnName()); - columnEntity.setAttrName(attrName); - columnEntity.setAttrname(StringUtils.uncapitalize(attrName)); - - //列的数据类型,转换成Java类型 - String attrType = config.getString(columnEntity.getDataType(), "unknowType"); - columnEntity.setAttrType(attrType); - if (!hasBigDecimal && attrType.equals("BigDecimal" )) { - hasBigDecimal = true; - } - //是否主键 - if("PRI".equalsIgnoreCase(column.get("columnKey")) && tableEntity.getPk() == null){ - tableEntity.setPk(columnEntity); - } - - columsList.add(columnEntity); - } - tableEntity.setColumns(columsList); - - //没主键,则第一个字段为主键 - if(tableEntity.getPk() == null){ - tableEntity.setPk(tableEntity.getColumns().get(0)); - } - - //设置velocity资源加载器 - Properties prop = new Properties(); - prop.put("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); - Velocity.init(prop); - - String main = config.getString("main" ); - main = StringUtils.isBlank(main) ? config.getString("package" ) : main; - - //封装模板数据 - Map map = new HashMap<>(); - map.put("tableName", tableEntity.getTableName()); - map.put("comments", tableEntity.getComments()); - map.put("pk", tableEntity.getPk()); - map.put("className", tableEntity.getClassName()); - map.put("classname", tableEntity.getClassname()); - map.put("pathName", tableEntity.getClassname()); - map.put("columns", tableEntity.getColumns()); - map.put("hasBigDecimal", hasBigDecimal); - map.put("main", main); - map.put("package", config.getString("package" )); - map.put("moduleName", config.getString("moduleName" )); - map.put("author", config.getString("author")); - map.put("version", config.getString("version")); - map.put("email", config.getString("email")); - map.put("datetime", DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN)); - map.put("date", DateUtils.format(new Date(), DateUtils.DATE_PATTERN)); - VelocityContext context = new VelocityContext(map); - - - - //获取模板列表 - List templates = getTemplates(); - for(String template : templates){ - //渲染模板 - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, "UTF-8"); - tpl.merge(context, sw); - - try { - //添加到zip - zip.putNextEntry(new ZipEntry(getFileName(template, tableEntity.getClassName(), config.getString("package"), config.getString("moduleName")))); - IOUtils.write(sw.toString(), zip, "UTF-8"); - IOUtils.closeQuietly(sw); - zip.closeEntry(); - } catch (IOException e) { - throw new RRException("渲染模板失败,表名:" + tableEntity.getTableName(), e); - } - } - } - - - /** - * 列名转换成Java属性名 - */ - public static String columnToJava(String columnName) { - return WordUtils.capitalizeFully(columnName, new char[]{'_'}).replace("_", ""); - } - - /** - * 表名转换成Java类名 - */ - public static String tableToJava(String tableName, String tablePrefix) { - if(StringUtils.isNotBlank(tablePrefix)){ - tableName = tableName.replaceFirst(tablePrefix, ""); - } - return columnToJava(tableName); - } - - /** - * 获取配置信息 - */ - public static Configuration getConfig(){ - try { - return new PropertiesConfiguration("generator.properties"); - } catch (ConfigurationException e) { - throw new RRException("获取配置文件失败,", e); - } - } - - /** - * 获取文件名 - */ - public static String getFileName(String template, String className, String packageName, String moduleName) { - String packagePath = "main" + File.separator + "java" + File.separator; - if (StringUtils.isNotBlank(packageName)) { - packagePath += packageName.replace(".", File.separator) + File.separator; - } - - if (template.contains("Entity.java.vm" )) { - return packagePath + "entity" + File.separator + className + "Entity.java"; - } - - if (template.contains("Excel.java.vm" )) { - return packagePath + "excel" + File.separator + className + "Excel.java"; - } - - if (template.contains("Dao.java.vm" )) { - return packagePath + "dao" + File.separator + className + "Dao.java"; - } - - if (template.contains("Service.java.vm" )) { - return packagePath + "service" + File.separator + className + "Service.java"; - } - - if (template.contains("ServiceImpl.java.vm" )) { - return packagePath + "service" + File.separator + "impl" + File.separator + className + "ServiceImpl.java"; - } - - if (template.contains("Controller.java.vm" )) { - return packagePath + "controller" + File.separator + className + "Controller.java"; - } - - if (template.contains("Redis.java.vm" )) { - return packagePath + "redis" + File.separator + className + "Redis.java"; - } - - if (template.contains("DTO.java.vm" )) { - return "dto" + File.separator + className + "DTO.java"; - } - - if (template.contains("Dao.xml.vm" )) { - return "main" + File.separator + "resources" + File.separator + "mapper" + File.separator + className + "Dao.xml"; - } - - if (template.contains("index.vue.vm" )) { - return "vue" + File.separator + "views" + File.separator + "modules" + - File.separator + moduleName + File.separator + className.toLowerCase() + ".vue"; - } - - if (template.contains("add-or-update.vue.vm" )) { - return "vue" + File.separator + "views" + File.separator + "modules" + - File.separator + moduleName + File.separator + className.toLowerCase() + "-add-or-update.vue"; - } - return null; - } + public static List getTemplates() { + List templates = new ArrayList<>(); + templates.add("template/Entity.java.vm"); + templates.add("template/Dao.java.vm"); + templates.add("template/Dao.xml.vm"); + templates.add("template/Service.java.vm"); + templates.add("template/ServiceImpl.java.vm"); + templates.add("template/Controller.java.vm"); + templates.add("template/Excel.java.vm"); + templates.add("template/Redis.java.vm"); + templates.add("template/DTO.java.vm"); + templates.add("template/index.vue.vm"); + templates.add("template/add-or-update.vue.vm"); + return templates; + } + + /** + * 生成代码 + */ + public static void generatorCode(Map table, + List> columns, ZipOutputStream zip) { + //配置信息 + Configuration config = getConfig(); + boolean hasBigDecimal = false; + //表信息 + TableEntity tableEntity = new TableEntity(); + tableEntity.setTableName(table.get("tableName")); + tableEntity.setComments(table.get("tableComment")); + //表名转换成Java类名 + String className = tableToJava(tableEntity.getTableName(), config.getString("tablePrefix")); + tableEntity.setClassName(className); + tableEntity.setClassname(StringUtils.uncapitalize(className)); + + //列信息 + List columsList = new ArrayList<>(); + for (Map column : columns) { + ColumnEntity columnEntity = new ColumnEntity(); + columnEntity.setColumnName(column.get("columnName")); + columnEntity.setDataType(column.get("dataType")); + columnEntity.setComments(column.get("columnComment")); + columnEntity.setExtra(column.get("extra")); + + //列名转换成Java属性名 + String attrName = columnToJava(columnEntity.getColumnName()); + columnEntity.setAttrName(attrName); + columnEntity.setAttrname(StringUtils.uncapitalize(attrName)); + + //列的数据类型,转换成Java类型 + String attrType = config.getString(columnEntity.getDataType(), "unknowType"); + columnEntity.setAttrType(attrType); + if (!hasBigDecimal && attrType.equals("BigDecimal")) { + hasBigDecimal = true; + } + //是否主键 + if ("PRI".equalsIgnoreCase(column.get("columnKey")) && tableEntity.getPk() == null) { + tableEntity.setPk(columnEntity); + } + + columsList.add(columnEntity); + } + tableEntity.setColumns(columsList); + + //没主键,则第一个字段为主键 + if (tableEntity.getPk() == null) { + tableEntity.setPk(tableEntity.getColumns().get(0)); + } + + //设置velocity资源加载器 + Properties prop = new Properties(); + prop.put("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); + Velocity.init(prop); + + String main = config.getString("main"); + main = StringUtils.isBlank(main) ? config.getString("package") : main; + + //封装模板数据 + Map map = new HashMap<>(); + map.put("tableName", tableEntity.getTableName()); + map.put("comments", tableEntity.getComments()); + map.put("pk", tableEntity.getPk()); + map.put("className", tableEntity.getClassName()); + map.put("classname", tableEntity.getClassname()); + map.put("pathName", tableEntity.getClassname()); + map.put("columns", tableEntity.getColumns()); + map.put("hasBigDecimal", hasBigDecimal); + map.put("main", main); + + String moduleName = config.getString("moduleName"); + map.put("moduleName", moduleName); + + String packageName = config.getString("package"); + map.put("package", packageName); + map.put("packageDTO", packageName); + if (StringUtils.isNotBlank(moduleName)) { + map.put("package", packageName.concat(".modules.").concat(moduleName)); + map.put("packageDTO", packageName.concat(".dto.").concat(moduleName)); + } else { + map.put("packageDTO", packageName.concat(".dto")); + } + + map.put("author", config.getString("author")); + map.put("version", config.getString("version")); + map.put("email", config.getString("email")); + map.put("datetime", DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN)); + map.put("date", DateUtils.format(new Date(), DateUtils.DATE_PATTERN)); + VelocityContext context = new VelocityContext(map); + + + //获取模板列表 + List templates = getTemplates(); + for (String template : templates) { + //渲染模板 + StringWriter sw = new StringWriter(); + Template tpl = Velocity.getTemplate(template, "UTF-8"); + tpl.merge(context, sw); + + try { + //添加到zip + zip.putNextEntry(new ZipEntry(getFileName(template, tableEntity.getClassName(), config.getString("package"), config.getString("moduleName")))); + IOUtils.write(sw.toString(), zip, "UTF-8"); + IOUtils.closeQuietly(sw); + zip.closeEntry(); + } catch (IOException e) { + throw new RRException("渲染模板失败,表名:" + tableEntity.getTableName(), e); + } + } + } + + + /** + * 列名转换成Java属性名 + */ + public static String columnToJava(String columnName) { + return WordUtils.capitalizeFully(columnName, new char[]{'_'}).replace("_", ""); + } + + /** + * 表名转换成Java类名 + */ + public static String tableToJava(String tableName, String tablePrefix) { + if (StringUtils.isNotBlank(tablePrefix)) { + tableName = tableName.replaceFirst(tablePrefix, ""); + } + return columnToJava(tableName); + } + + /** + * 获取配置信息 + */ + public static Configuration getConfig() { + try { + return new PropertiesConfiguration("generator.properties"); + } catch (ConfigurationException e) { + throw new RRException("获取配置文件失败,", e); + } + } + + /** + * 获取文件名 + */ + public static String getFileName(String template, String className, String packageName, String moduleName) { + String packagePath = "main" + File.separator + "java" + File.separator; + if (StringUtils.isNotBlank(packageName)) { + packagePath += packageName.replace(".", File.separator) + File.separator; + } + + if (template.contains("Entity.java.vm")) { + return packagePath + "entity" + File.separator + className + "Entity.java"; + } + + if (template.contains("Excel.java.vm")) { + return packagePath + "excel" + File.separator + className + "Excel.java"; + } + + if (template.contains("Dao.java.vm")) { + return packagePath + "dao" + File.separator + className + "Dao.java"; + } + + if (template.contains("Service.java.vm")) { + return packagePath + "service" + File.separator + className + "Service.java"; + } + + if (template.contains("ServiceImpl.java.vm")) { + return packagePath + "service" + File.separator + "impl" + File.separator + className + "ServiceImpl.java"; + } + + if (template.contains("Controller.java.vm")) { + return packagePath + "controller" + File.separator + className + "Controller.java"; + } + + if (template.contains("Redis.java.vm")) { + return packagePath + "redis" + File.separator + className + "Redis.java"; + } + + if (template.contains("DTO.java.vm")) { + return "dto" + File.separator + className + "DTO.java"; + } + + if (template.contains("Dao.xml.vm")) { + return "main" + File.separator + "resources" + File.separator + "mapper" + File.separator + className + "Dao.xml"; + } + + if (template.contains("index.vue.vm")) { + return "vue" + File.separator + "views" + File.separator + "modules" + + File.separator + moduleName + File.separator + className.toLowerCase() + ".vue"; + } + + if (template.contains("add-or-update.vue.vm")) { + return "vue" + File.separator + "views" + File.separator + "modules" + + File.separator + moduleName + File.separator + className.toLowerCase() + "-add-or-update.vue"; + } + return null; + } } diff --git a/epmet-cloud-generator/src/main/resources/generator.properties b/epmet-cloud-generator/src/main/resources/generator.properties index 7a58589..d4762ac 100644 --- a/epmet-cloud-generator/src/main/resources/generator.properties +++ b/epmet-cloud-generator/src/main/resources/generator.properties @@ -1,6 +1,6 @@ #\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u03E2 -main= +main=com.epmet #\u5305\u540D package=com.epmet.plugin.power moduleName=axis diff --git a/epmet-cloud-generator/src/main/resources/template/Controller.java.vm b/epmet-cloud-generator/src/main/resources/template/Controller.java.vm index 1e489dc..5caa046 100644 --- a/epmet-cloud-generator/src/main/resources/template/Controller.java.vm +++ b/epmet-cloud-generator/src/main/resources/template/Controller.java.vm @@ -9,7 +9,7 @@ import ${main}.commons.tools.validator.ValidatorUtils; import ${main}.commons.tools.validator.group.AddGroup; import ${main}.commons.tools.validator.group.UpdateGroup; import ${main}.commons.tools.validator.group.DefaultGroup; -import ${package}.dto.${className}DTO; +import ${packageDTO}.${className}DTO; import ${package}.excel.${className}Excel; import ${package}.service.${className}Service; import org.springframework.beans.factory.annotation.Autowired; diff --git a/epmet-cloud-generator/src/main/resources/template/DTO.java.vm b/epmet-cloud-generator/src/main/resources/template/DTO.java.vm index f444c74..0512679 100644 --- a/epmet-cloud-generator/src/main/resources/template/DTO.java.vm +++ b/epmet-cloud-generator/src/main/resources/template/DTO.java.vm @@ -1,4 +1,4 @@ -package ${package}.dto; +package ${packageDTO}; import java.io.Serializable; import java.util.Date; diff --git a/epmet-cloud-generator/src/main/resources/template/Service.java.vm b/epmet-cloud-generator/src/main/resources/template/Service.java.vm index 59e4905..7d31658 100644 --- a/epmet-cloud-generator/src/main/resources/template/Service.java.vm +++ b/epmet-cloud-generator/src/main/resources/template/Service.java.vm @@ -2,7 +2,7 @@ package ${package}.service; import ${main}.commons.mybatis.service.BaseService; import ${main}.commons.tools.page.PageData; -import ${package}.dto.${className}DTO; +import ${packageDTO}.${className}DTO; import ${package}.entity.${className}Entity; import java.util.List; diff --git a/epmet-cloud-generator/src/main/resources/template/ServiceImpl.java.vm b/epmet-cloud-generator/src/main/resources/template/ServiceImpl.java.vm index f0bcfe2..a925071 100644 --- a/epmet-cloud-generator/src/main/resources/template/ServiceImpl.java.vm +++ b/epmet-cloud-generator/src/main/resources/template/ServiceImpl.java.vm @@ -7,7 +7,7 @@ import ${main}.commons.tools.page.PageData; import ${main}.commons.tools.utils.ConvertUtils; import ${package}.commons.tools.constant.FieldConstant; import ${package}.dao.${className}Dao; -import ${package}.dto.${className}DTO; +import ${packageDTO}.${className}DTO; import ${package}.entity.${className}Entity; import ${package}.redis.${className}Redis; import ${package}.service.${className}Service; diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/PowerAxisLeaderDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/PowerAxisLeaderDTO.java new file mode 100644 index 0000000..5e5f016 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/PowerAxisLeaderDTO.java @@ -0,0 +1,89 @@ +package com.epmet.plugin.power.dto.axis; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 动力主轴领导人 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +@Data +public class PowerAxisLeaderDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 姓名 + */ + private String name; + + /** + * 关联动力主轴ID + */ + private String structReferenceId; + + /** + * 性别 1男2女0未知 + */ + private String gender; + + /** + * 联系方式 + */ + private String mobile; + + /** + * 简介 300字内 + */ + private String interoduction; + + /** + * 头像 图片访问地址 + */ + private String avatar; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/PowerAxisTagDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/PowerAxisTagDTO.java new file mode 100644 index 0000000..747fa26 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/PowerAxisTagDTO.java @@ -0,0 +1,84 @@ +package com.epmet.plugin.power.dto.axis; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 动力主轴标签 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +@Data +public class PowerAxisTagDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 标签类别 动力主轴结构:STRUCT;动力主轴领导人: LEADER + */ + private String tagCategory; + + /** + * 标签类别编码 + */ + private String categoryCode; + + /** + * 标签类别名称 + */ + private String categoryName; + + /** + * 排序 正序 + */ + private Integer sort; + + /** + * 禁用状态 0.正常 1.已禁用 + */ + private String forbiddenFlag; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml index 6759f10..bd84d49 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml @@ -173,13 +173,13 @@ 6379 123456 - false + true 192.168.1.140:8848 1fecc730-5e6e-464c-aae9-7567944e7936 false - + 192.168.43.184 false diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisLeaderController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisLeaderController.java new file mode 100644 index 0000000..6782d54 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisLeaderController.java @@ -0,0 +1,82 @@ +package com.epmet.plugin.power.modules.axis.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.plugin.power.dto.axis.PowerAxisLeaderDTO; +import com.epmet.plugin.power.modules.axis.excel.PowerAxisLeaderExcel; +import com.epmet.plugin.power.modules.axis.service.PowerAxisLeaderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 动力主轴领导人 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +@RestController +@RequestMapping("axisLeader") +public class PowerAxisLeaderController { + + @Autowired + private PowerAxisLeaderService powerAxisLeaderService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = powerAxisLeaderService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + PowerAxisLeaderDTO data = powerAxisLeaderService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody PowerAxisLeaderDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + powerAxisLeaderService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody PowerAxisLeaderDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + powerAxisLeaderService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + powerAxisLeaderService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = powerAxisLeaderService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, PowerAxisLeaderExcel.class); + } + + + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisTagController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisTagController.java new file mode 100644 index 0000000..b3652ba --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisTagController.java @@ -0,0 +1,82 @@ +package com.epmet.plugin.power.modules.axis.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.plugin.power.dto.axis.PowerAxisTagDTO; +import com.epmet.plugin.power.modules.axis.excel.PowerAxisTagExcel; +import com.epmet.plugin.power.modules.axis.service.PowerAxisTagService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 动力主轴标签 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +@RestController +@RequestMapping("axisTag") +public class PowerAxisTagController { + + @Autowired + private PowerAxisTagService powerAxisTagService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = powerAxisTagService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + PowerAxisTagDTO data = powerAxisTagService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody PowerAxisTagDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + powerAxisTagService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody PowerAxisTagDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + powerAxisTagService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + powerAxisTagService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = powerAxisTagService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, PowerAxisTagExcel.class); + } + + + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisLeaderDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisLeaderDao.java new file mode 100644 index 0000000..345947a --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisLeaderDao.java @@ -0,0 +1,16 @@ +package com.epmet.plugin.power.modules.axis.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.plugin.power.modules.axis.entity.PowerAxisLeaderEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 动力主轴领导人 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +@Mapper +public interface PowerAxisLeaderDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisTagDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisTagDao.java new file mode 100644 index 0000000..151cf7b --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisTagDao.java @@ -0,0 +1,16 @@ +package com.epmet.plugin.power.modules.axis.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.plugin.power.modules.axis.entity.PowerAxisTagEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 动力主轴标签 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +@Mapper +public interface PowerAxisTagDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/entity/PowerAxisLeaderEntity.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/entity/PowerAxisLeaderEntity.java new file mode 100644 index 0000000..b990389 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/entity/PowerAxisLeaderEntity.java @@ -0,0 +1,59 @@ +package com.epmet.plugin.power.modules.axis.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 动力主轴领导人 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pli_power_axis_leader") +public class PowerAxisLeaderEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 姓名 + */ + private String name; + + /** + * 关联动力主轴ID + */ + private String structReferenceId; + + /** + * 性别 1男2女0未知 + */ + private String gender; + + /** + * 联系方式 + */ + private String mobile; + + /** + * 简介 300字内 + */ + private String interoduction; + + /** + * 头像 图片访问地址 + */ + private String avatar; + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/entity/PowerAxisTagEntity.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/entity/PowerAxisTagEntity.java new file mode 100644 index 0000000..2630e2e --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/entity/PowerAxisTagEntity.java @@ -0,0 +1,54 @@ +package com.epmet.plugin.power.modules.axis.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 动力主轴标签 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pli_power_axis_tag") +public class PowerAxisTagEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 标签类别 动力主轴结构:STRUCT;动力主轴领导人: LEADER + */ + private String tagCategory; + + /** + * 标签类别编码 + */ + private String categoryCode; + + /** + * 标签类别名称 + */ + private String categoryName; + + /** + * 排序 正序 + */ + private Integer sort; + + /** + * 禁用状态 0.正常 1.已禁用 + */ + private String forbiddenFlag; + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/excel/PowerAxisLeaderExcel.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/excel/PowerAxisLeaderExcel.java new file mode 100644 index 0000000..b861d0c --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/excel/PowerAxisLeaderExcel.java @@ -0,0 +1,60 @@ +package com.epmet.plugin.power.modules.axis.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 动力主轴领导人 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +@Data +public class PowerAxisLeaderExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "姓名") + private String name; + + @Excel(name = "关联动力主轴ID") + private String structReferenceId; + + @Excel(name = "性别 1男2女0未知") + private String gender; + + @Excel(name = "联系方式") + private String mobile; + + @Excel(name = "简介 300字内") + private String interoduction; + + @Excel(name = "头像 图片访问地址") + private String avatar; + + @Excel(name = "删除标识 0.未删除 1.已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/excel/PowerAxisTagExcel.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/excel/PowerAxisTagExcel.java new file mode 100644 index 0000000..f9cffaa --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/excel/PowerAxisTagExcel.java @@ -0,0 +1,57 @@ +package com.epmet.plugin.power.modules.axis.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 动力主轴标签 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +@Data +public class PowerAxisTagExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "标签类别 动力主轴结构:STRUCT;动力主轴领导人: LEADER") + private String tagCategory; + + @Excel(name = "标签类别编码") + private String categoryCode; + + @Excel(name = "标签类别名称") + private String categoryName; + + @Excel(name = "排序 正序") + private Integer sort; + + @Excel(name = "禁用状态 0.正常 1.已禁用") + private String forbiddenFlag; + + @Excel(name = "删除标识 0.未删除 1.已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/redis/PowerAxisLeaderRedis.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/redis/PowerAxisLeaderRedis.java new file mode 100644 index 0000000..bbf9dd1 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/redis/PowerAxisLeaderRedis.java @@ -0,0 +1,30 @@ +package com.epmet.plugin.power.modules.axis.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 动力主轴领导人 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +@Component +public class PowerAxisLeaderRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/redis/PowerAxisTagRedis.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/redis/PowerAxisTagRedis.java new file mode 100644 index 0000000..e4dbda2 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/redis/PowerAxisTagRedis.java @@ -0,0 +1,30 @@ +package com.epmet.plugin.power.modules.axis.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 动力主轴标签 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +@Component +public class PowerAxisTagRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisLeaderService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisLeaderService.java new file mode 100644 index 0000000..b5aeb6f --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisLeaderService.java @@ -0,0 +1,78 @@ +package com.epmet.plugin.power.modules.axis.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.plugin.power.dto.axis.PowerAxisLeaderDTO; +import com.epmet.plugin.power.modules.axis.entity.PowerAxisLeaderEntity; + +import java.util.List; +import java.util.Map; + +/** + * 动力主轴领导人 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +public interface PowerAxisLeaderService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-04-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-04-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PowerAxisLeaderDTO + * @author generator + * @date 2022-04-18 + */ + PowerAxisLeaderDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-04-18 + */ + void save(PowerAxisLeaderDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-04-18 + */ + void update(PowerAxisLeaderDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-04-18 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisTagService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisTagService.java new file mode 100644 index 0000000..f6424c0 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisTagService.java @@ -0,0 +1,79 @@ +package com.epmet.plugin.power.modules.axis.service; + + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.plugin.power.dto.axis.PowerAxisTagDTO; +import com.epmet.plugin.power.modules.axis.entity.PowerAxisTagEntity; + +import java.util.List; +import java.util.Map; + +/** + * 动力主轴标签 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +public interface PowerAxisTagService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-04-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-04-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PowerAxisTagDTO + * @author generator + * @date 2022-04-18 + */ + PowerAxisTagDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-04-18 + */ + void save(PowerAxisTagDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-04-18 + */ + void update(PowerAxisTagDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-04-18 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisLeaderServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisLeaderServiceImpl.java new file mode 100644 index 0000000..a223f7d --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisLeaderServiceImpl.java @@ -0,0 +1,87 @@ +package com.epmet.plugin.power.modules.axis.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.plugin.power.dto.axis.PowerAxisLeaderDTO; +import com.epmet.plugin.power.modules.axis.dao.PowerAxisLeaderDao; +import com.epmet.plugin.power.modules.axis.entity.PowerAxisLeaderEntity; +import com.epmet.plugin.power.modules.axis.redis.PowerAxisLeaderRedis; +import com.epmet.plugin.power.modules.axis.service.PowerAxisLeaderService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 动力主轴领导人 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +@Service +public class PowerAxisLeaderServiceImpl extends BaseServiceImpl implements PowerAxisLeaderService { + + @Autowired + private PowerAxisLeaderRedis powerAxisLeaderRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PowerAxisLeaderDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PowerAxisLeaderDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public PowerAxisLeaderDTO get(String id) { + PowerAxisLeaderEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PowerAxisLeaderDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PowerAxisLeaderDTO dto) { + PowerAxisLeaderEntity entity = ConvertUtils.sourceToTarget(dto, PowerAxisLeaderEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PowerAxisLeaderDTO dto) { + PowerAxisLeaderEntity entity = ConvertUtils.sourceToTarget(dto, PowerAxisLeaderEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java new file mode 100644 index 0000000..6709202 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java @@ -0,0 +1,87 @@ +package com.epmet.plugin.power.modules.axis.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.plugin.power.dto.axis.PowerAxisTagDTO; +import com.epmet.plugin.power.modules.axis.dao.PowerAxisTagDao; +import com.epmet.plugin.power.modules.axis.entity.PowerAxisTagEntity; +import com.epmet.plugin.power.modules.axis.redis.PowerAxisTagRedis; +import com.epmet.plugin.power.modules.axis.service.PowerAxisTagService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 动力主轴标签 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-18 + */ +@Service +public class PowerAxisTagServiceImpl extends BaseServiceImpl implements PowerAxisTagService { + + @Autowired + private PowerAxisTagRedis powerAxisTagRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PowerAxisTagDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PowerAxisTagDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public PowerAxisTagDTO get(String id) { + PowerAxisTagEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PowerAxisTagDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PowerAxisTagDTO dto) { + PowerAxisTagEntity entity = ConvertUtils.sourceToTarget(dto, PowerAxisTagEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PowerAxisTagDTO dto) { + PowerAxisTagEntity entity = ConvertUtils.sourceToTarget(dto, PowerAxisTagEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisLeaderDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisLeaderDao.xml new file mode 100644 index 0000000..e95bd63 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisLeaderDao.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisTagDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisTagDao.xml new file mode 100644 index 0000000..1a02406 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisTagDao.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index e75186a..8061615 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ - epmet-cloud-generator + epmet-plugins-module epmet-plugins-common