商品分组禁用清空起止时间

This commit is contained in:
Tankaikai 2025-04-16 15:20:02 +08:00
parent ab41db4aaa
commit ff8a1e5de2
1 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package com.czg.service.product.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
@ -121,8 +122,13 @@ public class ProdGroupServiceImpl extends ServiceImpl<ProdGroupMapper, ProdGroup
if (exists) {
throw new CzgException("商品分组已存在");
}
ProdGroup entity = BeanUtil.copyProperties(dto, ProdGroup.class);
super.updateById(entity);
ProdGroup entity = getById(dto.getId());
BeanUtil.copyProperties(dto, entity, CopyOptions.create().setIgnoreNullValue(true));
if (entity.getStatus() == StatusEnum.DISABLE.value()) {
entity.setSaleStartTime(null);
entity.setSaleEndTime(null);
}
super.updateById(entity, false);
if (!isUpdateProduct) {
return;
}