Kaynağa Gözat

加入knife4j文档

lilinhui 3 hafta önce
ebeveyn
işleme
d8ef7a2c81

+ 1 - 1
pom.xml

@@ -19,7 +19,7 @@
         <druid.version>1.2.19</druid.version>
         <druid.version>1.2.19</druid.version>
         <bitwalker.version>1.19</bitwalker.version>
         <bitwalker.version>1.19</bitwalker.version>
         <kaptcha.version>2.3.2</kaptcha.version>
         <kaptcha.version>2.3.2</kaptcha.version>
-        <swagger.version>2.9.2</swagger.version>
+        <swagger.version>3.0.0</swagger.version>
         <pagehelper.boot.version>1.3.1</pagehelper.boot.version>
         <pagehelper.boot.version>1.3.1</pagehelper.boot.version>
         <fastjson.version>2.0.10</fastjson.version>
         <fastjson.version>2.0.10</fastjson.version>
         <oshi.version>5.2.5</oshi.version>
         <oshi.version>5.2.5</oshi.version>

+ 15 - 1
poyee-order/src/main/java/com/tzy/controller/LotOrderController.java

@@ -1,21 +1,28 @@
 package com.tzy.controller;
 package com.tzy.controller;
 
 
+import com.tzy.common.config.handle.ApiVersion;
 import com.tzy.common.dto.OutDTO;
 import com.tzy.common.dto.OutDTO;
 import com.tzy.entity.LotOrder;
 import com.tzy.entity.LotOrder;
 import com.tzy.service.LotOrderService;
 import com.tzy.service.LotOrderService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
 import java.util.List;
 import java.util.List;
 
 
 @RestController
 @RestController
-@RequestMapping("/lot/order")
+@Api(tags = "拍品订单")
+@RequestMapping("/api/{version}/lot/order/")
 public class LotOrderController {
 public class LotOrderController {
     @Autowired
     @Autowired
     private LotOrderService lotOrderService;
     private LotOrderService lotOrderService;
 
 
     @PostMapping("create")
     @PostMapping("create")
     @ResponseBody
     @ResponseBody
+    @ApiOperation("创建拍品订单")
+    @ApiVersion(1.0)
     public OutDTO createLotOrder(@RequestBody LotOrder lotOrder) {
     public OutDTO createLotOrder(@RequestBody LotOrder lotOrder) {
         int inserted = lotOrderService.createLotOrder(lotOrder);
         int inserted = lotOrderService.createLotOrder(lotOrder);
         if (inserted > 0) {
         if (inserted > 0) {
@@ -28,6 +35,8 @@ public class LotOrderController {
     //app拍品订单列表查询
     //app拍品订单列表查询
     @PostMapping("/list")
     @PostMapping("/list")
     @ResponseBody
     @ResponseBody
+    @ApiOperation("拍品订单列表查询")
+    @ApiVersion(1.0)
     public OutDTO queryLotList(@RequestBody LotOrder lotOrder) {
     public OutDTO queryLotList(@RequestBody LotOrder lotOrder) {
         List<LotOrder> lotOrders = lotOrderService.getLotOrders(lotOrder);
         List<LotOrder> lotOrders = lotOrderService.getLotOrders(lotOrder);
         return OutDTO.ok().put("lotOrders", lotOrders);
         return OutDTO.ok().put("lotOrders", lotOrders);
@@ -36,13 +45,18 @@ public class LotOrderController {
     //app订单详情查询
     //app订单详情查询
     @PostMapping("/query")
     @PostMapping("/query")
     @ResponseBody
     @ResponseBody
+    @ApiOperation("拍品订单详情查询")
+    @ApiVersion(1.0)
     public OutDTO queryLotOrderById(@RequestBody LotOrder lotOrder) {
     public OutDTO queryLotOrderById(@RequestBody LotOrder lotOrder) {
         lotOrder = lotOrderService.getLotOrderById(lotOrder.getId());
         lotOrder = lotOrderService.getLotOrderById(lotOrder.getId());
         return OutDTO.ok().put("lotOrder", lotOrder);
         return OutDTO.ok().put("lotOrder", lotOrder);
     }
     }
 
 
     //修改订单收货地址
     //修改订单收货地址
+    @ResponseBody
     @PostMapping("/editOrderAddress")
     @PostMapping("/editOrderAddress")
+    @ApiOperation("修改订单收货地址")
+    @ApiVersion(1.0)
     public OutDTO editOrderShippingAddress(@RequestBody LotOrder lotOrder) {
     public OutDTO editOrderShippingAddress(@RequestBody LotOrder lotOrder) {
         int i = lotOrderService.updateLotOrderAddress(lotOrder);
         int i = lotOrderService.updateLotOrderAddress(lotOrder);
         if (i > 0) {
         if (i > 0) {

+ 5 - 5
poyee-order/src/main/resources/mapper/LotOrderMapper.xml

@@ -3,7 +3,7 @@
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
         "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.tzy.mapper.LotOrderMapper">
 <mapper namespace="com.tzy.mapper.LotOrderMapper">
-    <resultMap id="lotOrderResultMap" type="lotOrder">
+    <resultMap id="lotOrderResultMap" type="com.tzy.entity.LotOrder">
         <id column="id" property="id"/>
         <id column="id" property="id"/>
         <result column="order_no" property="orderNo"/>
         <result column="order_no" property="orderNo"/>
         <result column="auction_name" property="auctionName"/>
         <result column="auction_name" property="auctionName"/>
@@ -19,7 +19,7 @@
         <result column="create_time" property="createTime"/>
         <result column="create_time" property="createTime"/>
         <result column="pay_time" property="payTime"/>
         <result column="pay_time" property="payTime"/>
     </resultMap>
     </resultMap>
-    <select id="selectLotOrder" resultMap="lotOrderResultMap" parameterType="lotOrder">
+    <select id="selectLotOrder" resultMap="lotOrderResultMap" parameterType="com.tzy.entity.LotOrder">
         select id,order_no,auction_name,lot_name,user_id,status,payment_amount,merchant_id,shipping_address_id,express_id,lot_id,auction_id,create_time,pay_time from lot_order_info
         select id,order_no,auction_name,lot_name,user_id,status,payment_amount,merchant_id,shipping_address_id,express_id,lot_id,auction_id,create_time,pay_time from lot_order_info
         <where>
         <where>
 
 
@@ -35,18 +35,18 @@
         </where>
         </where>
         order by create_time desc
         order by create_time desc
     </select>
     </select>
-    <select id="selectLotOrderById" resultType="lotOrder">
+    <select id="selectLotOrderById" resultType="com.tzy.entity.LotOrder">
         select id,order_no,auction_name,lot_name,user_id,status,payment_amount,merchant_id,shipping_address_id,express_id,lot_id,auction_id,create_time,pay_time from lot_order_info
         select id,order_no,auction_name,lot_name,user_id,status,payment_amount,merchant_id,shipping_address_id,express_id,lot_id,auction_id,create_time,pay_time from lot_order_info
         where id=#{id}
         where id=#{id}
     </select>
     </select>
-    <select id="countLotOrderByLotId" parameterType="lotOrder" resultType="int">
+    <select id="countLotOrderByLotId" parameterType="com.tzy.entity.LotOrder" resultType="int">
         select count(*) from lot_order_info where lot_id=#{lotId}
         select count(*) from lot_order_info where lot_id=#{lotId}
     </select>
     </select>
     <insert id="insertLotOrder">
     <insert id="insertLotOrder">
         insert into lot_order_info (order_no,auction_name,lot_name,user_id,status,payment_amount,merchant_id,shipping_address_id,express_id,lot_id,auction_id,create_time,pay_time)
         insert into lot_order_info (order_no,auction_name,lot_name,user_id,status,payment_amount,merchant_id,shipping_address_id,express_id,lot_id,auction_id,create_time,pay_time)
         values (#{orderNo},#{auctionName},#{lotName},#{userId},#{status},#{paymentAmount},#{merchantId},#{shippingAddressId},#{expressId},#{lotId},#{auctionId},#{createTime},#{payTime})
         values (#{orderNo},#{auctionName},#{lotName},#{userId},#{status},#{paymentAmount},#{merchantId},#{shippingAddressId},#{expressId},#{lotId},#{auctionId},#{createTime},#{payTime})
     </insert>
     </insert>
-    <update id="updateLotOrderAddress" parameterType="lotOrder">
+    <update id="updateLotOrderAddress" parameterType="com.tzy.entity.LotOrder">
         update lot_order_info set shipping_address_id=#{shippingAddressId},shipping_address=#{shippingAddress},shipping_address_likename=#{shippingAddressLinkname},shipping_address_phone=#{shippingAddressPhone}
         update lot_order_info set shipping_address_id=#{shippingAddressId},shipping_address=#{shippingAddress},shipping_address_likename=#{shippingAddressLinkname},shipping_address_phone=#{shippingAddressPhone}
         where id=#{id}
         where id=#{id}
     </update>
     </update>

+ 0 - 44
poyee-order/target/classes/mapper/LotOrderMapper.xml

@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-        "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.tzy.mapper.LotOrderMapper">
-    <resultMap id="lotOrderResultMap" type="lotOrder">
-        <id column="id" property="id"/>
-        <result column="order_no" property="orderNo"/>
-        <result column="auction_name" property="auctionName"/>
-        <result column="lot_name" property="lotName"/>
-        <result column="user_id" property="lotId"/>
-        <result column="status" property="status"/>
-        <result column="payment_amount" property="paymentAmount"/>
-        <result  column="merchant_id" property="merchantId"/>
-        <result column="shipping_address_id" property="shippingAddressId"/>
-        <result column="express_id" property="expressId"/>
-        <result column="lot_id" property="lotId"/>
-        <result column="auction_id" property="auctionId"/>
-        <result column="create_time" property="createTime"/>
-        <result column="pay_time" property="payTime"/>
-    </resultMap>
-    <select id="selectLotOrder" resultMap="lotOrderResultMap" parameterType="lotOrder">
-        select id,order_no,auction_name,lot_name,user_id,status,payment_amount,merchant_id,shipping_address_id,express_id,lot_id,auction_id,create_time,pay_time from lot_order_info
-        <where>
-            <if test="id!=null">
-                and id=#{id}
-            </if>
-            <if test="orderNo!=null and orderNo!=''">
-                and order_no=#{orderNo}
-            </if>
-            <if test="status!=null">
-                and status=#{status}
-            </if>
-            <if test="userId!=null">
-                and user_id=#{userId}
-            </if>
-        </where>
-        order by create_time desc
-    </select>
-    <insert id="insertLotOrder">
-        insert into lot_order_info (order_no,auction_name,lot_name,user_id,status,payment_amount,merchant_id,shipping_address_id,express_id,lot_id,auction_id,create_time,pay_time)
-        values (#{orderNo},#{auctionName},#{lotName},#{userId},#{status},#{paymentAmount},#{merchantId},#{shippingAddressId},#{expressId},#{lotId},#{auctionId},#{createTime},#{payTime})
-    </insert>
-</mapper>

+ 10 - 10
poyi-app-common/pom.xml

@@ -43,21 +43,21 @@
             <groupId>io.springfox</groupId>
             <groupId>io.springfox</groupId>
             <artifactId>springfox-swagger2</artifactId>
             <artifactId>springfox-swagger2</artifactId>
         </dependency>
         </dependency>
-        <!--防止进入swagger页面报类型转换错误,排除2.9.2中的引用,手动增加1.5.21版本-->
         <dependency>
         <dependency>
-            <groupId>io.swagger</groupId>
-            <artifactId>swagger-annotations</artifactId>
-            <version>1.5.21</version>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-boot-starter</artifactId>
+            <version>3.0.0</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
-            <groupId>io.swagger</groupId>
-            <artifactId>swagger-models</artifactId>
-            <version>1.5.21</version>
+            <groupId>com.github.xiaoymin</groupId>
+            <artifactId>knife4j-spring-boot-starter</artifactId>
+            <version>3.0.3</version>
         </dependency>
         </dependency>
-        <!-- swagger2-UI-->
+        <!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
         <dependency>
         <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-swagger-ui</artifactId>
+            <groupId>io.swagger</groupId>
+            <artifactId>swagger-models</artifactId>
+            <version>1.6.2</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
             <groupId>org.springframework.cloud</groupId>

+ 5 - 0
poyi-app/pom.xml

@@ -17,6 +17,11 @@
             <artifactId>poyi-service</artifactId>
             <artifactId>poyi-service</artifactId>
             <version>${tzy.version}</version>
             <version>${tzy.version}</version>
         </dependency>
         </dependency>
+        <dependency>
+            <groupId>com.tzy</groupId>
+            <artifactId>poyee-order</artifactId>
+            <version>${tzy.version}</version>
+        </dependency>
         <dependency>
         <dependency>
             <groupId>org.codehaus.janino</groupId>
             <groupId>org.codehaus.janino</groupId>
             <artifactId>janino</artifactId>
             <artifactId>janino</artifactId>

+ 8 - 3
poyi-app/src/main/resources/application-druid.yml

@@ -6,9 +6,9 @@ spring:
         druid:
         druid:
             # 主库数据源
             # 主库数据源
             master:
             master:
-                username: postgres
-                password: 123456
-                url: jdbc:postgresql://192.168.50.8:5432/ahx_app
+              username: postgres
+              password: 123456
+              url: jdbc:postgresql://192.168.50.8:5432/ahx_app
             # 初始连接数
             # 初始连接数
             initialSize: 5
             initialSize: 5
             # 最小连接池数量
             # 最小连接池数量
@@ -52,3 +52,8 @@ spring:
                 wall:
                 wall:
                     config:
                     config:
                         multi-statement-allow: true
                         multi-statement-allow: true
+knife4j:
+  enable: true
+  setting:
+    language: zh-CN
+  production: false #是否生产环境

+ 5 - 0
poyi-app/src/main/resources/application-prod.yml

@@ -202,3 +202,8 @@ express:
     appsecret: 44d5f413cebb406b867b4f5b3477b0af
     appsecret: 44d5f413cebb406b867b4f5b3477b0af
     redirect_uri: https://m-dev.hobbystocks.cn/api/home/jdAuth
     redirect_uri: https://m-dev.hobbystocks.cn/api/home/jdAuth
 
 
+knife4j:
+  enable: true
+  setting:
+    language: zh-CN
+  production: true #是否生产环境