|
@@ -3,6 +3,7 @@ package com.zhongzheng.modules.exam.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
+import com.zhongzheng.modules.exam.domain.ExamApplyGoods;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -66,11 +67,18 @@ public class ExamBeforeGoodsServiceImpl extends ServiceImpl<ExamBeforeGoodsMappe
|
|
|
|
|
|
@Override
|
|
|
public Boolean insertByAddBo(ExamBeforeGoodsAddBo bo) {
|
|
|
- ExamBeforeGoods add = BeanUtil.toBean(bo, ExamBeforeGoods.class);
|
|
|
- validEntityBeforeSave(add);
|
|
|
- add.setCreateTime(DateUtils.getNowTime());
|
|
|
- add.setUpdateTime(DateUtils.getNowTime());
|
|
|
- return this.save(add);
|
|
|
+ LambdaQueryWrapper<ExamBeforeGoods> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(ExamBeforeGoods::getBeforeId, bo.getBeforeId());
|
|
|
+ this.remove(lqw);
|
|
|
+ for (Long goodsId : bo.getGoodsId()) {
|
|
|
+ ExamBeforeGoods add = new ExamBeforeGoods();
|
|
|
+ add.setCreateTime(DateUtils.getNowTime());
|
|
|
+ add.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ add.setGoodsId(goodsId);
|
|
|
+ add.setBeforeId(bo.getBeforeId());
|
|
|
+ return this.save(add);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
@Override
|