From f81300462deff06ab6c90b24ecb9f0ba5031a766 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Fri, 22 Jan 2021 11:23:52 +0800 Subject: [PATCH] modify --- zq-erp/src/main/java/com/matrix/system/app/action/ApiVipLabelAction.java | 29 ++++++++- zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml | 3 + zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml | 27 ++++++++ zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipLabel.java | 30 ++++++++++ zq-erp/src/main/java/com/matrix/system/app/dto/LabelDto.java | 34 +++++++++++ zq-erp/src/main/java/com/matrix/system/app/action/ApiVipInfoAction.java | 6 ++ zq-erp/src/main/java/com/matrix/system/app/dto/VipInfoListDto.java | 24 +++++++ zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipLabelDao.java | 2 8 files changed, 147 insertions(+), 8 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/app/action/ApiVipInfoAction.java b/zq-erp/src/main/java/com/matrix/system/app/action/ApiVipInfoAction.java index da71651..7906568 100644 --- a/zq-erp/src/main/java/com/matrix/system/app/action/ApiVipInfoAction.java +++ b/zq-erp/src/main/java/com/matrix/system/app/action/ApiVipInfoAction.java @@ -2,6 +2,7 @@ import com.matrix.core.constance.MatrixConstance; import com.matrix.core.pojo.AjaxResult; +import com.matrix.core.pojo.PaginationVO; import com.matrix.core.tools.EncrypUtil; import com.matrix.core.tools.StringUtils; import com.matrix.core.tools.WebUtil; @@ -78,6 +79,11 @@ if (StringUtils.isBlank(vipInfoListDto.getOrder())) { vipInfoListDto.setOrder("asc"); } + + int offset = (vipInfoListDto.getPageNum() - 1) * vipInfoListDto.getPageSize(); + int limit = vipInfoListDto.getPageSize(); + vipInfoListDto.setOffset(offset); + vipInfoListDto.setLimit(limit); return AjaxResult.buildSuccessInstance(sysVipInfoService.findVipAddressBook(vipInfoListDto)); } 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 1d518c6..22d3e15 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 @@ -1,19 +1,26 @@ 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 org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; /** * @author wzy * @date 2020-12-22 **/ -//@Api(value = "ApiVipLabelAction", tags = "客户标签接口类") +@Api(value = "ApiVipLabelAction", tags = "客户标签接口类") @RestController @RequestMapping(value = "/api/label") -public class ApiVipLabelAction { +public class ApiVipLabelAction extends BaseController { + @Autowired + private SysVipLabelDao sysVipLabelDao; @ApiOperation(value = "获取客户标签列表", notes = "获取客户标签列表") @GetMapping(value = "/findLabelByVipId/{vipId}") @@ -22,10 +29,22 @@ } - @ApiOperation(value = "添加客户标签", notes = "添加客户标签") + @ApiOperation(value = "添加标签", notes = "添加标签") @PostMapping(value = "/addLabel") - public AjaxResult addLabel() { - return null; + public AjaxResult addLabel(@RequestBody LabelDto labelDto) { + SysVipLabel sysVipLabel = new SysVipLabel(); + 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 = "删除标签") diff --git a/zq-erp/src/main/java/com/matrix/system/app/dto/LabelDto.java b/zq-erp/src/main/java/com/matrix/system/app/dto/LabelDto.java new file mode 100644 index 0000000..635a1ea --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/app/dto/LabelDto.java @@ -0,0 +1,34 @@ +package com.matrix.system.app.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @author wzy + * @date 2021-01-22 + **/ +@ApiModel(value = "LabelDto", description = "添加标签接收参数接收类") +public class LabelDto { + + @ApiModelProperty(value = "标签内容", example = "123") + private String label; + + @ApiModelProperty(value = "颜色", example = "#FFFFFF") + private String color; + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } +} diff --git a/zq-erp/src/main/java/com/matrix/system/app/dto/VipInfoListDto.java b/zq-erp/src/main/java/com/matrix/system/app/dto/VipInfoListDto.java index 03feb35..1154bf5 100644 --- a/zq-erp/src/main/java/com/matrix/system/app/dto/VipInfoListDto.java +++ b/zq-erp/src/main/java/com/matrix/system/app/dto/VipInfoListDto.java @@ -8,7 +8,7 @@ * @date 2020-12-21 **/ @ApiModel(value = "VipInfoListDto", description = "获取会员列表参数类") -public class VipInfoListDto { +public class VipInfoListDto extends BasePageDto { @ApiModelProperty(value = "查询参数(客户姓名/手机/会员编号/拼音)", example = "") private String queryKey; @@ -34,6 +34,28 @@ @ApiModelProperty(hidden = true) private Long companyId; + @ApiModelProperty(hidden = true) + private int offset; + + @ApiModelProperty(hidden = true) + private int limit; + + public int getOffset() { + return offset; + } + + public void setOffset(int offset) { + this.offset = offset; + } + + public int getLimit() { + return limit; + } + + public void setLimit(int limit) { + this.limit = limit; + } + public Long getCompanyId() { return companyId; } 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 1319298..7346820 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 @@ -37,6 +37,36 @@ private Long companyId; + private Long userId; + + private Integer isAll; + + private String color; + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public Integer getIsAll() { + return isAll; + } + + public void setIsAll(Integer isAll) { + this.isAll = isAll; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + public Long getShopId() { return shopId; } diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipLabelDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipLabelDao.java index 7333440..19011db 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipLabelDao.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipLabelDao.java @@ -9,6 +9,8 @@ int insert(SysVipLabel sysVipLabel); + int update(SysVipLabel sysVipLabel); + int deleteById(@Param("id") Long id); List<SysVipLabel> selectByVipId(@Param("vipId") Long vipId); diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml index d29ea9e..b2b7892 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml @@ -1345,6 +1345,9 @@ <if test="record.sort != 'monthArrived' and record.sort != 'yearArrived'"> order by ${record.sort} ${record.order} </if> + <if test="record.offset >=0 and record.limit >0"> + limit #{record.offset},#{record.limit} + </if> </select> <select id="selectVipInfoById" resultType="com.matrix.system.app.vo.VipInfoVo"> 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 26606d4..b71cf45 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml @@ -10,16 +10,39 @@ create_by, id, vip_id, - label + label, + shop_id, + company_id, + is_all, + user_id, + color ) values ( #{createTime}, #{createBy}, #{id}, #{vipId}, - #{label} + #{label}, + #{shopId}, + #{companyId}, + #{isAll}, + #{userId}, + #{color} ) </insert> + <update id="update"> + update sys_vip_label + <set> + <if test="label != null and label !='' "> + label = #{label}, + </if> + <if test="color != null and color !='' "> + color = #{color}, + </if> + </set> + WHERE ID=#{id} + </update> + <delete id="deleteById"> delete from sys_vip_label where id=#{id} -- Gitblit v1.9.1