主单查询增加区域条件的筛选

This commit is contained in:
杨丹琪 2023-10-21 03:04:05 +08:00
parent c328e4f4c4
commit 3eb06f5951
7 changed files with 55 additions and 1 deletions

View File

@ -218,8 +218,22 @@ public class OrderMasterController extends BaseController {
@ResponseBody @ResponseBody
public TableDataInfo appList(@RequestBody OrderMaster orderMaster) { public TableDataInfo appList(@RequestBody OrderMaster orderMaster) {
// TableDataInfo rspData = new TableDataInfo(); // TableDataInfo rspData = new TableDataInfo();
startPage();
List<OrderListResponse> orderListResponses = new ArrayList<>(); List<OrderListResponse> orderListResponses = new ArrayList<>();
// 入参中的城市id存在时查询符合条件的地址id
if (CollectionUtils.isNotEmpty(orderMaster.getDistrictIds())
|| CollectionUtils.isNotEmpty(orderMaster.getCityIds())
|| CollectionUtils.isNotEmpty(orderMaster.getStreetIds())) {
List<CustomerAddress> addressList = addressService.getCustomerAddressList(new CustomerAddress(){{
setDistrictIds(orderMaster.getDistrictIds());
setCityIds(orderMaster.getCityIds());
setStreetIds(orderMaster.getStreetIds());
}});
orderMaster.setAddressIds(addressList.stream().map(CustomerAddress::getCustomerAddressId).collect(Collectors.toList()));
if (CollectionUtils.isEmpty(orderMaster.getAddressIds())) {
return voDataTable(orderListResponses, new ArrayList<>());
}
}
startPage();
List<OrderMaster> list = orderMasterService.selectOrderMasterList(orderMaster); List<OrderMaster> list = orderMasterService.selectOrderMasterList(orderMaster);
list.forEach(master -> { list.forEach(master -> {
//子单 //子单

View File

@ -4,6 +4,8 @@ import com.ghy.common.annotation.Excel;
import com.ghy.common.core.domain.BaseEntity; import com.ghy.common.core.domain.BaseEntity;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* @author clunt * @author clunt
* 消费者地址 * 消费者地址
@ -47,4 +49,9 @@ public class CustomerAddress extends BaseEntity {
@Excel(name = "是否有效,0.有效, 1.无效", cellType = Excel.ColumnType.STRING) @Excel(name = "是否有效,0.有效, 1.无效", cellType = Excel.ColumnType.STRING)
private Integer status; private Integer status;
private List<Long> districtIds;
private List<Long> cityIds;
private List<Long> streetIds;
} }

View File

@ -33,6 +33,18 @@
<if test="customerId != null"> <if test="customerId != null">
AND customer_id = #{customerId} AND customer_id = #{customerId}
</if> </if>
<if test="cityIds != null and cityIds.size > 0">
AND city_id IN
<foreach collection="cityIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="districtIds != null and districtIds.size > 0">
AND country_id IN
<foreach collection="districtIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where> </where>
</select> </select>

View File

@ -178,4 +178,11 @@ public class OrderMaster extends BaseEntity {
private String lastCallTime; private String lastCallTime;
private List<Long> cityIds;
private List<Long> districtIds;
private List<Long> streetIds;
private List<Long> addressIds;
} }

View File

@ -203,6 +203,12 @@
<if test="createBy != null and createBy != ''"> <if test="createBy != null and createBy != ''">
AND om.create_by = #{createBy} AND om.create_by = #{createBy}
</if> </if>
<if test="addressIds != null and addressIds.size > 0">
AND om.address_id IN
<foreach collection="addressIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where> </where>
order by om.create_time order by om.create_time
<trim suffixOverrides=","> <trim suffixOverrides=",">

View File

@ -53,4 +53,6 @@ public class SysArea extends BaseEntity {
private List<SysArea> child; private List<SysArea> child;
private List<Long> areaIds;
} }

View File

@ -35,6 +35,12 @@
<if test="areaId != null and areaId != 0"> <if test="areaId != null and areaId != 0">
AND area_id = #{areaId} AND area_id = #{areaId}
</if> </if>
<if test="areaIds != null and areaIds.size > 0">
AND area_id in
<foreach collection="areaIds" item="areaId" open="(" separator="," close=")">
#{areaId}
</foreach>
</if>
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND area_code like concat('%', #{goodsCode}, '%') AND area_code like concat('%', #{goodsCode}, '%')
</if> </if>