skyouc
2025-04-01 4422564b84dae692a44e955d7d696b39dbf3c155
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.vincent.rsf.server.manager.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.manager.controller.params.IsptItemsParams;
import com.vincent.rsf.server.manager.controller.params.QlyInspectAndItem;
import com.vincent.rsf.server.manager.mapper.QlyIsptItemMapper;
import com.vincent.rsf.server.manager.entity.QlyIsptItem;
import com.vincent.rsf.server.manager.service.QlyIsptItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
 
import java.util.List;
import java.util.Objects;
 
@Service("qlyIsptItemService")
public class QlyIsptItemServiceImpl extends ServiceImpl<QlyIsptItemMapper, QlyIsptItem> implements QlyIsptItemService {
 
    /**
     * @author Ryan
     * @description 批量修改
     * @param
     * @return
     * @time 2025/4/1 09:40
     */
    @Override
    public boolean batchUpdate(IsptItemsParams params) {
        if (Objects.isNull(params.getIds()) || params.getIds().isEmpty()) {
            throw new CoolException("ID不能为空!!");
        }
        QlyIsptItem isptItem = params.getIsptItem();
        if (Objects.isNull(isptItem)) {
            throw new CoolException("参数不能为空!");
        }
 
       return this.update(new LambdaUpdateWrapper<QlyIsptItem>()
                .in(QlyIsptItem::getId, params.getIds())
                .set(!Objects.isNull(isptItem.getIsptStatus()), QlyIsptItem::getIsptStatus, !Objects.isNull(isptItem.getIsptStatus()) ? isptItem.getIsptStatus() : "0")
                .set(!Objects.isNull(isptItem.getDisQty()), QlyIsptItem::getDisQty, !Objects.isNull(isptItem.getDisQty()) ? isptItem.getDisQty() : 0)
                .set(!Objects.isNull(isptItem.getDlyQty()), QlyIsptItem::getDlyQty, !Objects.isNull(isptItem.getDlyQty()) ? isptItem.getDlyQty() : 0)
                .set(!Objects.isNull(isptItem.getIsptResult()), QlyIsptItem::getIsptResult, !Objects.isNull(isptItem.getIsptResult()) ? isptItem.getIsptResult() : "0"));
    }
}