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.utils.SecurityUtils; import com.gkhy.exam.system.domain.ProcessInspection; import com.gkhy.exam.system.mapper.ProcessInspectionMapper; import com.gkhy.exam.system.service.ProcessInspectionService; import net.sf.jsqlparser.expression.operators.relational.ItemsList; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.util.List; @Service public class ProcessInspectionServiceImpl extends ServiceImpl implements ProcessInspectionService { @Autowired private ProcessInspectionMapper processInspectionMapper; @Override public CommonPage selectProcessInspectionList(Integer companyId, Integer templateType,Integer itemId) { boolean admin = SecurityUtils.adminUser(); if (!admin){ if (companyId==null){ companyId = SecurityUtils.getCompanyId().intValue(); } } List processInspections = processInspectionMapper.selectByCompanyidAndTypeList(companyId, templateType, itemId); return CommonPage.restPage(processInspections); } @Override public CommonResult insertProcessInspection(ProcessInspection processInspection) { processInspection.setCreateTime(LocalDateTime.now()); processInspection.setCreateBy(SecurityUtils.getUsername()); processInspectionMapper.insert(processInspection); return CommonResult.success(); } @Override public CommonResult updateProcessInspection(ProcessInspection processInspection) { processInspection.setUpdateBy(SecurityUtils.getUsername()); processInspection.setUpdateTime(LocalDateTime.now()); int update = processInspectionMapper.updateById(processInspection); return CommonResult.success(); } @Override public CommonResult deletedProcessInspection(Integer inspectionId) { ProcessInspection processInspection = new ProcessInspection(); processInspection.setUpdateBy(SecurityUtils.getUsername()); processInspection.setUpdateTime(LocalDateTime.now()); processInspection.setId(inspectionId); processInspection.setDelFlag(2); processInspectionMapper.updateById(processInspection); return CommonResult.success(); } }