From 81406fbab9b6be9c61c115f5daf3f9bbfa4d256a Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 22 Jan 2021 12:29:40 +0800
Subject: [PATCH] modify
---
zq-erp/src/main/java/com/matrix/system/common/interceptor/ApiUserLoginInterceptor.java | 2
zq-erp/src/main/java/com/matrix/system/app/action/ApiVipLabelAction.java | 34 ++++++++++++++--
zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml | 26 ++++++++++---
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java | 8 +--
zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipLabel.java | 13 ------
5 files changed, 53 insertions(+), 30 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
index 22d3e15..5ba12c4 100644
--- 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
@@ -7,8 +7,12 @@
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
@@ -22,10 +26,26 @@
@Autowired
private SysVipLabelDao sysVipLabelDao;
- @ApiOperation(value = "获取客户标签列表", notes = "获取客户标签列表")
- @GetMapping(value = "/findLabelByVipId/{vipId}")
- public AjaxResult findLabelByVipId(@PathVariable("vipId") Long vipId) {
- return null;
+ @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 = new AjaxResult();
+ ajaxResult.putInMap("allLabel", zbLabel);
+ ajaxResult.putInMap("myLabel", userLabel);
+ return ajaxResult;
}
@@ -50,7 +70,11 @@
@ApiOperation(value = "删除标签", notes = "删除标签")
@GetMapping(value = "/delById/{id}")
public AjaxResult delById(@PathVariable("id") Long id) {
- return null;
+ int i = sysVipLabelDao.deleteById(id);
+ if (i > 0) {
+ return AjaxResult.buildSuccessInstance("删除成功");
+ }
+ return AjaxResult.buildFailInstance("删除失败");
}
diff --git a/zq-erp/src/main/java/com/matrix/system/common/interceptor/ApiUserLoginInterceptor.java b/zq-erp/src/main/java/com/matrix/system/common/interceptor/ApiUserLoginInterceptor.java
index ade0b0b..4fe5642 100644
--- a/zq-erp/src/main/java/com/matrix/system/common/interceptor/ApiUserLoginInterceptor.java
+++ b/zq-erp/src/main/java/com/matrix/system/common/interceptor/ApiUserLoginInterceptor.java
@@ -47,7 +47,7 @@
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
if ("dev".equals(evn)) {
- SysUsers sysUsers = sysUsersDao.selectById(1074L);
+ SysUsers sysUsers = sysUsersDao.selectById(1012L);
request.getSession().setAttribute(MatrixConstance.LOGIN_KEY, sysUsers);
return true;
}
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipLabel.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipLabel.java
index 7346820..c71e8e9 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipLabel.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipLabel.java
@@ -24,11 +24,6 @@
private Long id;
/**
- * 会员ID
- */
- private Long vipId;
-
- /**
* 标签内容
*/
private String label;
@@ -105,14 +100,6 @@
public void setId(Long id) {
this.id = id;
- }
-
- public Long getVipId() {
- return vipId;
- }
-
- public void setVipId(Long vipId) {
- this.vipId = vipId;
}
public String getLabel() {
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java
index 8a6f81e..1d98eaa 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java
@@ -485,7 +485,7 @@
int i=sysVipInfoDao.insert(vipInfo);
if (CollectionUtils.isNotEmpty(addVipDto.getLabels())) {
- batchInsertLabel(addVipDto.getLabels(), user.getSuName(), vipInfo.getId());
+// batchInsertLabel(addVipDto.getLabels(), user.getSuName(), vipInfo.getId());
}
//创建用户默认储值卡
@@ -536,9 +536,8 @@
int i = sysVipInfoDao.update(vipInfo);
if (CollectionUtils.isNotEmpty(modifyVipDto.getLabels())) {
- sysVipLabelDao.deleteByVipId(modifyVipDto.getVipId());
-
- batchInsertLabel(modifyVipDto.getLabels(), user.getSuName(), vipInfo.getId());
+// sysVipLabelDao.deleteByVipId(modifyVipDto.getVipId());
+// batchInsertLabel(modifyVipDto.getLabels(), user.getSuName(), vipInfo.getId());
}
return i;
}
@@ -551,7 +550,6 @@
sysVipLabel.setCreateTime(new Date());
sysVipLabel.setCreateBy(suName);
sysVipLabel.setLabel(iterator.next());
- sysVipLabel.setVipId(id);
sysVipLabelDao.insert(sysVipLabel);
}
}
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml
index b71cf45..059acf2 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml
@@ -9,7 +9,6 @@
create_time,
create_by,
id,
- vip_id,
label,
shop_id,
company_id,
@@ -20,7 +19,6 @@
#{createTime},
#{createBy},
#{id},
- #{vipId},
#{label},
#{shopId},
#{companyId},
@@ -56,14 +54,30 @@
</select>
<select id="selectByModel" resultType="com.matrix.system.hive.bean.SysVipLabel">
- select * from sys_vip_label
+ select
+ create_time createTime,
+ create_by createBy,
+ id,
+ label,
+ shop_id shopId,
+ company_id companyId,
+ is_all isAll,
+ user_id userId,
+ color
+ from sys_vip_label
where 1=1
<if test="record!=null">
<if test="record.label!=null and record.label!=''">
- and label=#{record.label}
+ and label like CONCAT('%', CONCAT(#{record.label},'%'))
</if>
- <if test="record.vipId!=null">
- and vip_id=#{record.vipId}
+ <if test="record.isAll!=null and record.isAll!=0">
+ and is_all=#{record.isAll}
+ </if>
+ <if test="record.userId!=null and record.userId!=''">
+ and user_id=#{record.userId}
+ </if>
+ <if test="record.companyId!=null and record.companyId!=''">
+ and company_id=#{record.companyId}
</if>
</if>
</select>
--
Gitblit v1.9.1