package com.zhongzheng.controller.goods; import java.util.List; import java.util.Arrays; import com.zhongzheng.modules.goods.bo.GoodsSpecAddBo; import com.zhongzheng.modules.goods.bo.GoodsSpecTemplateAddBo; import com.zhongzheng.modules.goods.bo.GoodsSpecTemplateEditBo; import com.zhongzheng.modules.goods.bo.GoodsSpecTemplateQueryBo; import com.zhongzheng.modules.goods.service.IGoodsSpecTemplateService; import com.zhongzheng.modules.goods.vo.GoodsSpecAttrDetailVo; import com.zhongzheng.modules.goods.vo.GoodsSpecAttrListVo; import com.zhongzheng.modules.goods.vo.GoodsSpecAttributeRelationVo; import com.zhongzheng.modules.goods.vo.GoodsSpecTemplateVo; 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 ruoyi * @date 2022-09-29 */ @Api(value = "规格模板控制器", tags = {"规格模板管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/template") public class GoodsSpecTemplateController extends BaseController { private final IGoodsSpecTemplateService iGoodsSpecTemplateService; /** * 查询模板列表 */ @ApiOperation("查询模板列表") @GetMapping("/list") public TableDataInfo list(GoodsSpecTemplateQueryBo bo) { startPage(); List list = iGoodsSpecTemplateService.queryList(bo); return getDataTable(list); } /** * 导出【请填写功能名称】列表 */ @ApiOperation("导出【请填写功能名称】列表") @PreAuthorize("@ss.hasPermi('system:template:export')") @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(GoodsSpecTemplateQueryBo bo) { List list = iGoodsSpecTemplateService.queryList(bo); ExcelUtil util = new ExcelUtil(GoodsSpecTemplateVo.class); return util.exportExcel(list, "【请填写功能名称】"); } /** * 获取规格模板详细信息 */ @ApiOperation("获取规格模板详细信息") @GetMapping("/detail/{specTemplateId}") public AjaxResult getInfo(@PathVariable("specTemplateId" ) Long specTemplateId) { return AjaxResult.success(iGoodsSpecTemplateService.queryById(specTemplateId)); } /** * 新增【请填写功能名称】 */ @ApiOperation("新增【请填写功能名称】") @PreAuthorize("@ss.hasPermi('system:template:add')") @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT) @PostMapping() public AjaxResult add(@RequestBody GoodsSpecTemplateAddBo bo) { return toAjax(iGoodsSpecTemplateService.insertByAddBo(bo) ? 1 : 0); } /** * 新增规格模板 */ @ApiOperation("新增规格模板") @PostMapping("/addSpec") public AjaxResult> addSpec(@RequestBody GoodsSpecTemplateAddBo bo) { List vo = iGoodsSpecTemplateService.addSpec(bo); return AjaxResult.success(vo); } /** * 修改规格模板 */ @ApiOperation("修改规格模板") @PostMapping("/edit") public AjaxResult> edit(@RequestBody GoodsSpecTemplateEditBo bo) { List vo = iGoodsSpecTemplateService.updateByEditBo(bo); return AjaxResult.success(vo); } /** * 删除规格模板 */ @ApiOperation("删除规格模板") @GetMapping("/del/{specTemplateId}") public AjaxResult remove(@PathVariable Long specTemplateId) { return toAjax(iGoodsSpecTemplateService.deleteWithValidByIds(specTemplateId,false) ? 1 : 0); } }