package com.gkhy.exam.system.service.impl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.gkhy.exam.common.api.CommonPage;
|
import com.gkhy.exam.common.api.CommonResult;
|
import com.gkhy.exam.common.exception.ApiException;
|
import com.gkhy.exam.common.utils.PageUtils;
|
import com.gkhy.exam.common.utils.SecurityUtils;
|
import com.gkhy.exam.system.domain.AnnualReport;
|
import com.gkhy.exam.system.mapper.AnnualReportMapper;
|
import com.gkhy.exam.system.service.AnnualReportService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.time.LocalDateTime;
|
import java.util.List;
|
|
@Service
|
public class AnnualReportServiceImpl extends ServiceImpl<AnnualReportMapper, AnnualReport> implements AnnualReportService {
|
|
@Autowired
|
private AnnualReportMapper annualReportMapper;
|
|
|
@Override
|
public CommonPage selectAnnualList(AnnualReport annualReport) {
|
if (!SecurityUtils.adminUser()){
|
if (annualReport.getCompanyId()==null){
|
throw new ApiException("非管理员操作,企业id不可为空");
|
}
|
}
|
PageUtils.startPage();
|
List<AnnualReport> annualReports = annualReportMapper.selectAnnualList(annualReport);
|
return CommonPage.restPage(annualReports);
|
}
|
|
@Override
|
public CommonResult insertAnnual(AnnualReport annualReport) {
|
annualReport.setCreateBy(SecurityUtils.getUsername());
|
annualReport.setCreateTime(LocalDateTime.now());
|
annualReportMapper.insert(annualReport);
|
return CommonResult.success();
|
}
|
|
@Override
|
public CommonResult updateAnnual(AnnualReport annualReport) {
|
annualReport.setUpdateBy(SecurityUtils.getUsername());
|
annualReport.setUpdateTime(LocalDateTime.now());
|
annualReportMapper.updateById(annualReport);
|
return CommonResult.success();
|
}
|
|
@Override
|
public CommonResult deletedAnnual(Integer annualId) {
|
AnnualReport annualReport = new AnnualReport();
|
annualReport.setId(annualId);
|
annualReport.setUpdateBy(SecurityUtils.getUsername());
|
annualReport.setUpdateTime(LocalDateTime.now());
|
annualReport.setDelFlag(2);
|
annualReportMapper.updateById(annualReport);
|
return CommonResult.success();
|
}
|
}
|