| | |
| | | package com.gkhy.exam.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gkhy.exam.common.api.CommonPage; |
| | | import com.gkhy.exam.common.api.CommonResult; |
| | |
| | | |
| | | @Override |
| | | public CommonPage selectAnnualList(AnnualReport annualReport) { |
| | | if (!SecurityUtils.adminUser()){ |
| | | if (annualReport.getCompanyId()==null){ |
| | | if (!SecurityUtils.adminUser()) { |
| | | if (annualReport.getCompanyId() == null) { |
| | | throw new ApiException("非管理员操作,企业id不可为空"); |
| | | } |
| | | } |
| | |
| | | |
| | | @Override |
| | | public CommonResult insertAnnual(AnnualReport annualReport) { |
| | | LambdaQueryWrapper<AnnualReport> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AnnualReport::getCompanyId, annualReport.getCompanyId()) |
| | | .eq(AnnualReport::getYear, annualReport.getYear()) |
| | | .eq(AnnualReport::getDelFlag, 1); |
| | | if (annualReportMapper.selectCount(queryWrapper) > 0) { |
| | | return CommonResult.failed("该年度报表已存在"); |
| | | } |
| | | annualReport.setCreateBy(SecurityUtils.getUsername()); |
| | | annualReport.setCreateTime(LocalDateTime.now()); |
| | | annualReportMapper.insert(annualReport); |
| | |
| | | |
| | | @Override |
| | | public CommonResult updateAnnual(AnnualReport annualReport) { |
| | | LambdaQueryWrapper<AnnualReport> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AnnualReport::getCompanyId, annualReport.getCompanyId()) |
| | | .eq(AnnualReport::getYear, annualReport.getYear()) |
| | | .eq(AnnualReport::getDelFlag, 1) |
| | | .ne(AnnualReport::getId, annualReport.getId()); |
| | | if (annualReportMapper.selectCount(queryWrapper) > 0) { |
| | | return CommonResult.failed("该年度报表已存在"); |
| | | } |
| | | annualReport.setUpdateBy(SecurityUtils.getUsername()); |
| | | annualReport.setUpdateTime(LocalDateTime.now()); |
| | | annualReportMapper.updateById(annualReport); |