Browse Source

属性信息

yq 2 years ago
parent
commit
37c28dc995

+ 4 - 4
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/MybatisGeneratorUtils.java

@@ -65,13 +65,13 @@ public class MybatisGeneratorUtils {
         StrategyConfig strategy = new StrategyConfig();
         strategy.setNaming(NamingStrategy.underline_to_camel);
         strategy.setColumnNaming(NamingStrategy.underline_to_camel);
-        strategy.setSuperMapperClass("com.usky.common.mvc.base.CrudMapper");
-        strategy.setSuperServiceClass("com.usky.common.mvc.base.CrudService");
-        strategy.setSuperServiceImplClass("com.usky.common.mvc.base.AbstractCrudService");
+        strategy.setSuperMapperClass("com.usky.common.mybatis.core.CrudMapper");
+        strategy.setSuperServiceClass("com.usky.common.mybatis.core.CrudService");
+        strategy.setSuperServiceImplClass("com.usky.common.mybatis.core.AbstractCrudService");
         // strategy.setTablePrefix("t_"); // 表名前缀
         strategy.setEntityLombokModel(true); //使用lombok
         //修改自己想要生成的表
-        strategy.setInclude("dmp_data_event","dmp_data_info","dmp_device_info","dmp_device_status","dmp_product_attribute","dmp_product_attribute_attach","dmp_product_info","dmp_software_subpackage","dmp_software_upgrade");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
+        strategy.setInclude("dmp_software_info");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
         mpg.setStrategy(strategy);
 
         // 关闭默认 xml 生成,调整生成 至 根目录

+ 38 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/DmpSoftwareInfoController.java

@@ -0,0 +1,38 @@
+package com.usky.iot.controller.web;
+
+
+import com.usky.common.core.bean.ApiResult;
+import com.usky.iot.domain.DmpSoftwareInfo;
+import com.usky.iot.service.DmpSoftwareInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 软件信息表
+ *
+ * @author ya
+ * @since 2022-10-11
+ */
+@RestController
+@RequestMapping("/dmpSoftwareInfo")
+public class DmpSoftwareInfoController {
+
+    @Autowired
+    private DmpSoftwareInfoService dmpSoftwareInfoService;
+
+    /**
+     * 集合
+     * @param name
+     * @return
+     */
+    @GetMapping("/list")
+    public ApiResult<List<DmpSoftwareInfo>> list(@RequestParam(required = false) String name){
+        return ApiResult.success(dmpSoftwareInfoService.list(name));
+    }
+}
+

+ 66 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/domain/DmpSoftwareInfo.java

@@ -0,0 +1,66 @@
+package com.usky.iot.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 软件信息表
+ * </p>
+ *
+ * @author ya
+ * @since 2022-10-11
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class DmpSoftwareInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 软件ID
+     */
+    private String softwareId;
+
+    /**
+     * 生效状态
+     */
+    private Integer effectStatus;
+
+    /**
+     * 软件名称
+     */
+    private String softwareName;
+
+    /**
+     * 软件说明
+     */
+    private String softwareExplain;
+
+    /**
+     * 序号
+     */
+    private Integer orderNumber;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createdTime;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updatedTime;
+
+
+}

+ 3 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/domain/DmpSoftwareSubpackage.java

@@ -1,5 +1,7 @@
 package com.usky.iot.domain;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -23,6 +25,7 @@ public class DmpSoftwareSubpackage implements Serializable {
     /**
      * 主键id
      */
+    @TableId(value = "id", type = IdType.AUTO)
     private Integer id;
 
     /**

+ 17 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/mapper/DmpSoftwareInfoMapper.java

@@ -0,0 +1,17 @@
+package com.usky.iot.mapper;
+
+import com.usky.common.mybatis.core.CrudMapper;
+import com.usky.iot.domain.DmpSoftwareInfo;
+
+
+/**
+ * <p>
+ * 软件信息表 Mapper 接口
+ * </p>
+ *
+ * @author ya
+ * @since 2022-10-11
+ */
+public interface DmpSoftwareInfoMapper extends CrudMapper<DmpSoftwareInfo> {
+
+}

+ 21 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/DmpSoftwareInfoService.java

@@ -0,0 +1,21 @@
+package com.usky.iot.service;
+
+import com.usky.common.mybatis.core.CrudService;
+import com.usky.iot.domain.DmpSoftwareInfo;
+
+import java.util.List;
+
+
+/**
+ * <p>
+ * 软件信息表 服务类
+ * </p>
+ *
+ * @author ya
+ * @since 2022-10-11
+ */
+public interface DmpSoftwareInfoService extends CrudService<DmpSoftwareInfo> {
+
+
+    List<DmpSoftwareInfo> list(String name);
+}

+ 5 - 5
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpDeviceInfoServiceImpl.java

@@ -125,11 +125,11 @@ public class DmpDeviceInfoServiceImpl extends AbstractCrudService<DmpDeviceInfoM
             List<DmpDeviceInfo> deviceInfos = BeanMapperUtils.mapList(dmpDeviceExportVOS, DmpDeviceExportVO.class, DmpDeviceInfo.class);
             long count = deviceInfos.stream()
                     .peek(device -> device.setProductId(productId))
-                    .filter(device -> StringUtils.isNotBlank(device.getDeviceName()) ||
-                    StringUtils.isNotBlank(device.getDeviceName())
-                    || StringUtils.isNotBlank(device.getDeviceCode())
-                    || StringUtils.isNotBlank(device.getSimCode())
-                    || null != device.getSubscribeFlag()
+                    .filter(device -> StringUtils.isBlank(device.getDeviceName()) ||
+                    StringUtils.isBlank(device.getDeviceName())
+                    || StringUtils.isBlank(device.getDeviceCode())
+                    || StringUtils.isBlank(device.getSimCode())
+                    || null == device.getSubscribeFlag()
             ).count();
             if (count > 0){
                 throw new BusinessException("表格字段不能为空");

+ 32 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpSoftwareInfoServiceImpl.java

@@ -0,0 +1,32 @@
+package com.usky.iot.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import com.usky.iot.domain.DmpSoftwareInfo;
+import com.usky.iot.mapper.DmpSoftwareInfoMapper;
+import com.usky.iot.service.DmpSoftwareInfoService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 软件信息表 服务实现类
+ * </p>
+ *
+ * @author ya
+ * @since 2022-10-11
+ */
+@Service
+public class DmpSoftwareInfoServiceImpl extends AbstractCrudService<DmpSoftwareInfoMapper, DmpSoftwareInfo> implements DmpSoftwareInfoService {
+
+
+    @Override
+    public List<DmpSoftwareInfo> list(String name) {
+        LambdaQueryWrapper<DmpSoftwareInfo> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.like(StringUtils.isNotBlank(name),DmpSoftwareInfo::getSoftwareName,name);
+        return this.list(queryWrapper);
+    }
+}

+ 1 - 1
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpSoftwareUpgradeServiceImpl.java

@@ -41,7 +41,7 @@ public class DmpSoftwareUpgradeServiceImpl extends AbstractCrudService<DmpSoftwa
 
     @Override
     public void add(DmpSoftwareUpgrade dmpProductInfo, MultipartFile file) {
-        dmpProductInfo.setPackageLength(Integer.getInteger(String.valueOf(file.getSize())));
+        dmpProductInfo.setPackageLength((int)file.getSize());
         try {
             dmpProductInfo.setCheckCode(MD5Utils.md5Hex(file.getBytes()));
         } catch (Exception e) {

+ 7 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/vo/DmpDeviceExportVO.java

@@ -1,5 +1,6 @@
 package com.usky.iot.service.vo;
 
+import cn.afterturn.easypoi.excel.annotation.Excel;
 import lombok.Data;
 
 @Data
@@ -8,29 +9,35 @@ public class DmpDeviceExportVO {
     /**
      * 设备名称
      */
+    @Excel(name = "设备名称",width = 14)
     private String deviceName;
     /**
      * 产品ID
      */
+    @Excel(name = "用户名称",width = 14)
     private Integer productId;
 
     /**
      * 设备编号
      */
+    @Excel(name = "IMEI",width = 14)
     private String deviceCode;
     /**
      * 物联网卡号
      */
+    @Excel(name = "SIM",width = 14)
     private String simCode;
 
     /**
      * 国际移动用户识别码
      */
+    @Excel(name = "IMSI",width = 14)
     private String imsiCode;
 
     /**
      * 是否自动订阅
      */
+    @Excel(name = "是否开启订阅",width = 14)
     private Integer subscribeFlag;
 
 }

+ 17 - 0
service-iot/service-iot-biz/src/main/resources/mapper/iot/DmpSoftwareInfoMapper.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usky.iot.mapper.DmpSoftwareInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.iot.domain.DmpSoftwareInfo">
+        <id column="id" property="id" />
+        <result column="software_id" property="softwareId" />
+        <result column="effect_status" property="effectStatus" />
+        <result column="software_name" property="softwareName" />
+        <result column="software_explain" property="softwareExplain" />
+        <result column="order_number" property="orderNumber" />
+        <result column="created_time" property="createdTime" />
+        <result column="updated_time" property="updatedTime" />
+    </resultMap>
+
+</mapper>

+ 3 - 3
usky-module-demo/usky-module-demo-biz/src/main/java/com/usky/demo/MybatisGenerator.java

@@ -65,9 +65,9 @@ public class MybatisGenerator {
         StrategyConfig strategy = new StrategyConfig();
         strategy.setNaming(NamingStrategy.underline_to_camel);
         strategy.setColumnNaming(NamingStrategy.underline_to_camel);
-        strategy.setSuperMapperClass("com.usky.common.mvc.base.CrudMapper");
-        strategy.setSuperServiceClass("com.usky.common.mvc.base.CrudService");
-        strategy.setSuperServiceImplClass("com.usky.common.mvc.base.AbstractCrudService");
+        strategy.setSuperMapperClass("com.usky.common.mybatis.core.CrudMapper");
+        strategy.setSuperServiceClass("com.usky.common.mybatis.core.CrudService");
+        strategy.setSuperServiceImplClass("com.usky.common.mybatis.core.AbstractCrudService");
         // strategy.setTablePrefix("t_"); // 表名前缀
         strategy.setEntityLombokModel(true); //使用lombok
         //修改自己想要生成的表