package com.zhongzheng.controller.mall; import java.util.List; import java.util.Arrays; import com.zhongzheng.modules.top.mall.bo.TopStoreAddBo; import com.zhongzheng.modules.top.mall.bo.TopStoreEditBo; import com.zhongzheng.modules.top.mall.bo.TopStoreQueryBo; import com.zhongzheng.modules.top.mall.service.ITopStoreService; import com.zhongzheng.modules.top.mall.vo.TopStoreVo; import lombok.RequiredArgsConstructor; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.zhongzheng.common.annotation.Log; import com.zhongzheng.common.core.controller.BaseController; import com.zhongzheng.common.core.domain.AjaxResult; import com.zhongzheng.common.enums.BusinessType; import com.zhongzheng.common.utils.poi.ExcelUtil; import com.zhongzheng.common.core.page.TableDataInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; /** * 商户店铺管理Controller * * @author hjl * @date 2023-05-18 */ @Api(value = "商户店铺管理控制器", tags = {"商户店铺管理管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/mall/store") public class TopStoreController extends BaseController { private final ITopStoreService iTopStoreService; /** * 查询商户店铺管理列表 */ @ApiOperation("查询商户店铺管理列表") @PreAuthorize("@ss.hasPermi('system:store:list')") @GetMapping("/list") public TableDataInfo list(TopStoreQueryBo bo) { startPage(); List list = iTopStoreService.queryList(bo); return getDataTable(list); } /** * 导出商户店铺管理列表 */ @ApiOperation("导出商户店铺管理列表") @PreAuthorize("@ss.hasPermi('system:store:export')") @Log(title = "商户店铺管理", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(TopStoreQueryBo bo) { List list = iTopStoreService.queryList(bo); ExcelUtil util = new ExcelUtil(TopStoreVo.class); return util.exportExcel(list, "商户店铺管理"); } /** * 获取商户店铺管理详细信息 */ @ApiOperation("获取商户店铺管理详细信息") @PreAuthorize("@ss.hasPermi('system:store:query')") @GetMapping("/{storeId}") public AjaxResult getInfo(@PathVariable("storeId" ) Long storeId) { return AjaxResult.success(iTopStoreService.queryById(storeId)); } /** * 新增商户店铺管理 */ @ApiOperation("新增商户店铺管理") @PreAuthorize("@ss.hasPermi('system:store:add')") @Log(title = "商户店铺管理", businessType = BusinessType.INSERT) @PostMapping() public AjaxResult add(@RequestBody TopStoreAddBo bo) { return toAjax(iTopStoreService.insertByAddBo(bo) ? 1 : 0); } /** * 修改商户店铺管理 */ @ApiOperation("修改商户店铺管理") @PreAuthorize("@ss.hasPermi('system:store:edit')") @Log(title = "商户店铺管理", businessType = BusinessType.UPDATE) @PostMapping("/edit") public AjaxResult edit(@RequestBody TopStoreEditBo bo) { return toAjax(iTopStoreService.updateByEditBo(bo) ? 1 : 0); } /** * 删除商户店铺管理 */ @ApiOperation("删除商户店铺管理") @PreAuthorize("@ss.hasPermi('system:store:remove')") @Log(title = "商户店铺管理" , businessType = BusinessType.DELETE) @DeleteMapping("/{storeIds}") public AjaxResult remove(@PathVariable Long[] storeIds) { return toAjax(iTopStoreService.deleteWithValidByIds(Arrays.asList(storeIds), true) ? 1 : 0); } }