From f7ea5773570beb5ad8c6efb5c1cf743294ee079b Mon Sep 17 00:00:00 2001 From: wzy <wzy19931122ai@163.com> Date: Sun, 24 Jan 2021 14:16:04 +0800 Subject: [PATCH] modify --- zq-erp/src/main/java/com/matrix/system/app/action/ApiVipLabelAction.java | 82 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 82 insertions(+), 0 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/app/action/ApiVipLabelAction.java b/zq-erp/src/main/java/com/matrix/system/app/action/ApiVipLabelAction.java new file mode 100644 index 0000000..3399e91 --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/app/action/ApiVipLabelAction.java @@ -0,0 +1,82 @@ +package com.matrix.system.app.action; + +import com.matrix.core.pojo.AjaxResult; +import com.matrix.system.app.dto.LabelDto; +import com.matrix.system.hive.action.BaseController; +import com.matrix.system.hive.bean.SysVipLabel; +import com.matrix.system.hive.dao.SysVipLabelDao; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @author wzy + * @date 2020-12-22 + **/ +@Api(value = "ApiVipLabelAction", tags = "客户标签接口类") +@RestController +@RequestMapping(value = "/api/label") +public class ApiVipLabelAction extends BaseController { + + @Autowired + private SysVipLabelDao sysVipLabelDao; + + @ApiOperation(value = "获取标签列表", notes = "获取标签列表") + @ApiResponses({ + @ApiResponse(code = 200, message = "ok", response = SysVipLabel.class) + }) + @PostMapping(value = "/findLabelList") + public AjaxResult findLabelByVipId(@RequestBody LabelDto labelDto) { + SysVipLabel sysVipLabel = new SysVipLabel(); + sysVipLabel.setCompanyId(getMe().getCompanyId()); + sysVipLabel.setIsAll(1); + sysVipLabel.setLabel(labelDto.getLabel()); + List<SysVipLabel> zbLabel = sysVipLabelDao.selectByModel(sysVipLabel); + + sysVipLabel = new SysVipLabel(); + sysVipLabel.setUserId(getMe().getSuId()); + sysVipLabel.setLabel(labelDto.getLabel()); + List<SysVipLabel> userLabel = sysVipLabelDao.selectByModel(sysVipLabel); + AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("获取成功"); + ajaxResult.putInMap("allLabel", zbLabel); + ajaxResult.putInMap("myLabel", userLabel); + return ajaxResult; + } + + + @ApiOperation(value = "添加标签", notes = "添加标签") + @PostMapping(value = "/addLabel") + public AjaxResult addLabel(@RequestBody LabelDto labelDto) { + SysVipLabel sysVipLabel = new SysVipLabel(); + sysVipLabel.setCreateBy(getMe().getSuName()); + sysVipLabel.setLabel(labelDto.getLabel()); + sysVipLabel.setColor(labelDto.getColor()); + sysVipLabel.setShopId(getMe().getShopId()); + sysVipLabel.setCompanyId(getMe().getCompanyId()); + sysVipLabel.setUserId(getMe().getSuId()); + sysVipLabel.setIsAll(2); + int i = sysVipLabelDao.insert(sysVipLabel); + if (i > 0) { + return AjaxResult.buildSuccessInstance("添加成功"); + } else { + return AjaxResult.buildFailInstance("添加失败"); + } + } + + @ApiOperation(value = "删除标签", notes = "删除标签") + @GetMapping(value = "/delById/{id}") + public AjaxResult delById(@PathVariable("id") Long id) { + int i = sysVipLabelDao.deleteById(id); + if (i > 0) { + return AjaxResult.buildSuccessInstance("删除成功"); + } + return AjaxResult.buildFailInstance("删除失败"); + } + + +} -- Gitblit v1.9.1