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 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; } }