package com.gk.hotwork.Service.ServiceImpl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gk.hotwork.Domain.AttachmentInfo; import com.gk.hotwork.Domain.UserInfo; import com.gk.hotwork.Mapper.AttachmentInfoMapper; import com.gk.hotwork.Service.AttachmentInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; import java.util.List; /** * @email 1603559716@qq.com * @author: zf * @date: 2023/7/24 * @time: 13:48 */ @Service public class AttachmentInfoServiceImpl extends ServiceImpl implements AttachmentInfoService { @Autowired private AttachmentInfoMapper attachmentInfoMapper; @Override public AttachmentInfo findByKey(String key) { AttachmentInfo attachmentInfo = attachmentInfoMapper.selectOne(new LambdaQueryWrapper() .eq(AttachmentInfo::getDelFlag,0) .eq(AttachmentInfo::getFileKey,key)); return attachmentInfo; } @Override public AttachmentInfo findById(Long id) { AttachmentInfo attachmentInfo = attachmentInfoMapper.selectOne(new LambdaQueryWrapper() .eq(AttachmentInfo::getDelFlag,0) .eq(AttachmentInfo::getId,id)); return attachmentInfo; } @Override public List findByBusinessId(Long businessId) { List attachmentInfoList = attachmentInfoMapper.selectList(new LambdaQueryWrapper() .eq(AttachmentInfo::getDelFlag,0) .eq(AttachmentInfo::getBusinessId,businessId)); return attachmentInfoList; } @Override public List findByIds(List ids) { return attachmentInfoMapper.selectList(new LambdaQueryWrapper() .in(AttachmentInfo::getId,ids) .eq(AttachmentInfo::getDelFlag,0)); } @Override public void delete(Long id, UserInfo userInfo) { AttachmentInfo attachmentInfo = new AttachmentInfo(); attachmentInfo.setId(id); attachmentInfo.setUpdateTime(new Date()); attachmentInfo.setUpdateUid(userInfo.getId()); attachmentInfo.setUpdateUname(userInfo.getRealname()); attachmentInfo.setDelFlag(1); attachmentInfoMapper.updateById(attachmentInfo); } @Override public AttachmentInfo saveOne(AttachmentInfo attachmentInfo) { attachmentInfoMapper.insert(attachmentInfo); return attachmentInfoMapper.selectById(attachmentInfo.getId()); } @Override public List saveBatchAttachment(List attachmentInfoList) { attachmentInfoMapper.saveBatch(attachmentInfoList); return attachmentInfoList; } @Override public void updateBusinessIdBatch(List attachmentList) { attachmentInfoMapper.updateBusinessIdBatch(attachmentList); } @Override public void deleteByBusinessId(Long businessId) { attachmentInfoMapper.deleteByBusinessId(businessId); } }