| package doumeemes.service.business.impl; | 
|   | 
| import doumeemes.core.model.PageData; | 
| import doumeemes.core.model.PageWrap; | 
| import doumeemes.core.utils.Utils; | 
| import doumeemes.dao.business.CompanyAuthMapper; | 
| import doumeemes.dao.business.model.CompanyAuth; | 
| import doumeemes.service.business.CompanyAuthService; | 
| 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 2022/04/20 09:33 | 
|  */ | 
| @Service | 
| public class CompanyAuthServiceImpl implements CompanyAuthService { | 
|   | 
|     @Autowired | 
|     private CompanyAuthMapper companyAuthMapper; | 
|   | 
|     @Override | 
|     public Integer create(CompanyAuth companyAuth) { | 
|         companyAuthMapper.insert(companyAuth); | 
|         return companyAuth.getId(); | 
|     } | 
|   | 
|     @Override | 
|     public void deleteById(Integer id) { | 
|         companyAuthMapper.deleteById(id); | 
|     } | 
|   | 
|     @Override | 
|     public void delete(CompanyAuth companyAuth) { | 
|         UpdateWrapper<CompanyAuth> deleteWrapper = new UpdateWrapper<>(companyAuth); | 
|         companyAuthMapper.delete(deleteWrapper); | 
|     } | 
|   | 
|     @Override | 
|     public void deleteByIdInBatch(List<Integer> ids) { | 
|         if (CollectionUtils.isEmpty(ids)) { | 
|             return; | 
|         } | 
|         companyAuthMapper.deleteBatchIds(ids); | 
|     } | 
|   | 
|     @Override | 
|     public void updateById(CompanyAuth companyAuth) { | 
|         companyAuthMapper.updateById(companyAuth); | 
|     } | 
|   | 
|     @Override | 
|     public void updateByIdInBatch(List<CompanyAuth> companyAuths) { | 
|         if (CollectionUtils.isEmpty(companyAuths)) { | 
|             return; | 
|         } | 
|         for (CompanyAuth companyAuth: companyAuths) { | 
|             this.updateById(companyAuth); | 
|         } | 
|     } | 
|   | 
|     @Override | 
|     public CompanyAuth findById(Integer id) { | 
|         return companyAuthMapper.selectById(id); | 
|     } | 
|   | 
|     @Override | 
|     public CompanyAuth findOne(CompanyAuth companyAuth) { | 
|         QueryWrapper<CompanyAuth> wrapper = new QueryWrapper<>(companyAuth); | 
|         return companyAuthMapper.selectOne(wrapper); | 
|     } | 
|   | 
|     @Override | 
|     public List<CompanyAuth> findList(CompanyAuth companyAuth) { | 
|         QueryWrapper<CompanyAuth> wrapper = new QueryWrapper<>(companyAuth); | 
|         return companyAuthMapper.selectList(wrapper); | 
|     } | 
|    | 
|     @Override | 
|     public PageData<CompanyAuth> findPage(PageWrap<CompanyAuth> pageWrap) { | 
|         IPage<CompanyAuth> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); | 
|         QueryWrapper<CompanyAuth> queryWrapper = new QueryWrapper<>(); | 
|         Utils.MP.blankToNull(pageWrap.getModel()); | 
|         if (pageWrap.getModel().getId() != null) { | 
|             queryWrapper.lambda().eq(CompanyAuth::getId, pageWrap.getModel().getId()); | 
|         } | 
|         if (pageWrap.getModel().getDeleted() != null) { | 
|             queryWrapper.lambda().eq(CompanyAuth::getDeleted, pageWrap.getModel().getDeleted()); | 
|         } | 
|         if (pageWrap.getModel().getCreateUser() != null) { | 
|             queryWrapper.lambda().eq(CompanyAuth::getCreateUser, pageWrap.getModel().getCreateUser()); | 
|         } | 
|         if (pageWrap.getModel().getCreateTime() != null) { | 
|             queryWrapper.lambda().ge(CompanyAuth::getCreateTime, Utils.Date.getStart(pageWrap.getModel().getCreateTime())); | 
|             queryWrapper.lambda().le(CompanyAuth::getCreateTime, Utils.Date.getEnd(pageWrap.getModel().getCreateTime())); | 
|         } | 
|         if (pageWrap.getModel().getUpdateUser() != null) { | 
|             queryWrapper.lambda().eq(CompanyAuth::getUpdateUser, pageWrap.getModel().getUpdateUser()); | 
|         } | 
|         if (pageWrap.getModel().getUpdateTime() != null) { | 
|             queryWrapper.lambda().ge(CompanyAuth::getUpdateTime, Utils.Date.getStart(pageWrap.getModel().getUpdateTime())); | 
|             queryWrapper.lambda().le(CompanyAuth::getUpdateTime, Utils.Date.getEnd(pageWrap.getModel().getUpdateTime())); | 
|         } | 
|         if (pageWrap.getModel().getRemark() != null) { | 
|             queryWrapper.lambda().eq(CompanyAuth::getRemark, pageWrap.getModel().getRemark()); | 
|         } | 
|         if (pageWrap.getModel().getCompanyId() != null) { | 
|             queryWrapper.lambda().eq(CompanyAuth::getCompanyId, pageWrap.getModel().getCompanyId()); | 
|         } | 
|         if (pageWrap.getModel().getStatus() != null) { | 
|             queryWrapper.lambda().eq(CompanyAuth::getStatus, pageWrap.getModel().getStatus()); | 
|         } | 
|         for(PageWrap.SortData sortData: pageWrap.getSorts()) { | 
|             if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { | 
|                 queryWrapper.orderByDesc(sortData.getProperty()); | 
|             } else { | 
|                 queryWrapper.orderByAsc(sortData.getProperty()); | 
|             } | 
|         } | 
|         return PageData.from(companyAuthMapper.selectPage(page, queryWrapper)); | 
|     } | 
|   | 
|     @Override | 
|     public long count(CompanyAuth companyAuth) { | 
|         QueryWrapper<CompanyAuth> wrapper = new QueryWrapper<>(companyAuth); | 
|         return companyAuthMapper.selectCount(wrapper); | 
|     } | 
| } |