| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.InsuranceMapper; |
| | | import com.doumee.dao.business.SolutionWorktypeMapper; |
| | | import com.doumee.dao.business.SolutionsMapper; |
| | | import com.doumee.dao.business.model.Solutions; |
| | | import com.doumee.dao.business.WorktypeMapper; |
| | | import com.doumee.dao.business.join.SolutionWorktypeJoinMapper; |
| | | import com.doumee.dao.business.join.SolutionsJoinMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.service.business.CompanyService; |
| | | import com.doumee.service.business.SolutionsService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * 保险方案信息表Service实现 |
| | | * @author 江蹄蹄 |
| | | * @date 2024/01/15 15:07 |
| | | * @date 2024/01/16 10:03 |
| | | */ |
| | | @Service |
| | | public class SolutionsServiceImpl implements SolutionsService { |
| | | |
| | | @Autowired |
| | | private SolutionsMapper solutionsMapper; |
| | | @Autowired |
| | | private SolutionsJoinMapper solutionsJoinMapper; |
| | | @Autowired |
| | | private WorktypeMapper worktypeMapper; |
| | | @Autowired |
| | | private SolutionWorktypeJoinMapper solutionWorktypeJoinMapper; |
| | | @Autowired |
| | | private InsuranceMapper insuranceMapper; |
| | | |
| | | @Override |
| | | public Integer create(Solutions solutions) { |
| | | solutionsMapper.insert(solutions); |
| | | LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal(); |
| | | initCreateParam(solutions);//工种数据有效性检验,去除空白行数据 |
| | | |
| | | solutions.setIsdeleted(Constants.ZERO); |
| | | solutions.setCreator(user.getId()); |
| | | solutions.setCreateDate(new Date()); |
| | | solutions.setVersion(UUID.randomUUID().toString());//版本号 |
| | | solutions.setDataType(Constants.ZERO); |
| | | solutions.setStatus(Constants.ZERO); |
| | | solutionsMapper.insert(solutions);//基础版本 |
| | | |
| | | //如果有工种,则产生一个新的有效历史版本 ~ |
| | | Solutions newModel = new Solutions(); |
| | | BeanUtils.copyProperties(solutions,newModel); |
| | | newModel.setId(null); |
| | | newModel.setBaseId(solutions.getId()); |
| | | newModel.setDataType(Constants.TWO); |
| | | solutionsMapper.insert(newModel); |
| | | |
| | | dealWorkType(solutions,newModel,solutions.getWorktypeIdList(),true); |
| | | return solutions.getId(); |
| | | } |
| | | |
| | | private void dealWorkType(Solutions solutions, Solutions newModel, List<Integer> worktypeIdList, boolean b) { |
| | | Insurance model = insuranceMapper.selectById(solutions.getInsuranceId()); |
| | | if(model == null || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO) |
| | | || !Constants.equalsInteger(model.getDataType(),Constants.TWO)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,该保险公司信息不存在,请尝试刷新页面重试~" ); |
| | | } |
| | | if( !Constants.equalsInteger(model.getStatus(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,该保险公司已被,请尝试刷新页面重试~" ); |
| | | } |
| | | List<Worktype> worktypeList = worktypeMapper.selectList(new QueryWrapper<Worktype>().lambda() |
| | | .eq(Worktype::getInsuranceId,solutions.getInsuranceId()) |
| | | .eq(Worktype::getIsdeleted,Constants.ZERO) |
| | | .in(Worktype::getId,worktypeIdList)); |
| | | if(worktypeList==null ||worktypeIdList.size()==0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,工种信息选择有误,请尝试刷新页面重试~" ); |
| | | } |
| | | int num =0; |
| | | for(Worktype type : worktypeList) { |
| | | //基础版本 |
| | | SolutionWorktype w = new SolutionWorktype(); |
| | | w.setSolutionId(solutions.getId()); |
| | | w.setIsdeleted(Constants.ZERO); |
| | | w.setCreator(newModel.getCreator()); |
| | | w.setCreateDate(solutions.getCreateDate()); |
| | | w.setWorktypeId(type.getId()); |
| | | w.setStatus(Constants.ZERO); |
| | | w.setSortnum(num++); |
| | | solutionWorktypeJoinMapper.insert(w); |
| | | |
| | | //历史版本的工种信息 |
| | | SolutionWorktype newType = new SolutionWorktype(); |
| | | BeanUtils.copyProperties(w, newType); |
| | | newType.setSolutionId(newModel.getId()); |
| | | solutionWorktypeJoinMapper.insert(newType); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void initCreateParam(Solutions solutions) { |
| | | if(StringUtils.isBlank(solutions.getName()) |
| | | ||solutions.getInsuranceId()==null |
| | | ||solutions.getWorktypeIdList()==null |
| | | ||solutions.getWorktypeIdList().size()==0 |
| | | ||Constants.formatIntegerNum(solutions.getMaxAge()) < 0 |
| | | ||Constants.formatIntegerNum(solutions.getMinAge()) < 0 |
| | | // ||Constants.formatIntegerNum(solutions.getPriceCycleUnit()) < 0 |
| | | ||Constants.formatIntegerNum(solutions.getInsureCycle()) < 0 |
| | | ||Constants.formatIntegerNum(solutions.getInsureCycleUnit()) < 0 |
| | | || solutions.getMinAge() >solutions.getMaxAge() |
| | | || Constants.formatBigdecimal(solutions.getPrice()).compareTo(new BigDecimal(0)) !=1 |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void updateById(Solutions solutions) { |
| | | LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal(); |
| | | Solutions model = findById(solutions.getId()); |
| | | if(model == null || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO) |
| | | || !Constants.equalsInteger(model.getDataType(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY ); |
| | | } |
| | | //数据有效性校验 |
| | | initCreateParam(solutions); |
| | | |
| | | solutions.setEditor(user.getId()); |
| | | solutions.setVersion(UUID.randomUUID().toString()); |
| | | solutions.setEditDate(new Date()); |
| | | solutionsMapper.updateById(solutions); |
| | | |
| | | //如果修改,则产生一个新的历史版本 ~ |
| | | Solutions newModel = new Solutions(); |
| | | BeanUtils.copyProperties( findById(solutions.getId()),newModel); |
| | | newModel.setId(null); |
| | | newModel.setVersion(solutions.getVersion()); |
| | | newModel.setCreateDate(new Date()); |
| | | newModel.setBaseId(solutions.getId()); |
| | | newModel.setDataType(Constants.TWO); |
| | | solutionsMapper.insert(newModel); |
| | | |
| | | //删除所有工种数据 |
| | | solutionWorktypeJoinMapper.delete(new UpdateWrapper<SolutionWorktype>() |
| | | .lambda() |
| | | .eq(SolutionWorktype::getSolutionId,solutions.getId()) |
| | | ); |
| | | solutionsMapper.update(null,new UpdateWrapper<Solutions>() |
| | | .lambda() |
| | | .ne(Solutions::getId,newModel.getId()) |
| | | .eq(Solutions::getBaseId,solutions.getId()) |
| | | .eq(Solutions::getDataType,Constants.TWO) |
| | | .set(Solutions::getDataType,Constants.ONE) |
| | | .set(StringUtils.isNotBlank(solutions.getSignKeyword()),Solutions::getSignKeyword,solutions.getSignKeyword()) |
| | | ); |
| | | //处理工种信息,新增最新的,同时产生历史版本 |
| | | dealWorkType(solutions,newModel,solutions.getWorktypeIdList(),false); |
| | | } |
| | | |
| | | @Override |
| | |
| | | this.updateById(solutions); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateStatus(Solutions solutions){ |
| | | if(solutions.getId() == null || solutions.getStatus()==null || solutions.getStatus()<0||solutions.getStatus()>1){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST ); |
| | | } |
| | | Solutions model = findById(solutions.getId()); |
| | | if(model == null || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO) |
| | | || !Constants.equalsInteger(model.getDataType(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY ); |
| | | } |
| | | if(Constants.equalsInteger(model.getStatus(),solutions.getStatus())){ |
| | | //如果状态不发生改变,直接返回 |
| | | return; |
| | | } |
| | | LoginUserInfo user= (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | //同时更新基表和历史版本所有数据状态 |
| | | solutionsMapper.update(null,new UpdateWrapper<Solutions>() |
| | | .lambda() |
| | | .and(m -> m.eq(Solutions::getId,model.getId()).or().eq(Solutions::getBaseId,model.getId())) |
| | | .eq(Solutions::getIsdeleted,Constants.ZERO) |
| | | .set(Solutions::getEditDate,new Date()) |
| | | .set(Solutions::getEditor,user.getId()) |
| | | .set(Solutions::getStatus,solutions.getStatus()) |
| | | ); |
| | | } |
| | | @Override |
| | | public Solutions findById(Integer id) { |
| | | return solutionsMapper.selectById(id); |
| | | MPJLambdaWrapper<Solutions> queryWrapper = new MPJLambdaWrapper<>(); |
| | | queryWrapper.selectAll(Solutions.class); |
| | | queryWrapper.selectAs(Insurance::getName,Solutions::getInsuranceName); |
| | | queryWrapper.leftJoin(Insurance.class,Insurance::getId,Solutions::getInsuranceId); |
| | | queryWrapper.eq(Solutions::getId,id); |
| | | Solutions model = solutionsJoinMapper.selectJoinOne(Solutions.class,queryWrapper); |
| | | if(model == null || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY ); |
| | | } |
| | | MPJLambdaWrapper<SolutionWorktype> wrapper = new MPJLambdaWrapper<>(); |
| | | wrapper.selectAll(SolutionWorktype.class); |
| | | wrapper.selectAs(Worktype::getName,SolutionWorktype::getWorktypeName); |
| | | wrapper.leftJoin(Worktype.class,Worktype::getId,SolutionWorktype::getWorktypeId); |
| | | wrapper.eq(SolutionWorktype::getSolutionId,id); |
| | | wrapper.eq(SolutionWorktype::getIsdeleted,Constants.ZERO); |
| | | wrapper.orderByAsc(SolutionWorktype::getSortnum); |
| | | List<SolutionWorktype> worktypeList = solutionWorktypeJoinMapper.selectJoinList(SolutionWorktype.class,wrapper); |
| | | model.setWorktypeList(worktypeList); |
| | | return model; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public List<Solutions> findList(Solutions solutions) { |
| | | solutions.setIsdeleted(Constants.ZERO); |
| | | solutions.setStatus(Constants.ZERO); |
| | | if(solutions.getDataType() == null){ |
| | | solutions.setDataType(Constants.TWO); |
| | | } |
| | | QueryWrapper<Solutions> wrapper = new QueryWrapper<>(solutions); |
| | | return solutionsMapper.selectList(wrapper); |
| | | } |
| | |
| | | @Override |
| | | public PageData<Solutions> findPage(PageWrap<Solutions> pageWrap) { |
| | | IPage<Solutions> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<Solutions> queryWrapper = new QueryWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | pageWrap.getModel().setDataType(Constants.ZERO);//只选择基表数据 |
| | | pageWrap.getModel().setIsdeleted(Constants.ZERO); |
| | | MPJLambdaWrapper<Solutions> queryWrapper = new MPJLambdaWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | queryWrapper.selectAll(Solutions.class); |
| | | queryWrapper.selectAs(Insurance::getName,Solutions::getInsuranceName); |
| | | queryWrapper.leftJoin(Insurance.class,Insurance::getId,Solutions::getInsuranceId); |
| | | |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getId, pageWrap.getModel().getId()); |
| | | queryWrapper.eq(Solutions::getId, pageWrap.getModel().getId()); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getCreator, pageWrap.getModel().getCreator()); |
| | | queryWrapper.eq(Solutions::getCreator, pageWrap.getModel().getCreator()); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(Solutions::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.lambda().le(Solutions::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.ge(Solutions::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.le(Solutions::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | } |
| | | if (pageWrap.getModel().getEditor() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getEditor, pageWrap.getModel().getEditor()); |
| | | queryWrapper.eq(Solutions::getEditor, pageWrap.getModel().getEditor()); |
| | | } |
| | | if (pageWrap.getModel().getEditDate() != null) { |
| | | queryWrapper.lambda().ge(Solutions::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.lambda().le(Solutions::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.ge(Solutions::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.le(Solutions::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | } |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | queryWrapper.eq(Solutions::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getName() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getName, pageWrap.getModel().getName()); |
| | | queryWrapper.like(Solutions::getName, pageWrap.getModel().getName()); |
| | | } |
| | | if (pageWrap.getModel().getRemark() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getRemark, pageWrap.getModel().getRemark()); |
| | | queryWrapper.eq(Solutions::getRemark, pageWrap.getModel().getRemark()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.eq(Solutions::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | if (pageWrap.getModel().getSortnum() != null) { |
| | | queryWrapper.eq(Solutions::getSortnum, pageWrap.getModel().getSortnum()); |
| | | } |
| | | if (pageWrap.getModel().getInsuranceId() != null) { |
| | | queryWrapper.eq(Solutions::getInsuranceId, pageWrap.getModel().getInsuranceId()); |
| | | } |
| | | if (pageWrap.getModel().getValidType() != null) { |
| | | queryWrapper.eq(Solutions::getValidType, pageWrap.getModel().getValidType()); |
| | | } |
| | | if (pageWrap.getModel().getType() != null) { |
| | | queryWrapper.eq(Solutions::getType, pageWrap.getModel().getType()); |
| | | } |
| | | if (pageWrap.getModel().getMinAge() != null) { |
| | | queryWrapper.eq(Solutions::getMinAge, pageWrap.getModel().getMinAge()); |
| | | } |
| | | if (pageWrap.getModel().getMaxAge() != null) { |
| | | queryWrapper.eq(Solutions::getMaxAge, pageWrap.getModel().getMaxAge()); |
| | | } |
| | | if (pageWrap.getModel().getPrice() != null) { |
| | | queryWrapper.eq(Solutions::getPrice, pageWrap.getModel().getPrice()); |
| | | } |
| | | if (pageWrap.getModel().getTimeUnit() != null) { |
| | | queryWrapper.eq(Solutions::getTimeUnit, pageWrap.getModel().getTimeUnit()); |
| | | } |
| | | if (pageWrap.getModel().getInsureCycle() != null) { |
| | | queryWrapper.eq(Solutions::getInsureCycle, pageWrap.getModel().getInsureCycle()); |
| | | } |
| | | if (pageWrap.getModel().getInsureCycleUnit() != null) { |
| | | queryWrapper.eq(Solutions::getInsureCycleUnit, pageWrap.getModel().getInsureCycleUnit()); |
| | | } |
| | | if (pageWrap.getModel().getPriceCycleUnit() != null) { |
| | | queryWrapper.eq(Solutions::getPriceCycleUnit, pageWrap.getModel().getPriceCycleUnit()); |
| | | } |
| | | if (pageWrap.getModel().getSingleWorktype() != null) { |
| | | queryWrapper.eq(Solutions::getSingleWorktype, pageWrap.getModel().getSingleWorktype()); |
| | | } |
| | | if (pageWrap.getModel().getEmail() != null) { |
| | | queryWrapper.eq(Solutions::getEmail, pageWrap.getModel().getEmail()); |
| | | } |
| | | if (pageWrap.getModel().getSpecialAgreement() != null) { |
| | | queryWrapper.eq(Solutions::getSpecialAgreement, pageWrap.getModel().getSpecialAgreement()); |
| | | } |
| | | if (pageWrap.getModel().getSpecialInfo() != null) { |
| | | queryWrapper.eq(Solutions::getSpecialInfo, pageWrap.getModel().getSpecialInfo()); |
| | | } |
| | | if (pageWrap.getModel().getOrtherInfo() != null) { |
| | | queryWrapper.eq(Solutions::getOrtherInfo, pageWrap.getModel().getOrtherInfo()); |
| | | } |
| | | if (pageWrap.getModel().getSolutionBaseId() != null) { |
| | | queryWrapper.eq(Solutions::getSolutionBaseId, pageWrap.getModel().getSolutionBaseId()); |
| | | } |
| | | if (pageWrap.getModel().getVersion() != null) { |
| | | queryWrapper.eq(Solutions::getVersion, pageWrap.getModel().getVersion()); |
| | | } |
| | | if (pageWrap.getModel().getDataType() != null) { |
| | | queryWrapper.eq(Solutions::getDataType, pageWrap.getModel().getDataType()); |
| | | } |
| | | if (pageWrap.getModel().getBaseId() != null) { |
| | | queryWrapper.eq(Solutions::getBaseId, pageWrap.getModel().getBaseId()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | PageData<Solutions> pageData = PageData.from(solutionsJoinMapper.selectJoinPage(page,Solutions.class, queryWrapper)); |
| | | |
| | | return pageData; |
| | | } |
| | | @Override |
| | | public PageData<Solutions> findPageCom(PageWrap<Solutions> pageWrap) { |
| | | IPage<Solutions> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<Solutions> queryWrapper = new QueryWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | pageWrap.getModel().setDataType(Constants.ZERO);//只选择基表数据 |
| | | pageWrap.getModel().setStatus(Constants.ZERO); |
| | | pageWrap.getModel().setIsdeleted(Constants.ZERO); |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | queryWrapper.exists(("select b.id from company_solution b where b.isdeleted=0 and b.company_id="+user.getCompanyId()+" and b.SOLUTION_BASE_ID = solutions.id")); |
| | | if (pageWrap.getModel().getName() != null) { |
| | | queryWrapper.lambda().like(Solutions::getName, pageWrap.getModel().getName()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getStatus, pageWrap.getModel().getStatus()); |
| | |
| | | if (pageWrap.getModel().getInsuranceId() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getInsuranceId, pageWrap.getModel().getInsuranceId()); |
| | | } |
| | | if (pageWrap.getModel().getValidType() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getValidType, pageWrap.getModel().getValidType()); |
| | | } |
| | | if (pageWrap.getModel().getType() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getType, pageWrap.getModel().getType()); |
| | | } |
| | | if (pageWrap.getModel().getMinAge() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getMinAge, pageWrap.getModel().getMinAge()); |
| | | } |
| | | if (pageWrap.getModel().getMaxAge() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getMaxAge, pageWrap.getModel().getMaxAge()); |
| | | } |
| | | if (pageWrap.getModel().getPrice() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getPrice, pageWrap.getModel().getPrice()); |
| | | } |
| | | if (pageWrap.getModel().getTimeUnit() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getTimeUnit, pageWrap.getModel().getTimeUnit()); |
| | | } |
| | | if (pageWrap.getModel().getInsureCycle() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getInsureCycle, pageWrap.getModel().getInsureCycle()); |
| | | } |
| | | if (pageWrap.getModel().getInsureCycleUnit() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getInsureCycleUnit, pageWrap.getModel().getInsureCycleUnit()); |
| | | } |
| | | if (pageWrap.getModel().getPriceCycleUnit() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getPriceCycleUnit, pageWrap.getModel().getPriceCycleUnit()); |
| | | } |
| | | if (pageWrap.getModel().getSingleWorktype() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getSingleWorktype, pageWrap.getModel().getSingleWorktype()); |
| | | } |
| | | if (pageWrap.getModel().getEmail() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getEmail, pageWrap.getModel().getEmail()); |
| | | } |
| | | if (pageWrap.getModel().getSpecialAgreement() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getSpecialAgreement, pageWrap.getModel().getSpecialAgreement()); |
| | | } |
| | | if (pageWrap.getModel().getSpecialInfo() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getSpecialInfo, pageWrap.getModel().getSpecialInfo()); |
| | | } |
| | | if (pageWrap.getModel().getOrtherInfo() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getOrtherInfo, pageWrap.getModel().getOrtherInfo()); |
| | | } |
| | | if (pageWrap.getModel().getSolutionBaseId() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getSolutionBaseId, pageWrap.getModel().getSolutionBaseId()); |
| | | } |
| | | if (pageWrap.getModel().getVersion() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getVersion, pageWrap.getModel().getVersion()); |
| | | } |
| | | if (pageWrap.getModel().getDataType() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getDataType, pageWrap.getModel().getDataType()); |
| | | } |
| | | if (pageWrap.getModel().getBaseId() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getBaseId, pageWrap.getModel().getBaseId()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | queryWrapper.lambda().orderByAsc(Solutions::getInsuranceId); |
| | | return PageData.from(solutionsMapper.selectPage(page, queryWrapper)); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<Solutions> findListForCompany() { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | List<Solutions> solutionsList = solutionsJoinMapper.selectJoinList(Solutions.class,new MPJLambdaWrapper<Solutions>() |
| | | .selectAll(Solutions.class) |
| | | .leftJoin(CompanySolution.class,CompanySolution::getSolutionBaseId,Solutions::getId) |
| | | .eq(Solutions::getIsdeleted,Constants.ZERO) |
| | | .eq(Solutions::getDataType,Constants.TWO) |
| | | .eq(CompanySolution::getIsdeleted,Constants.ZERO) |
| | | .eq(CompanySolution::getCompanyId,user.getCompanyId()) |
| | | .orderByAsc(Solutions::getSortnum) |
| | | ); |
| | | return solutionsList; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public long count(Solutions solutions) { |
| | | QueryWrapper<Solutions> wrapper = new QueryWrapper<>(solutions); |
| | | return solutionsMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | |
| | | |
| | | } |