yuan
4 天以前 3436929ce8f22fe0bb68a19a7d37412b34fca061
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
package com.ruoyi.basic.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.mapper.EnterpriseInfoMapper;
import com.ruoyi.basic.pojo.EnterpriseInfo;
import com.ruoyi.basic.service.IEnterpriseInfoService;
import org.springframework.stereotype.Service;
 
@Service
public class EnterpriseInfoServiceImpl extends ServiceImpl<EnterpriseInfoMapper, EnterpriseInfo>
        implements IEnterpriseInfoService {
 
    @Override
    public EnterpriseInfo getEnterpriseInfo() {
        LambdaQueryWrapper<EnterpriseInfo> wrapper = new LambdaQueryWrapper<>();
        wrapper.orderByDesc(EnterpriseInfo::getId).last("LIMIT 1");
        EnterpriseInfo info = this.getOne(wrapper);
        if (info == null) {
            info = new EnterpriseInfo();
        }
        return info;
    }
 
    @Override
    public boolean saveOrUpdateInfo(EnterpriseInfo enterpriseInfo) {
        if (enterpriseInfo.getId() == null) {
            return this.save(enterpriseInfo);
        }
        return this.updateById(enterpriseInfo);
    }
}