demand: 批次规则批量修改bug修改,新增一次性修改批次接口,查询漏组批次增加查询组批次成功条件,查树增加根据始发网点查

committer: heyu
This commit is contained in:
aike 2025-07-01 14:33:50 +08:00
parent 38a45dd71e
commit ac60b02465
11 changed files with 306 additions and 167 deletions

View File

@ -302,4 +302,14 @@ public class EmisTmsSiteBatchController extends EmisBaseController
}
return AjaxResult.success("批量修改成功");
}
/**
* 批量编辑一级网点TMS组批次
*/
@PreAuthorize("@ss.hasPermi('emis:emisTmsSiteBatch:editAll')")
@Log(title = "一级网点TMS组批次", businessType = BusinessType.UPDATE)
@PostMapping("/editAll")
public AjaxResult editAll(@RequestBody EmisTmsSiteBatch emisTmsSiteBatch) throws EmisBizError {
return toAjax(emisTmsSiteBatchService.editAll(emisTmsSiteBatch));
}
}

View File

@ -78,4 +78,12 @@ public interface EmisTmsSiteBatchDtlMapper extends BaseMapper<EmisTmsSiteBatchDt
* @return 运单列表
*/
List<EmisWaybill> selectEmisWayBillByBatchNo(@Param("batchNo") String batchNo);
/**
* 根据batchNo批量软删除(del_flag=1)
* @param batchNo 批次号
* @return 影响行数
*/
int updateDelFlagByBatchNo(String batchNo);
}

View File

@ -76,4 +76,11 @@ public interface EmisTmsSiteBatchLoadingMapper extends BaseMapper<EmisTmsSiteBat
* @return 结果
*/
public int deleteEmisTmsSiteBatchLoadingByIds(Long[] ids);
/**
* 根据batchNo批量软删除(del_flag=1)
* @param batchNo 批次号
* @return 影响行数
*/
void updateDelFlagByBatchNo(String batchNo);
}

View File

@ -112,4 +112,12 @@ public interface EmisTmsSiteBatchMapper extends BaseMapper<EmisTmsSiteBatch>
* @return 组批次信息列表
*/
List<EmisTmsSiteBatch> selectEmisTmsSiteBatchListByBillCodes(@Param("billCodes") List<String> billCodes);
/**
* 验重
*
* @param emisTmsSiteBatch
* @return
*/
int checkUnique(EmisTmsSiteBatch emisTmsSiteBatch);
}

View File

@ -112,4 +112,12 @@ public interface IEmisTmsSiteBatchService
* @return
*/
public EmisTmsSiteBatch geDetail(Long id);
/**
* 批量编辑一级网点TMS组批次
*
* @param emisTmsSiteBatch 一级网点TMS组批次
* @return 结果
*/
int editAll(EmisTmsSiteBatch emisTmsSiteBatch) throws EmisBizError;
}

View File

@ -98,6 +98,7 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
/**
* 批次明细
*
* @param emisTmsSiteBatch
* @return
*/
@ -154,14 +155,9 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
}
}
private void checkUnique(EmisTmsSiteBatch oldSiteBatch, String billCode) throws EmisBizError {
EmisTmsSiteBatch emisTmsSiteBatch = new EmisTmsSiteBatch();
emisTmsSiteBatch.setStartSiteCode(oldSiteBatch.getStartSiteCode());
emisTmsSiteBatch.setNextSiteCode(oldSiteBatch.getNextSiteCode());
emisTmsSiteBatch.setSupplierCode(oldSiteBatch.getSupplierCode());
private void checkUnique(EmisTmsSiteBatch emisTmsSiteBatch, String billCode) throws EmisBizError {
emisTmsSiteBatch.getParams().put("billCode", billCode);
List<EmisTmsSiteBatch> batchList = emisTmsSiteBatchMapper.selectEmisTmsSiteBatchList(emisTmsSiteBatch);
if (CollectionUtil.isNotEmpty(batchList)) {
if (emisTmsSiteBatchMapper.checkUnique(emisTmsSiteBatch) > 0) {
throw new EmisBizError(EmisBizErrorType.FAIL, billCode + "已组批次,不要重复组");
}
}
@ -248,4 +244,33 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
return emisTmsSiteBatchMapper.selectEmisTmsSiteBatchWithDetailsById(id);
}
@Override
@Transactional
public int editAll(EmisTmsSiteBatch emisTmsSiteBatch) throws EmisBizError {
if (!CollectionUtils.isEmpty(emisTmsSiteBatch.getBatchDtlList())) {
for (EmisTmsSiteBatchDtl itemDtl : emisTmsSiteBatch.getBatchDtlList()) {
checkSiteBatch(emisTmsSiteBatch, itemDtl.getBillCode());
}
}
emisTmsSiteBatchMapper.updateEmisTmsSiteBatch(emisTmsSiteBatch);
emisTmsSiteBatchDtlMapper.updateDelFlagByBatchNo(emisTmsSiteBatch.getBatchNo());
emisTmsSiteBatchLoadingMapper.updateDelFlagByBatchNo(emisTmsSiteBatch.getBatchNo());
if (StringUtil.isBlank(emisTmsSiteBatch.getBatchNo())) {
return 1;
}
if (CollectionUtil.isNotEmpty(emisTmsSiteBatch.getBatchDtlList())) {
for (EmisTmsSiteBatchDtl itemDtl : emisTmsSiteBatch.getBatchDtlList()) {
itemDtl.setBatchNo(emisTmsSiteBatch.getBatchNo());
emisTmsSiteBatchDtlMapper.insertEmisTmsSiteBatchDtl(itemDtl);
}
}
if (CollectionUtil.isNotEmpty(emisTmsSiteBatch.getLoadingList())) {
for (EmisTmsSiteBatchLoading batchLoading : emisTmsSiteBatch.getLoadingList()) {
batchLoading.setBatchNo(emisTmsSiteBatch.getBatchNo());
emisTmsSiteBatchLoadingMapper.insertEmisTmsSiteBatchLoading(batchLoading);
}
}
return 1;
}
}

View File

@ -145,7 +145,13 @@ public class EmisTransPlanRuleServiceImpl extends EmisBaseService implements IEm
}
// 构建树形结构
return buildTree(allRules, emisTransPlanRule);
List<EmisTransPlanRule> trees = buildTree(allRules, emisTransPlanRule);
String lineStartSiteCode = (String) emisTransPlanRule.getParams().get("lineStartSiteCode");
if (StringUtil.isNotBlank(lineStartSiteCode)) {
trees = trees.stream().filter(i -> lineStartSiteCode.equals(i.getStartSiteCode()))
.collect(Collectors.toList());
}
return trees;
}
@Override
@ -378,8 +384,6 @@ public class EmisTransPlanRuleServiceImpl extends EmisBaseService implements IEm
}
}
@Override
public List<String> checkTree(EmisTransPlanRule emisTransPlanRule) {
List<EmisTransPlanRule> allRules = emisTransPlanRuleMapper.selectEmisTransPlanRuleTree(emisTransPlanRule);
@ -400,37 +404,52 @@ public class EmisTransPlanRuleServiceImpl extends EmisBaseService implements IEm
}
int successCount = 0;
for (EmisTransPlanRule emisTransPlanRule : emisTransPlanRuleList) {
for (EmisTransPlanRule inputRule : emisTransPlanRuleList) {
try {
// 校验非空
checkCode(emisTransPlanRule);
checkDate(emisTransPlanRule);
// 检查重复(排除自身)
checkDuplicateForUpdate(emisTransPlanRule);
// 校验循环引用
// 1. 查历史数据
EmisTransPlanRule dbRule = emisTransPlanRuleMapper.selectEmisTransPlanRuleById(inputRule.getId());
if (dbRule == null) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "ID:" + inputRule.getId() + "的规则不存在");
}
// 2. 合并前端传递的字段到历史数据对象
EmisTransPlanRule mergedRule = new EmisTransPlanRule();
org.springframework.beans.BeanUtils.copyProperties(dbRule, mergedRule);
// 只覆盖前端传递的非null字段,跳过static/final字段
java.lang.reflect.Field[] fields = EmisTransPlanRule.class.getDeclaredFields();
for (java.lang.reflect.Field field : fields) {
int modifiers = field.getModifiers();
if (java.lang.reflect.Modifier.isStatic(modifiers)
|| java.lang.reflect.Modifier.isFinal(modifiers)) {
continue;
}
field.setAccessible(true);
Object val = field.get(inputRule);
if (val != null) {
field.set(mergedRule, val);
}
}
// 3. 校验合并后的对象
checkCode(mergedRule);
checkDate(mergedRule);
checkDuplicateForUpdate(mergedRule);
EmisTransPlanRule checkRule = new EmisTransPlanRule();
checkRule.setProductType(emisTransPlanRule.getProductType());
checkRule.setProductType(mergedRule.getProductType());
List<EmisTransPlanRule> allRules = emisTransPlanRuleMapper
.selectEmisTransPlanRuleListWithoutName(checkRule);
// 移除当前要修改的规则,避免自己与自己比较
allRules.removeIf(rule -> rule.getId().equals(emisTransPlanRule.getId()));
allRules.add(emisTransPlanRule);
buildTree(allRules, emisTransPlanRule);
// 执行更新
int result = emisTransPlanRuleMapper.updateEmisTransPlanRule(emisTransPlanRule);
allRules.removeIf(rule -> rule.getId().equals(mergedRule.getId()));
allRules.add(mergedRule);
buildTree(allRules, mergedRule);
// 4. 只更新前端传递的字段
int result = emisTransPlanRuleMapper.updateEmisTransPlanRule(inputRule);
if (result > 0) {
successCount++;
}
} catch (Exception e) {
log.error("批量修改供应商线路规划失败,ID: {}, 错误: {}", emisTransPlanRule.getId(), e.getMessage());
log.error("批量修改供应商线路规划失败,ID: {}, 错误: {}", inputRule.getId(), e.getMessage());
throw new EmisBizError(EmisBizErrorType.SYS_EXCEPTION,
"批量修改失败,ID: " + emisTransPlanRule.getId() + ", 错误: " + e.getMessage());
"批量修改失败,ID: " + inputRule.getId() + ", 错误: " + e.getMessage());
}
}
return successCount;
}

View File

@ -193,4 +193,10 @@
and a.del_flag = '0'
and a.send_date <![CDATA[ > ]]> '2025-01-01 00:00:00'
</select>
<update id="updateDelFlagByBatchNo" parameterType="String">
update emis_tms_site_batch_dtl
set del_flag = '1'
where batch_no = #{batchNo} and del_flag = '0'
</update>
</mapper>

View File

@ -148,4 +148,10 @@
#{id}
</foreach>
</delete>
<update id="updateDelFlagByBatchNo" parameterType="String">
update emis_tms_site_batch_loading
set del_flag = '1'
where batch_no = #{batchNo} and del_flag = '0'
</update>
</mapper>

View File

@ -301,46 +301,19 @@
ORDER BY a.etd DESC
</select>
<select id="checkUnique" parameterType="EmisTmsSiteBatch" resultType="int">
select count(1) from emis_tms_site_batch
where del_flag='0'
and id = #{id}
and batch_no = #{batchNo}
and batch_name = #{batchName}
and batch_date = #{batchDate}
and trans_line_type = #{transLineType}
and product_type = #{productType}
and batch_type = #{batchType}
and trans_type = #{transType}
and start_site_code = #{startSiteCode}
and send_country = #{sendCountry}
and next_site_code = #{nextSiteCode}
and air_billl_no = #{airBilllNo}
and etd = #{etd}
and eta = #{eta}
and pack_num = #{packNum}
and car_no = #{carNo}
and ship_no = #{shipNo}
and clearance_res_status = #{clearanceResStatus}
and declare_res_status = #{declareResStatus}
and dest_country = #{destCountry}
and dest_country_name = #{destCountryName}
and total_parcel_qty = #{totalParcelQty}
and total_waybill_qty = #{totalWaybillQty}
and total_volume = #{totalVolume}
and total_weight = #{totalWeight}
and op_man = #{opMan}
and remark = #{remark}
and tenant_id = #{tenantId}
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
and create_site = #{createSite}
and update_site = #{updateSite}
limit 1
</select>
<select id="checkUnique" parameterType="EmisTmsSiteBatch" resultType="int">
select count(1)
from emis_tms_site_batch
where del_flag = '0'
and batch_no != #{batchNo}
and start_site_code = #{startSiteCode}
and next_site_code = #{nextSiteCode}
and supplier_code=#{supplierCode}
and batch_no in (select batch_no from emis_tms_site_batch_dtl where del_flag='0'
and FIND_IN_SET(`bill_code`
, #{params.billCode}) )
limit 1
</select>
<select id="selectEmisTmsSiteBatchById" parameterType="Long" resultMap="EmisTmsSiteBatchResult">
select id, batch_no, batch_name, batch_date, supplier_code, supplier_name, trans_line_type, product_type, batch_type, trans_type, start_site_code, send_country, next_site_code, air_billl_no, etd, eta, car_no, ship_no, clearance_res_status, declare_res_status, dest_country, dest_country_name, trans_weight, pack_num, total_parcel_qty, total_waybill_qty, total_volume, total_weight, op_man, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site

View File

@ -50,19 +50,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select
m.id, m.bill_code, m.miss_reason, m.create_by, m.create_time, m.update_by, m.update_time, m.remark, m.del_flag,
m.line_code, m.product_type, m.start_site_code, m.next_site_code, m.supplier_code, m.start_date, m.end_date,m.miss_type,
w.send_site_code, s1.site_name as send_site_name,
w.send_country, c1.name as send_country_name, w.destination_code, n.dest_name as destination_name,w.bl_is_question,
w.send_site_code, s1.site_name as send_site_name,s2.site_name as start_site_name,s3.site_name as next_site_name, w.send_country, c1.name as send_country_name, w.destination_code, n.dest_name as destination_name,w.bl_is_question,
l.line_name as line_name,
w.receive_country, c2.name as receive_country_name, w.send_date, w.bl_sign, w.sign_date,
w.product_type,
w.payment_type, w.parcel_qty, w.bill_weight, w.total_volume, w.volume_weight,
w.settlement_weight, w.freight, w.remark as waybill_remark, w.fee_remark, m.manager, k.trans_manager,
(SELECT GROUP_CONCAT(s.site_name ORDER BY FIND_IN_SET(s.site_code, m.start_site_code))
FROM emis_site s
WHERE FIND_IN_SET(s.site_code, m.start_site_code) AND s.del_flag = 0) as start_site_name,
(SELECT GROUP_CONCAT(s.site_name ORDER BY FIND_IN_SET(s.site_code, m.next_site_code))
FROM emis_site s
WHERE FIND_IN_SET(s.site_code, m.next_site_code) AND s.del_flag = 0) as next_site_name,
(SELECT GROUP_CONCAT(s.name)
FROM emis_supplier s
WHERE FIND_IN_SET(s.code, m.supplier_code)
@ -72,14 +65,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE FIND_IN_SET(p.prod_code, m.product_type)
AND p.del_flag = '0') as product_type_name
from emis_tms_site_batch_miss m
left join emis_waybill w on m.bill_code = w.bill_code and w.del_flag='0'
left join emis_site s1 on w.send_site_code=s1.site_code and s1.del_flag=0
left join emis_country c1 on w.send_country=c1.code and c1.del_flag='0'
left join emis_country c2 on w.receive_country=c2.code and c2.del_flag='0'
left join emis_destination n on w.destination_code=n.dest_code and n.del_flag='0'
left join emis_trans_line k on w.trans_line_type=k.line_code and k.del_flag='0'
left join emis_trans_plan_rule r on m.trans_plan_rule_id=r.id and r.del_flag='0'
left join emis_trans_line l on m.line_code=l.line_code and l.del_flag='0'
left join emis_waybill w on m.bill_code = w.bill_code and w.del_flag='0'
left join emis_site s1 on w.send_site_code=s1.site_code and s1.del_flag=0
left join emis_site s2 on m.start_site_code=s2.site_code and s2.del_flag=0
left join emis_site s3 on m.next_site_code=s3.site_code and s3.del_flag=0
left join emis_country c1 on w.send_country=c1.code and c1.del_flag='0'
left join emis_country c2 on w.receive_country=c2.code and c2.del_flag='0'
left join emis_destination n on w.destination_code=n.dest_code and n.del_flag='0'
left join emis_trans_line k on w.trans_line_type=k.line_code and k.del_flag='0'
left join emis_trans_plan_rule r on m.trans_plan_rule_id=r.id and r.del_flag='0'
left join emis_trans_line l on m.line_code=l.line_code and l.del_flag='0'
</sql>
<!-- <select id="selectEmisTmsSiteBatchMissList" parameterType="EmisTmsSiteBatchMiss" resultMap="EmisTmsSiteBatchMissResult">-->
@ -132,88 +127,162 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- </select>-->
<select id="selectEmisTmsSiteBatchMissList" parameterType="EmisTmsSiteBatchMiss" resultMap="EmisTmsSiteBatchMissResult">
<include refid="selectEmisTmsSiteBatchMissVo"/>
<where>
m.del_flag = '0'
<if test="missCount != null">
<choose>
<when test="missCount == -1">
AND m.miss_type = 2
</when>
<when test="missCount == -2">
AND m.miss_type = 3
</when>
<when test="missCount == -3">
AND m.miss_type = 1
</when>
<when test="missCount > 0">
AND m.bill_code IN (
SELECT bill_code
FROM emis_tms_site_batch_miss
WHERE del_flag = '0'
GROUP BY bill_code
HAVING COUNT(*) = #{missCount}
<choose>
<when test="missCount == -4">
<!-- 当missCount=-4时,查询emis_waybill_batch_status表 -->
select
null as id, w.bill_code, '已组批次成功' as miss_reason,
null as create_by, null as create_time, null as update_by, null as update_time,
null as remark, '0' as del_flag,
w.trans_line_type as line_code, w.product_type, w.start_site_code, w.next_site_code,
null as supplier_code, null as start_date, null as end_date, '0' as miss_type,
w.send_site_code, s1.site_name as send_site_name,
w.send_country, c1.name as send_country_name, w.destination_code, n.dest_name as destination_name, w.bl_is_question,
l.line_name as line_name,
w.receive_country, c2.name as receive_country_name, w.send_date, w.bl_sign, w.sign_date,
w.product_type,
w.payment_type, w.parcel_qty, w.bill_weight, w.total_volume, w.volume_weight,
w.settlement_weight, w.freight, w.remark as waybill_remark, w.fee_remark,
null as manager, null as trans_manager,
(SELECT GROUP_CONCAT(s.site_name ORDER BY FIND_IN_SET(s.site_code, w.start_site_code))
FROM emis_site s
WHERE FIND_IN_SET(s.site_code, w.start_site_code) AND s.del_flag = 0) as start_site_name,
(SELECT GROUP_CONCAT(s.site_name ORDER BY FIND_IN_SET(s.site_code, w.next_site_code))
FROM emis_site s
WHERE FIND_IN_SET(s.site_code, w.next_site_code) AND s.del_flag = 0) as next_site_name,
null as supplier_name,
(SELECT GROUP_CONCAT(p.prod_name)
FROM emis_trans_product p
WHERE FIND_IN_SET(p.prod_code, w.product_type)
AND p.del_flag = '0') as product_type_name
from emis_waybill_batch_status b
inner join emis_waybill w on b.bill_code = w.bill_code and w.del_flag='0'
left join emis_site s1 on w.send_site_code=s1.site_code and s1.del_flag=0
left join emis_country c1 on w.send_country=c1.code and c1.del_flag=0
left join emis_destination n on w.destination_code=n.dest_code and n.del_flag=0
left join emis_trans_line l on w.trans_line_type=l.line_code and l.del_flag=0
left join emis_country c2 on w.receive_country=c2.code and c2.del_flag=0
<where>
b.site_batch_status = '1'
<if test="billCode != null and billCode != ''">
AND w.bill_code REGEXP REPLACE(#{billCode}, '\n', '|')
</if>
<if test="lineCode != null and lineCode != ''">
AND w.trans_line_type = #{lineCode}
</if>
<if test="productType != null and productType != ''">
AND FIND_IN_SET(#{productType}, w.product_type)
</if>
<if test="startSiteCode != null and startSiteCode != ''">
AND (
w.start_site_code REGEXP REPLACE(#{startSiteCode}, ',', '|')
)
AND m.miss_type = 0
</when>
</choose>
</if>
<if test="billCode != null and billCode != ''">
AND m.bill_code REGEXP REPLACE(#{billCode}, '\n', '|')
</if>
<if test="missReason != null and missReason != ''">
AND m.miss_reason like concat('%', #{missReason}, '%')
</if>
<if test="manager != null and manager != ''">
AND (
m.manager REGEXP REPLACE(#{manager}, ',', '|')
)
</if>
<if test="transManager != null and transManager != ''">
AND k.trans_manager like concat('%', #{transManager}, '%')
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (r.manager=#{params.privEmpName} or k.trans_manager=#{params.privEmpName})
</if>
<if test="lineCode != null and lineCode != ''">
AND m.line_code = #{lineCode}
</if>
<if test="productType != null and productType != ''">
AND FIND_IN_SET(#{productType}, m.product_type)
</if>
<if test="startSiteCode != null and startSiteCode != ''">
AND (
m.start_site_code REGEXP REPLACE(#{startSiteCode}, ',', '|')
)
</if>
<if test="nextSiteCode != null and nextSiteCode != ''">
AND (
m.next_site_code REGEXP REPLACE(#{nextSiteCode}, ',', '|')
)
</if>
<if test="supplierCode != null and supplierCode != ''">
AND FIND_IN_SET(#{supplierCode}, m.supplier_code)
</if>
<if test="startDate != null">
AND m.start_date = #{startDate}
</if>
<if test="endDate != null">
AND m.end_date = #{endDate}
</if>
<if test="blIsQuestion != null and blIsQuestion != ''">
AND w.bl_is_question = #{blIsQuestion}
</if>
<if test="sendSiteCode != null and sendSiteCode != ''">
AND w.send_site_code = #{sendSiteCode}
</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and w.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and w.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
</where>
order by m.bill_code desc
</if>
<if test="nextSiteCode != null and nextSiteCode != ''">
AND (
w.next_site_code REGEXP REPLACE(#{nextSiteCode}, ',', '|')
)
</if>
<if test="blIsQuestion != null and blIsQuestion != ''">
AND w.bl_is_question = #{blIsQuestion}
</if>
<if test="sendSiteCode != null and sendSiteCode != ''">
AND w.send_site_code = #{sendSiteCode}
</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and w.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and w.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
</where>
order by w.bill_code desc
</when>
<otherwise>
<include refid="selectEmisTmsSiteBatchMissVo"/>
<where>
m.del_flag = '0'
<if test="missCount != null">
<choose>
<when test="missCount == -1">
AND m.miss_type = 2
</when>
<when test="missCount == -2">
AND m.miss_type = 3
</when>
<when test="missCount == -3">
AND m.miss_type = 1
</when>
<when test="missCount > 0">
AND m.bill_code IN (
SELECT bill_code
FROM emis_tms_site_batch_miss
WHERE del_flag = '0'
GROUP BY bill_code
HAVING COUNT(*) = #{missCount}
)
AND m.miss_type = 0
</when>
</choose>
</if>
<if test="billCode != null and billCode != ''">
AND m.bill_code REGEXP REPLACE(#{billCode}, '\n', '|')
</if>
<if test="missReason != null and missReason != ''">
AND m.miss_reason like concat('%', #{missReason}, '%')
</if>
<if test="manager != null and manager != ''">
AND (
m.manager REGEXP REPLACE(#{manager}, ',', '|')
)
</if>
<if test="transManager != null and transManager != ''">
AND k.trans_manager like concat('%', #{transManager}, '%')
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (r.manager=#{params.privEmpName} or k.trans_manager=#{params.privEmpName})
</if>
<if test="lineCode != null and lineCode != ''">
AND m.line_code = #{lineCode}
</if>
<if test="productType != null and productType != ''">
AND FIND_IN_SET(#{productType}, m.product_type)
</if>
<if test="startSiteCode != null and startSiteCode != ''">
AND (
m.start_site_code REGEXP REPLACE(#{startSiteCode}, ',', '|')
)
</if>
<if test="nextSiteCode != null and nextSiteCode != ''">
AND (
m.next_site_code REGEXP REPLACE(#{nextSiteCode}, ',', '|')
)
</if>
<if test="supplierCode != null and supplierCode != ''">
AND FIND_IN_SET(#{supplierCode}, m.supplier_code)
</if>
<if test="startDate != null">
AND m.start_date = #{startDate}
</if>
<if test="endDate != null">
AND m.end_date = #{endDate}
</if>
<if test="blIsQuestion != null and blIsQuestion != ''">
AND w.bl_is_question = #{blIsQuestion}
</if>
<if test="sendSiteCode != null and sendSiteCode != ''">
AND w.send_site_code = #{sendSiteCode}
</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and w.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and w.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
</where>
order by m.bill_code desc
</otherwise>
</choose>
</select>
<select id="selectEmisTmsSiteBatchMissById" parameterType="Long" resultMap="EmisTmsSiteBatchMissResult">