whycxzp
2021-01-07 d7fb9e92779e971954ca59b86848569592f6185b
update basic
24个文件已修改
476 ■■■■ 已修改文件
.gitignore 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/Application.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/CentralMonitorSysCtrlController.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/CentralMonitorSysRTController.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/CentralMonitorSysSTController.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/MotorSystemInfController.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/Response.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/CentralMonitorSysCtrlMapper.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/CentralMonitorSysRTMapper.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/CentralMonitorSysSTMapper.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/MotorSystemInfMapper.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/CentralMonitorSysCtrl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/CentralMonitorSysRT.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/CentralMonitorSysST.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/Menu.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/MotorSystemInf.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/CentralMonitorSysCtrlService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/CentralMonitorSysRTService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/CentralMonitorSysSTService.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/MotorSystemInfService.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/swagger/SwaggerConfig.java 98 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/swagger/SwaggerConfig4Knife.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/config/application.yml 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -1,4 +1,6 @@
/target
/out
./src/test
.idea
.idea
motorSystem.iml
draft.md
pom.xml
@@ -5,13 +5,14 @@
    <groupId>org.whyckj</groupId>
    <artifactId>motorSystem</artifactId>
    <version>1.0-SNAPSHOT</version>
    <version>1.0</version>
    <packaging>jar</packaging>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.12.RELEASE</version>
        <!--<version>2.2.0.RELEASE</version>-->
        <relativePath/>
    </parent>
@@ -47,33 +48,56 @@
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.1.2</version>
        </dependency>
        <!--<dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.7.0</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.7.0</version>
        </dependency>-->
        <!--knife4j-->
        <dependency>
            <groupId>com.github.xiaoymin</groupId>
            <artifactId>knife4j-spring-boot-starter</artifactId>
            <version>2.0.2</version>
            <!--<version>2.0.6</version>-->
            <!--<exclusions>
                <exclusion>
                    <groupId>org.springframework.plugin</groupId>
                    <artifactId>spring-plugin-core</artifactId>
                </exclusion>
            </exclusions>-->
        </dependency>
        <!--<dependency>
            <groupId>org.springframework.plugin</groupId>
            <artifactId>spring-plugin-core</artifactId>
            &lt;!&ndash;<version>2.0.0.RELEASE</version>&ndash;&gt;
        </dependency>-->
        <!--连接池-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-extension</artifactId>
            <version>3.1.2</version>
        </dependency>
        <!--连接池-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.1.10</version>
        </dependency>
        <!--swagger-->
        <!--<dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.9.2</version>
            <groupId>org.springframework.plugin</groupId>
            <artifactId>spring-plugin-core</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>
        &lt;!&ndash; 避免版本冲突 &ndash;&gt;
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.9.2</version>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>29.0-jre</version>
        </dependency>-->
        <dependency>
            <groupId>com.spring4all</groupId>
            <artifactId>swagger-spring-boot-starter</artifactId>
            <version>1.9.0.RELEASE</version>
        </dependency>
        <!--pageHelper分页-->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
@@ -92,6 +116,7 @@
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <!--必须是这个1.4.2版本!!!否则打成jar无法访问页面!!-->
                <version>1.4.2.RELEASE</version>
                <configuration>
                    <!-- 工程主入口-->
src/main/java/com/whyc/Application.java
@@ -1,13 +1,14 @@
package com.whyc;
import com.spring4all.swagger.EnableSwagger2Doc;
//import com.spring4all.swagger.EnableSwagger2Doc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
 * @Description : 启动类
@@ -15,10 +16,8 @@
 **/
@SpringBootApplication
@EnableWebMvc
@EnableSwagger2
@EnableSwagger2Doc
@ServletComponentScan(basePackages = "com.whyc.filter")
public class Application extends WebMvcConfigurerAdapter {
public class Application extends WebMvcConfigurerAdapter  implements WebMvcConfigurer {
    public static void main(String[] args) {
        SpringApplication.run(Application.class,args);
@@ -26,9 +25,10 @@
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        super.addResourceHandlers(registry);
        registry.addResourceHandler("/**").addResourceLocations("/");
        //super.addResourceHandlers(registry);
        //registry.addResourceHandler("/**").addResourceLocations("/");
        registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
}
src/main/java/com/whyc/controller/CentralMonitorSysCtrlController.java
@@ -1,9 +1,31 @@
package com.whyc.controller;
/**
 *
 */
import com.whyc.dto.Response;
import com.whyc.pojo.CentralMonitorSysCtrl;
import com.whyc.service.CentralMonitorSysCtrlService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;
@RequestMapping("CentralMonitorSysCtrl")
@RestController
@Api(tags = "集中监控系统Ctrl")
public class CentralMonitorSysCtrlController {
    @Autowired
    private CentralMonitorSysCtrlService service;
    @GetMapping("infoByDevId")
    @ApiOperation(value = "根据设备id获取Ctrl信息")
    public Response<CentralMonitorSysCtrl> getInfoByDevId(@RequestParam int devId){
        return service.getInfoByDevId(devId);
    }
}
src/main/java/com/whyc/controller/CentralMonitorSysRTController.java
@@ -1,8 +1,9 @@
package com.whyc.controller;
import com.whyc.dto.Response;
import com.whyc.pojo.CentralMonitorSysCtrl;
import com.whyc.pojo.CentralMonitorSysRT;
import com.whyc.service.CentralMonitorSysCtrlService;
import com.whyc.service.CentralMonitorSysRTService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -12,17 +13,17 @@
import org.springframework.web.bind.annotation.RestController;
@RequestMapping("CentralMonitorSysCtrl")
@RequestMapping("CentralMonitorSysRT")
@RestController
@Api(tags = "集中监控系统Ctrl")
public class CentralMonitorSysCtrlController {
@Api(tags = "集中监控系统RT")
public class CentralMonitorSysRTController {
    @Autowired
    private CentralMonitorSysCtrlService service;
    private CentralMonitorSysRTService service;
    @GetMapping("infoByDevId")
    @ApiOperation(value = "根据设备id获取Ctrl信息")
    public Response getInfoByDevId(@RequestParam int devId){
    @ApiOperation(value = "根据设备id获取RT信息")
    public Response<CentralMonitorSysRT> getInfoByDevId(@RequestParam int devId){
        return service.getInfoByDevId(devId);
    }
src/main/java/com/whyc/controller/CentralMonitorSysSTController.java
@@ -1,8 +1,9 @@
package com.whyc.controller;
import com.whyc.dto.Response;
import com.whyc.service.CentralMonitorSysCtrlService;
import com.whyc.pojo.CentralMonitorSysST;
import com.whyc.service.CentralMonitorSysRTService;
import com.whyc.service.CentralMonitorSysSTService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -12,17 +13,17 @@
import org.springframework.web.bind.annotation.RestController;
@RequestMapping("CentralMonitorSysRT")
@RequestMapping("CentralMonitorSysST")
@RestController
@Api(tags = "集中监控系统RT")
public class CentralMonitorSysRTController {
@Api(tags = "集中监控系统ST")
public class CentralMonitorSysSTController {
    @Autowired
    private CentralMonitorSysRTService service;
    private CentralMonitorSysSTService service;
    @GetMapping("infoByDevId")
    @ApiOperation(value = "根据设备id获取RT信息")
    public Response getInfoByDevId(@RequestParam int devId){
    @ApiOperation(value = "根据设备id获取ST信息")
    public Response<CentralMonitorSysST> getInfoByDevId(@RequestParam int devId){
        return service.getInfoByDevId(devId);
    }
src/main/java/com/whyc/controller/MotorSystemInfController.java
@@ -1,30 +1,40 @@
package com.whyc.controller;
import com.whyc.dto.Response;
import com.whyc.pojo.MotorSystemInf;
import com.whyc.service.MotorSystemInfService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
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;
/**
 * Motor系统
 */
@RequestMapping("motorSystem")
@RestController
@Api(tags = "MotorSystem信息")
@Api(tags = "MotorSystem设备信息")
public class MotorSystemInfController {
    @Autowired
    private MotorSystemInfService service = new MotorSystemInfService();
    private MotorSystemInfService service;
    @GetMapping("all")
    @ApiOperation(value = "查询所有")
    public Response getAll(){
        return null;
    @ApiOperation(value = "查询所有设备信息")
    public Response<MotorSystemInf> getAll(){
        return service.getAll();
    }
    @GetMapping("devBySysId")
    @ApiOperation(value = "根据系统id查询设备")
    public Response<List<MotorSystemInf>> getDevBySysId(@RequestParam int sysId){
        return service.getDevBySysId(sysId);
    }
}
src/main/java/com/whyc/dto/Response.java
@@ -1,31 +1,33 @@
package com.whyc.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiResponse;
import springfox.documentation.annotations.ApiIgnore;
import java.io.Serializable;
/**
 * 接口数据响应对象
 */
@ApiModel
public class Response<T> implements Serializable {
    private Integer code;
    @ApiModelProperty(value = "对象")
    @ApiModelProperty
    private T data;
    public Response setCode(Integer code) {
    public Response<T> setCode(Integer code) {
        this.code = code;
        return this;
    }
    public Response setData(T data) {
    public Response<T> setData(T data) {
        this.data = data;
        return this;
    }
    public Response set(Integer code,T data) {
    public Response<T> set(Integer code,T data) {
        this.code = code;
        this.data = data;
        return this;
@@ -35,7 +37,7 @@
        return code;
    }
    public Object getData() {
    public T getData() {
        return data;
    }
}
src/main/java/com/whyc/mapper/CentralMonitorSysCtrlMapper.java
@@ -1,4 +1,6 @@
package com.whyc.mapper;
public interface CentralMonitorSysCtrlMapper {
import com.whyc.pojo.CentralMonitorSysCtrl;
public interface CentralMonitorSysCtrlMapper extends CustomMapper<CentralMonitorSysCtrl> {
}
src/main/java/com/whyc/mapper/CentralMonitorSysRTMapper.java
@@ -1,6 +1,8 @@
package com.whyc.mapper;
public class CentralMonitorSysRTMapper {
import com.whyc.pojo.CentralMonitorSysRT;
public interface CentralMonitorSysRTMapper extends CustomMapper<CentralMonitorSysRT> {
}
src/main/java/com/whyc/mapper/CentralMonitorSysSTMapper.java
@@ -1,4 +1,6 @@
package com.whyc.mapper;
public interface CentralMonitorSysSTMapper {
import com.whyc.pojo.CentralMonitorSysST;
public interface CentralMonitorSysSTMapper extends CustomMapper<CentralMonitorSysST> {
}
src/main/java/com/whyc/mapper/MotorSystemInfMapper.java
@@ -1,9 +1,11 @@
package com.whyc.mapper;
import com.whyc.pojo.MotorSystemInf;
/**
 *
 */
public class MotorSystemInfMapper {
public interface MotorSystemInfMapper extends CustomMapper<MotorSystemInf> {
}
src/main/java/com/whyc/pojo/CentralMonitorSysCtrl.java
@@ -1,5 +1,6 @@
package com.whyc.pojo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -8,7 +9,7 @@
/**
 * MotorSystem中1001设备-5000kVA进线屏 的详细参数
 */
@ApiModel(value = "集中监控系统Control")
@ApiModel
@Alias("CentralMonitorSystemControl")
@TableName( schema = "`db_3.5mw_motor`",value = "tb_central_monitor_sys_control")
public class CentralMonitorSysCtrl {
@@ -17,24 +18,32 @@
    @ApiModelProperty(value = "命令控制")
    Integer        opCmd                ;
    @ApiModelProperty(value = "1号2500A进线屏开关合闸")
    @TableField("switch_close_1st_2500A")
    Integer        switchClose1st2500A    ;
    @ApiModelProperty(value = "1号2500A进线屏开关分闸")
    @TableField("switch_open_1st_2500A")
    Integer        switchOpen1st2500A    ;
    @ApiModelProperty(value = "2号2500A进线屏开关合闸")
    @TableField("switch_close_2st_2500A")
    Integer        switchClose2st2500A    ;
    @ApiModelProperty(value = "2号2500A进线屏开关分闸")
    @TableField("switch_open_2st_2500A")
    Integer        switchOpen2st2500A    ;
    @ApiModelProperty(value = "母联屏开关合闸")
    Integer        switchCloseBusScreen;
    @ApiModelProperty(value = "母联屏开关分闸")
    Integer        switchOpenBusScreen    ;
    @ApiModelProperty(value = "1号2500A负载屏开关合闸")
    @TableField("switch_close_1st_2500A_load")
    Integer        switchClose1st2500ALoad;
    @ApiModelProperty(value = "1号2500A负载屏开关分闸")
    @TableField("switch_open_1st_2500A_load")
    Integer        switchOpen1st2500ALoad;
    @ApiModelProperty(value = "2号2500A负载屏开关合闸")
    @TableField("switch_close_2st_2500A_load")
    Integer        switchClose2st2500ALoad;
    @ApiModelProperty(value = "2号2500A负载屏开关分闸")
    @TableField("switch_open_2st_2500A_load")
    Integer        switchOpen2st2500ALoad;
src/main/java/com/whyc/pojo/CentralMonitorSysRT.java
@@ -12,7 +12,7 @@
 *  1001~1004-5000kVA进线屏/出线屏,1/2号3200kVA出线屏
 *  的简略参数
 */
@ApiModel(value = "集中监控系统RT")
@ApiModel
@Alias("CentralMonitorSystemRT")
@TableName( schema = "`db_3.5mw_motor`",value = "tb_central_monitor_sys_rt")
public class CentralMonitorSysRT {
src/main/java/com/whyc/pojo/CentralMonitorSysST.java
@@ -1,5 +1,6 @@
package com.whyc.pojo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -12,7 +13,7 @@
 *  1005-直流主配电板
 *  的参数
 */
@ApiModel(value = "集中监控系统ST")
@ApiModel
@Alias("CentralMonitorSystemST")
@TableName( schema = "`db_3.5mw_motor`",value = "tb_central_monitor_sys_st")
public class CentralMonitorSysST {
@@ -21,16 +22,22 @@
    Integer    devId;
    Date recordTime;
    @ApiModelProperty(value = "1号2500A进线屏开关合闸状态")
    @TableField("switch_close_1st_2500A")
    Integer    switchClose1st2500A;
    @ApiModelProperty(value = "1号2500A进线屏开关分闸状态")
    @TableField("switch_open_1st_2500A")
    Integer    switchOpen1st2500A;
    @ApiModelProperty(value = "1号2500A进线屏开关故障状态")
    @TableField("switch_fault_1st_2500A")
    Integer    switchFault1st2500A;
    @ApiModelProperty(value = "2号2500A进线屏开关合闸状态")
    @TableField("switch_close_2st_2500A")
    Integer    switchClose2st2500A;
    @ApiModelProperty(value = "2号2500A进线屏开关分闸状态")
    @TableField("switch_open_2st_2500A")
    Integer    switchOpen2st2500A;
    @ApiModelProperty(value = "2号2500A进线屏开关故障状态")
    @TableField("switch_fault_2st_2500A")
    Integer    switchFault2st2500A;
    @ApiModelProperty(value = "母联屏合闸状态")
    Integer    switchCloseBusScreen;
@@ -39,16 +46,22 @@
    @ApiModelProperty(value = "母联屏开关故障")
    Integer    switchFaultBusScreen;
    @ApiModelProperty(value = "1号2500A负载屏开关合闸状态")
    @TableField("switch_close_1st_2500A_load")
    Integer    switchClose1st2500ALoad;
    @ApiModelProperty(value = "1号2500A负载屏开关分闸状态")
    @TableField("switch_open_1st_2500A_load")
    Integer    switchOpen1st2500ALoad;
    @ApiModelProperty(value = "1号2500A负载屏开关故障状态")
    @TableField("switch_fault_1st_2500A_load")
    Integer    switchFault1st2500ALoad;
    @ApiModelProperty(value = "2号2500A负载屏开关合闸状态")
    @TableField("switch_close_2st_2500A_load")
    Integer    switchClose2st2500ALoad;
    @ApiModelProperty(value = "2号2500A负载屏开关分闸状态")
    @TableField("switch_open_2st_2500A_load")
    Integer    switchOpen2st2500ALoad;
    @ApiModelProperty(value = "2号2500A负载屏开关故障状态")
    @TableField("switch_fault_2st_2500A_load")
    Integer    switchFault2st2500ALoad;
    @ApiModelProperty(value = "A排电流")
    Float    currA;
src/main/java/com/whyc/pojo/Menu.java
@@ -7,7 +7,7 @@
 * 用户菜单
 */
@Alias("Menu")
@TableName( schema = "`db_3.5mw_web`",value = "tb_menu")
@TableName( schema = "`db_3.5mw_web`",value = "`tb_menu`")
public class Menu {
    private Integer id;
    private String name;
src/main/java/com/whyc/pojo/MotorSystemInf.java
@@ -21,8 +21,8 @@
 *      4002:水站通讯
 *      4003:ups通讯
 */
@Alias("System")
@TableName( schema = "`db_3.5mw_motor`",value = "tb_3.5mw_motor_inf")
@Alias("SystemInf")
@TableName( schema = "`db_3.5mw_motor`",value = "`tb_3.5mw_motor_inf`")
public class MotorSystemInf {
    private Long    num;
src/main/java/com/whyc/service/CentralMonitorSysCtrlService.java
@@ -1,6 +1,29 @@
package com.whyc.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.whyc.dto.Response;
import com.whyc.mapper.CentralMonitorSysCtrlMapper;
import com.whyc.pojo.CentralMonitorSysCtrl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class CentralMonitorSysCtrlService {
    @Resource
    private CentralMonitorSysCtrlMapper mapper;
    public Response getInfoByDevId(int devId) {
        QueryWrapper<CentralMonitorSysCtrl> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("dev_id",devId);
        try {
            CentralMonitorSysCtrl centralMonitorSysCtrl = mapper.selectOne(queryWrapper);
            return new Response<>().set(1,centralMonitorSysCtrl);
        }catch (Exception e){
            e.printStackTrace();
            return new Response<>().setCode(0);
        }
    }
}
src/main/java/com/whyc/service/CentralMonitorSysRTService.java
@@ -1,6 +1,29 @@
package com.whyc.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.whyc.dto.Response;
import com.whyc.mapper.CentralMonitorSysRTMapper;
import com.whyc.pojo.CentralMonitorSysRT;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
@Service
public class CentralMonitorSysRTService {
    @Resource
    private CentralMonitorSysRTMapper mapper;
    public Response getInfoByDevId(int devId) {
        QueryWrapper<CentralMonitorSysRT> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("dev_id",devId);
        try{
            CentralMonitorSysRT centralMonitorSysRT = mapper.selectOne(queryWrapper);
            return new Response<>().set(1,centralMonitorSysRT);
        }catch (Exception e){
            e.printStackTrace();
            return new Response<>().setCode(0);
        }
    }
}
src/main/java/com/whyc/service/CentralMonitorSysSTService.java
@@ -1,6 +1,30 @@
package com.whyc.service;
public class CentralMonitorSysSTService {
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.whyc.dto.Response;
import com.whyc.mapper.CentralMonitorSysRTMapper;
import com.whyc.mapper.CentralMonitorSysSTMapper;
import com.whyc.pojo.CentralMonitorSysRT;
import com.whyc.pojo.CentralMonitorSysST;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class CentralMonitorSysSTService {
    @Resource
    private CentralMonitorSysSTMapper mapper;
    public Response getInfoByDevId(int devId) {
        QueryWrapper<CentralMonitorSysST> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("dev_id",devId);
        try{
            CentralMonitorSysST centralMonitorSysST = mapper.selectOne(queryWrapper);
            return new Response<>().set(1,centralMonitorSysST);
        }catch (Exception e){
            e.printStackTrace();
            return new Response<>().setCode(0);
        }
    }
}
src/main/java/com/whyc/service/MotorSystemInfService.java
@@ -1,9 +1,42 @@
package com.whyc.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.whyc.dto.Response;
import com.whyc.mapper.MotorSystemInfMapper;
import com.whyc.pojo.MotorSystemInf;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
 *
 */
@Service
public class MotorSystemInfService {
    @Resource
    private MotorSystemInfMapper mapper;
    public Response getAll() {
        try {
            List<MotorSystemInf> motorSystemInfs = mapper.selectList(null);
            return new Response<>().set(1,motorSystemInfs);
        }catch (Exception e){
            e.printStackTrace();
            return new Response<>().setCode(0);
        }
    }
    public Response<List<MotorSystemInf>> getDevBySysId(int sysId) {
        try{
            QueryWrapper<MotorSystemInf> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("sys_id",sysId);
            List<MotorSystemInf> motorSystemInfs = mapper.selectList(queryWrapper);
            return new Response<List<MotorSystemInf>>().set(1,motorSystemInfs);
        }catch (Exception e){
            e.printStackTrace();
            return new Response<List<MotorSystemInf>>().setCode(0);
        }
    }
}
src/main/java/com/whyc/swagger/SwaggerConfig.java
@@ -1,45 +1,53 @@
package com.whyc.swagger;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
 * Swagger Config
 */
@Configuration
@EnableSwagger2
@ConditionalOnProperty(name = "swagger.enable",havingValue = "true")
@ComponentScan(basePackages= {"com.whyc.controller"})
@EnableWebMvc
public class SwaggerConfig {
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.any())
                .build();
    }
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("对外开放接口API 文档")               //大标题 title
                .description("HTTP对外开放接口")             //小标题
                .version("1.0.0")                           //版本
//                .termsOfServiceUrl("http://xxx.xxx.com")    //终端服务程序
//                .license("LICENSE")                         //链接显示文字
//                .licenseUrl("http://xxx.xxx.com")           //网站链接
                .build();
    }
}
//package com.whyc.swagger;
//
//import com.google.common.base.Predicates;
//import com.spring4all.swagger.EnableSwagger2Doc;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.ComponentScan;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.servlet.config.annotation.EnableWebMvc;
//import springfox.documentation.builders.ApiInfoBuilder;
//import springfox.documentation.builders.PathSelectors;
//import springfox.documentation.builders.RequestHandlerSelectors;
//import springfox.documentation.service.ApiInfo;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spring.web.plugins.Docket;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
//
///**
// * Swagger Config-这个是原生的,但是如果Application注解了@EnableSwagger2Doc,会加载第三方的
// */
//
//@Configuration
//@EnableSwagger2
//@ConditionalOnProperty(name = "swagger.enabled",havingValue = "true")
//@ComponentScan(basePackages= {"com.whyc.controller"})
//@EnableWebMvc
//@EnableAutoConfiguration
//public class SwaggerConfig {
//
//    @Bean
//    public Docket api() {
//        return new Docket(DocumentationType.SWAGGER_2)
//                .apiInfo(apiInfo())
//                .pathMapping("/")
//                .select()
//                .apis(RequestHandlerSelectors.any())
//                .build();
//    }
//
//    private ApiInfo apiInfo() {
//        return new ApiInfoBuilder()
//                .title("对外开放接口API 文档")               //大标题 title
//                //.description("HTTP对外开放接口")             //小标题
//                //.version("1.0.0")                           //版本
////                .termsOfServiceUrl("http://xxx.xxx.com")    //终端服务程序
////                .license("LICENSE")                         //链接显示文字
////                .licenseUrl("http://xxx.xxx.com")           //网站链接
//                .build();
//    }
//}
src/main/java/com/whyc/swagger/SwaggerConfig4Knife.java
@@ -1,6 +1,42 @@
package com.whyc.swagger;
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
@EnableKnife4j
public class SwaggerConfig4Knife {
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .groupName("电机系统")
                .select()
                .apis(RequestHandlerSelectors.any())
                .apis(RequestHandlerSelectors.basePackage("com.whyc.controller"))
                .build();
    }
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("3.5WM电机系统")               //大标题 title
                .contact(new Contact("PerryHsu","todo","todo"))
                .description("3.5WM电机系统")             //小标题
                .version("1.0")                           //版本
//                .termsOfServiceUrl("http://xxx.xxx.com")    //终端服务程序
//                .license("LICENSE")                         //链接显示文字
//                .licenseUrl("http://xxx.xxx.com")           //网站链接
                .build();
    }
}
src/main/resources/config/application.yml
@@ -45,8 +45,20 @@
  support-methods-arguments: true
  params: count=countSql
#swagger是否激活,swagger的UI界面地址为 localhost:8080/swagger-ui.html
swagger:
  enabled: true
  ui-config:
    operations-sorter: method
  title: 武汉源畅-3.5WM电机系统
#swagger:
#  enabled: true
#  ui-config:
#    operations-sorter: method
#  title: 武汉源畅-3.5WM电机系统
#  authorization:
#    type: None
#    auth-regex: none
#  base-package: com.whyc.controller
#knife4j:
#  enable: true
##  production: true
##  cors: true
#  setting:
#    enableSwaggerModels: true
#    enableDocumentManage: true
#    swaggerModelName: 实体类列表