Kaynağa Gözat

售后添加搜索

yzc 1 yıl önce
ebeveyn
işleme
f47edbd9ca

+ 4 - 0
hx-sale/src/main/java/com/fjhx/sale/service/after/impl/AfterSalesServiceImpl.java

@@ -17,6 +17,7 @@ import com.fjhx.sale.mapper.after.AfterSalesMapper;
 import com.fjhx.sale.service.after.AfterSalesService;
 import com.fjhx.sale.service.contract.ContractProductService;
 import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.ruoyi.common.utils.wrapper.SqlField;
 import com.ruoyi.system.utils.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -49,6 +50,9 @@ public class AfterSalesServiceImpl extends ServiceImpl<AfterSalesMapper, AfterSa
     @Override
     public Page<AfterSalesVo> getPage(AfterSalesSelectDto dto) {
         IWrapper<AfterSales> wrapper = getWrapper();
+
+        wrapper.keyword(dto.getKeyword(), new SqlField("as1.code"), new SqlField("c.code"));
+
         wrapper.orderByDesc("as1", AfterSales::getId);
         Page<AfterSalesVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         List<AfterSalesVo> records = page.getRecords();

+ 4 - 2
hx-sale/src/main/resources/mapper/after/AfterSalesMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.fjhx.sale.mapper.after.AfterSalesMapper">
     <select id="getPage" resultType="com.fjhx.sale.entity.after.vo.AfterSalesVo">
         SELECT as1.id,
-               as1.code,
+               as1.`code`,
                as1.contract_id,
                as1.type,
                as1.user_id,
@@ -17,8 +17,10 @@
                as1.update_time,
                as1.contract_product_id,
                as1.product_id,
-               as1.quantity
+               as1.quantity,
+               c.`code` AS contractCode
         FROM after_sales as1
+                 LEFT JOIN contract c ON as1.contract_id = c.id
             ${ew.customSqlSegment}
     </select>