| | |
| | | import com.doumee.dao.business.SolutionWorktypeMapper; |
| | | import com.doumee.dao.business.SolutionsMapper; |
| | | 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.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 java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private SolutionsMapper solutionsMapper; |
| | | @Autowired |
| | | private SolutionsJoinMapper solutionsJoinMapper; |
| | | @Autowired |
| | | private WorktypeMapper worktypeMapper; |
| | | @Autowired |
| | | private SolutionWorktypeMapper solutionWorktypeMapper; |
| | | private SolutionWorktypeJoinMapper solutionWorktypeJoinMapper; |
| | | @Autowired |
| | | private InsuranceMapper insuranceMapper; |
| | | |
| | |
| | | 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.setCreateDate(solutions.getCreateDate()); |
| | | w.setWorktypeId(type.getId()); |
| | | w.setStatus(Constants.ZERO); |
| | | solutionWorktypeMapper.insert(w); |
| | | w.setSortnum(num++); |
| | | solutionWorktypeJoinMapper.insert(w); |
| | | |
| | | //历史版本的工种信息 |
| | | SolutionWorktype newType = new SolutionWorktype(); |
| | | BeanUtils.copyProperties(w, newType); |
| | | newType.setSolutionId(newModel.getId()); |
| | | solutionWorktypeMapper.insert(newType); |
| | | solutionWorktypeJoinMapper.insert(newType); |
| | | } |
| | | |
| | | } |
| | |
| | | solutionsMapper.insert(newModel); |
| | | |
| | | //删除所有工种数据 |
| | | solutionWorktypeMapper.delete(new UpdateWrapper<SolutionWorktype>() |
| | | solutionWorktypeJoinMapper.delete(new UpdateWrapper<SolutionWorktype>() |
| | | .lambda() |
| | | .eq(SolutionWorktype::getSolutionId,solutions.getId()) |
| | | ); |
| | |
| | | } |
| | | @Override |
| | | public Solutions findById(Integer id) { |
| | | return solutionsMapper.selectById(id); |
| | | Solutions model = solutionsMapper.selectById(id); |
| | | 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 |
| | |
| | | queryWrapper.lambda().eq(Solutions::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getName() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getName, pageWrap.getModel().getName()); |
| | | queryWrapper.lambda().like(Solutions::getName, pageWrap.getModel().getName()); |
| | | } |
| | | if (pageWrap.getModel().getRemark() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getRemark, pageWrap.getModel().getRemark()); |
| | |
| | | } |
| | | return PageData.from(solutionsMapper.selectPage(page, queryWrapper)); |
| | | } |
| | | @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().getSortnum() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getSortnum, pageWrap.getModel().getSortnum()); |
| | | } |
| | | if (pageWrap.getModel().getInsuranceId() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getInsuranceId, pageWrap.getModel().getInsuranceId()); |
| | | } |
| | | if (pageWrap.getModel().getBaseId() != null) { |
| | | queryWrapper.lambda().eq(Solutions::getBaseId, pageWrap.getModel().getBaseId()); |
| | | } |
| | | queryWrapper.lambda().orderByAsc(Solutions::getInsuranceId); |
| | | return PageData.from(solutionsMapper.selectPage(page, queryWrapper)); |
| | | } |
| | | |
| | | @Override |
| | | public long count(Solutions solutions) { |
| | | QueryWrapper<Solutions> wrapper = new QueryWrapper<>(solutions); |
| | | return solutionsMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | |
| | | } |