Browse Source

调整分页

wanglang 2 months ago
parent
commit
0e86e71921

+ 2 - 2
trade-admin/src/main/java/com/trade/admin/customer/service/impl/CustomerAssignServiceImpl.java

@@ -65,9 +65,9 @@ public class CustomerAssignServiceImpl extends ServiceImpl<CustomerAssignMapper,
 
 
     @Override
     @Override
     public GridPage<CustomerAssign> findBySearch(SearchCustomerAssign search) {
     public GridPage<CustomerAssign> findBySearch(SearchCustomerAssign search) {
-        Page<CustomerReferralCode> page = PageHelper.startPage(search.getPageNum(), search.getPageSize());
+        Page<CustomerReferralCode> page = PageHelper.startPage(search.getPage(), search.getRows());
         List<CustomerAssign> rows = customerAssignMapper.findBySearch(search);
         List<CustomerAssign> rows = customerAssignMapper.findBySearch(search);
-        return new GridPage<>(search.getPageNum(), search.getPageSize(), page.getTotal(), rows);
+        return new GridPage<>(search.getPage(), search.getRows(), page.getTotal(), rows);
     }
     }
 
 
     @Override
     @Override

+ 2 - 2
trade-admin/src/main/java/com/trade/admin/salecontract/service/impl/BSaleContractServiceImpl.java

@@ -33,14 +33,14 @@ public class BSaleContractServiceImpl implements BSaleContractService {
     @Override
     @Override
     public GridPage<SalesContractVo> getSalesContractPage(ContractSearchDto contractSearch) {
     public GridPage<SalesContractVo> getSalesContractPage(ContractSearchDto contractSearch) {
         contractSearch.setPoint(false);
         contractSearch.setPoint(false);
-        Page<SalesContractVo> page = PageHelper.startPage(contractSearch.getPageNum(), contractSearch.getPageSize());
+        Page<SalesContractVo> page = PageHelper.startPage(contractSearch.getPage(), contractSearch.getRows());
         if (StringUtils.isNotEmpty(contractSearch.getCustomerUserInfo())) {
         if (StringUtils.isNotEmpty(contractSearch.getCustomerUserInfo())) {
             List<Long> customerUserIds = enterpriseService.findByCustomerInfo(contractSearch.getCustomerUserInfo())
             List<Long> customerUserIds = enterpriseService.findByCustomerInfo(contractSearch.getCustomerUserInfo())
                     .stream().map(e -> e.getCustomerId()).collect(Collectors.toList());
                     .stream().map(e -> e.getCustomerId()).collect(Collectors.toList());
             contractSearch.setCustomerUserIdList(customerUserIds);
             contractSearch.setCustomerUserIdList(customerUserIds);
         }
         }
         List<SalesContractVo> rows = salesContractService.getSalesContractInfo(contractSearch);
         List<SalesContractVo> rows = salesContractService.getSalesContractInfo(contractSearch);
-        return new GridPage<>(contractSearch.getPageNum(), contractSearch.getPageSize(), page.getTotal(), rows);
+        return new GridPage<>(contractSearch.getPage(), contractSearch.getRows(), page.getTotal(), rows);
     }
     }
 
 
     @Override
     @Override

+ 2 - 2
trade-client/src/main/java/com/trade/client/trade/sales/service/impl/SalesServiceImpl.java

@@ -218,9 +218,9 @@ public class SalesServiceImpl implements SalesService {
         CustomerUser customerUser = customerUserService.getCustomerUser();
         CustomerUser customerUser = customerUserService.getCustomerUser();
         contractSearch.setCustomerUserId(customerUser.getId());
         contractSearch.setCustomerUserId(customerUser.getId());
         contractSearch.setPoint(true);
         contractSearch.setPoint(true);
-        Page<SalesContractVo> page = PageHelper.startPage(contractSearch.getPageNum(), contractSearch.getPageSize());
+        Page<SalesContractVo> page = PageHelper.startPage(contractSearch.getPage(), contractSearch.getRows());
         List<SalesContractVo> rows = salesContractService.getSalesContractInfo(contractSearch);
         List<SalesContractVo> rows = salesContractService.getSalesContractInfo(contractSearch);
-        return new GridPage<>(contractSearch.getPageNum(), contractSearch.getPageSize(), page.getTotal(), rows);
+        return new GridPage<>(contractSearch.getPage(), contractSearch.getRows(), page.getTotal(), rows);
     }
     }
 
 
     @Override
     @Override

+ 34 - 15
trade-common/src/main/java/com/trade/common/core/page/PageDomain.java

@@ -10,13 +10,20 @@ import com.trade.common.utils.StringUtils;
 public class PageDomain {
 public class PageDomain {
 
 
     /** 当前记录起始索引 */
     /** 当前记录起始索引 */
-    private Integer pageNum;
+    private Integer page = 1;
     /** 每页显示记录数 */
     /** 每页显示记录数 */
-    private Integer pageSize;
+    private Integer rows = 30;
     /** 排序列 */
     /** 排序列 */
     private String orderByColumn;
     private String orderByColumn;
     /** 排序的方向desc或者asc */
     /** 排序的方向desc或者asc */
-    private String isAsc = "asc";
+    /**
+     * 排序字段
+     */
+    private String sidx = "gmt_create";
+    /**
+     * 排序类型
+     */
+    private String sort = "desc";
     /** 分页参数合理化 */
     /** 分页参数合理化 */
     private Boolean reasonable = true;
     private Boolean reasonable = true;
 
 
@@ -24,23 +31,23 @@ public class PageDomain {
         if (StringUtils.isEmpty(orderByColumn)) {
         if (StringUtils.isEmpty(orderByColumn)) {
             return "";
             return "";
         }
         }
-        return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
+        return StringUtils.toUnderScoreCase(orderByColumn) + " " + sort;
     }
     }
 
 
-    public Integer getPageNum() {
-        return pageNum;
+    public Integer getPage() {
+        return page;
     }
     }
 
 
-    public void setPageNum(Integer pageNum) {
-        this.pageNum = pageNum;
+    public void setPage(Integer page) {
+        this.page = page;
     }
     }
 
 
-    public Integer getPageSize() {
-        return pageSize;
+    public Integer getRows() {
+        return rows;
     }
     }
 
 
-    public void setPageSize(Integer pageSize) {
-        this.pageSize = pageSize;
+    public void setRows(Integer rows) {
+        this.rows = rows;
     }
     }
 
 
     public String getOrderByColumn() {
     public String getOrderByColumn() {
@@ -51,8 +58,12 @@ public class PageDomain {
         this.orderByColumn = orderByColumn;
         this.orderByColumn = orderByColumn;
     }
     }
 
 
-    public String getIsAsc() {
-        return isAsc;
+    public String getSort() {
+        return sort;
+    }
+
+    public void setSort(String sort) {
+        this.sort = sort;
     }
     }
 
 
     public void setIsAsc(String isAsc) {
     public void setIsAsc(String isAsc) {
@@ -63,7 +74,7 @@ public class PageDomain {
             } else if ("descending".equals(isAsc)) {
             } else if ("descending".equals(isAsc)) {
                 isAsc = "desc";
                 isAsc = "desc";
             }
             }
-            this.isAsc = isAsc;
+            this.sort = isAsc;
         }
         }
     }
     }
 
 
@@ -77,4 +88,12 @@ public class PageDomain {
     public void setReasonable(Boolean reasonable) {
     public void setReasonable(Boolean reasonable) {
         this.reasonable = reasonable;
         this.reasonable = reasonable;
     }
     }
+
+    public String getSidx() {
+        return sidx;
+    }
+
+    public void setSidx(String sidx) {
+        this.sidx = sidx;
+    }
 }
 }

+ 11 - 0
trade-service/src/main/java/com/trade/service/sales/mapper/SalesCommodityMapper.java

@@ -7,6 +7,9 @@ package com.trade.service.sales.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.trade.service.sales.domain.SalesCommodity;
 import com.trade.service.sales.domain.SalesCommodity;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 
 /**
 /**
  * @Description:销售商品数据访问层
  * @Description:销售商品数据访问层
@@ -15,4 +18,12 @@ import org.apache.ibatis.annotations.Mapper;
  */
  */
 @Mapper
 @Mapper
 public interface SalesCommodityMapper extends BaseMapper<SalesCommodity> {
 public interface SalesCommodityMapper extends BaseMapper<SalesCommodity> {
+
+    /**
+     * 根据销售合同id查询销售商品
+     * 
+     * @param salesContractId 销售合同id
+     * @return 销售商品列表
+     */
+    List<SalesCommodity> selectBySalesContractId(@Param("salesContractId") Long salesContractId);
 }
 }

+ 12 - 7
trade-service/src/main/java/com/trade/service/sales/service/SalesCommodityService.java

@@ -1,21 +1,26 @@
 /**
 /**
  * @filename:SalesCommodityService 2024-09-03
  * @filename:SalesCommodityService 2024-09-03
- * @project KJT  v1.0.0
- * Copyright(c) 2024 wanglang Co. Ltd.
- * All right reserved. 
+ * @project KJT v1.0.0 Copyright(c) 2024 wanglang Co. Ltd. All right reserved.
  */
  */
 package com.trade.service.sales.service;
 package com.trade.service.sales.service;
 
 
-
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.trade.service.sales.domain.SalesCommodity;
 import com.trade.service.sales.domain.SalesCommodity;
 
 
+import java.util.List;
+
 /**
 /**
  * @Description:销售商品服务层
  * @Description:销售商品服务层
  * @version: v1.0.0
  * @version: v1.0.0
  * @author: wanglang
  * @author: wanglang
- * 
  */
  */
 public interface SalesCommodityService extends IService<SalesCommodity> {
 public interface SalesCommodityService extends IService<SalesCommodity> {
-	
-}
+
+    /**
+     * 根据销售合同id查询销售商品
+     * 
+     * @param salesContractId 销售合同id
+     * @return 销售商品列表
+     */
+    List<SalesCommodity> queryBySalesContractId(Long salesContractId);
+}

+ 6 - 0
trade-service/src/main/java/com/trade/service/sales/service/impl/SalesCommodityServiceImpl.java

@@ -10,6 +10,8 @@ import com.trade.service.sales.mapper.SalesCommodityMapper;
 import com.trade.service.sales.service.SalesCommodityService;
 import com.trade.service.sales.service.SalesCommodityService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.List;
+
 /**
 /**
  * @Description:销售商品服务实现
  * @Description:销售商品服务实现
  * @version: v1.0.0
  * @version: v1.0.0
@@ -17,4 +19,8 @@ import org.springframework.stereotype.Service;
  */
  */
 @Service
 @Service
 public class SalesCommodityServiceImpl extends ServiceImpl<SalesCommodityMapper, SalesCommodity> implements SalesCommodityService {
 public class SalesCommodityServiceImpl extends ServiceImpl<SalesCommodityMapper, SalesCommodity> implements SalesCommodityService {
+    @Override
+    public List<SalesCommodity> queryBySalesContractId(Long salesContractId) {
+        return null;
+    }
 }
 }

+ 46 - 23
trade-service/src/main/resources/mapper/sales/SalesCommodityMapper.xml

@@ -2,27 +2,50 @@
 <!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.trade.service.sales.mapper.SalesCommodityMapper">
 <mapper namespace="com.trade.service.sales.mapper.SalesCommodityMapper">
 
 
-	<resultMap id="BaseResultMap" type="com.trade.service.sales.domain.SalesCommodity">
-		<id column="id" property="id" />
-		<id column="sales_contract_id" property="salesContractId" />
-		<id column="hs_code" property="hsCode" />
-		<id column="name" property="name" />
-        <id column="pack_spec" property="packSpec" />
-		<id column="measurement_unit" property="measurementUnit" />
-		<id column="export_tax_rebate_rate" property="exportTaxRebateRate" />
-        <id column="added_tax_rate" property="addedTaxRate" />
-		<id column="number" property="number" />
-		<id column="price_unit" property="priceUnit" />
-        <id column="currency" property="currency" />
-		<id column="amount" property="amount" />
-        <id column="deleted" property="deleted" />
-        <id column="entity_no" property="entityNo" />
-        <id column="entity_name" property="entityName" />
-		<id column="gmt_create" property="gmtCreate" />
-		<id column="gmt_modified" property="gmtModified" />
-	</resultMap>
-	<sql id="Base_Column_List">
-		id, sales_contract_id, entity_no, entity_name, hs_code, name, pack_spec, measurement_unit, export_tax_rebate_rate, added_tax_rate, number, price_unit, currency, amount, deleted, gmt_create, gmt_modified
-	</sql>
-
+    <resultMap id="BaseResultMap" type="com.trade.service.sales.domain.SalesCommodity">
+        <id column="id" property="id"/>
+        <id column="sales_contract_id" property="salesContractId"/>
+        <id column="hs_code" property="hsCode"/>
+        <id column="name" property="name"/>
+        <id column="pack_spec" property="packSpec"/>
+        <id column="measurement_unit" property="measurementUnit"/>
+        <id column="export_tax_rebate_rate" property="exportTaxRebateRate"/>
+        <id column="added_tax_rate" property="addedTaxRate"/>
+        <id column="number" property="number"/>
+        <id column="price_unit" property="priceUnit"/>
+        <id column="currency" property="currency"/>
+        <id column="amount" property="amount"/>
+        <id column="deleted" property="deleted"/>
+        <id column="entity_no" property="entityNo"/>
+        <id column="entity_name" property="entityName"/>
+        <id column="gmt_create" property="gmtCreate"/>
+        <id column="gmt_modified" property="gmtModified"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        id
+        , sales_contract_id, entity_no, entity_name, hs_code, name, pack_spec, measurement_unit, export_tax_rebate_rate, added_tax_rate, number, price_unit, currency, amount, deleted, gmt_create, gmt_modified
+    </sql>
+    <select id="selectBySalesContractId" resultMap="BaseResultMap">
+        select T1.id,
+               T1.sales_contract_id,
+               T1.entity_no,
+               T1.hs_code,
+               T1.name,
+               T1.pack_spec,
+               T1.measurement_unit,
+               T1.export_tax_rebate_rate,
+               T1.added_tax_rate,
+               T1.number,
+               T1.price_unit,
+               T1.currency,
+               T1.amount,
+               T1.deleted,
+               T1.gmt_create,
+               T1.gmt_modified,
+               T2.entity_name
+        from sales_commodity T1
+                 join vendor_entity T2 on T1.entity_no = T2.entity_no
+        where T1.sales_contract_id = #{salesContractId}
+          and T1.deleted = 0
+    </select>
 </mapper>
 </mapper>