yangys
2024-04-04 ed4a5236bab800094be4a8378f5098eebe3de6ac
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
package com.qianwen.smartman.modules.visual.service.impl;
 
import org.springframework.stereotype.Service;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qianwen.core.log.exception.ServiceException;
import com.qianwen.core.tool.utils.Func;
import com.qianwen.smartman.modules.visual.entity.VisualCategory;
import com.qianwen.smartman.modules.visual.mapper.VisualCategoryMapper;
import com.qianwen.smartman.modules.visual.service.IVisualCategoryService;
 
@Service
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/visual/service/impl/VisualCategoryServiceImpl.class */
public class VisualCategoryServiceImpl extends ServiceImpl<VisualCategoryMapper, VisualCategory> implements IVisualCategoryService {
    
 
    @Override // org.springblade.modules.visual.service.IVisualCategoryService
    public boolean submit(VisualCategory visualCategory) {
        LambdaQueryWrapper<VisualCategory> lqw = Wrappers.<VisualCategory>query().lambda().eq(VisualCategory::getCategoryValue, visualCategory.getCategoryValue());
        /*
        Wrapper wrapper = (LambdaQueryWrapper) Wrappers.query().lambda().eq((v0) -> {
            return v0.getCategoryValue();
        }, visualCategory.getCategoryValue());*/
        Long cnt = this.baseMapper.selectCount(Func.isEmpty(visualCategory.getId()) ? lqw : lqw.notIn(VisualCategory::getId, new Object[] { visualCategory.getId() }));
        /*
        Long cnt = ((VisualCategoryMapper) this.baseMapper).selectCount(Func.isEmpty(visualCategory.getId()) ? wrapper : (Wrapper) wrapper.notIn((v0) -> {
            return v0.getId();
        }, new Object[]{visualCategory.getId()}));*/
        if (cnt.longValue() > 0) {
            throw new ServiceException("当前模块键值已存在!");
        }
        visualCategory.setIsDeleted(0);
        return saveOrUpdate(visualCategory);
    }
}