package com.fjhx.jushuitan.controller.shop;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.jushuitan.entity.shop.dto.ShopInfoDto;
import com.fjhx.jushuitan.entity.shop.dto.ShopInfoSelectDto;
import com.fjhx.jushuitan.entity.shop.vo.ShopInfoVo;
import com.fjhx.jushuitan.service.shop.ShopInfoService;
import com.ruoyi.common.core.domain.BaseSelectDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 * 店铺管理 前端控制器
 * </p>
 *
 * @author
 * @since 2024-01-07
 */
@RestController
@RequestMapping("/shopInfo")
public class ShopInfoController {

    @Autowired
    private ShopInfoService shopInfoService;

    /**
     * 店铺管理分页
     */
    @PostMapping("/page")
    public Page<ShopInfoVo> page(@RequestBody ShopInfoSelectDto dto) {
        return shopInfoService.getPage(dto);
    }

    /**
     * 店铺管理明细
     */
    @PostMapping("/detail")
    public ShopInfoVo detail(@RequestBody BaseSelectDto dto) {
        return shopInfoService.detail(dto.getId());
    }

    /**
     * 店铺管理新增
     */
    @PostMapping("/add")
    public void add(@RequestBody ShopInfoDto shopInfoDto) {
        shopInfoService.add(shopInfoDto);
    }

    /**
     * 店铺管理编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody ShopInfoDto shopInfoDto) {
        shopInfoService.edit(shopInfoDto);
    }

    /**
     * 店铺管理删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        shopInfoService.delete(dto.getId());
    }

}
