| | |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.utils.AppContants; |
| | | import cc.mrbird.febs.mall.conversion.MallGoodsConversion; |
| | | import cc.mrbird.febs.mall.dto.*; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | public IPage<AdminMallGoodsVo> getCategoryListInPage(MallGoods mallGoods, QueryRequest request) { |
| | | Page<AdminMallGoodsVo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<AdminMallGoodsVo> adminMallGoodsVos = this.baseMapper.selectMallGoodsInPage(page, mallGoods); |
| | | return adminMallGoodsVos; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<AdminMallGoodsVo> getAppCategoryListInPage(MallGoods mallGoods, QueryRequest request) { |
| | | Page<AdminMallGoodsVo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<AdminMallGoodsVo> adminMallGoodsVos = this.baseMapper.selectMallAppGoodsInPage(page, mallGoods); |
| | | return adminMallGoodsVos; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public FebsResponse addMallAppGoods(AddMallGoodsDto addMallGoodsDto) { |
| | | String goodsNo = addMallGoodsDto.getGoodsNo(); |
| | | Integer mallGoodsByGoodsNo = mallGoodsMapper.selectMallGoodsCountByGoodsNo(goodsNo); |
| | | if (mallGoodsByGoodsNo > 0) { |
| | | return new FebsResponse().fail().message("商品编号不能重复"); |
| | | } |
| | | //新增商品 |
| | | MallGoods mallGoods = MallGoodsConversion.INSTANCE.dtoToEntity(addMallGoodsDto); |
| | | mallGoods.setIsSale(MallGoods.ISSALE_STATUS_DISABLED); |
| | | mallGoods.setIsApp(AppContants.IS_APP_GOODS); |
| | | mallGoodsMapper.insert(mallGoods); |
| | | return new FebsResponse().success().message("添加成功"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse updateAppMallGoods(MallGoodsUpdateDto mallGoodsUpdateDto) { |
| | | //新增商品 |
| | | MallGoods mallGoods = mallGoodsMapper.selectById(mallGoodsUpdateDto.getId()); |
| | | BeanUtil.copyProperties(mallGoodsUpdateDto, mallGoods); |
| | | mallGoodsMapper.updateById(mallGoods); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public List<AdminMallGoodsTreeVo> getAllGoodsTree() { |
| | | return mallGoodsMapper.getAllGoodsTree(); |
| | | } |
| | |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<AdminHomeDeliverySettingVo> getDeliveryHomeListInPage(AdminHomeDeliverySettingVo adminHomeDeliverySetting, QueryRequest request) { |
| | | Page<DataDictionaryCustom> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<DataDictionaryCustom> dataDictionaryCustomIPage = this.baseMapper.getDeliveryHomeListInPage(page, adminHomeDeliverySetting); |
| | | List<DataDictionaryCustom> records = dataDictionaryCustomIPage.getRecords(); |
| | | List<AdminHomeDeliverySettingVo> adminHomeDeliverySettingVos = new ArrayList<>(); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(DataDictionaryCustom dataDictionaryCustom : records){ |
| | | AdminHomeDeliverySettingVo adminHomeDeliverySettingVo = JSONUtil.toBean(dataDictionaryCustom.getValue(), AdminHomeDeliverySettingVo.class); |
| | | adminHomeDeliverySettingVo.setId(dataDictionaryCustom.getId()); |
| | | adminHomeDeliverySettingVos.add(adminHomeDeliverySettingVo); |
| | | } |
| | | } |
| | | IPage<AdminHomeDeliverySettingVo> adminHomeDeliverySettingVoIPage = new Page<>(); |
| | | adminHomeDeliverySettingVoIPage.setRecords(adminHomeDeliverySettingVos); |
| | | adminHomeDeliverySettingVoIPage.setTotal(dataDictionaryCustomIPage.getTotal()); |
| | | return adminHomeDeliverySettingVoIPage; |
| | | } |
| | | |
| | | |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | @Override |
| | | public FebsResponse deliveryHomeUpdate(AdminHomeDeliverySettingVo adminHomeDeliverySettingVo) { |
| | | DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectById(adminHomeDeliverySettingVo.getId()); |
| | | adminHomeDeliverySettingVo.setId(null); |
| | | dataDictionaryCustom.setValue(JSONUtil.toJsonStr(adminHomeDeliverySettingVo)); |
| | | dataDictionaryCustomMapper.updateById(dataDictionaryCustom); |
| | | return new FebsResponse().success(); |
| | | } |
| | | } |