| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain.TFoundationConfig; |
| | | import com.ruoyi.system.domain.TGoodsType; |
| | |
| | | TShop shop = shopService.getById(shopId); |
| | | LambdaQueryWrapper<TGoodsType> wrapper = new LambdaQueryWrapper<>(); |
| | | if(roleType != 1){ |
| | | wrapper.eq(TGoodsType::getMealType, shop.getMealType()); |
| | | if(roleType == 2){ |
| | | wrapper.eq(TGoodsType::getMealType, shop.getMealType()); |
| | | }else { |
| | | wrapper.isNull(TGoodsType::getMealType); |
| | | } |
| | | } |
| | | return AjaxResult.success(goodsTypeService.list(wrapper)); |
| | | } |
| | |
| | | /** |
| | | * 添加商品分类管理 |
| | | */ |
| | | @Log(title = "商品分类-添加商品分类", businessType = BusinessType.INSERT) |
| | | @ApiOperation( value = "添加商品分类") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TGoodsType dto) { |
| | | Long shopId = tokenService.getLoginUser().getObjectId(); |
| | | TShop shop = shopService.getById(shopId); |
| | | dto.setMealType(shop.getMealType()); |
| | | dto.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | dto.setShopId(shopId); |
| | | return AjaxResult.success(goodsTypeService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改商品分类 |
| | | */ |
| | | @Log(title = "商品分类-修改商品分类", businessType = BusinessType.UPDATE) |
| | | @ApiOperation( value = "修改商品分类") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<Boolean> update(@RequestBody TGoodsType dto) { |
| | |
| | | /** |
| | | * 删除商品分类 |
| | | */ |
| | | @Log(title = "商品分类-删除商品分类", businessType = BusinessType.DELETE) |
| | | @ApiOperation( value = "删除商品分类") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam("id") Long id) { |
| | |
| | | /** |
| | | * 批量删除商品分类 |
| | | */ |
| | | @Log(title = "商品分类-批量删除商品分类", businessType = BusinessType.DELETE) |
| | | @ApiOperation( value = "批量删除商品分类") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Long> ids) { |