1
This commit is contained in:
@@ -115,6 +115,8 @@ public class JDOrderListController extends BaseController
|
||||
query.getParams().put("rebateWithoutUploadLink", true);
|
||||
}
|
||||
|
||||
applyModelNumberExcludeFilter(query);
|
||||
|
||||
java.util.List<JDOrder> list;
|
||||
if (orderBy != null && !orderBy.isEmpty()) {
|
||||
// 设置排序参数
|
||||
@@ -269,6 +271,8 @@ public class JDOrderListController extends BaseController
|
||||
{
|
||||
String fileName = "JD订单数据";
|
||||
|
||||
applyModelNumberExcludeFilter(jdOrder);
|
||||
|
||||
List<JDOrder> list = jdOrderService.selectJDOrderList(jdOrder);
|
||||
|
||||
// 设置响应头,指定文件名
|
||||
@@ -571,9 +575,7 @@ public class JDOrderListController extends BaseController
|
||||
if (query.getModelNumber() != null && !query.getModelNumber().trim().isEmpty()) {
|
||||
query.setModelNumber(query.getModelNumber().trim());
|
||||
}
|
||||
if (query.getModelNumberExclude() != null && !query.getModelNumberExclude().trim().isEmpty()) {
|
||||
query.setModelNumberExclude(query.getModelNumberExclude().trim());
|
||||
}
|
||||
applyModelNumberExcludeFilter(query);
|
||||
if (query.getBuyer() != null && !query.getBuyer().trim().isEmpty()) {
|
||||
query.setBuyer(query.getBuyer().trim());
|
||||
}
|
||||
@@ -688,4 +690,32 @@ public class JDOrderListController extends BaseController
|
||||
return AjaxResult.error("生成失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 型号不含:支持逗号、中文逗号、空格、换行分隔的多个关键词,型号不得包含任一关键词。
|
||||
*/
|
||||
private void applyModelNumberExcludeFilter(JDOrder query) {
|
||||
if (query == null) {
|
||||
return;
|
||||
}
|
||||
List<String> terms = parseModelNumberExcludeTerms(query.getModelNumberExclude());
|
||||
if (!terms.isEmpty()) {
|
||||
query.getParams().put("modelNumberExcludeList", terms);
|
||||
}
|
||||
query.setModelNumberExclude(null);
|
||||
}
|
||||
|
||||
private static List<String> parseModelNumberExcludeTerms(String raw) {
|
||||
List<String> out = new ArrayList<>();
|
||||
if (StringUtils.isEmpty(raw)) {
|
||||
return out;
|
||||
}
|
||||
for (String part : raw.split("[,,\\s\\n]+")) {
|
||||
String t = part.trim();
|
||||
if (!t.isEmpty() && !out.contains(t)) {
|
||||
out.add(t);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class JDOrder extends BaseEntity {
|
||||
@Excel(name = "型号")
|
||||
private String modelNumber;
|
||||
|
||||
/** 列表筛选:型号不含此子串(对应 SQL NOT LIKE %值%),不入库 */
|
||||
/** 列表筛选:型号不含这些子串(逗号/空格分隔,对应 SQL 多条 NOT LIKE),不入库 */
|
||||
@Transient
|
||||
private String modelNumberExclude;
|
||||
|
||||
|
||||
@@ -68,7 +68,11 @@
|
||||
</if>
|
||||
<if test="distributionMark != null and distributionMark != ''"> and distribution_mark = #{distributionMark}</if>
|
||||
<if test="modelNumber != null and modelNumber != ''"> and model_number like concat('%', #{modelNumber}, '%')</if>
|
||||
<if test="modelNumberExclude != null and modelNumberExclude != ''"> and (model_number is null or model_number not like concat('%', #{modelNumberExclude}, '%'))</if>
|
||||
<if test="params.modelNumberExcludeList != null and params.modelNumberExcludeList.size() > 0">
|
||||
<foreach collection="params.modelNumberExcludeList" item="ex">
|
||||
and (model_number is null or model_number not like concat('%', #{ex}, '%'))
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="link != null and link != ''"> and link like concat('%', #{link}, '%')</if>
|
||||
<if test="paymentAmount != null"> and payment_amount = #{paymentAmount}</if>
|
||||
<if test="rebateAmount != null"> and rebate_amount = #{rebateAmount}</if>
|
||||
@@ -117,7 +121,11 @@
|
||||
</if>
|
||||
<if test="distributionMark != null and distributionMark != ''"> and distribution_mark = #{distributionMark}</if>
|
||||
<if test="modelNumber != null and modelNumber != ''"> and model_number like concat('%', #{modelNumber}, '%')</if>
|
||||
<if test="modelNumberExclude != null and modelNumberExclude != ''"> and (model_number is null or model_number not like concat('%', #{modelNumberExclude}, '%'))</if>
|
||||
<if test="params.modelNumberExcludeList != null and params.modelNumberExcludeList.size() > 0">
|
||||
<foreach collection="params.modelNumberExcludeList" item="ex">
|
||||
and (model_number is null or model_number not like concat('%', #{ex}, '%'))
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="link != null and link != ''"> and link like concat('%', #{link}, '%')</if>
|
||||
<if test="paymentAmount != null"> and payment_amount = #{paymentAmount}</if>
|
||||
<if test="rebateAmount != null"> and rebate_amount = #{rebateAmount}</if>
|
||||
|
||||
Reference in New Issue
Block a user