| | |
| | | package com.jilongda.manage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.jilongda.common.basic.PageInfo; |
| | | import com.jilongda.manage.model.TBrand; |
| | | import com.jilongda.manage.model.TMaterial; |
| | | import com.jilongda.manage.model.TModel; |
| | | import com.jilongda.manage.model.TSupplier; |
| | | import com.jilongda.manage.mapper.TSupplierMapper; |
| | | import com.jilongda.manage.query.TSupplierQuery; |
| | | import com.jilongda.manage.service.TSupplierService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.jilongda.manage.vo.TModelVO; |
| | | import com.jilongda.manage.vo.TSupplierVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TSupplierServiceImpl extends ServiceImpl<TSupplierMapper, TSupplier> implements TSupplierService { |
| | | |
| | | @Override |
| | | public PageInfo<TSupplierVO> pageList(TSupplierQuery query) { |
| | | PageInfo<TSupplierVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TSupplierVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean isExit(Integer id, String name) { |
| | | if(Objects.nonNull(id)){ |
| | | return this.count(Wrappers.lambdaQuery(TSupplier.class) |
| | | .ne(TSupplier::getId, id).eq(TSupplier::getName, name)) > 0; |
| | | }else { |
| | | // 如果是新增,则判断名称是否存在 |
| | | return count(Wrappers.lambdaQuery(TSupplier.class).eq(TSupplier::getName, name)) > 0; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Boolean upAndDown(Long id, Integer status) { |
| | | TSupplier supplier = this.baseMapper.selectById(id); |
| | | supplier.setStatus(status); |
| | | return this.updateById(supplier); |
| | | } |
| | | |
| | | } |