123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- 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<GoodsSpecTemplateVo> list(GoodsSpecTemplateQueryBo bo) {
- startPage();
- List<GoodsSpecTemplateVo> list = iGoodsSpecTemplateService.queryList(bo);
- return getDataTable(list);
- }
- /**
- * 导出【请填写功能名称】列表
- */
- @ApiOperation("导出【请填写功能名称】列表")
- @PreAuthorize("@ss.hasPermi('system:template:export')")
- @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult<GoodsSpecTemplateVo> export(GoodsSpecTemplateQueryBo bo) {
- List<GoodsSpecTemplateVo> list = iGoodsSpecTemplateService.queryList(bo);
- ExcelUtil<GoodsSpecTemplateVo> util = new ExcelUtil<GoodsSpecTemplateVo>(GoodsSpecTemplateVo.class);
- return util.exportExcel(list, "【请填写功能名称】");
- }
- /**
- * 获取规格模板详细信息
- */
- @ApiOperation("获取规格模板详细信息")
- @GetMapping("/detail/{specTemplateId}")
- public AjaxResult<GoodsSpecTemplateVo> 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<Void> add(@RequestBody GoodsSpecTemplateAddBo bo) {
- return toAjax(iGoodsSpecTemplateService.insertByAddBo(bo) ? 1 : 0);
- }
- /**
- * 新增规格模板
- */
- @ApiOperation("新增规格模板")
- @PostMapping("/addSpec")
- public AjaxResult<List<GoodsSpecAttributeRelationVo>> addSpec(@RequestBody GoodsSpecTemplateAddBo bo) {
- List<GoodsSpecAttributeRelationVo> vo = iGoodsSpecTemplateService.addSpec(bo);
- return AjaxResult.success(vo);
- }
- /**
- * 修改规格模板
- */
- @ApiOperation("修改规格模板")
- @PostMapping("/edit")
- public AjaxResult<List<GoodsSpecAttributeRelationVo>> edit(@RequestBody GoodsSpecTemplateEditBo bo) {
- List<GoodsSpecAttributeRelationVo> vo = iGoodsSpecTemplateService.updateByEditBo(bo);
- return AjaxResult.success(vo);
- }
- /**
- * 删除规格模板
- */
- @ApiOperation("删除规格模板")
- @GetMapping("/del/{specTemplateId}")
- public AjaxResult<Void> remove(@PathVariable Long specTemplateId) {
- return toAjax(iGoodsSpecTemplateService.deleteWithValidByIds(specTemplateId,false) ? 1 : 0);
- }
- }
|