czt
2025-05-29 753abfcaf090f79a4226693c2829a2d47b422058
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
46
47
48
49
50
51
52
53
package com.fzzy.igds.sys;
 
import com.fzzy.igds.dzhwk.domain.Granary;
import com.fzzy.igds.sys.repository.GranaryRepository;
import com.fzzy.igds.util.ContextUtil;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
 
/**
 * @Description
 * @Author CZT
 * @Date 2024/11/22 14:48
 */
@Slf4j
@Service("sys.granaryService")
public class GranaryService {
 
    @Resource
    private GranaryRepository granaryRepository;
 
    public List<Granary> getGranary(String companyId, String deptId) {
 
        if (StringUtils.isEmpty(companyId)) {
            companyId = ContextUtil.getCompanyId();
        }
        if (StringUtils.isEmpty(deptId)) {
            deptId = ContextUtil.subDeptId(null);
        }
        return granaryRepository.getGranary(companyId, deptId);
    }
 
    public void saveOrUpdate(Granary data) {
        if (StringUtils.isEmpty(data.getCompanyId())) {
            data.setCompanyId(ContextUtil.getCompanyId());
        }
        if (StringUtils.isEmpty(data.getDeptId())) {
            data.setDeptId(ContextUtil.subDeptId(null));
        }
        data.setUpdateTime(new Date());
        granaryRepository.save(data);
    }
 
    public String delData(Granary data) {
        granaryRepository.delete(data);
        return null;
    }
 
}