Merge pull request 'demand: 批次规则批量修改bug修改,新增一次性修改批次接口,查询漏组批次增加查询组批次成功条件,查树增加根据始发网点查' (#82) from develop into master

Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/82
This commit is contained in:
heyu 2025-07-01 15:09:54 +08:00
commit 1841e8ea46
11 changed files with 306 additions and 167 deletions

View File

@ -302,4 +302,14 @@ public class EmisTmsSiteBatchController extends EmisBaseController
} }
return AjaxResult.success("批量修改成功"); 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 运单列表 * @return 运单列表
*/ */
List<EmisWaybill> selectEmisWayBillByBatchNo(@Param("batchNo") String batchNo); 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 结果 * @return 结果
*/ */
public int deleteEmisTmsSiteBatchLoadingByIds(Long[] ids); 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 组批次信息列表 * @return 组批次信息列表
*/ */
List<EmisTmsSiteBatch> selectEmisTmsSiteBatchListByBillCodes(@Param("billCodes") List<String> billCodes); 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 * @return
*/ */
public EmisTmsSiteBatch geDetail(Long id); 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 * @param emisTmsSiteBatch
* @return * @return
*/ */
@ -154,14 +155,9 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
} }
} }
private void checkUnique(EmisTmsSiteBatch oldSiteBatch, String billCode) throws EmisBizError { private void checkUnique(EmisTmsSiteBatch emisTmsSiteBatch, String billCode) throws EmisBizError {
EmisTmsSiteBatch emisTmsSiteBatch = new EmisTmsSiteBatch();
emisTmsSiteBatch.setStartSiteCode(oldSiteBatch.getStartSiteCode());
emisTmsSiteBatch.setNextSiteCode(oldSiteBatch.getNextSiteCode());
emisTmsSiteBatch.setSupplierCode(oldSiteBatch.getSupplierCode());
emisTmsSiteBatch.getParams().put("billCode", billCode); emisTmsSiteBatch.getParams().put("billCode", billCode);
List<EmisTmsSiteBatch> batchList = emisTmsSiteBatchMapper.selectEmisTmsSiteBatchList(emisTmsSiteBatch); if (emisTmsSiteBatchMapper.checkUnique(emisTmsSiteBatch) > 0) {
if (CollectionUtil.isNotEmpty(batchList)) {
throw new EmisBizError(EmisBizErrorType.FAIL, billCode + "已组批次,不要重复组"); throw new EmisBizError(EmisBizErrorType.FAIL, billCode + "已组批次,不要重复组");
} }
} }
@ -248,4 +244,33 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
return emisTmsSiteBatchMapper.selectEmisTmsSiteBatchWithDetailsById(id); 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 @Override
@ -378,8 +384,6 @@ public class EmisTransPlanRuleServiceImpl extends EmisBaseService implements IEm
} }
} }
@Override @Override
public List<String> checkTree(EmisTransPlanRule emisTransPlanRule) { public List<String> checkTree(EmisTransPlanRule emisTransPlanRule) {
List<EmisTransPlanRule> allRules = emisTransPlanRuleMapper.selectEmisTransPlanRuleTree(emisTransPlanRule); List<EmisTransPlanRule> allRules = emisTransPlanRuleMapper.selectEmisTransPlanRuleTree(emisTransPlanRule);
@ -400,37 +404,52 @@ public class EmisTransPlanRuleServiceImpl extends EmisBaseService implements IEm
} }
int successCount = 0; int successCount = 0;
for (EmisTransPlanRule emisTransPlanRule : emisTransPlanRuleList) { for (EmisTransPlanRule inputRule : emisTransPlanRuleList) {
try { try {
// 校验非空 // 1. 查历史数据
checkCode(emisTransPlanRule); EmisTransPlanRule dbRule = emisTransPlanRuleMapper.selectEmisTransPlanRuleById(inputRule.getId());
checkDate(emisTransPlanRule); if (dbRule == null) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "ID:" + inputRule.getId() + "的规则不存在");
// 检查重复(排除自身) }
checkDuplicateForUpdate(emisTransPlanRule); // 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(); EmisTransPlanRule checkRule = new EmisTransPlanRule();
checkRule.setProductType(emisTransPlanRule.getProductType()); checkRule.setProductType(mergedRule.getProductType());
List<EmisTransPlanRule> allRules = emisTransPlanRuleMapper List<EmisTransPlanRule> allRules = emisTransPlanRuleMapper
.selectEmisTransPlanRuleListWithoutName(checkRule); .selectEmisTransPlanRuleListWithoutName(checkRule);
// 移除当前要修改的规则,避免自己与自己比较 allRules.removeIf(rule -> rule.getId().equals(mergedRule.getId()));
allRules.removeIf(rule -> rule.getId().equals(emisTransPlanRule.getId())); allRules.add(mergedRule);
allRules.add(emisTransPlanRule); buildTree(allRules, mergedRule);
buildTree(allRules, emisTransPlanRule); // 4. 只更新前端传递的字段
int result = emisTransPlanRuleMapper.updateEmisTransPlanRule(inputRule);
// 执行更新
int result = emisTransPlanRuleMapper.updateEmisTransPlanRule(emisTransPlanRule);
if (result > 0) { if (result > 0) {
successCount++; successCount++;
} }
} catch (Exception e) { } catch (Exception e) {
log.error("批量修改供应商线路规划失败,ID: {}, 错误: {}", emisTransPlanRule.getId(), e.getMessage()); log.error("批量修改供应商线路规划失败,ID: {}, 错误: {}", inputRule.getId(), e.getMessage());
throw new EmisBizError(EmisBizErrorType.SYS_EXCEPTION, throw new EmisBizError(EmisBizErrorType.SYS_EXCEPTION,
"批量修改失败,ID: " + emisTransPlanRule.getId() + ", 错误: " + e.getMessage()); "批量修改失败,ID: " + inputRule.getId() + ", 错误: " + e.getMessage());
} }
} }
return successCount; return successCount;
} }

View File

@ -193,4 +193,10 @@
and a.del_flag = '0' and a.del_flag = '0'
and a.send_date <![CDATA[ > ]]> '2025-01-01 00:00:00' and a.send_date <![CDATA[ > ]]> '2025-01-01 00:00:00'
</select> </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> </mapper>

View File

@ -148,4 +148,10 @@
#{id} #{id}
</foreach> </foreach>
</delete> </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> </mapper>

View File

@ -301,46 +301,19 @@
ORDER BY a.etd DESC ORDER BY a.etd DESC
</select> </select>
<select id="checkUnique" parameterType="EmisTmsSiteBatch" resultType="int"> <select id="checkUnique" parameterType="EmisTmsSiteBatch" resultType="int">
select count(1) from emis_tms_site_batch select count(1)
where del_flag='0' from emis_tms_site_batch
and id = #{id} where del_flag = '0'
and batch_no = #{batchNo} and batch_no != #{batchNo}
and batch_name = #{batchName} and start_site_code = #{startSiteCode}
and batch_date = #{batchDate} and next_site_code = #{nextSiteCode}
and trans_line_type = #{transLineType} and supplier_code=#{supplierCode}
and product_type = #{productType} and batch_no in (select batch_no from emis_tms_site_batch_dtl where del_flag='0'
and batch_type = #{batchType} and FIND_IN_SET(`bill_code`
and trans_type = #{transType} , #{params.billCode}) )
and start_site_code = #{startSiteCode} limit 1
and send_country = #{sendCountry} </select>
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="selectEmisTmsSiteBatchById" parameterType="Long" resultMap="EmisTmsSiteBatchResult"> <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 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 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.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, 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_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,
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, 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.receive_country, c2.name as receive_country_name, w.send_date, w.bl_sign, w.sign_date,
w.product_type, w.product_type,
w.payment_type, w.parcel_qty, w.bill_weight, w.total_volume, w.volume_weight, 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, 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) (SELECT GROUP_CONCAT(s.name)
FROM emis_supplier s FROM emis_supplier s
WHERE FIND_IN_SET(s.code, m.supplier_code) 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) WHERE FIND_IN_SET(p.prod_code, m.product_type)
AND p.del_flag = '0') as product_type_name AND p.del_flag = '0') as product_type_name
from emis_tms_site_batch_miss m 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_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 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_site s2 on m.start_site_code=s2.site_code and s2.del_flag=0
left join emis_country c2 on w.receive_country=c2.code and c2.del_flag='0' left join emis_site s3 on m.next_site_code=s3.site_code and s3.del_flag=0
left join emis_destination n on w.destination_code=n.dest_code and n.del_flag='0' left join emis_country c1 on w.send_country=c1.code and c1.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_country c2 on w.receive_country=c2.code and c2.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_destination n on w.destination_code=n.dest_code and n.del_flag='0'
left join emis_trans_line l on m.line_code=l.line_code and l.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> </sql>
<!-- <select id="selectEmisTmsSiteBatchMissList" parameterType="EmisTmsSiteBatchMiss" resultMap="EmisTmsSiteBatchMissResult">--> <!-- <select id="selectEmisTmsSiteBatchMissList" parameterType="EmisTmsSiteBatchMiss" resultMap="EmisTmsSiteBatchMissResult">-->
@ -132,88 +127,162 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- </select>--> <!-- </select>-->
<select id="selectEmisTmsSiteBatchMissList" parameterType="EmisTmsSiteBatchMiss" resultMap="EmisTmsSiteBatchMissResult"> <select id="selectEmisTmsSiteBatchMissList" parameterType="EmisTmsSiteBatchMiss" resultMap="EmisTmsSiteBatchMissResult">
<include refid="selectEmisTmsSiteBatchMissVo"/> <choose>
<where> <when test="missCount == -4">
m.del_flag = '0' <!-- 当missCount=-4时,查询emis_waybill_batch_status表 -->
<if test="missCount != null"> select
<choose> null as id, w.bill_code, '已组批次成功' as miss_reason,
<when test="missCount == -1"> null as create_by, null as create_time, null as update_by, null as update_time,
AND m.miss_type = 2 null as remark, '0' as del_flag,
</when> w.trans_line_type as line_code, w.product_type, w.start_site_code, w.next_site_code,
<when test="missCount == -2"> null as supplier_code, null as start_date, null as end_date, '0' as miss_type,
AND m.miss_type = 3 w.send_site_code, s1.site_name as send_site_name,
</when> w.send_country, c1.name as send_country_name, w.destination_code, n.dest_name as destination_name, w.bl_is_question,
<when test="missCount == -3"> l.line_name as line_name,
AND m.miss_type = 1 w.receive_country, c2.name as receive_country_name, w.send_date, w.bl_sign, w.sign_date,
</when> w.product_type,
<when test="missCount > 0"> w.payment_type, w.parcel_qty, w.bill_weight, w.total_volume, w.volume_weight,
AND m.bill_code IN ( w.settlement_weight, w.freight, w.remark as waybill_remark, w.fee_remark,
SELECT bill_code null as manager, null as trans_manager,
FROM emis_tms_site_batch_miss (SELECT GROUP_CONCAT(s.site_name ORDER BY FIND_IN_SET(s.site_code, w.start_site_code))
WHERE del_flag = '0' FROM emis_site s
GROUP BY bill_code WHERE FIND_IN_SET(s.site_code, w.start_site_code) AND s.del_flag = 0) as start_site_name,
HAVING COUNT(*) = #{missCount} (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 </if>
</when> <if test="nextSiteCode != null and nextSiteCode != ''">
</choose> AND (
</if> w.next_site_code REGEXP REPLACE(#{nextSiteCode}, ',', '|')
<if test="billCode != null and billCode != ''"> )
AND m.bill_code REGEXP REPLACE(#{billCode}, '\n', '|') </if>
</if> <if test="blIsQuestion != null and blIsQuestion != ''">
<if test="missReason != null and missReason != ''"> AND w.bl_is_question = #{blIsQuestion}
AND m.miss_reason like concat('%', #{missReason}, '%') </if>
</if> <if test="sendSiteCode != null and sendSiteCode != ''">
<if test="manager != null and manager != ''"> AND w.send_site_code = #{sendSiteCode}
AND ( </if>
m.manager REGEXP REPLACE(#{manager}, ',', '|') <if test="params.beginSendDate != null and params.beginSendDate != ''">
) and w.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if> </if>
<if test="transManager != null and transManager != ''"> <if test="params.endSendDate != null and params.endSendDate != ''">
AND k.trans_manager like concat('%', #{transManager}, '%') and w.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if> </if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'"> </where>
and (r.manager=#{params.privEmpName} or k.trans_manager=#{params.privEmpName}) order by w.bill_code desc
</if> </when>
<if test="lineCode != null and lineCode != ''"> <otherwise>
AND m.line_code = #{lineCode} <include refid="selectEmisTmsSiteBatchMissVo"/>
</if> <where>
<if test="productType != null and productType != ''"> m.del_flag = '0'
AND FIND_IN_SET(#{productType}, m.product_type) <if test="missCount != null">
</if> <choose>
<if test="startSiteCode != null and startSiteCode != ''"> <when test="missCount == -1">
AND ( AND m.miss_type = 2
m.start_site_code REGEXP REPLACE(#{startSiteCode}, ',', '|') </when>
) <when test="missCount == -2">
</if> AND m.miss_type = 3
<if test="nextSiteCode != null and nextSiteCode != ''"> </when>
AND ( <when test="missCount == -3">
m.next_site_code REGEXP REPLACE(#{nextSiteCode}, ',', '|') AND m.miss_type = 1
) </when>
</if> <when test="missCount > 0">
<if test="supplierCode != null and supplierCode != ''"> AND m.bill_code IN (
AND FIND_IN_SET(#{supplierCode}, m.supplier_code) SELECT bill_code
</if> FROM emis_tms_site_batch_miss
<if test="startDate != null"> WHERE del_flag = '0'
AND m.start_date = #{startDate} GROUP BY bill_code
</if> HAVING COUNT(*) = #{missCount}
<if test="endDate != null"> )
AND m.end_date = #{endDate} AND m.miss_type = 0
</if> </when>
<if test="blIsQuestion != null and blIsQuestion != ''"> </choose>
AND w.bl_is_question = #{blIsQuestion} </if>
</if> <if test="billCode != null and billCode != ''">
<if test="sendSiteCode != null and sendSiteCode != ''"> AND m.bill_code REGEXP REPLACE(#{billCode}, '\n', '|')
AND w.send_site_code = #{sendSiteCode} </if>
</if> <if test="missReason != null and missReason != ''">
<if test="params.beginSendDate != null and params.beginSendDate != ''"> AND m.miss_reason like concat('%', #{missReason}, '%')
and w.send_date <![CDATA[ >= ]]> #{params.beginSendDate} </if>
</if> <if test="manager != null and manager != ''">
<if test="params.endSendDate != null and params.endSendDate != ''"> AND (
and w.send_date <![CDATA[ <= ]]> #{params.endSendDate} m.manager REGEXP REPLACE(#{manager}, ',', '|')
</if> )
</where> </if>
order by m.bill_code desc <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>
<select id="selectEmisTmsSiteBatchMissById" parameterType="Long" resultMap="EmisTmsSiteBatchMissResult"> <select id="selectEmisTmsSiteBatchMissById" parameterType="Long" resultMap="EmisTmsSiteBatchMissResult">