| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.common.model.dtos.shop.PageComShopGoodsDTO; |
| | | import com.panzhihua.common.model.dtos.shop.PageComShopStoreDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.shop.ComShopStoreVO; |
| | | import com.panzhihua.common.model.vos.shop.ShopGoodsVO; |
| | | import com.panzhihua.common.model.vos.shop.ShopStoreVO; |
| | | import com.panzhihua.service_community.dao.ComShopStoreDAO; |
| | | import com.panzhihua.service_community.model.dos.ComShopGoodsDO; |
| | | import com.panzhihua.service_community.model.dos.ComShopStoreDO; |
| | | import com.panzhihua.service_community.service.ComShopStoreService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | @Slf4j |
| | | @Service |
| | | public class ComShopStoreServiceImpl extends ServiceImpl<ComShopStoreDAO, ComShopStoreDO> implements ComShopStoreService { |
| | | |
| | | @Override |
| | | public R pageStoreList(PageComShopStoreDTO pageComShopStoreDTO){ |
| | | Page page = new Page<>(pageComShopStoreDTO.getPageNum(),pageComShopStoreDTO.getPageSize()); |
| | | return R.ok(this.baseMapper.pageShopStore(page,pageComShopStoreDTO)); |
| | | public R pageStoreList(PageComShopStoreDTO pageComShopStoreDTO) { |
| | | Page page = new Page<>(pageComShopStoreDTO.getPageNum(), pageComShopStoreDTO.getPageSize()); |
| | | IPage<ComShopStoreVO> comShopStoreVOIPage = this.baseMapper.pageShopStore(page, pageComShopStoreDTO); |
| | | return R.ok(comShopStoreVOIPage); |
| | | } |
| | | |
| | | @Override |
| | | public R saveStore(ShopStoreVO storeVO) { |
| | | if (storeVO == null) { |
| | | return R.ok("500", "数据为空!"); |
| | | } |
| | | ComShopStoreDO storeDO = new ComShopStoreDO(); |
| | | BeanUtils.copyProperties(storeVO, storeDO); |
| | | storeDO.setSale(0); |
| | | this.baseMapper.insert(storeDO); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public R editStore(Long id, ShopStoreVO storeVO) { |
| | | if (storeVO == null) { |
| | | return R.ok("500", "数据为空!"); |
| | | } |
| | | LambdaQueryWrapper<ComShopStoreDO> query = new LambdaQueryWrapper<ComShopStoreDO>().eq(ComShopStoreDO::getId, id); |
| | | ComShopStoreDO storeDO = new ComShopStoreDO(); |
| | | BeanUtils.copyProperties(storeVO, storeDO); |
| | | int update = this.baseMapper.update(storeDO, query); |
| | | return update > 0 ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @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); |
| | | return update > 0 ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @Override |
| | | public R getOneInfo(Long id) { |
| | | ComShopStoreDO comShopStoreDO = this.baseMapper.selectById(id); |
| | | if (comShopStoreDO == null) { |
| | | R.fail(500,"商铺不存在"); |
| | | } |
| | | ShopStoreVO shopStoreVO = new ShopStoreVO(); |
| | | BeanUtils.copyProperties(comShopStoreDO,shopStoreVO); |
| | | return R.ok(shopStoreVO); |
| | | } |
| | | } |