| | |
| | | import com.panzhihua.common.model.dtos.shop.PageComShopStoreDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.shop.PageShopStoreVO; |
| | | import com.panzhihua.common.model.vos.shop.PageShopStoreVO; |
| | | import com.panzhihua.service_community.dao.ComShopGoodsDAO; |
| | | import com.panzhihua.common.model.vos.shop.PageShopStoreVO; |
| | | import com.panzhihua.common.model.vos.shop.ShopStoreVO; |
| | | import com.panzhihua.service_community.dao.ComShopStoreDAO; |
| | | import com.panzhihua.service_community.model.dos.ComShopStoreDO; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @auther lyq |
| | |
| | | @Slf4j |
| | | @Service |
| | | public class ComShopStoreServiceImpl extends ServiceImpl<ComShopStoreDAO, ComShopStoreDO> implements ComShopStoreService { |
| | | |
| | | @Resource |
| | | private ComShopGoodsDAO shopGoodsDAO; |
| | | |
| | | /** |
| | | * 查询店铺列表 |
| | | * @param pageComShopStoreDTO 请求参数 |
| | | * @return 店铺列表 |
| | | */ |
| | | |
| | | @Override |
| | | public R pageStoreList(PageComShopStoreDTO pageComShopStoreDTO) { |
| | | Page page = new Page<>(pageComShopStoreDTO.getPageNum(), pageComShopStoreDTO.getPageSize()); |
| | | IPage<PageShopStoreVO> comShopStoreVOIPage = this.baseMapper.pageShopStore(page, pageComShopStoreDTO); |
| | | return R.ok(comShopStoreVOIPage); |
| | | } |
| | | |
| | | /** |
| | | * 查询店铺详情 |
| | | * @param comShopStoreDTO 请求参数 |
| | | * @return 店铺详情 |
| | | */ |
| | | @Override |
| | | public R shopStoreDetail(PageComShopStoreDTO comShopStoreDTO) { |
| | | //查询店铺 |
| | | ComShopStoreDO storeDO = this.baseMapper.selectById(comShopStoreDTO.getStoreId()); |
| | | if (storeDO == null) { |
| | | return R.fail(401,"店铺不存在"); |
| | | } |
| | | if(storeDO.getStatus().equals(ComShopStoreDO.status.no)){ |
| | | return R.fail(402,"店铺已被禁用"); |
| | | } |
| | | PageShopStoreVO shopStoreVO = new PageShopStoreVO(); |
| | | BeanUtils.copyProperties(storeDO, shopStoreVO); |
| | | |
| | | //查询店铺下商品信息 |
| | | Page page = new Page<>(comShopStoreDTO.getPageNum(), comShopStoreDTO.getPageSize()); |
| | | shopStoreVO.setGoodsList(shopGoodsDAO.pageShopGoodsByStoreId(page, comShopStoreDTO).getRecords()); |
| | | |
| | | return R.ok(shopStoreVO); |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public R deleteStore(Long[] id) { |
| | | ComShopStoreDO storeDO = new ComShopStoreDO(); |
| | | storeDO.setDeleteStatus(2); |
| | | LambdaQueryWrapper<ComShopStoreDO> query = new LambdaQueryWrapper<ComShopStoreDO>().eq(ComShopStoreDO::getId, id); |
| | | int update = this.baseMapper.update(storeDO, query); |
| | | LambdaQueryWrapper<ComShopStoreDO> query = new LambdaQueryWrapper<ComShopStoreDO>().in(ComShopStoreDO::getId, id); |
| | | ComShopStoreDO comShopStoreDO = this.baseMapper.selectOne(query); |
| | | comShopStoreDO.setDeleteStatus(2); |
| | | int update = this.baseMapper.updateById(comShopStoreDO); |
| | | return update > 0 ? R.ok() : R.fail(); |
| | | } |
| | | |
| | |
| | | BeanUtils.copyProperties(comShopStoreDO,shopStoreVO); |
| | | return R.ok(shopStoreVO); |
| | | } |
| | | |
| | | @Override |
| | | public R getUserStoreInfo(Long userId) { |
| | | ComShopStoreDO comShopStoreDO = this.baseMapper.selectOne(new LambdaQueryWrapper<ComShopStoreDO>().eq(ComShopStoreDO::getDeleteStatus, 1).eq(ComShopStoreDO::getSysUserId, userId)); |
| | | if (comShopStoreDO == null) { |
| | | R.fail(500,"商铺不存在"); |
| | | } |
| | | ShopStoreVO shopStoreVO = new ShopStoreVO(); |
| | | BeanUtils.copyProperties(comShopStoreDO,shopStoreVO); |
| | | return R.ok(shopStoreVO); |
| | | } |
| | | } |