123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package cn.cslg.pas.service;
- import cn.cslg.pas.common.model.params.PatentInstructionTextParams;
- import cn.cslg.pas.domain.PatentInstructionText;
- import cn.cslg.pas.mapper.PatentInstructionTextMapper;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.core.toolkit.Wrappers;
- import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- import lombok.RequiredArgsConstructor;
- import org.springframework.context.annotation.Lazy;
- import org.springframework.stereotype.Service;
- import java.util.ArrayList;
- import java.util.List;
- /**
- * @author Administrator
- * @description 针对表【os_patent_instruction_text(专利说明书(文本))】的数据库操作Service
- * @createDate 2022-04-16 08:38:10
- */
- @Service
- @RequiredArgsConstructor(onConstructor_ = {@Lazy})
- public class PatentInstructionTextService extends ServiceImpl<PatentInstructionTextMapper, PatentInstructionText> {
- private final PatentService patentService;
- public PatentInstructionText getPatentInstructionTextByPatentId(Integer patentId) {
- LambdaQueryWrapper<PatentInstructionText> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(PatentInstructionText::getPatentId, patentId);
- return this.getOne(queryWrapper);
- }
- public List<PatentInstructionText> getPatentInstructionTextByPatentIds(List<Integer> patentIds) {
- if (patentIds == null || patentIds.size() == 0) {
- return new ArrayList<>();
- }
- LambdaQueryWrapper<PatentInstructionText> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.in(PatentInstructionText::getPatentId, patentIds);
- return this.list(queryWrapper);
- }
- public void deleteByPatentId(Integer patentId) {
- this.remove(Wrappers.<PatentInstructionText>lambdaQuery().eq(PatentInstructionText::getPatentId, patentId));
- }
- public void importPatentInstructionText(Integer localPatentId, Integer importPatentId, List<PatentInstructionText> importPatentInstructionTextList) {
- this.deleteByPatentId(localPatentId);
- PatentInstructionText patentInstructionText = importPatentInstructionTextList.stream().filter(item -> item.getPatentId().equals(importPatentId)).findFirst().orElse(null);
- if (patentInstructionText != null) {
- patentInstructionText.setId(null);
- patentInstructionText.setPatentId(localPatentId);
- patentInstructionText.insert();
- }
- }
- public void updatePatentInstructionText(PatentInstructionTextParams params) {
- PatentInstructionText patentInstructionText = this.getPatentInstructionTextByPatentId(params.getPatentId());
- if (patentInstructionText == null) {
- patentInstructionText = new PatentInstructionText();
- }
- patentInstructionText.setPatentId(params.getPatentId());
- patentInstructionText.setManual(params.getManual());
- patentInstructionText.setManualOut(params.getManualOut());
- patentInstructionText.insertOrUpdate();
- }
- }
|