From aacf734ba498b6a5f7c1b1ab7d987f6834a8f33f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A3=B7=E5=8F=B6?= <14103883+leaf-phos@user.noreply.gitee.com> Date: Mon, 9 Dec 2024 18:21:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DeviceServiceImpl.java | 3 +- .../ruoyi/ss/user/service/UserValidator.java | 5 + .../java/com/ruoyi/ss/vip/domain/Vip.java | 47 +++++++ .../com/ruoyi/ss/vip/domain/VipQuery.java | 16 +++ .../java/com/ruoyi/ss/vip/domain/VipVO.java | 27 ++++ .../com/ruoyi/ss/vip/mapper/VipMapper.java | 69 +++++++++ .../com/ruoyi/ss/vip/mapper/VipMapper.xml | 103 ++++++++++++++ .../com/ruoyi/ss/vip/service/VipService.java | 70 +++++++++ .../ruoyi/ss/vip/service/VipValidator.java | 21 +++ .../ss/vip/service/impl/VipServiceImpl.java | 133 ++++++++++++++++++ .../ss/vip/service/impl/VipValidatorImpl.java | 75 ++++++++++ .../ruoyi/ss/vipLevel/domain/VipLevel.java | 50 +++++++ .../ss/vipLevel/domain/VipLevelQuery.java | 17 +++ .../ruoyi/ss/vipLevel/domain/VipLevelVO.java | 16 +++ .../ss/vipLevel/mapper/VipLevelMapper.java | 64 +++++++++ .../ss/vipLevel/mapper/VipLevelMapper.xml | 94 +++++++++++++ .../ss/vipLevel/service/VipLevelService.java | 65 +++++++++ .../vipLevel/service/VipLevelValidator.java | 37 +++++ .../service/impl/VipLevelServiceImpl.java | 114 +++++++++++++++ .../service/impl/VipLevelValidatorImpl.java | 74 ++++++++++ .../controller/mch/MchVipLevelController.java | 80 +++++++++++ .../web/controller/ss/VipController.java | 106 ++++++++++++++ .../web/controller/ss/VipLevelController.java | 123 ++++++++++++++++ 23 files changed, 1408 insertions(+), 1 deletion(-) create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vip/domain/Vip.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vip/domain/VipQuery.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vip/domain/VipVO.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vip/mapper/VipMapper.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vip/mapper/VipMapper.xml create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/VipService.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/VipValidator.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/impl/VipServiceImpl.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/impl/VipValidatorImpl.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/domain/VipLevel.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/domain/VipLevelQuery.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/domain/VipLevelVO.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/mapper/VipLevelMapper.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/mapper/VipLevelMapper.xml create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/VipLevelService.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/VipLevelValidator.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/impl/VipLevelServiceImpl.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/impl/VipLevelValidatorImpl.java create mode 100644 smart-switch-web/src/main/java/com/ruoyi/web/controller/mch/MchVipLevelController.java create mode 100644 smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/VipController.java create mode 100644 smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/VipLevelController.java diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java index 30316a8d..0395c80a 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java @@ -823,6 +823,7 @@ public class DeviceServiceImpl implements DeviceService ServiceUtil.assertion(DeviceStatus.FIXING.getStatus().equals(device.getStatus()), "设备正在维修中,无法使用"); Long deviceId = device.getDeviceId(); + LocalDateTime now = LocalDateTime.now(); Boolean result = transactionTemplate.execute(status -> { // 更新数据库时长 @@ -837,7 +838,7 @@ public class DeviceServiceImpl implements DeviceService // 物联网设备增加时长 if (withIot) { DeviceVO newDevice = selectById(deviceId); - long betweenSeconds = Duration.between(LocalDateTime.now(), newDevice.getExpireTime()).getSeconds(); + long betweenSeconds = Duration.between(now, newDevice.getExpireTime()).getSeconds(); if (betweenSeconds > 0) { CommandResponse rechargeResult = iotService.setTime(device, betweenSeconds); ServiceUtil.assertion(!rechargeResult.isSuccess(), "设备充值失败,请检查设备是否在线"); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserValidator.java b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserValidator.java index edae94a1..7ed065a2 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserValidator.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserValidator.java @@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.ValidateResult; import com.ruoyi.common.core.domain.entity.SmUser; import com.ruoyi.ss.user.domain.SmUserVO; +import java.util.Collections; import java.util.List; /** @@ -59,4 +60,8 @@ public interface UserValidator { * @return */ boolean isAgent(Long userId); + + default boolean isExist(Long userId) { + return isExist(Collections.singletonList(userId)); + }; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vip/domain/Vip.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/domain/Vip.java new file mode 100644 index 00000000..c0a4e625 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/domain/Vip.java @@ -0,0 +1,47 @@ +package com.ruoyi.ss.vip.domain; + +import java.time.LocalDateTime; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * 会员对象 ss_vip + * + * @author ruoyi + * @date 2024-12-09 + */ +@Data +public class Vip extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + private Long id; + + @Excel(name = "用户ID") + @ApiModelProperty("用户ID") + private Long userId; + + @Excel(name = "店铺ID") + @ApiModelProperty("店铺ID") + private Long storeId; + + @Excel(name = "会员等级ID") + @ApiModelProperty("会员等级ID") + private Long levelId; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "有效期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("有效期") + private LocalDateTime expireTime; + + @Excel(name = "过期类型", readConverterExp = "1=永久,2=时限") + @ApiModelProperty("过期类型") + private String expireType; +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vip/domain/VipQuery.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/domain/VipQuery.java new file mode 100644 index 00000000..5453b8c1 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/domain/VipQuery.java @@ -0,0 +1,16 @@ +package com.ruoyi.ss.vip.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author wjh + * 2024/12/9 + */ +@Data +public class VipQuery extends VipVO{ + + @ApiModelProperty("排除ID") + private Long excludeId; + +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vip/domain/VipVO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/domain/VipVO.java new file mode 100644 index 00000000..ee355fb8 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/domain/VipVO.java @@ -0,0 +1,27 @@ +package com.ruoyi.ss.vip.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author wjh + * 2024/12/9 + */ +@Data +public class VipVO extends Vip{ + + @ApiModelProperty("用户名称") + private String userName; + + @ApiModelProperty("店铺名称") + private String storeName; + + @ApiModelProperty("VIP等级名称") + private String vipLevelName; + + @ApiModelProperty("店铺商户ID") + private String storeMchId; + + @ApiModelProperty("VIP商户ID") + private String vipMchId; +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vip/mapper/VipMapper.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/mapper/VipMapper.java new file mode 100644 index 00000000..9859a294 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/mapper/VipMapper.java @@ -0,0 +1,69 @@ +package com.ruoyi.ss.vip.mapper; + +import java.util.List; +import com.ruoyi.ss.vip.domain.Vip; +import com.ruoyi.ss.vip.domain.VipVO; +import com.ruoyi.ss.vip.domain.VipQuery; +import org.apache.ibatis.annotations.Param; + +/** + * 会员Mapper接口 + * + * @author ruoyi + * @date 2024-12-09 + */ +public interface VipMapper +{ + /** + * 查询会员 + * + * @param id 会员主键 + * @return 会员 + */ + public VipVO selectVipById(Long id); + + /** + * 查询会员列表 + * + * @param query 会员 + * @return 会员集合 + */ + public List selectVipList(@Param("query")VipQuery query); + + /** + * 新增会员 + * + * @param vip 会员 + * @return 结果 + */ + public int insertVip(Vip vip); + + /** + * 修改会员 + * + * @param vip 会员 + * @return 结果 + */ + public int updateVip(@Param("data") Vip vip); + + /** + * 删除会员 + * + * @param id 会员主键 + * @return 结果 + */ + public int deleteVipById(Long id); + + /** + * 批量删除会员 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteVipByIds(Long[] ids); + + /** + * 查询数量 + */ + int selectCount(@Param("query") VipQuery query); +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vip/mapper/VipMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/mapper/VipMapper.xml new file mode 100644 index 00000000..8cfefccd --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/mapper/VipMapper.xml @@ -0,0 +1,103 @@ + + + + + + + + select + sv.id, + sv.user_id, + sv.store_id, + sv.level_id, + sv.expire_time, + sv.create_time, + if(su.is_real, su.real_name, su.user_name) as user_name, + ss.name as store_name, + ss.user_id as store_mch_id, + svl.name as vip_level_name, + svl.mch_id as vip_mch_id + from ss_vip sv + left join sm_user su on su.user_id = sv.user_id + left join sm_store ss on ss.store_id = sv.store_id + left join ss_vip_level svl on svl.id = sv.level_id + + + + and sv.id = #{query.id} + and sv.user_id = #{query.userId} + and sv.store_id = #{query.storeId} + and sv.level_id = #{query.levelId} + and if(su.is_real, su.real_name, su.user_name) like concat('%',#{query.userName},'%') + and ss.name like concat('%',#{query.storeName},'%') + and svl.name like concat('%',#{query.vipLevelName},'%') + and sv.id != #{query.excludeId} + + + + + + + + + + insert into ss_vip + + user_id, + store_id, + level_id, + expire_time, + create_time, + + + #{userId}, + #{storeId}, + #{levelId}, + #{expireTime}, + #{createTime}, + + + + + update ss_vip + + + + where id = #{data.id} + + + + user_id = #{data.userId}, + store_id = #{data.storeId}, + level_id = #{data.levelId}, + expire_time = #{data.expireTime}, + create_time = #{data.createTime}, + + + + delete from ss_vip where id = #{id} + + + + delete from ss_vip where id in + + #{id} + + + diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/VipService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/VipService.java new file mode 100644 index 00000000..500e97ae --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/VipService.java @@ -0,0 +1,70 @@ +package com.ruoyi.ss.vip.service; + +import java.util.List; +import com.ruoyi.ss.vip.domain.Vip; +import com.ruoyi.ss.vip.domain.VipVO; +import com.ruoyi.ss.vip.domain.VipQuery; + +/** + * 会员Service接口 + * + * @author ruoyi + * @date 2024-12-09 + */ +public interface VipService +{ + /** + * 查询会员 + * + * @param id 会员主键 + * @return 会员 + */ + public VipVO selectVipById(Long id); + + /** + * 查询会员列表 + * + * @param vip 会员 + * @return 会员集合 + */ + public List selectVipList(VipQuery vip); + + /** + * 新增会员 + * + * @param vip 会员 + * @return 结果 + */ + public int insertVip(Vip vip); + + /** + * 修改会员 + * + * @param vip 会员 + * @return 结果 + */ + public int updateVip(Vip vip); + + /** + * 批量删除会员 + * + * @param ids 需要删除的会员主键集合 + * @return 结果 + */ + public int deleteVipByIds(Long[] ids); + + /** + * 删除会员信息 + * + * @param id 会员主键 + * @return 结果 + */ + public int deleteVipById(Long id); + + /** + * 查询数量 + * @param query + * @return + */ + int selectCount(VipQuery query); +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/VipValidator.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/VipValidator.java new file mode 100644 index 00000000..c5d7f1cd --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/VipValidator.java @@ -0,0 +1,21 @@ +package com.ruoyi.ss.vip.service; + +import com.ruoyi.ss.vip.domain.Vip; +import com.ruoyi.ss.vip.domain.VipVO; + +/** + * @author wjh + * 2024/12/9 + */ +public interface VipValidator { + + /** + * 新增、更新前校验 + */ + void beforeCheck(Vip data); + + /** + * 新增、更新后校验 + */ + void afterCheck(VipVO vo); +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/impl/VipServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/impl/VipServiceImpl.java new file mode 100644 index 00000000..037030be --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/impl/VipServiceImpl.java @@ -0,0 +1,133 @@ +package com.ruoyi.ss.vip.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.ss.vip.service.VipValidator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.ss.vip.mapper.VipMapper; +import com.ruoyi.ss.vip.domain.Vip; +import com.ruoyi.ss.vip.domain.VipVO; +import com.ruoyi.ss.vip.domain.VipQuery; +import com.ruoyi.ss.vip.service.VipService; +import org.springframework.transaction.support.TransactionTemplate; + +/** + * 会员Service业务层处理 + * + * @author ruoyi + * @date 2024-12-09 + */ +@Service +public class VipServiceImpl implements VipService +{ + @Autowired + private VipMapper vipMapper; + + @Autowired + private VipValidator vipValidator; + @Autowired + private TransactionTemplate transactionTemplate; + + /** + * 查询会员 + * + * @param id 会员主键 + * @return 会员 + */ + @Override + public VipVO selectVipById(Long id) + { + return vipMapper.selectVipById(id); + } + + /** + * 查询会员列表 + * + * @param vip 会员 + * @return 会员 + */ + @Override + public List selectVipList(VipQuery vip) + { + return vipMapper.selectVipList(vip); + } + + /** + * 新增会员 + * + * @param vip 会员 + * @return 结果 + */ + @Override + public int insertVip(Vip vip) { + vipValidator.beforeCheck(vip); + + vip.setCreateTime(DateUtils.getNowDate()); + + Integer result = transactionTemplate.execute(status -> { + int insert = vipMapper.insertVip(vip); + + if (insert == 1) { + VipVO vo = this.selectVipById(vip.getId()); + vipValidator.afterCheck(vo); + } + + return insert; + }); + + return result == null ? 0 : result; + } + + /** + * 修改会员 + * + * @param vip 会员 + * @return 结果 + */ + @Override + public int updateVip(Vip vip) { + vipValidator.beforeCheck(vip); + + Integer result = transactionTemplate.execute(status -> { + int update = vipMapper.updateVip(vip); + + if (update == 1) { + VipVO vo = this.selectVipById(vip.getId()); + vipValidator.afterCheck(vo); + } + + return update; + }); + + return result == null ? 0 : result; + } + + /** + * 批量删除会员 + * + * @param ids 需要删除的会员主键 + * @return 结果 + */ + @Override + public int deleteVipByIds(Long[] ids) { + return vipMapper.deleteVipByIds(ids); + } + + /** + * 删除会员信息 + * + * @param id 会员主键 + * @return 结果 + */ + @Override + public int deleteVipById(Long id) + { + return vipMapper.deleteVipById(id); + } + + @Override + public int selectCount(VipQuery query) { + return vipMapper.selectCount(query); + } +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/impl/VipValidatorImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/impl/VipValidatorImpl.java new file mode 100644 index 00000000..2bc8a437 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vip/service/impl/VipValidatorImpl.java @@ -0,0 +1,75 @@ +package com.ruoyi.ss.vip.service.impl; + +import com.ruoyi.common.utils.ServiceUtil; +import com.ruoyi.ss.store.service.StoreValidator; +import com.ruoyi.ss.user.service.UserValidator; +import com.ruoyi.ss.vip.domain.Vip; +import com.ruoyi.ss.vip.domain.VipQuery; +import com.ruoyi.ss.vip.domain.VipVO; +import com.ruoyi.ss.vip.service.VipService; +import com.ruoyi.ss.vip.service.VipValidator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Objects; + +/** + * @author wjh + * 2024/12/9 + */ +@Service +public class VipValidatorImpl implements VipValidator { + + @Autowired + private VipService vipService; + + @Autowired + private UserValidator userValidator; + + @Autowired + private StoreValidator storeValidator; + + /** + * 新增、更新前校验 + * + * @param data + */ + @Override + public void beforeCheck(Vip data) { + ServiceUtil.assertion(data == null, "参数错误"); + + this.checkRepeatUserStore(data.getId(), data.getUserId(), data.getStoreId()); + } + + + @Override + public void afterCheck(VipVO vo) { + if (vo == null) { + return; + } + this.checkRepeatUserStore(vo.getId(), vo.getUserId(), vo.getStoreId()); + + this.checkMch(vo.getStoreMchId(), vo.getVipMchId()); + } + + private void checkMch(String storeMchId, String vipMchId) { + ServiceUtil.assertion(!Objects.equals(storeMchId, vipMchId), "当前选择的VIP等级与店铺商户不一致"); + } + + /** + * 校验用户是否重复成为店铺会员 + * @param id 会员ID + * @param userId 用户ID + * @param storeId 店铺ID + */ + private void checkRepeatUserStore(Long id, Long userId, Long storeId) { + if (userId == null || storeId == null) { + return; + } + VipQuery query = new VipQuery(); + query.setUserId(userId); + query.setStoreId(storeId); + query.setExcludeId(id); + ServiceUtil.assertion(vipService.selectCount(query) > 0, "当前用户已经是店铺VIP,无法重复绑定");; + } +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/domain/VipLevel.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/domain/VipLevel.java new file mode 100644 index 00000000..f7b21118 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/domain/VipLevel.java @@ -0,0 +1,50 @@ +package com.ruoyi.ss.vipLevel.domain; + +import java.math.BigDecimal; + +import com.ruoyi.common.core.domain.ValidGroup; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +import javax.validation.constraints.*; + +/** + * 会员等级对象 ss_vip_level + * + * @author ruoyi + * @date 2024-12-09 + */ +@Data +public class VipLevel extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + private Long id; + + @Excel(name = "商户ID") + @ApiModelProperty("商户ID") + @NotNull(message = "商户不允许为空", groups = {ValidGroup.Create.class}) + private Long mchId; + + @Excel(name = "等级名称") + @ApiModelProperty("等级名称") + @NotBlank(message = "等级名称不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class}) + @Size(max = 30, message = "等级名称长度不能超过30个字符") + private String name; + + @Excel(name = "折扣") + @ApiModelProperty("折扣") + @Min(value = 0, message = "折扣不允许小于0折") + @Max(value = 10, message = "折扣不允许大于10折") + private BigDecimal discount; + + @Excel(name = "描述文本") + @ApiModelProperty("描述文本") + @Size(max = 1000, message = "描述不允许超过1000个字符") + private String description; + +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/domain/VipLevelQuery.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/domain/VipLevelQuery.java new file mode 100644 index 00000000..3dc3e107 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/domain/VipLevelQuery.java @@ -0,0 +1,17 @@ +package com.ruoyi.ss.vipLevel.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author wjh + * 2024/12/9 + */ +@Data +public class VipLevelQuery extends VipLevelVO { + + @ApiModelProperty("ID列表") + private List ids; +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/domain/VipLevelVO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/domain/VipLevelVO.java new file mode 100644 index 00000000..69754b5a --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/domain/VipLevelVO.java @@ -0,0 +1,16 @@ +package com.ruoyi.ss.vipLevel.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author wjh + * 2024/12/9 + */ +@Data +public class VipLevelVO extends VipLevel{ + + @ApiModelProperty("商户名称") + private String mchName; + +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/mapper/VipLevelMapper.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/mapper/VipLevelMapper.java new file mode 100644 index 00000000..a50b24e4 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/mapper/VipLevelMapper.java @@ -0,0 +1,64 @@ +package com.ruoyi.ss.vipLevel.mapper; + +import java.util.List; +import com.ruoyi.ss.vipLevel.domain.VipLevel; +import com.ruoyi.ss.vipLevel.domain.VipLevelVO; +import com.ruoyi.ss.vipLevel.domain.VipLevelQuery; +import org.apache.ibatis.annotations.Param; + +/** + * 会员等级Mapper接口 + * + * @author ruoyi + * @date 2024-12-09 + */ +public interface VipLevelMapper +{ + /** + * 查询会员等级 + * + * @param id 会员等级主键 + * @return 会员等级 + */ + public VipLevelVO selectVipLevelById(Long id); + + /** + * 查询会员等级列表 + * + * @param query 会员等级 + * @return 会员等级集合 + */ + public List selectVipLevelList(@Param("query")VipLevelQuery query); + + /** + * 新增会员等级 + * + * @param vipLevel 会员等级 + * @return 结果 + */ + public int insertVipLevel(VipLevel vipLevel); + + /** + * 修改会员等级 + * + * @param vipLevel 会员等级 + * @return 结果 + */ + public int updateVipLevel(@Param("data") VipLevel vipLevel); + + /** + * 删除会员等级 + * + * @param id 会员等级主键 + * @return 结果 + */ + public int deleteVipLevelById(Long id); + + /** + * 批量删除会员等级 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteVipLevelByIds(@Param("ids") List ids); +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/mapper/VipLevelMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/mapper/VipLevelMapper.xml new file mode 100644 index 00000000..1b3cf70c --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/mapper/VipLevelMapper.xml @@ -0,0 +1,94 @@ + + + + + + + + select + svl.id, + svl.mch_id, + svl.name, + svl.discount, + svl.create_time, + svl.description, + if (mch.is_real, mch.real_name, mch.user_name) as mch_name + from ss_vip_level svl + left join sm_user mch on mch.user_id = svl.mch_id + + + + and svl.id = #{query.id} + and svl.mch_id = #{query.mchId} + and svl.name like concat('%', #{query.name}, '%') + and svl.description like concat('%', #{query.description}, '%') + + and if (mch.is_real, mch.real_name, mch.user_name) like concat('%', #{query.mchName}, '%') + + + and id in + + #{item} + + + + + + + + + + insert into ss_vip_level + + mch_id, + `name`, + discount, + create_time, + `description`, + + + #{mchId}, + #{name}, + #{discount}, + #{createTime}, + #{description}, + + + + + update ss_vip_level + + + + where id = #{data.id} + + + + mch_id = #{data.mchId}, + `name` = #{data.name}, + discount = #{data.discount}, + create_time = #{data.createTime}, + `description` = #{data.description}, + + + + delete from ss_vip_level where id = #{id} + + + + delete from ss_vip_level where id in + + #{id} + + + diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/VipLevelService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/VipLevelService.java new file mode 100644 index 00000000..88458e39 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/VipLevelService.java @@ -0,0 +1,65 @@ +package com.ruoyi.ss.vipLevel.service; + +import java.util.List; +import com.ruoyi.ss.vipLevel.domain.VipLevel; +import com.ruoyi.ss.vipLevel.domain.VipLevelVO; +import com.ruoyi.ss.vipLevel.domain.VipLevelQuery; + +/** + * 会员等级Service接口 + * + * @author ruoyi + * @date 2024-12-09 + */ +public interface VipLevelService +{ + /** + * 查询会员等级 + * + * @param id 会员等级主键 + * @return 会员等级 + */ + public VipLevelVO selectVipLevelById(Long id); + + /** + * 查询会员等级列表 + * + * @param vipLevel 会员等级 + * @return 会员等级集合 + */ + public List selectVipLevelList(VipLevelQuery vipLevel); + + /** + * 新增会员等级 + * + * @param vipLevel 会员等级 + * @return 结果 + */ + public int insertVipLevel(VipLevel vipLevel); + + /** + * 修改会员等级 + * + * @param vipLevel 会员等级 + * @return 结果 + */ + public int updateVipLevel(VipLevel vipLevel); + + /** + * 批量删除会员等级 + * + * @param ids 需要删除的会员等级主键集合 + * @return 结果 + */ + public int deleteVipLevelByIds(List ids); + + /** + * 删除会员等级信息 + * + * @param id 会员等级主键 + * @return 结果 + */ + public int deleteVipLevelById(Long id); + + List selectByIds(List ids); +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/VipLevelValidator.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/VipLevelValidator.java new file mode 100644 index 00000000..0036c6b0 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/VipLevelValidator.java @@ -0,0 +1,37 @@ +package com.ruoyi.ss.vipLevel.service; + +import com.ruoyi.ss.vipLevel.domain.VipLevelVO; + +import java.util.List; + +/** + * @author wjh + * 2024/12/9 + */ +public interface VipLevelValidator { + + /** + * 用户是否可见 + */ + boolean canView(VipLevelVO vo, Long userId); + + /** + * 用户是否可操作 + */ + boolean canOpera(Long id, Long userId); + + /** + * 用户是否可操作全部 + */ + boolean canOperaAll(List ids, Long userId); + + /** + * 是否允许操作 + */ + boolean canOpera(VipLevelVO vo, Long userId); + + /** + * 删除前校验 + */ + void beforeDel(List ids); +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/impl/VipLevelServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/impl/VipLevelServiceImpl.java new file mode 100644 index 00000000..2bc5505e --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/impl/VipLevelServiceImpl.java @@ -0,0 +1,114 @@ +package com.ruoyi.ss.vipLevel.service.impl; + +import java.util.Collections; +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.collection.CollectionUtils; +import com.ruoyi.ss.vipLevel.service.VipLevelValidator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.ss.vipLevel.mapper.VipLevelMapper; +import com.ruoyi.ss.vipLevel.domain.VipLevel; +import com.ruoyi.ss.vipLevel.domain.VipLevelVO; +import com.ruoyi.ss.vipLevel.domain.VipLevelQuery; +import com.ruoyi.ss.vipLevel.service.VipLevelService; + +/** + * 会员等级Service业务层处理 + * + * @author ruoyi + * @date 2024-12-09 + */ +@Service +public class VipLevelServiceImpl implements VipLevelService +{ + @Autowired + private VipLevelMapper vipLevelMapper; + + @Autowired + private VipLevelValidator vipLevelValidator; + + /** + * 查询会员等级 + * + * @param id 会员等级主键 + * @return 会员等级 + */ + @Override + public VipLevelVO selectVipLevelById(Long id) + { + return vipLevelMapper.selectVipLevelById(id); + } + + /** + * 查询会员等级列表 + * + * @param vipLevel 会员等级 + * @return 会员等级 + */ + @Override + public List selectVipLevelList(VipLevelQuery vipLevel) + { + return vipLevelMapper.selectVipLevelList(vipLevel); + } + + /** + * 新增会员等级 + * + * @param vipLevel 会员等级 + * @return 结果 + */ + @Override + public int insertVipLevel(VipLevel vipLevel) + { + vipLevel.setCreateTime(DateUtils.getNowDate()); + return vipLevelMapper.insertVipLevel(vipLevel); + } + + /** + * 修改会员等级 + * + * @param vipLevel 会员等级 + * @return 结果 + */ + @Override + public int updateVipLevel(VipLevel vipLevel) + { + return vipLevelMapper.updateVipLevel(vipLevel); + } + + /** + * 批量删除会员等级 + * + * @param ids 需要删除的会员等级主键 + * @return 结果 + */ + @Override + public int deleteVipLevelByIds(List ids) { + vipLevelValidator.beforeDel(ids); + + return vipLevelMapper.deleteVipLevelByIds(ids); + } + + /** + * 删除会员等级信息 + * + * @param id 会员等级主键 + * @return 结果 + */ + @Override + public int deleteVipLevelById(Long id) + { + return vipLevelMapper.deleteVipLevelById(id); + } + + @Override + public List selectByIds(List ids) { + if (CollectionUtils.isEmptyElement(ids)) { + return Collections.emptyList(); + } + VipLevelQuery query = new VipLevelQuery(); + query.setIds(ids); + return this.selectVipLevelList(query); + } +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/impl/VipLevelValidatorImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/impl/VipLevelValidatorImpl.java new file mode 100644 index 00000000..84f6157a --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/vipLevel/service/impl/VipLevelValidatorImpl.java @@ -0,0 +1,74 @@ +package com.ruoyi.ss.vipLevel.service.impl; + +import com.ruoyi.common.utils.ServiceUtil; +import com.ruoyi.common.utils.collection.CollectionUtils; +import com.ruoyi.ss.vip.service.VipService; +import com.ruoyi.ss.vipLevel.domain.VipLevelVO; +import com.ruoyi.ss.vipLevel.service.VipLevelService; +import com.ruoyi.ss.vipLevel.service.VipLevelValidator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; + +/** + * @author wjh + * 2024/12/9 + */ +@Service +public class VipLevelValidatorImpl implements VipLevelValidator { + + @Autowired + private VipLevelService vipLevelService; + + @Autowired + private VipService vipService; + + /** + * 用户是否可见 + * + * @param vo + * @param userId + */ + @Override + public boolean canView(VipLevelVO vo, Long userId) { + return vo != null && userId != null && Objects.equals(vo.getMchId(), userId); + } + + @Override + public boolean canOpera(Long id, Long userId) { + if (userId == null || id == null) { + return false; + } + VipLevelVO vo = vipLevelService.selectVipLevelById(id); + return canOpera(vo, userId); + } + + @Override + public boolean canOperaAll(List ids, Long userId) { + if (CollectionUtils.isEmptyElement(ids) || userId == null) { + return false; + } + List list = vipLevelService.selectByIds(ids); + for (VipLevelVO vo : list) { + if (!this.canOpera(vo, userId)) { + return false; + } + } + return true; + } + + @Override + public boolean canOpera(VipLevelVO vo, Long userId) { + return vo != null && userId != null && Objects.equals(vo.getMchId(), userId); + } + + @Override + public void beforeDel(List ids) { + ServiceUtil.assertion(CollectionUtils.isEmptyElement(ids), "参数错误"); + + // TODO +// vipService.selectVip + } +} diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/mch/MchVipLevelController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/mch/MchVipLevelController.java new file mode 100644 index 00000000..27ba24f4 --- /dev/null +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/mch/MchVipLevelController.java @@ -0,0 +1,80 @@ +package com.ruoyi.web.controller.mch; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.ValidGroup; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.ss.vipLevel.domain.VipLevel; +import com.ruoyi.ss.vipLevel.domain.VipLevelQuery; +import com.ruoyi.ss.vipLevel.domain.VipLevelVO; +import com.ruoyi.ss.vipLevel.service.VipLevelService; +import com.ruoyi.ss.vipLevel.service.VipLevelValidator; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @author wjh + * 2024/12/9 + */ +@RestController +@RequestMapping("/mch/vipLevel") +public class MchVipLevelController extends BaseController { + + @Autowired + private VipLevelService vipLevelService; + + @Autowired + private VipLevelValidator vipLevelValidator; + + @ApiOperation("商户获取VIP等级列表") + @GetMapping("/list") + public TableDataInfo list(VipLevelQuery query) { + startPage(); + query.setMchId(getUserId()); + List list = vipLevelService.selectVipLevelList(query); + return getDataTable(list); + } + + @ApiModelProperty("获取VIP等级明细") + @GetMapping("/{id}") + public AjaxResult getById(@PathVariable Long id) { + VipLevelVO vo = vipLevelService.selectVipLevelById(id); + if (!vipLevelValidator.canView(vo, getUserId())) { + return error("您无权查看该信息"); + } + return success(vo); + } + + @ApiModelProperty("新增VIP等级") + @PostMapping + public AjaxResult add(@RequestBody @Validated(ValidGroup.FrontCreate.class) VipLevel data) { + data.setMchId(getUserId()); + return toAjax(vipLevelService.insertVipLevel(data)); + } + + @ApiModelProperty("修改VIP等级") + @PutMapping + public AjaxResult update(@RequestBody @Validated(ValidGroup.FrontUpdate.class) VipLevel data) { + if (!vipLevelValidator.canOpera(data.getId(), getUserId())) { + return error("您无权操作该数据"); + } + return toAjax(vipLevelService.updateVipLevel(data)); + } + + @ApiModelProperty("删除VIP等级") + @DeleteMapping("/{ids}") + public AjaxResult del(@PathVariable List ids) { + if (!vipLevelValidator.canOperaAll(ids, getUserId())) { + return error("您无权操作该数据"); + } + return toAjax(vipLevelService.deleteVipLevelByIds(ids)); + } + +} diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/VipController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/VipController.java new file mode 100644 index 00000000..11a52856 --- /dev/null +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/VipController.java @@ -0,0 +1,106 @@ +package com.ruoyi.web.controller.ss; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +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.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.ss.vip.domain.Vip; +import com.ruoyi.ss.vip.domain.VipVO; +import com.ruoyi.ss.vip.domain.VipQuery; +import com.ruoyi.ss.vip.service.VipService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 会员Controller + * + * @author ruoyi + * @date 2024-12-09 + */ +@RestController +@RequestMapping("/ss/vip") +public class VipController extends BaseController +{ + @Autowired + private VipService vipService; + + /** + * 查询会员列表 + */ + @PreAuthorize("@ss.hasPermi('ss:vip:list')") + @GetMapping("/list") + public TableDataInfo list(VipQuery query) + { + startPage(); + startOrderBy(); + List list = vipService.selectVipList(query); + return getDataTable(list); + } + + /** + * 导出会员列表 + */ + @PreAuthorize("@ss.hasPermi('ss:vip:export')") + @Log(title = "会员", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, VipQuery query) + { + List list = vipService.selectVipList(query); + ExcelUtil util = new ExcelUtil(VipVO.class); + util.exportExcel(response, list, "会员数据"); + } + + /** + * 获取会员详细信息 + */ + @PreAuthorize("@ss.hasPermi('ss:vip:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(vipService.selectVipById(id)); + } + + /** + * 新增会员 + */ + @PreAuthorize("@ss.hasPermi('ss:vip:add')") + @Log(title = "会员", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody Vip vip) + { + return toAjax(vipService.insertVip(vip)); + } + + /** + * 修改会员 + */ + @PreAuthorize("@ss.hasPermi('ss:vip:edit')") + @Log(title = "会员", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody Vip vip) { + return toAjax(vipService.updateVip(vip)); + } + + /** + * 删除会员 + */ + @PreAuthorize("@ss.hasPermi('ss:vip:remove')") + @Log(title = "会员", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(vipService.deleteVipByIds(ids)); + } +} diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/VipLevelController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/VipLevelController.java new file mode 100644 index 00000000..b03e6997 --- /dev/null +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/VipLevelController.java @@ -0,0 +1,123 @@ +package com.ruoyi.web.controller.ss; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.ValidGroup; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +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.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.ss.vipLevel.domain.VipLevel; +import com.ruoyi.ss.vipLevel.domain.VipLevelVO; +import com.ruoyi.ss.vipLevel.domain.VipLevelQuery; +import com.ruoyi.ss.vipLevel.service.VipLevelService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 会员等级Controller + * + * @author ruoyi + * @date 2024-12-09 + */ +@RestController +@RequestMapping("/ss/vipLevel") +public class VipLevelController extends BaseController +{ + @Autowired + private VipLevelService vipLevelService; + + /** + * 查询会员等级列表 + */ + @PreAuthorize("@ss.hasPermi('ss:vipLevel:list')") + @GetMapping("/list") + public TableDataInfo list(VipLevelQuery query) + { + startPage(); + startOrderBy(); + List list = vipLevelService.selectVipLevelList(query); + return getDataTable(list); + } + + /** + * 查询会员等级列表 + */ + @PreAuthorize("@ss.hasPermi('ss:vipLevel:list')") + @PostMapping("/listByIds") + public AjaxResult list(@RequestBody List ids) + { + VipLevelQuery query = new VipLevelQuery(); + query.setIds(ids); + List list = vipLevelService.selectVipLevelList(query); + return success(list); + } + + /** + * 导出会员等级列表 + */ + @PreAuthorize("@ss.hasPermi('ss:vipLevel:export')") + @Log(title = "会员等级", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, VipLevelQuery query) + { + List list = vipLevelService.selectVipLevelList(query); + ExcelUtil util = new ExcelUtil(VipLevelVO.class); + util.exportExcel(response, list, "会员等级数据"); + } + + /** + * 获取会员等级详细信息 + */ + @PreAuthorize("@ss.hasPermi('ss:vipLevel:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(vipLevelService.selectVipLevelById(id)); + } + + /** + * 新增会员等级 + */ + @PreAuthorize("@ss.hasPermi('ss:vipLevel:add')") + @Log(title = "会员等级", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody @Validated(ValidGroup.Create.class) VipLevel vipLevel) + { + return toAjax(vipLevelService.insertVipLevel(vipLevel)); + } + + /** + * 修改会员等级 + */ + @PreAuthorize("@ss.hasPermi('ss:vipLevel:edit')") + @Log(title = "会员等级", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody @Validated(ValidGroup.Update.class) VipLevel vipLevel) + { + return toAjax(vipLevelService.updateVipLevel(vipLevel)); + } + + /** + * 删除会员等级 + */ + @PreAuthorize("@ss.hasPermi('ss:vipLevel:remove')") + @Log(title = "会员等级", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable List ids) + { + return toAjax(vipLevelService.deleteVipLevelByIds(ids)); + } +}