✨ 毛利分析筛选支持编码名称搜索

This commit is contained in:
caojia
2026-11-17 16:16:14 +08:00
parent 5c8e905a37
commit 2aec7fdd5c
5 changed files with 31 additions and 16 deletions
@@ -104,6 +104,12 @@ class ProfitReportAreaFilterTest
String emptySql = statement.getBoundSql(query).getSql();
assertFalse(emptySql.contains("join ctr_customer c"));
assertTrue(emptySql.contains("and 1 = 0"));
query.setAreaCustomerIds(null);
query.setProductKeyword("EXP");
String productSql = statement.getBoundSql(query).getSql();
assertTrue(productSql.contains("p.product_code like concat('%', ?, '%')"));
assertTrue(productSql.contains("p.product_name like concat('%', ?, '%')"));
}
}
@@ -37,6 +37,8 @@ public class PrcProfitReportQuery extends BaseEntity
/** 客户名称拆分后的多值查询条件。 */
private List<String> customerNames;
private String belongSalerCode;
/** 产品代码或产品名称的统一模糊查询关键字。 */
private String productKeyword;
private String productCode;
private String productName;
private String countryCode;
@@ -171,6 +171,10 @@ public class PrcProfitReportServiceImpl implements IPrcProfitReportService
}
query.setCustomerArea(query.getCustomerArea().trim());
query.setProfitRule(rule.name());
if (query.getBelongSalerCode() != null)
{
query.setBelongSalerCode(query.getBelongSalerCode().trim());
}
query.setOrderNos(splitFilterValues(query.getOrderNo(), "订单号"));
query.setCustomerCodes(splitFilterValues(query.getCustomerCode(), "客户代码"));
query.setCustomerNames(splitFilterValues(query.getCustomerName(), "客户名称"));
@@ -197,12 +197,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and p.country_code &lt;=&gt; #{countryCode}
and i.currency &lt;=&gt; #{currency}
<if test="belongSalerCode != null and belongSalerCode != ''">
and i.belong_saler_code = #{belongSalerCode}
and (i.belong_saler_code = #{belongSalerCode}
or p.belong_saler_code = #{belongSalerCode}
or i.belong_saler like concat('%', #{belongSalerCode}, '%')
or p.belong_saler like concat('%', #{belongSalerCode}, '%'))
</if>
</when>
<otherwise>
<if test="belongSalerCode != null and belongSalerCode != ''">
and i.belong_saler_code = #{belongSalerCode}
and (i.belong_saler_code = #{belongSalerCode}
or p.belong_saler_code = #{belongSalerCode}
or i.belong_saler like concat('%', #{belongSalerCode}, '%')
or p.belong_saler like concat('%', #{belongSalerCode}, '%'))
</if>
<if test="productCode != null and productCode != ''">
and p.product_code = #{productCode}
@@ -215,6 +221,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</otherwise>
</choose>
<if test="productKeyword != null and productKeyword != ''">
and (p.product_code like concat('%', #{productKeyword}, '%')
or p.product_name like concat('%', #{productKeyword}, '%'))
</if>
<if test="productName != null and productName != ''">
and p.product_name like concat('%', #{productName}, '%')
</if>
+7 -14
View File
@@ -16,7 +16,7 @@
</div>
</Teleport>
<el-card shadow="never" class="search-card">
<el-form :model="query" label-width="88px" @submit.prevent>
<el-form :model="query" label-width="120px" @submit.prevent>
<el-row :gutter="16">
<el-col :xs="24" :sm="12" :lg="8">
<el-form-item label="客户区域" class="filter-item">
@@ -52,18 +52,13 @@
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :lg="8">
<el-form-item label="业务员编码" class="filter-item">
<el-input v-model="query.belongSalerCode" clearable placeholder="输入业务员编码" class="filter-control" @keyup.enter="handleSearch" />
<el-form-item label="业务员编码/姓名" class="filter-item">
<el-input v-model="query.belongSalerCode" clearable placeholder="输入业务员编码或姓名" class="filter-control" @keyup.enter="handleSearch" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :lg="8">
<el-form-item label="产品代码" class="filter-item">
<el-input v-model="query.productCode" clearable placeholder="输入产品代码" class="filter-control" @keyup.enter="handleSearch" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :lg="8">
<el-form-item label="产品名称" class="filter-item">
<el-input v-model="query.productName" clearable placeholder="输入产品名称" class="filter-control" @keyup.enter="handleSearch" />
<el-form-item label="产品代码/名称" class="filter-item">
<el-input v-model="query.productKeyword" clearable placeholder="输入产品代码或名称" class="filter-control" @keyup.enter="handleSearch" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :lg="8">
@@ -282,8 +277,7 @@ const query = reactive({
orderNo: '',
customerCode: '',
belongSalerCode: '',
productCode: '',
productName: '',
productKeyword: '',
countryName: '',
countryCode: '',
currency: ''
@@ -599,8 +593,7 @@ watch(() => [
query.orderNo,
query.customerCode,
query.belongSalerCode,
query.productCode,
query.productName,
query.productKeyword,
query.countryName,
query.countryCode,
query.currency,