|
@@ -0,0 +1,122 @@
|
|
|
|
|
+package com.zhongzheng.modules.recruit.service.impl;
|
|
|
|
|
+
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
|
|
+import com.zhongzheng.common.utils.DateUtils;
|
|
|
|
|
+import com.zhongzheng.modules.recruit.bo.RecruitNeedsAddBo;
|
|
|
|
|
+import com.zhongzheng.modules.recruit.bo.RecruitNeedsEditBo;
|
|
|
|
|
+import com.zhongzheng.modules.recruit.bo.RecruitNeedsQueryBo;
|
|
|
|
|
+import com.zhongzheng.modules.recruit.domain.RecruitNeeds;
|
|
|
|
|
+import com.zhongzheng.modules.recruit.mapper.RecruitNeedsMapper;
|
|
|
|
|
+import com.zhongzheng.modules.recruit.service.IRecruitNeedsService;
|
|
|
|
|
+import com.zhongzheng.modules.recruit.vo.RecruitNeedsVo;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
+import com.github.pagehelper.Page;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.Collection;
|
|
|
|
|
+import java.util.Collections;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 招聘需求Service业务层处理
|
|
|
|
|
+ *
|
|
|
|
|
+ * @author ruoyi
|
|
|
|
|
+ * @date 2021-08-12
|
|
|
|
|
+ */
|
|
|
|
|
+@Service
|
|
|
|
|
+public class RecruitNeedsServiceImpl extends ServiceImpl<RecruitNeedsMapper, RecruitNeeds> implements IRecruitNeedsService {
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public RecruitNeedsVo queryById(Long id){
|
|
|
|
|
+ RecruitNeeds db = this.baseMapper.selectById(id);
|
|
|
|
|
+ return BeanUtil.toBean(db, RecruitNeedsVo.class);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<RecruitNeedsVo> queryList(RecruitNeedsQueryBo bo) {
|
|
|
|
|
+ LambdaQueryWrapper<RecruitNeeds> lqw = Wrappers.lambdaQuery();
|
|
|
|
|
+ lqw.eq(bo.getCompanyId() != null, RecruitNeeds::getCompanyId, bo.getCompanyId());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getJob()), RecruitNeeds::getJob, bo.getJob());
|
|
|
|
|
+ lqw.eq(bo.getIncomeStart() != null, RecruitNeeds::getIncomeStart, bo.getIncomeStart());
|
|
|
|
|
+ lqw.eq(bo.getIncomeEnd() != null, RecruitNeeds::getIncomeEnd, bo.getIncomeEnd());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getDuty()), RecruitNeeds::getDuty, bo.getDuty());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getRequirement()), RecruitNeeds::getRequirement, bo.getRequirement());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getWelfare()), RecruitNeeds::getWelfare, bo.getWelfare());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getJobKey()), RecruitNeeds::getJobKey, bo.getJobKey());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getWorkingYearsDict()), RecruitNeeds::getWorkingYearsDict, bo.getWorkingYearsDict());
|
|
|
|
|
+ lqw.eq(bo.getWorkingYearsStart() != null, RecruitNeeds::getWorkingYearsStart, bo.getWorkingYearsStart());
|
|
|
|
|
+ lqw.eq(bo.getWorkingYearsEnd() != null, RecruitNeeds::getWorkingYearsEnd, bo.getWorkingYearsEnd());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getMinimumEduDict()), RecruitNeeds::getMinimumEduDict, bo.getMinimumEduDict());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getMajor()), RecruitNeeds::getMajor, bo.getMajor());
|
|
|
|
|
+ lqw.eq(bo.getStatus() != null, RecruitNeeds::getStatus, bo.getStatus());
|
|
|
|
|
+ lqw.eq(bo.getTenantId() != null, RecruitNeeds::getTenantId, bo.getTenantId());
|
|
|
|
|
+ lqw.eq(bo.getIncomeType() != null, RecruitNeeds::getIncomeType, bo.getIncomeType());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getProvince()), RecruitNeeds::getProvince, bo.getProvince());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getCity()), RecruitNeeds::getCity, bo.getCity());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getDistrict()), RecruitNeeds::getDistrict, bo.getDistrict());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getAddress()), RecruitNeeds::getAddress, bo.getAddress());
|
|
|
|
|
+ lqw.eq(bo.getPeopleNum() != null, RecruitNeeds::getPeopleNum, bo.getPeopleNum());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getJobNature()), RecruitNeeds::getJobNature, bo.getJobNature());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getBonusCertificate()), RecruitNeeds::getBonusCertificate, bo.getBonusCertificate());
|
|
|
|
|
+ lqw.eq(bo.getIsUrgent() != null, RecruitNeeds::getIsUrgent, bo.getIsUrgent());
|
|
|
|
|
+ return entity2Vo(this.list(lqw));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 实体类转化成视图对象
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param collection 实体类集合
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ private List<RecruitNeedsVo> entity2Vo(Collection<RecruitNeeds> collection) {
|
|
|
|
|
+ List<RecruitNeedsVo> voList = collection.stream()
|
|
|
|
|
+ .map(any -> BeanUtil.toBean(any, RecruitNeedsVo.class))
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ if (collection instanceof Page) {
|
|
|
|
|
+ Page<RecruitNeeds> page = (Page<RecruitNeeds>)collection;
|
|
|
|
|
+ Page<RecruitNeedsVo> pageVo = new Page<>();
|
|
|
|
|
+ BeanUtil.copyProperties(page,pageVo);
|
|
|
|
|
+ pageVo.addAll(voList);
|
|
|
|
|
+ voList = pageVo;
|
|
|
|
|
+ }
|
|
|
|
|
+ return voList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Boolean insertByAddBo(RecruitNeedsAddBo bo) {
|
|
|
|
|
+ RecruitNeeds add = BeanUtil.toBean(bo, RecruitNeeds.class);
|
|
|
|
|
+ validEntityBeforeSave(add);
|
|
|
|
|
+ add.setCreateTime(DateUtils.getNowTime());
|
|
|
|
|
+ add.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
+ return this.save(add);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Boolean updateByEditBo(RecruitNeedsEditBo bo) {
|
|
|
|
|
+ RecruitNeeds update = BeanUtil.toBean(bo, RecruitNeeds.class);
|
|
|
|
|
+ validEntityBeforeSave(update);
|
|
|
|
|
+ update.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
+ return this.updateById(update);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 保存前的数据校验
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param entity 实体类数据
|
|
|
|
|
+ */
|
|
|
|
|
+ private void validEntityBeforeSave(RecruitNeeds entity){
|
|
|
|
|
+ //TODO 做一些数据校验,如唯一约束
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
|
|
+ if(isValid){
|
|
|
|
|
+ //TODO 做一些业务上的校验,判断是否需要校验
|
|
|
|
|
+ }
|
|
|
|
|
+ return this.removeByIds(ids);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|