erp工厂新增、编辑、批量更新、定时任务、分页查询优化

This commit is contained in:
liss
2025-10-10 17:55:01 +08:00
parent bd62556640
commit 30420ab96f
30 changed files with 239 additions and 251 deletions

View File

@@ -27,6 +27,7 @@ public interface ErrorCodeConstants {
ErrorCode ERP_FACTORY_NOT_EXISTS = new ErrorCode(1_008_000_001, "ERP工厂数据不存在");
ErrorCode ERP_FACTORY_REDIS_NOT_EXISTS = new ErrorCode(1_008_000_002, "ERP工厂redis数据不存在");
ErrorCode ERP_FACTORY_NOT_ALLOW_UPDATE = new ErrorCode(1_008_000_003, "类型为ERP的数据或启用的数据不允许编辑");
ErrorCode ERP_COSTCENTER_NOT_EXISTS = new ErrorCode(1_009_000_001, "ERP成本中心数据不存在");

View File

@@ -88,6 +88,14 @@ public class ErpFactoryController {
return success(BeanUtils.toBean(pageResult, ErpFactoryRespVO.class));
}
@GetMapping("/pageByCpn")
@Operation(summary = "获得ERP工厂分页")
@PreAuthorize("@ss.hasPermission('base:erp-factory:query')")
public CommonResult<PageResult<ErpFactoryRespVO>> getErpFactoryPageByCpn(@Valid ErpFactoryPageReqVO pageReqVO) {
PageResult<ErpFactoryDO> pageResult = erpFactoryService.getErpFactoryPageByCpn(pageReqVO);
return success(BeanUtils.toBean(pageResult, ErpFactoryRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出ERP工厂 Excel")
@PreAuthorize("@ss.hasPermission('base:erp-factory:export')")
@@ -101,6 +109,14 @@ public class ErpFactoryController {
BeanUtils.toBean(list, ErpFactoryRespVO.class));
}
@PutMapping("/enable-list")
@Operation(summary = "批量更新")
@PreAuthorize("@ss.hasPermission('base:erp-factory:update')")
public CommonResult<Boolean> enableFactoryList(@RequestBody List<ErpFactoryRespVO> saveReqVOS) {
erpFactoryService.enableFactoryList(saveReqVOS);
return success(true);
}
@PostMapping("/getErpFactoryTask")
@Operation(summary = "定时获得erp工厂数据")
@PreAuthorize("@ss.hasPermission('base:erp-factory:create')")

View File

@@ -1,5 +1,6 @@
package com.zt.plat.module.erp.controller.admin.erp.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zt.plat.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -14,4 +15,13 @@ public class ErpFactoryPageReqVO extends PageParam {
@Schema(description = "工厂编码")
private String number;
@Schema(description = "公司编号")
private String companyNumber;
@Schema(description = "公司名称")
private String companyName;
@Schema(description = "类型")
private String type;
}

View File

@@ -22,4 +22,18 @@ public class ErpFactoryRespVO {
@ExcelProperty("工厂编码")
private String number;
@Schema(description = "公司编号")
private String companyNumber;
@Schema(description = "类型")
private String type;
@Schema(description = "绑定工厂名")
private String relName;
@Schema(description = "绑定工厂编码")
private String relnumber;
@Schema(description = "是否启用")
private String isEnable;
}

View File

@@ -19,4 +19,21 @@ public class ErpFactorySaveReqVO {
@NotEmpty(message = "工厂编码不能为空")
private String number;
@Schema(description = "公司编号")
private String companyNumber;
@Schema(description = "公司编号")
private String companyName;
@Schema(description = "类型")
private String type;
@Schema(description = "绑定工厂名")
private String relName;
@Schema(description = "绑定工厂编码")
private String relnumber;
@Schema(description = "是否启用")
private String isEnable;
}

View File

@@ -1,7 +1,9 @@
package com.zt.plat.module.erp.dal.dataobject.erp;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
import lombok.*;
/**
* ERP工厂 DO
*
@@ -18,9 +20,7 @@ import lombok.*;
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class ErpFactoryDO {
public class ErpFactoryDO extends BusinessBaseDO {
/**
* 主键
@@ -41,6 +41,35 @@ public class ErpFactoryDO {
* 公司编号
*/
@TableField("CPN_ID")
private String companyId;
private String companyNumber;
/**
* 公司名称
*/
@TableField(exist = false)
private String companyName;
/**
* 类型
*/
@TableField("TP")
private String type;
/**
* 绑定工厂名
*/
@TableField("REL_NAME")
private String relName;
/**
* 绑定工厂编码
*/
@TableField("REL_NUM")
private String relnumber;
/**
* 类型
*/
@TableField("IS_ENB")
private String isEnable;
}

View File

@@ -41,4 +41,10 @@ public class ErpWarehouseDO {
@TableField("NUM")
private String number;
/**
* 类别
*/
@TableField("TP")
private String type;
}

View File

@@ -25,6 +25,4 @@ public interface ErpBomMapper extends BaseMapperX<ErpBomDO> {
.eqIfPresent(ErpBomDO::getUnit, reqVO.getUnit())
.orderByDesc(ErpBomDO::getId));
}
Long insertGetId(ErpBomDO aDo);
}

View File

@@ -29,6 +29,4 @@ public interface ErpCostcenterMapper extends BaseMapperX<ErpCostcenterDO> {
.betweenIfPresent(ErpCostcenterDO::getEndDate, reqVO.getEndDate())
.orderByDesc(ErpCostcenterDO::getId));
}
void updateBatchByNumber(@Param("list") List<ErpCostcenterDO> toUpdate);
}

View File

@@ -22,9 +22,11 @@ public interface ErpFactoryMapper extends BaseMapperX<ErpFactoryDO> {
return selectPage(reqVO, new LambdaQueryWrapperX<ErpFactoryDO>()
.likeIfPresent(ErpFactoryDO::getName, reqVO.getName())
.eqIfPresent(ErpFactoryDO::getNumber, reqVO.getNumber())
.eqIfPresent(ErpFactoryDO::getType, reqVO.getType())
.orderByDesc(ErpFactoryDO::getId));
}
void updateBatch(@Param("toUpdate") List<ErpFactoryDO> toUpdate);
String selectMaxCode();
List<ErpFactoryDO> getPageByReq(ErpFactoryPageReqVO pageReqVO);
}

View File

@@ -179,15 +179,42 @@ public class ErpContractServiceImpl implements ErpContractService {
try {
OftenEnum.FuncnrEnum funcnrEnum = OftenEnum.FuncnrEnum.合同信息;
String funcnr = funcnrEnum.getFuncnr();
Map<String, Object> req = new HashMap<>();
JSONArray dataArrayALL = new JSONArray();
String commanyKey = "erpMap" + OftenEnum.FuncnrEnum.公司代码.getFuncnr();
Map<String, Long> redisCache = myRedisConfig.getRedisCacheMap(commanyKey);
if (CollUtil.isEmpty(redisCache)) {
return;
}
String cstmKey = "erpMap" + OftenEnum.FuncnrEnum.客商信息.getFuncnr();
Map<String, Long> redisCachecstmKey = myRedisConfig.getRedisCacheMap(cstmKey);
if (CollUtil.isEmpty(redisCachecstmKey)) {
return;
}
// 1. 调用ERP接口获取数据
for (String INEDR : new String[]{"1", "2"}) {
req.put("INEDR", INEDR);
for (String number : redisCache.keySet()) {
req.put("BUKRS", number);
for (String partner : redisCachecstmKey.keySet()) {
req.put("PARTNER", partner);
// 1. 调用ERP接口获取数据
HashMap<String, Object> dataFromERP = erpConfig.fetchDataFromERP(funcnr, null);
JSONArray dataArray = (JSONArray) dataFromERP.get("E_RESP");
if (CollUtil.isEmpty(dataArray)) {
if (dataArray!= null) {
dataArrayALL.addAll(dataArray);
}
}
}
}
if (CollUtil.isEmpty(dataArrayALL)) {
throw exception(ERP_CONTRACT_NOT_EXISTS);
}
// 2. 处理公司数据,区分新增和更新
ProcessingResult result = processData(dataArray,funcnrEnum);
ProcessingResult result = processData(dataArrayALL, funcnrEnum);
// 3. 批量保存数据
saveData(result);

View File

@@ -62,4 +62,8 @@ public interface ErpFactoryService {
PageResult<ErpFactoryDO> getErpFactoryPage(ErpFactoryPageReqVO pageReqVO);
void callErpRfcInterface();
void enableFactoryList(List<ErpFactoryRespVO> saveReqVOS);
PageResult<ErpFactoryDO> getErpFactoryPageByCpn(ErpFactoryPageReqVO pageReqVO);
}

View File

@@ -16,6 +16,7 @@ import com.zt.plat.module.erp.controller.admin.erp.vo.ErpFactorySaveReqVO;
import com.zt.plat.module.erp.dal.dataobject.erp.ErpFactoryDO;
import com.zt.plat.module.erp.dal.mysql.erp.ErpFactoryMapper;
import jakarta.annotation.Resource;
import org.apache.ibatis.executor.BatchResult;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
@@ -51,6 +52,21 @@ public class ErpFactoryServiceImpl implements ErpFactoryService {
public ErpFactoryRespVO createErpFactory(ErpFactorySaveReqVO createReqVO) {
// 插入
ErpFactoryDO erpFactory = BeanUtils.toBean(createReqVO, ErpFactoryDO.class);
// 工厂编码自动生成,格式 GC-0001,依次新增
if (erpFactory.getNumber() == null){
String maxCode = erpFactoryMapper.selectMaxCode();
if (maxCode == null) {
erpFactory.setNumber("GC-0001");
} else {
String prefix = "GC-";
String numberPart = maxCode.substring(prefix.length());
int nextNumber = Integer.parseInt(numberPart) + 1;
String nextCode = prefix + String.format("%04d", nextNumber);
erpFactory.setNumber(nextCode);
}
}
erpFactory.setType("供应链");
erpFactory.setIsEnable("1");
erpFactoryMapper.insert(erpFactory);
// 返回
return BeanUtils.toBean(erpFactory, ErpFactoryRespVO.class);
@@ -62,6 +78,9 @@ public class ErpFactoryServiceImpl implements ErpFactoryService {
validateErpFactoryExists(updateReqVO.getId());
// 更新
ErpFactoryDO updateObj = BeanUtils.toBean(updateReqVO, ErpFactoryDO.class);
if (updateObj.getType().equals("ERP")||updateObj.getIsEnable().equals("1")){
throw exception(ERP_FACTORY_NOT_ALLOW_UPDATE);
}
erpFactoryMapper.updateById(updateObj);
}
@@ -103,6 +122,39 @@ public class ErpFactoryServiceImpl implements ErpFactoryService {
public PageResult<ErpFactoryDO> getErpFactoryPage(ErpFactoryPageReqVO pageReqVO) {
return erpFactoryMapper.selectPage(pageReqVO);
}
@Override
public void enableFactoryList(List<ErpFactoryRespVO> saveReqVOS) {
List<ErpFactoryDO> updateObj = BeanUtils.toBean(saveReqVOS, ErpFactoryDO.class);
List<BatchResult> count = erpFactoryMapper.updateById(updateObj);
if (CollUtil.isEmpty(count)) {
throw exception(ERP_FACTORY_NOT_EXISTS);
}
}
@Override
public PageResult<ErpFactoryDO> getErpFactoryPageByCpn(ErpFactoryPageReqVO pageReqVO) {
// 获取分页数据
List<ErpFactoryDO> list = erpFactoryMapper.getPageByReq(pageReqVO);
if (list == null) {
list = CollUtil.newArrayList();
}
// 分页处理
int pageNo = pageReqVO.getPageNo();
int pageSize = pageReqVO.getPageSize();
int total = list.size();
// 计算分页起始和结束位置
int fromIndex = (pageNo - 1) * pageSize;
int toIndex = Math.min(fromIndex + pageSize, total);
// 如果起始位置超出范围,则返回空列表
if (fromIndex >= total) {
return new PageResult<>(new ArrayList<>(), (long) total);
}
// 截取当前页数据
List<ErpFactoryDO> pageList = list.subList(fromIndex, toIndex);
return new PageResult<>(pageList, (long) total);
}
@Override
@Transactional
@XxlJob("getErpFactoryTask")
@@ -173,7 +225,8 @@ public class ErpFactoryServiceImpl implements ErpFactoryService {
ErpFactoryDO DO = new ErpFactoryDO();
DO.setName(dataJson.getString("NAME1"));
DO.setNumber(number);
DO.setCompanyId(dataJson.getString("BUKRS"));
DO.setCompanyNumber(dataJson.getString("BUKRS"));
DO.setType("ERP");
if (numbers.get(number)!=null) {
// 更新
DO.setId(numbers.get(number));
@@ -244,7 +297,7 @@ public class ErpFactoryServiceImpl implements ErpFactoryService {
private void initializeMap(String key) {
Map<String, Long> existingNumbers = erpFactoryMapper.selectList(new LambdaQueryWrapperX<ErpFactoryDO>())
.stream()
.stream().filter(erpFactoryDO -> erpFactoryDO.getType().equals("ERP"))
.collect(Collectors.toMap(ErpFactoryDO::getNumber, ErpFactoryDO::getId));
myRedisConfig.addRedisCacheMap(key, existingNumbers);
}

View File

@@ -229,6 +229,7 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
private void initialize(String key) {
List<String> existingNumbers = erpMaterialMapper.selectList(new LambdaQueryWrapperX<ErpMaterialDO>())
.stream( )
.filter(ErpMaterialDO -> ErpMaterialDO.getType().equals("ERP"))
.map(ErpMaterialDO::getDownCenterNumber)
.collect(Collectors.toList());
myRedisConfig.updateRedisCache(key, existingNumbers);

View File

@@ -244,7 +244,8 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
}
private void initializeMap(String key) {
List<ErpWarehouseDO> assets = erpWarehouseMapper.selectList(new LambdaQueryWrapperX<ErpWarehouseDO>());
List<ErpWarehouseDO> assets = erpWarehouseMapper.selectList(new LambdaQueryWrapperX<ErpWarehouseDO>()
.eq(ErpWarehouseDO::getType, "ERP"));
Map<String, Long> existingNumbers = new HashMap<>();
for (ErpWarehouseDO asset : assets) {
String mapKey = asset.getFactoryNumber() + "-" + asset.getNumber();

View File

@@ -8,23 +8,4 @@
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<update id="updateBatch">
UPDATE sply_erp_ast
<set>
NAME = CASE
<foreach collection="toUpdate" item="item">
WHEN CPN_NUM = #{item.companyNumber} AND MAIN_AST_NUM = #{item.mainAssetNumber} THEN #{item.name}
</foreach>
END,
CPN_ID = CASE
<foreach collection="toUpdate" item="item">
WHEN CPN_NUM = #{item.companyNumber} AND MAIN_AST_NUM = #{item.mainAssetNumber} THEN #{item.companyId}
</foreach>
END
</set>
WHERE (CPN_NUM, MAIN_AST_NUM) IN
<foreach collection="toUpdate" item="item" open="(" separator="," close=")">
#{item.companyNumber}, #{item.mainAssetNumber}
</foreach>
</update>
</mapper>

View File

@@ -9,18 +9,4 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<insert id="insertGetId">
</insert>
<update id="updateBatch">
<foreach collection="toUpdate" item="item" separator=";">
UPDATE sply_erp_fact
<set>
<if test="item.name != null">NAME = #{item.name},</if>
<if test="item.number != null">CPN_ID = #{item.companyId},</if>
</set>
WHERE NUM = #{item.number}
</foreach>
</update>
</mapper>

View File

@@ -8,15 +8,4 @@
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<update id="updateBatch">
<foreach collection="toUpdate" item="item" separator=";">
UPDATE sply_erp_fact
<set>
<if test="item.name != null">NAME = #{item.name},</if>
<if test="item.number != null">CPN_ID = #{item.companyId},</if>
</set>
WHERE NUM = #{item.number}
</foreach>
</update>
</mapper>

View File

@@ -8,15 +8,4 @@
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<update id="updateBatch">
<foreach collection="toUpdate" item="item" separator=";">
UPDATE sply_erp_fact
<set>
<if test="item.name != null">NAME = #{item.name},</if>
<if test="item.number != null">CPN_ID = #{item.companyId},</if>
</set>
WHERE NUM = #{item.number}
</foreach>
</update>
</mapper>

View File

@@ -9,61 +9,4 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<update id="updateBatchByNumber">
UPDATE sply_erp_cctr
SET
NAME = CASE NUM
<foreach collection="list" item="item">
<if test="item.name != null and item.name != ''">
WHEN #{item.number} THEN #{item.name}
</if>
</foreach>
ELSE NAME
END,
IS_USE = CASE NUM
<foreach collection="list" item="item">
<if test="item.isUse != null and item.isUse != ''">
WHEN #{item.number} THEN #{item.isUse}
</if>
</foreach>
ELSE IS_USE
END,
SCO_NUM = CASE NUM
<foreach collection="list" item="item">
<if test="item.scopeNumber != null and item.scopeNumber != ''">
WHEN #{item.number} THEN #{item.scopeNumber}
</if>
</foreach>
ELSE SCO_NUM
END,
STRT_DT = CASE NUM
<foreach collection="list" item="item">
<if test="item.startDate != null">
WHEN #{item.number} THEN #{item.startDate}
</if>
</foreach>
ELSE STRT_DT
END,
END_DT = CASE NUM
<foreach collection="list" item="item">
<if test="item.endDate != null">
WHEN #{item.number} THEN #{item.endDate}
</if>
</foreach>
ELSE END_DT
END,
SCO_NAME = CASE NUM
<foreach collection="list" item="item">
<if test="item.scopeName != null and item.scopeName != ''">
WHEN #{item.number} THEN #{item.scopeName}
</if>
</foreach>
ELSE SCO_NAME
END
WHERE NUM IN
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.number}
</foreach>
</update>
</mapper>

View File

@@ -8,15 +8,4 @@
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<update id="updateBatch">
<foreach collection="toUpdate" item="item" separator=";">
UPDATE sply_erp_fact
<set>
<if test="item.name != null">NAME = #{item.name},</if>
<if test="item.number != null">CPN_ID = #{item.companyId},</if>
</set>
WHERE NUM = #{item.number}
</foreach>
</update>
</mapper>

View File

@@ -9,14 +9,28 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<update id="updateBatch">
<foreach collection="toUpdate" item="item" separator=";">
UPDATE sply_erp_fact
<set>
<if test="item.name != null">NAME = #{item.name},</if>
<if test="item.number != null">CPN_ID = #{item.companyId},</if>
</set>
WHERE NUM = #{item.number}
</foreach>
</update>
<select id="getPageByReq" resultType="com.zt.plat.module.erp.dal.dataobject.erp.ErpFactoryDO">
select f.*, c.NAME as companyName
from sply_erp_fact f left join sply_erp_company c on f.CPN_ID = c.NUM;
where f.DELETED = 0
<if test="reqVO.name != null">
and f.NAME like concat('%', #{reqVO.name}, '%')
</if>
<if test="reqVO.number != null">
and f.NUM like concat('%', #{reqVO.number}, '%')
</if>
<if test="reqVO.companyNumber != null">
and f.CPN_ID = like concat('%', #{reqVO.companyNumber}, '%')
</if>
<if test="reqVO.companyName != null">
and c.NAME like concat('%', #{reqVO.companyName}, '%')
</if>
<if test="reqVO.type != null">
and f.TP like concat('%', #{reqVO.type}, '%')
</if>
</select>
<select id="selectMaxCode" resultType="java.lang.String">
SELECT MAX(NUM) FROM sply_erp_fact where TP = '供应链'
</select>
</mapper>

View File

@@ -9,14 +9,4 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<update id="updateBatch">
<foreach collection="toUpdate" item="item" separator=";">
UPDATE sply_erp_fact
<set>
<if test="item.name != null">NAME = #{item.name},</if>
<if test="item.number != null">CPN_ID = #{item.companyId},</if>
</set>
WHERE NUM = #{item.number}
</foreach>
</update>
</mapper>

View File

@@ -9,14 +9,4 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<update id="updateBatch">
<foreach collection="toUpdate" item="item" separator=";">
UPDATE sply_erp_fact
<set>
<if test="item.name != null">NAME = #{item.name},</if>
<if test="item.number != null">CPN_ID = #{item.companyId},</if>
</set>
WHERE NUM = #{item.number}
</foreach>
</update>
</mapper>

View File

@@ -9,14 +9,4 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<update id="updateBatch">
<foreach collection="toUpdate" item="item" separator=";">
UPDATE sply_erp_fact
<set>
<if test="item.name != null">NAME = #{item.name},</if>
<if test="item.number != null">CPN_ID = #{item.companyId},</if>
</set>
WHERE NUM = #{item.number}
</foreach>
</update>
</mapper>

View File

@@ -9,14 +9,4 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<update id="updateBatch">
<foreach collection="toUpdate" item="item" separator=";">
UPDATE sply_erp_fact
<set>
<if test="item.name != null">NAME = #{item.name},</if>
<if test="item.number != null">CPN_ID = #{item.companyId},</if>
</set>
WHERE NUM = #{item.number}
</foreach>
</update>
</mapper>

View File

@@ -9,14 +9,4 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<update id="updateBatch">
<foreach collection="toUpdate" item="item" separator=";">
UPDATE sply_erp_fact
<set>
<if test="item.name != null">NAME = #{item.name},</if>
<if test="item.number != null">CPN_ID = #{item.companyId},</if>
</set>
WHERE NUM = #{item.number}
</foreach>
</update>
</mapper>

View File

@@ -9,14 +9,4 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<update id="updateBatch">
<foreach collection="toUpdate" item="item" separator=";">
UPDATE sply_erp_fact
<set>
<if test="item.name != null">NAME = #{item.name},</if>
<if test="item.number != null">CPN_ID = #{item.companyId},</if>
</set>
WHERE NUM = #{item.number}
</foreach>
</update>
</mapper>

View File

@@ -9,14 +9,4 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<update id="updateBatch">
<foreach collection="toUpdate" item="item" separator=";">
UPDATE sply_erp_fact
<set>
<if test="item.name != null">NAME = #{item.name},</if>
<if test="item.number != null">CPN_ID = #{item.companyId},</if>
</set>
WHERE NUM = #{item.number}
</foreach>
</update>
</mapper>

View File

@@ -9,14 +9,4 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<update id="updateBatch">
<foreach collection="toUpdate" item="item" separator=";">
UPDATE sply_erp_fact
<set>
<if test="item.name != null">NAME = #{item.name},</if>
<if test="item.number != null">CPN_ID = #{item.companyId},</if>
</set>
WHERE NUM = #{item.number}
</foreach>
</update>
</mapper>