Browse Source

bug处理 供应商列表

1 4 years ago
parent
commit
d5d31c2588

+ 2 - 1
modules/admin/src/main/java/com/fire/admin/repository/ChannelSupplierMapper.java

@@ -3,6 +3,7 @@ package com.fire.admin.repository;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fire.dto.ChannelSupplier;
 import com.fire.dto.ChannelSupplier;
+import org.apache.ibatis.annotations.Param;
 
 
 /**
 /**
  * @author: admin
  * @author: admin
@@ -12,7 +13,7 @@ import com.fire.dto.ChannelSupplier;
  */
  */
 public interface ChannelSupplierMapper {
 public interface ChannelSupplierMapper {
 
 
-    IPage<ChannelSupplier> getSupplierList(Page page, ChannelSupplier channelSupplier);
+    IPage<ChannelSupplier> getSupplierList(Page page, @Param("supplierName") String supplierName);
 
 
     void updateSupplier(ChannelSupplier channelSupplier);
     void updateSupplier(ChannelSupplier channelSupplier);
 
 

+ 4 - 4
modules/admin/src/main/java/com/fire/admin/rest/ChannelSupplierController.java

@@ -9,7 +9,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
@@ -28,10 +28,10 @@ public class ChannelSupplierController {
     @Autowired
     @Autowired
     private SupplierService supplierService;
     private SupplierService supplierService;
 
 
-    @GetMapping("/list")
+    @PostMapping("/list")
     @ApiOperation(value = "供应商列表",notes = "supplier_list.py")
     @ApiOperation(value = "供应商列表",notes = "supplier_list.py")
-    public BaseRestResponse<IPage<ChannelSupplier>> supplierList(Page<ChannelSupplier> page, ChannelSupplier channelSupplier) {
-        return new BaseRestResponse<>(supplierService.getSupplierList(page, channelSupplier));
+    public BaseRestResponse<IPage<ChannelSupplier>> supplierList(Page<ChannelSupplier> page,  String supplierName) {
+        return new BaseRestResponse<>(supplierService.getSupplierList(page, supplierName));
     }
     }
 
 
 
 

+ 1 - 1
modules/admin/src/main/java/com/fire/admin/service/SupplierService.java

@@ -12,7 +12,7 @@ import com.fire.dto.ChannelSupplier;
  */
  */
 public interface SupplierService {
 public interface SupplierService {
 
 
-    IPage<ChannelSupplier> getSupplierList(Page page, ChannelSupplier channelSupplier);
+    IPage<ChannelSupplier> getSupplierList(Page page, String supplierName);
 
 
     void updateSupplier(ChannelSupplier channelSupplier);
     void updateSupplier(ChannelSupplier channelSupplier);
 
 

+ 2 - 2
modules/admin/src/main/java/com/fire/admin/service/impl/SupplierServiceImpl.java

@@ -21,8 +21,8 @@ public class SupplierServiceImpl implements SupplierService {
     private ChannelSupplierMapper channelSupplierMapper;
     private ChannelSupplierMapper channelSupplierMapper;
 
 
     @Override
     @Override
-    public IPage<ChannelSupplier> getSupplierList(Page page, ChannelSupplier channelSupplier) {
-        return channelSupplierMapper.getSupplierList(page, channelSupplier);
+    public IPage<ChannelSupplier> getSupplierList(Page page, String supplierName) {
+        return channelSupplierMapper.getSupplierList(page, supplierName);
     }
     }
 
 
     @Override
     @Override

+ 39 - 17
modules/admin/src/main/resources/mapper/ChannelSupplierMapper.xml

@@ -36,31 +36,51 @@
     </resultMap>
     </resultMap>
 
 
     <sql id="select_all">
     <sql id="select_all">
-        SELECT
-            supplier_code,supplier_name,link_name,mobile,email,address,balance,consume_amount,recharge_amount,creator
-            create_time,updator,update_time,is_valid,account,passwd,app_key,make_order_url,query_url,call_back_url,version,ratio,
-            manage_url,user_id,alert_balance,is_delete
+        SELECT supplier_code,
+               supplier_name,
+               link_name,
+               mobile,
+               email,
+               address,
+               balance,
+               consume_amount,
+               recharge_amount,
+               creator,
+               create_time,
+               updator,
+               update_time,
+               is_valid,
+               account,
+               passwd,
+               app_key,
+               make_order_url,
+               query_url,
+               call_back_url,
+               version,
+               ratio,
+               manage_url,
+               user_id,
+               alert_balance,
+               is_delete
         FROM channel_supplier
         FROM channel_supplier
     </sql>
     </sql>
 
 
     <select id="getSupplierList" resultMap="supplierResultMap">
     <select id="getSupplierList" resultMap="supplierResultMap">
-        SELECT
-            <include refid="select_all"/>
-        FROM
-             channel_supplier
+        <include refid="select_all"/>
         <where>
         <where>
             <if test="supplierName != null and supplierName != ''">
             <if test="supplierName != null and supplierName != ''">
-                supplier_name = #{supplierName}
+                AND supplier_name = #{supplierName}
             </if>
             </if>
+            AND is_delete = 0
         </where>
         </where>
-        AND is_delete = 0
+
         ORDER BY balance DESC
         ORDER BY balance DESC
     </select>
     </select>
 
 
     <insert id="saveSupplier">
     <insert id="saveSupplier">
         INSERT INTO channel_supplier
         INSERT INTO channel_supplier
-        (supplier_code,supplier_name,balance,ratio,is_valid,create_time )
-        VALUES (#{supplierCode},#{supplierName},#{balance},#{ratio},#{isValid},#{createTime});
+            (supplier_code, supplier_name, balance, ratio, is_valid, create_time)
+        VALUES (#{supplierCode}, #{supplierName}, #{balance}, #{ratio}, #{isValid}, #{createTime});
     </insert>
     </insert>
 
 
     <update id="updateSupplier">
     <update id="updateSupplier">
@@ -75,7 +95,7 @@
             <if test="balance!=null">
             <if test="balance!=null">
                 balance = #{balance},
                 balance = #{balance},
             </if>
             </if>
-            <if test="ratio!=null and balance!=''" >
+            <if test="ratio!=null and balance!=''">
                 ratio = #{ratio},
                 ratio = #{ratio},
             </if>
             </if>
             <if test="isValid!=null">
             <if test="isValid!=null">
@@ -85,13 +105,15 @@
                 create_time = #{createTime}
                 create_time = #{createTime}
             </if>
             </if>
         </set>
         </set>
-            <where>
-                supplier_code = #{supplierCode}
-            </where>
+        <where>
+            supplier_code = #{supplierCode}
+        </where>
     </update>
     </update>
 
 
     <delete id="deleteSupplierById">
     <delete id="deleteSupplierById">
-        DELETE FROM channel_supplier WHERE id = #{id}
+        DELETE
+        FROM channel_supplier
+        WHERE id = #{id}
     </delete>
     </delete>
 
 
 </mapper>
 </mapper>