fix: swagger找不到接口bug

This commit is contained in:
2024-04-02 11:54:05 +08:00
parent 3070d38152
commit 0e7a4f33ee
7 changed files with 185 additions and 166 deletions
+3 -14
View File
@@ -12,20 +12,9 @@
<repositories> <repositories>
<repository> <repository>
<id>aliyun</id> <id>com.e-iceblue</id>
<name>aliyun Repository</name> <name>e-iceblue</name>
<url>https://maven.aliyun.com/repository/public</url> <url>https://repo.e-iceblue.cn/repository/maven-public/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>jeecg</id>
<name>jeecg Repository</name>
<url>https://maven.jeecg.org/nexus/content/repositories/jeecg</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository> </repository>
</repositories> </repositories>
@@ -1,4 +1,4 @@
package com.jero.modules.controller.controller; package com.jero.modules.controller;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@@ -13,6 +13,7 @@ import com.jero.modules.vo.DeviceStatisticsVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import com.jero.common.system.base.controller.JeroController; import com.jero.common.system.base.controller.JeroController;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
@@ -23,16 +24,18 @@ import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
/** /**
* @Description: 设备 * @Description: 设备
* @Author: jero-boot * @Author: jero-boot
* @Date: 2024-04-01 * @Date: 2024-04-01
* @Version: V1.0 * @Version: V1.0
*/ */
@Api(tags="设备")
@RestController
@RequestMapping("/device")
@Slf4j @Slf4j
@Transactional(rollbackFor = Exception.class)
@RestController
@Api(tags = "设备管理")
@RequestMapping("/device")
public class KhDeviceController extends JeroController<KhDevice, IKhDeviceService> { public class KhDeviceController extends JeroController<KhDevice, IKhDeviceService> {
@Autowired @Autowired
private IKhDeviceService khDeviceService; private IKhDeviceService khDeviceService;
@@ -47,11 +50,11 @@ public class KhDeviceController extends JeroController<KhDevice, IKhDeviceServic
* @return * @return
*/ */
@AutoLog(value = "设备-分页列表查询") @AutoLog(value = "设备-分页列表查询")
@ApiOperation(value="设备-分页列表查询", notes="设备-分页列表查询") @ApiOperation(value = "设备-分页列表查询", notes = "设备-分页列表查询")
@GetMapping(value = "/page") @GetMapping(value = "/page")
public Results<IPage<KhDevice>> queryPageList(KhDevice khDevice, public Results<IPage<KhDevice>> queryPageList(KhDevice khDevice,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
IPage<KhDevice> pageList = khDeviceService.queryPage(khDevice, pageNo, pageSize, req); IPage<KhDevice> pageList = khDeviceService.queryPage(khDevice, pageNo, pageSize, req);
return Results.OK(pageList); return Results.OK(pageList);
@@ -63,7 +66,7 @@ public class KhDeviceController extends JeroController<KhDevice, IKhDeviceServic
* @return * @return
*/ */
@AutoLog(value = "设备-系统设备概况") @AutoLog(value = "设备-系统设备概况")
@ApiOperation(value="设备-系统设备概况", notes="设备-系统设备概况") @ApiOperation(value = "设备-系统设备概况", notes = "设备-系统设备概况")
@GetMapping(value = "/statistics") @GetMapping(value = "/statistics")
public Results<DeviceStatisticsVO> statistics() { public Results<DeviceStatisticsVO> statistics() {
return Results.OK(khDeviceService.statistics()); return Results.OK(khDeviceService.statistics());
@@ -77,7 +80,7 @@ public class KhDeviceController extends JeroController<KhDevice, IKhDeviceServic
* @return * @return
*/ */
@AutoLog(value = "设备-列表查询") @AutoLog(value = "设备-列表查询")
@ApiOperation(value="设备-列表查询", notes="设备-列表查询") @ApiOperation(value = "设备-列表查询", notes = "设备-列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Results<List<KhDevice>> queryList(KhDevice khDevice, HttpServletRequest req) { public Results<List<KhDevice>> queryList(KhDevice khDevice, HttpServletRequest req) {
List<KhDevice> list = khDeviceService.queryList(khDevice, req); List<KhDevice> list = khDeviceService.queryList(khDevice, req);
@@ -91,7 +94,7 @@ public class KhDeviceController extends JeroController<KhDevice, IKhDeviceServic
* @return * @return
*/ */
@AutoLog(value = "设备-添加") @AutoLog(value = "设备-添加")
@ApiOperation(value="设备-添加", notes="设备-添加") @ApiOperation(value = "设备-添加", notes = "设备-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Results<T> add(@Validated @RequestBody KhDevice khDevice) { public Results<T> add(@Validated @RequestBody KhDevice khDevice) {
khDeviceService.add(khDevice); khDeviceService.add(khDevice);
@@ -105,7 +108,7 @@ public class KhDeviceController extends JeroController<KhDevice, IKhDeviceServic
* @return * @return
*/ */
@AutoLog(value = "设备-编辑") @AutoLog(value = "设备-编辑")
@ApiOperation(value="设备-编辑", notes="设备-编辑") @ApiOperation(value = "设备-编辑", notes = "设备-编辑")
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Results<T> edit(@Validated @RequestBody KhDevice khDevice) { public Results<T> edit(@Validated @RequestBody KhDevice khDevice) {
khDeviceService.editById(khDevice); khDeviceService.editById(khDevice);
@@ -119,10 +122,10 @@ public class KhDeviceController extends JeroController<KhDevice, IKhDeviceServic
* @return * @return
*/ */
@AutoLog(value = "设备-通过id删除") @AutoLog(value = "设备-通过id删除")
@ApiOperation(value="设备-通过id删除", notes="设备-通过id删除") @ApiOperation(value = "设备-通过id删除", notes = "设备-通过id删除")
@PostMapping(value = "/delete") @PostMapping(value = "/delete")
public Results<T> delete(@RequestBody Map<String, String> map) { public Results<T> delete(@RequestBody Map<String, String> map) {
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){ if (!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))) {
return Results.error("请选择数据!"); return Results.error("请选择数据!");
} }
khDeviceService.deleteById(map.get("id")); khDeviceService.deleteById(map.get("id"));
@@ -136,10 +139,10 @@ public class KhDeviceController extends JeroController<KhDevice, IKhDeviceServic
* @return * @return
*/ */
@AutoLog(value = "设备-批量删除") @AutoLog(value = "设备-批量删除")
@ApiOperation(value="设备-批量删除", notes="设备-批量删除") @ApiOperation(value = "设备-批量删除", notes = "设备-批量删除")
@PostMapping(value = "/deleteBatch") @PostMapping(value = "/deleteBatch")
public Results<T> deleteBatch(@RequestBody Map<String, String> map) { public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){ if (!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))) {
return Results.error("请选择数据!"); return Results.error("请选择数据!");
} }
this.khDeviceService.deleteByIds(Arrays.asList(map.get("ids").split(","))); this.khDeviceService.deleteByIds(Arrays.asList(map.get("ids").split(",")));
@@ -153,11 +156,11 @@ public class KhDeviceController extends JeroController<KhDevice, IKhDeviceServic
* @return * @return
*/ */
@AutoLog(value = "设备-通过id查询") @AutoLog(value = "设备-通过id查询")
@ApiOperation(value="设备-通过id查询", notes="设备-通过id查询") @ApiOperation(value = "设备-通过id查询", notes = "设备-通过id查询")
@GetMapping(value = "/queryById") @GetMapping(value = "/queryById")
public Results<KhDevice> queryById(@RequestParam(name="id",required=true) String id) { public Results<KhDevice> queryById(@RequestParam(name = "id", required = true) String id) {
KhDevice khDevice = khDeviceService.queryById(id); KhDevice khDevice = khDeviceService.queryById(id);
if(khDevice==null) { if (khDevice == null) {
return Results.error("未找到对应数据"); return Results.error("未找到对应数据");
} }
return Results.OK(khDevice); return Results.OK(khDevice);
@@ -187,3 +190,5 @@ public class KhDeviceController extends JeroController<KhDevice, IKhDeviceServic
} }
} }
@@ -1,9 +1,7 @@
package com.jero.modules.entity; package com.jero.modules.entity;
import java.io.Serializable; import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date; import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
@@ -16,7 +14,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
/** /**
@@ -1,9 +1,7 @@
package com.jero.modules.entity; package com.jero.modules.entity;
import java.io.Serializable; import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date; import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
@@ -16,7 +14,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
/** /**
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jero.modules.1.mapper.KhDeviceMapper"> <mapper namespace="com.jero.modules.mapper.KhDeviceMapper">
<resultMap id="KhDeviceResultMap" type="com.jero.modules.1.entity.KhDevice"> <resultMap id="KhDeviceResultMap" type="com.jero.modules.entity.KhDevice">
<id column="id" property="id" /> <id column="id" property="id" />
<result column="create_by" property="createBy" /> <result column="create_by" property="createBy" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
@@ -13,6 +13,6 @@
<result column="wellhead_id" property="wellheadId" /> <result column="wellhead_id" property="wellheadId" />
<result column="device_desc" property="deviceDesc" /> <result column="device_desc" property="deviceDesc" />
<result column="device_sn" property="deviceSn" /> <result column="device_sn" property="deviceSn" />
<result column="device_statuts" property="deviceStatuts" /> <result column="device_status" property="deviceStatus" />
</resultMap> </resultMap>
</mapper> </mapper>
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jero.modules.1.mapper.KhWellheadMapper"> <mapper namespace="com.jero.modules.mapper.KhWellheadMapper">
<resultMap id="KhWellheadResultMap" type="com.jero.modules.1.entity.KhWellhead"> <resultMap id="KhWellheadResultMap" type="com.jero.modules.entity.KhWellhead">
<id column="id" property="id" /> <id column="id" property="id" />
<result column="create_by" property="createBy" /> <result column="create_by" property="createBy" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
+31
View File
@@ -27,6 +27,37 @@
<artifactId>jero-boot-base-generater</artifactId> <artifactId>jero-boot-base-generater</artifactId>
<version>${jero.version}</version> <version>${jero.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.jero.boot</groupId>
<artifactId>jero-boot-modules</artifactId>
<version>${jero.version}</version>
<exclusions>
<exclusion>
<artifactId>activation</artifactId>
<groupId>javax.activation</groupId>
</exclusion>
<exclusion>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
</exclusion>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<artifactId>swagger-models</artifactId>
<groupId>io.swagger</groupId>
</exclusion>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
<exclusion>
<artifactId>swagger-annotations</artifactId>
<groupId>io.swagger</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies> </dependencies>
<build> <build>