删除标准收藏方法

This commit is contained in:
caozhen
2023-09-14 11:54:20 +08:00
parent e1f34d42f3
commit bd265f2440
2 changed files with 32 additions and 14 deletions
@@ -35,4 +35,10 @@ public interface ILawsStandardCollectionService extends IService<LawsStandardCol
*/
void deleteById(String id);
/**
* 删除标准收藏
*/
void deleteByStandardId(String id);
}
@@ -7,12 +7,12 @@ import com.jero.modules.laws.common.service.ILawsCommonService;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandard;
import com.jero.modules.laws.enterprise.service.EnterpriseStandardService;
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
import com.jero.modules.laws.standard.entity.LawsOverseasStandard;
import com.jero.modules.laws.standard.service.ILawsDomesticStandardService;
import com.jero.modules.laws.standard.service.ILawsOverseasStandardService;
import com.jero.modules.personal.entity.LawsStandardCollection;
import com.jero.modules.personal.mapper.LawsStandardCollectionMapper;
import com.jero.modules.personal.service.ILawsStandardCollectionService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -20,7 +20,6 @@ import org.springframework.transaction.annotation.Transactional;
import com.jero.common.exception.JeroBootException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.system.query.QueryGenerator;
@@ -46,9 +45,6 @@ public class LawsStandardCollectionServiceImpl extends ServiceImpl<LawsStandardC
@Autowired
private EnterpriseStandardService enterpriseStandardService; //企业标准
@Autowired
private ILawsCommonService lawsCommonService;
/**
* 列表查询
@@ -71,22 +67,28 @@ public class LawsStandardCollectionServiceImpl extends ServiceImpl<LawsStandardC
String source = collection.getSource();
if ("1".equals(source)){
//查询国内标准数据,赋值给collection
Map<String, Object> byIdAndModule = lawsCommonService.getByIdAndModule(standardId, source);
collection.setNewModelImplementationDate((Date) byIdAndModule.get("new_model_implementation_date"));
collection.setOnTheProductionDate((Date) byIdAndModule.get("on_the_production_date"));
collection.setReleaseDate((Date) byIdAndModule.get("release_date"));
LawsDomesticStandard standard = lawsDomesticStandardService.queryById(standardId);
if (standard != null){
collection.setNewModelImplementationDate(standard.getNewModelImplementationDate());
collection.setOnTheProductionDate(standard.getOnTheProductionDate());
collection.setReleaseDate(standard.getReleaseDate());
}
}
if ("2".equals(source)){
//查询海外标准数据,赋值给collection
Map<String, Object> byIdAndModule = lawsCommonService.getByIdAndModule(standardId, source);
collection.setNewModelImplementationDate((Date) byIdAndModule.get("new_model_implementation_date"));
collection.setOnTheProductionDate((Date) byIdAndModule.get("on_the_production_date"));
collection.setReleaseDate((Date) byIdAndModule.get("release_date"));
LawsOverseasStandard standard = lawsOverseasStandardService.queryById(standardId);
if (standard != null){
collection.setNewModelImplementationDate(standard.getNewModelImplementationDate());
collection.setOnTheProductionDate(standard.getOnTheProductionDate());
collection.setReleaseDate(standard.getReleaseDate());
}
}
if ("3".equals(source)){
//查询企业标准数据,赋值给collection
EnterpriseStandard standard = enterpriseStandardService.getById(standardId);
collection.setReleaseDate(standard.getReleaseDate());
if (standard != null){
collection.setReleaseDate(standard.getReleaseDate());
}
}
}
}
@@ -119,4 +121,14 @@ public class LawsStandardCollectionServiceImpl extends ServiceImpl<LawsStandardC
wrapper.eq(LawsStandardCollection::getCollectorId, sysUser.getId());
remove(wrapper);
}
/**
* 删除标准收藏
*/
@Override
public void deleteByStandardId(String id) {
LambdaQueryWrapper<LawsStandardCollection> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(LawsStandardCollection::getStandardId, id);
remove(wrapper);
}
}