| ¶Ô±ÈÐÂÎļþ | 
|  |  |  | 
|---|
|  |  |  | package com.doumee.service.business.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.utils.Utils; | 
|---|
|  |  |  | import com.doumee.dao.business.SolutionsBaseMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.model.SolutionsBase; | 
|---|
|  |  |  | import com.doumee.service.business.SolutionsBaseService; | 
|---|
|  |  |  | 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 org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.util.CollectionUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * ä¿é©æ¹æ¡ä¿¡æ¯è¡¨Serviceå®ç° | 
|---|
|  |  |  | * @author æ±è¹è¹ | 
|---|
|  |  |  | * @date 2024/10/28 19:16 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Service | 
|---|
|  |  |  | public class SolutionsBaseServiceImpl implements SolutionsBaseService { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SolutionsBaseMapper solutionsBaseMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer create(SolutionsBase solutionsBase) { | 
|---|
|  |  |  | solutionsBaseMapper.insert(solutionsBase); | 
|---|
|  |  |  | return solutionsBase.getId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void deleteById(Integer id) { | 
|---|
|  |  |  | solutionsBaseMapper.deleteById(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void delete(SolutionsBase solutionsBase) { | 
|---|
|  |  |  | UpdateWrapper<SolutionsBase> deleteWrapper = new UpdateWrapper<>(solutionsBase); | 
|---|
|  |  |  | solutionsBaseMapper.delete(deleteWrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void deleteByIdInBatch(List<Integer> ids) { | 
|---|
|  |  |  | if (CollectionUtils.isEmpty(ids)) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | solutionsBaseMapper.deleteBatchIds(ids); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void updateById(SolutionsBase solutionsBase) { | 
|---|
|  |  |  | solutionsBaseMapper.updateById(solutionsBase); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void updateByIdInBatch(List<SolutionsBase> solutionsBases) { | 
|---|
|  |  |  | if (CollectionUtils.isEmpty(solutionsBases)) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (SolutionsBase solutionsBase: solutionsBases) { | 
|---|
|  |  |  | this.updateById(solutionsBase); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public SolutionsBase findById(Integer id) { | 
|---|
|  |  |  | return solutionsBaseMapper.selectById(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public SolutionsBase findOne(SolutionsBase solutionsBase) { | 
|---|
|  |  |  | QueryWrapper<SolutionsBase> wrapper = new QueryWrapper<>(solutionsBase); | 
|---|
|  |  |  | return solutionsBaseMapper.selectOne(wrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<SolutionsBase> findList(SolutionsBase solutionsBase) { | 
|---|
|  |  |  | QueryWrapper<SolutionsBase> wrapper = new QueryWrapper<>(solutionsBase); | 
|---|
|  |  |  | return solutionsBaseMapper.selectList(wrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public PageData<SolutionsBase> findPage(PageWrap<SolutionsBase> pageWrap) { | 
|---|
|  |  |  | IPage<SolutionsBase> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); | 
|---|
|  |  |  | QueryWrapper<SolutionsBase> queryWrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | Utils.MP.blankToNull(pageWrap.getModel()); | 
|---|
|  |  |  | if (pageWrap.getModel().getId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getId, pageWrap.getModel().getId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getCreator() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getCreator, pageWrap.getModel().getCreator()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getCreateDate() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().ge(SolutionsBase::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); | 
|---|
|  |  |  | queryWrapper.lambda().le(SolutionsBase::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getEditor() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getEditor, pageWrap.getModel().getEditor()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getEditDate() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().ge(SolutionsBase::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); | 
|---|
|  |  |  | queryWrapper.lambda().le(SolutionsBase::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getIsdeleted() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getIsdeleted, pageWrap.getModel().getIsdeleted()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getName() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getName, pageWrap.getModel().getName()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getRemark() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getRemark, pageWrap.getModel().getRemark()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getStatus() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getStatus, pageWrap.getModel().getStatus()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getSortnum() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getSortnum, pageWrap.getModel().getSortnum()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getInsuranceId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getInsuranceId, pageWrap.getModel().getInsuranceId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getValidType() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getValidType, pageWrap.getModel().getValidType()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getMinAge() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getMinAge, pageWrap.getModel().getMinAge()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getMaxAge() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getMaxAge, pageWrap.getModel().getMaxAge()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getSingleWorktype() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getSingleWorktype, pageWrap.getModel().getSingleWorktype()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getSpecialAgreement() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getSpecialAgreement, pageWrap.getModel().getSpecialAgreement()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getSpecialInfo() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getSpecialInfo, pageWrap.getModel().getSpecialInfo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getOrtherInfo() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getOrtherInfo, pageWrap.getModel().getOrtherInfo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getVersion() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getVersion, pageWrap.getModel().getVersion()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getDataType() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getDataType, pageWrap.getModel().getDataType()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getBaseId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getBaseId, pageWrap.getModel().getBaseId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getSignKeyword() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getSignKeyword, pageWrap.getModel().getSignKeyword()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getValidTypeNum() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getValidTypeNum, pageWrap.getModel().getValidTypeNum()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getShopId() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getShopId, pageWrap.getModel().getShopId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getAddValidDays() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getAddValidDays, pageWrap.getModel().getAddValidDays()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getDelValidDays() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getDelValidDays, pageWrap.getModel().getDelValidDays()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getCanAdd() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getCanAdd, pageWrap.getModel().getCanAdd()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getCanReduce() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getCanReduce, pageWrap.getModel().getCanReduce()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getCanChangeUnit() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getCanChangeUnit, pageWrap.getModel().getCanChangeUnit()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getDelOnlyReplace() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getDelOnlyReplace, pageWrap.getModel().getDelOnlyReplace()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getCompanyName() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(SolutionsBase::getCompanyName, pageWrap.getModel().getCompanyName()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for(PageWrap.SortData sortData: pageWrap.getSorts()) { | 
|---|
|  |  |  | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { | 
|---|
|  |  |  | queryWrapper.orderByDesc(sortData.getProperty()); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | queryWrapper.orderByAsc(sortData.getProperty()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return PageData.from(solutionsBaseMapper.selectPage(page, queryWrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public long count(SolutionsBase solutionsBase) { | 
|---|
|  |  |  | QueryWrapper<SolutionsBase> wrapper = new QueryWrapper<>(solutionsBase); | 
|---|
|  |  |  | return solutionsBaseMapper.selectCount(wrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|