商品管理
parent
3f213a4ae6
commit
b7e1341962
|
@ -63,9 +63,11 @@ public interface ErrorCodeConstants {
|
|||
|
||||
ErrorCode GOODS_DOWN_UPDATE = new ErrorCode(1008007008, "请先下架商品,再进行修改");
|
||||
|
||||
ErrorCode GOODS_EXISTS_HUI = new ErrorCode(1008007008, "商品已存在回收站");
|
||||
ErrorCode GOODS_EXISTS_HUI = new ErrorCode(1008007009, "商品已存在回收站");
|
||||
|
||||
ErrorCode SUB_STOCK_ERROR = new ErrorCode(1008007008, "更新普通商品库存失败");
|
||||
ErrorCode SUB_STOCK_ERROR = new ErrorCode(1008007010, "更新普通商品库存失败");
|
||||
|
||||
ErrorCode RECHARGE_GEAR_NOT_EXISTS = new ErrorCode(1008007011, "充值档位不存在");
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeGearDO;
|
||||
import cn.iocoder.yudao.module.shop.convert.recharge.RechargeGearConvert;
|
||||
import cn.iocoder.yudao.module.shop.service.recharge.RechargeGearService;
|
||||
|
||||
@Tag(name = "管理后台 - 充值档位")
|
||||
@RestController
|
||||
@RequestMapping("/shop/recharge-gear")
|
||||
@Validated
|
||||
public class RechargeGearController {
|
||||
|
||||
@Resource
|
||||
private RechargeGearService rechargeGearService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建充值档位")
|
||||
@PreAuthorize("@ss.hasPermission('shop:recharge-gear:create')")
|
||||
public CommonResult<String> createRechargeGear(@Valid @RequestBody RechargeGearCreateReqVO createReqVO) {
|
||||
return success(rechargeGearService.createRechargeGear(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新充值档位")
|
||||
@PreAuthorize("@ss.hasPermission('shop:recharge-gear:update')")
|
||||
public CommonResult<Boolean> updateRechargeGear(@Valid @RequestBody RechargeGearUpdateReqVO updateReqVO) {
|
||||
rechargeGearService.updateRechargeGear(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除充值档位")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('shop:recharge-gear:delete')")
|
||||
public CommonResult<Boolean> deleteRechargeGear(@RequestParam("id") String id) {
|
||||
rechargeGearService.deleteRechargeGear(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得充值档位")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('shop:recharge-gear:query')")
|
||||
public CommonResult<RechargeGearRespVO> getRechargeGear(@RequestParam("id") String id) {
|
||||
RechargeGearDO rechargeGear = rechargeGearService.getRechargeGear(id);
|
||||
return success(RechargeGearConvert.INSTANCE.convert(rechargeGear));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得充值档位列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('shop:recharge-gear:query')")
|
||||
public CommonResult<List<RechargeGearRespVO>> getRechargeGearList(@RequestParam("ids") Collection<String> ids) {
|
||||
List<RechargeGearDO> list = rechargeGearService.getRechargeGearList(ids);
|
||||
return success(RechargeGearConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得充值档位分页")
|
||||
@PreAuthorize("@ss.hasPermission('shop:recharge-gear:query')")
|
||||
public CommonResult<PageResult<RechargeGearRespVO>> getRechargeGearPage(@Valid RechargeGearPageReqVO pageVO) {
|
||||
PageResult<RechargeGearDO> pageResult = rechargeGearService.getRechargeGearPage(pageVO);
|
||||
return success(RechargeGearConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出充值档位 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('shop:recharge-gear:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportRechargeGearExcel(@Valid RechargeGearExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<RechargeGearDO> list = rechargeGearService.getRechargeGearList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<RechargeGearExcelVO> datas = RechargeGearConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "充值档位.xls", "数据", RechargeGearExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 充值档位 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class RechargeGearBaseVO {
|
||||
|
||||
@Schema(description = "档位名称", required = true, example = "张三")
|
||||
@NotNull(message = "档位名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "档位备注", required = true)
|
||||
@NotNull(message = "档位备注不能为空")
|
||||
private String gearRemarks;
|
||||
|
||||
@Schema(description = "档位显示金额", required = true)
|
||||
@NotNull(message = "档位显示金额不能为空")
|
||||
private Integer gearAmount;
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 充值档位创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RechargeGearCreateReqVO extends RechargeGearBaseVO {
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 充值档位 Excel VO
|
||||
*
|
||||
* @author 创盈云
|
||||
*/
|
||||
@Data
|
||||
public class RechargeGearExcelVO {
|
||||
|
||||
@ExcelProperty("主键")
|
||||
private String id;
|
||||
|
||||
@ExcelProperty("档位名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("档位备注")
|
||||
private String gearRemarks;
|
||||
|
||||
@ExcelProperty("档位显示金额")
|
||||
private Integer gearAmount;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
@Schema(description = "管理后台 - 充值档位 Excel 导出 Request VO,参数和 RechargeGearPageReqVO 是一致的")
|
||||
@Data
|
||||
public class RechargeGearExportReqVO {
|
||||
|
||||
@Schema(description = "档位名称", example = "张三")
|
||||
private String name;
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
@Schema(description = "管理后台 - 充值档位分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RechargeGearPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "档位名称", example = "张三")
|
||||
private String name;
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 充值档位 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RechargeGearRespVO extends RechargeGearBaseVO {
|
||||
|
||||
@Schema(description = "主键", required = true, example = "3324")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 充值档位更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RechargeGearUpdateReqVO extends RechargeGearBaseVO {
|
||||
|
||||
@Schema(description = "主键", required = true, example = "3324")
|
||||
@NotNull(message = "主键不能为空")
|
||||
private String id;
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package cn.iocoder.yudao.module.shop.convert.recharge;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeGearDO;
|
||||
|
||||
/**
|
||||
* 充值档位 Convert
|
||||
*
|
||||
* @author 创盈云
|
||||
*/
|
||||
@Mapper
|
||||
public interface RechargeGearConvert {
|
||||
|
||||
RechargeGearConvert INSTANCE = Mappers.getMapper(RechargeGearConvert.class);
|
||||
|
||||
RechargeGearDO convert(RechargeGearCreateReqVO bean);
|
||||
|
||||
RechargeGearDO convert(RechargeGearUpdateReqVO bean);
|
||||
|
||||
RechargeGearRespVO convert(RechargeGearDO bean);
|
||||
|
||||
List<RechargeGearRespVO> convertList(List<RechargeGearDO> list);
|
||||
|
||||
PageResult<RechargeGearRespVO> convertPage(PageResult<RechargeGearDO> page);
|
||||
|
||||
List<RechargeGearExcelVO> convertList02(List<RechargeGearDO> list);
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package cn.iocoder.yudao.module.shop.dal.dataobject.recharge;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 充值档位 DO
|
||||
*
|
||||
* @author 创盈云
|
||||
*/
|
||||
@TableName("cy_recharge_gear")
|
||||
@KeySequence("cy_recharge_gear_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RechargeGearDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
/**
|
||||
* 档位名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 档位备注
|
||||
*/
|
||||
private String gearRemarks;
|
||||
/**
|
||||
* 档位显示金额
|
||||
*/
|
||||
private Integer gearAmount;
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package cn.iocoder.yudao.module.shop.dal.mysql.recharge;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeGearDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
|
||||
|
||||
/**
|
||||
* 充值档位 Mapper
|
||||
*
|
||||
* @author 创盈云
|
||||
*/
|
||||
@Mapper
|
||||
public interface RechargeGearMapper extends BaseMapperX<RechargeGearDO> {
|
||||
|
||||
default PageResult<RechargeGearDO> selectPage(RechargeGearPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RechargeGearDO>()
|
||||
.likeIfPresent(RechargeGearDO::getName, reqVO.getName())
|
||||
.orderByDesc(RechargeGearDO::getId));
|
||||
}
|
||||
|
||||
default List<RechargeGearDO> selectList(RechargeGearExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<RechargeGearDO>()
|
||||
.likeIfPresent(RechargeGearDO::getName, reqVO.getName())
|
||||
.orderByDesc(RechargeGearDO::getId));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package cn.iocoder.yudao.module.shop.service.recharge;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeGearDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 充值档位 Service 接口
|
||||
*
|
||||
* @author 创盈云
|
||||
*/
|
||||
public interface RechargeGearService {
|
||||
|
||||
/**
|
||||
* 创建充值档位
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
String createRechargeGear(@Valid RechargeGearCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新充值档位
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateRechargeGear(@Valid RechargeGearUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除充值档位
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteRechargeGear(String id);
|
||||
|
||||
/**
|
||||
* 获得充值档位
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 充值档位
|
||||
*/
|
||||
RechargeGearDO getRechargeGear(String id);
|
||||
|
||||
/**
|
||||
* 获得充值档位列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 充值档位列表
|
||||
*/
|
||||
List<RechargeGearDO> getRechargeGearList(Collection<String> ids);
|
||||
|
||||
/**
|
||||
* 获得充值档位分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 充值档位分页
|
||||
*/
|
||||
PageResult<RechargeGearDO> getRechargeGearPage(RechargeGearPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得充值档位列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 充值档位列表
|
||||
*/
|
||||
List<RechargeGearDO> getRechargeGearList(RechargeGearExportReqVO exportReqVO);
|
||||
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package cn.iocoder.yudao.module.shop.service.recharge;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeGearDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.shop.convert.recharge.RechargeGearConvert;
|
||||
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeGearMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.shop.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 充值档位 Service 实现类
|
||||
*
|
||||
* @author 创盈云
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class RechargeGearServiceImpl implements RechargeGearService {
|
||||
|
||||
@Resource
|
||||
private RechargeGearMapper rechargeGearMapper;
|
||||
|
||||
@Override
|
||||
public String createRechargeGear(RechargeGearCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
RechargeGearDO rechargeGear = RechargeGearConvert.INSTANCE.convert(createReqVO);
|
||||
rechargeGearMapper.insert(rechargeGear);
|
||||
// 返回
|
||||
return rechargeGear.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRechargeGear(RechargeGearUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateRechargeGearExists(updateReqVO.getId());
|
||||
// 更新
|
||||
RechargeGearDO updateObj = RechargeGearConvert.INSTANCE.convert(updateReqVO);
|
||||
rechargeGearMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRechargeGear(String id) {
|
||||
// 校验存在
|
||||
validateRechargeGearExists(id);
|
||||
// 删除
|
||||
rechargeGearMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateRechargeGearExists(String id) {
|
||||
if (rechargeGearMapper.selectById(id) == null) {
|
||||
throw exception(RECHARGE_GEAR_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RechargeGearDO getRechargeGear(String id) {
|
||||
return rechargeGearMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RechargeGearDO> getRechargeGearList(Collection<String> ids) {
|
||||
return rechargeGearMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<RechargeGearDO> getRechargeGearPage(RechargeGearPageReqVO pageReqVO) {
|
||||
return rechargeGearMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RechargeGearDO> getRechargeGearList(RechargeGearExportReqVO exportReqVO) {
|
||||
return rechargeGearMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeGearMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
|
@ -9,4 +9,8 @@ import lombok.ToString;
|
|||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DeptCreateReqVO extends DeptBaseVO {
|
||||
/**
|
||||
* 多租户编号
|
||||
*/
|
||||
private Long tenantId;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|||
import cn.iocoder.yudao.framework.tenant.config.TenantProperties;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptCreateReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleCreateReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantCreateReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantExportReqVO;
|
||||
|
@ -23,6 +24,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantPackageDO;
|
|||
import cn.iocoder.yudao.module.system.dal.mysql.tenant.TenantMapper;
|
||||
import cn.iocoder.yudao.module.system.enums.permission.RoleCodeEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.permission.RoleTypeEnum;
|
||||
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
||||
import cn.iocoder.yudao.module.system.service.permission.MenuService;
|
||||
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
|
||||
import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
||||
|
@ -73,6 +75,8 @@ public class TenantServiceImpl implements TenantService {
|
|||
private MenuService menuService;
|
||||
@Resource
|
||||
private PermissionService permissionService;
|
||||
@Resource
|
||||
private DeptService deptService;
|
||||
|
||||
@Override
|
||||
public List<Long> getTenantIdList() {
|
||||
|
@ -113,7 +117,10 @@ public class TenantServiceImpl implements TenantService {
|
|||
Long userId = createUser(roleId, createReqVO);
|
||||
// 修改租户的管理员
|
||||
tenantMapper.updateById(new TenantDO().setId(tenant.getId()).setContactUserId(userId));
|
||||
//创建顶级部门
|
||||
createDept(tenant,userId);
|
||||
});
|
||||
|
||||
return tenant.getId();
|
||||
}
|
||||
|
||||
|
@ -136,6 +143,17 @@ public class TenantServiceImpl implements TenantService {
|
|||
return roleId;
|
||||
}
|
||||
|
||||
private Long createDept(TenantDO tenant,Long userId){
|
||||
DeptCreateReqVO deptCreateReqVO = new DeptCreateReqVO();
|
||||
deptCreateReqVO.setName(tenant.getName());
|
||||
deptCreateReqVO.setSort(0);
|
||||
deptCreateReqVO.setStatus(0);
|
||||
deptCreateReqVO.setPhone(tenant.getContactMobile());
|
||||
deptCreateReqVO.setLeaderUserId(userId);
|
||||
deptCreateReqVO.setTenantId(tenant.getId());
|
||||
Long deptId = deptService.createDept(deptCreateReqVO);
|
||||
return deptId;
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTenant(TenantUpdateReqVO updateReqVO) {
|
||||
|
|
|
@ -204,6 +204,10 @@ yudao:
|
|||
- eb_store_product_rule
|
||||
- eb_store_product_reply
|
||||
- eb_user_address
|
||||
- cy_recharge_gear
|
||||
- cy_phone_record
|
||||
- cy_recharge_order_info
|
||||
- cy_refund_fee_record
|
||||
sms-code: # 短信验证码相关的配置项
|
||||
expire-times: 10m
|
||||
send-frequency: 1m
|
||||
|
|
|
@ -4,7 +4,7 @@ ENV = 'development'
|
|||
# 页面标题
|
||||
VUE_APP_TITLE = 创盈商户管理系统
|
||||
|
||||
# 芋道管理系统/开发环境
|
||||
# 创盈管理系统/开发环境
|
||||
VUE_APP_BASE_API = 'http://localhost:48080'
|
||||
|
||||
# 路由懒加载
|
||||
|
|
|
@ -4,7 +4,7 @@ ENV = 'development'
|
|||
# 页面标题
|
||||
VUE_APP_TITLE = 创盈商户管理系统
|
||||
|
||||
# 芋道管理系统/本地环境
|
||||
# 创盈管理系统/本地环境
|
||||
VUE_APP_BASE_API = 'http://api-dashboard.yudao.iocoder.cn'
|
||||
|
||||
# 路由懒加载
|
||||
|
|
|
@ -4,7 +4,7 @@ ENV = 'development'
|
|||
# 页面标题
|
||||
VUE_APP_TITLE = 创盈商户管理系统
|
||||
|
||||
# 芋道管理系统/本地环境
|
||||
# 创盈管理系统/本地环境
|
||||
# VUE_APP_BASE_API = '/proxy-api'
|
||||
VUE_APP_BASE_API = 'http://127.0.0.1:48080'
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ ENV = 'production'
|
|||
# 页面标题
|
||||
VUE_APP_TITLE = 创盈商户管理系统
|
||||
|
||||
# 芋道管理系统/生产环境
|
||||
# 创盈管理系统/生产环境
|
||||
VUE_APP_BASE_API = '/prod-api'
|
||||
|
||||
# 根据服务器或域名修改
|
||||
|
|
|
@ -6,7 +6,7 @@ VUE_APP_TITLE = 创盈商户管理系统
|
|||
# 测试环境配置
|
||||
ENV = 'staging'
|
||||
|
||||
# 芋道管理系统/测试环境
|
||||
# 创盈管理系统/测试环境
|
||||
VUE_APP_BASE_API = 'http://api-dashboard.yudao.iocoder.cn'
|
||||
|
||||
# 静态资源地址
|
||||
|
|
|
@ -6,7 +6,7 @@ ENV = 'staging'
|
|||
# 页面标题
|
||||
VUE_APP_TITLE = 创盈商户管理系统
|
||||
|
||||
# 芋道管理系统/测试环境
|
||||
# 创盈管理系统/测试环境
|
||||
VUE_APP_BASE_API = 'http://127.0.0.1:48080'
|
||||
|
||||
# 根据服务器或域名修改
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 创建充值档位
|
||||
export function createRechargeGear(data) {
|
||||
return request({
|
||||
url: '/shop/recharge-gear/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新充值档位
|
||||
export function updateRechargeGear(data) {
|
||||
return request({
|
||||
url: '/shop/recharge-gear/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除充值档位
|
||||
export function deleteRechargeGear(id) {
|
||||
return request({
|
||||
url: '/shop/recharge-gear/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得充值档位
|
||||
export function getRechargeGear(id) {
|
||||
return request({
|
||||
url: '/shop/recharge-gear/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得充值档位分页
|
||||
export function getRechargeGearPage(query) {
|
||||
return request({
|
||||
url: '/shop/recharge-gear/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 导出充值档位 Excel
|
||||
export function exportRechargeGearExcel(query) {
|
||||
return request({
|
||||
url: '/shop/recharge-gear/export-excel',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
|
@ -12,13 +12,13 @@
|
|||
<!-- 站内信 -->
|
||||
<notify-message class="right-menu-item hover-effect" />
|
||||
|
||||
<el-tooltip content="源码地址" effect="dark" placement="bottom">
|
||||
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
<!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">-->
|
||||
<!-- <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />-->
|
||||
<!-- </el-tooltip>-->
|
||||
|
||||
<el-tooltip content="文档地址" effect="dark" placement="bottom">
|
||||
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
<!-- <el-tooltip content="文档地址" effect="dark" placement="bottom">-->
|
||||
<!-- <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />-->
|
||||
<!-- </el-tooltip>-->
|
||||
|
||||
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template xmlns="">
|
||||
<div class="container">
|
||||
<div class="logo"></div>
|
||||
<!-- <div class="logo"></div>-->
|
||||
<!-- 登录区域 -->
|
||||
<div class="content">
|
||||
<!-- 配图 -->
|
||||
|
@ -9,7 +9,7 @@
|
|||
<div class="field">
|
||||
<!-- [移动端]标题 -->
|
||||
<h2 class="mobile-title">
|
||||
<h3 class="title">芋道后台管理系统</h3>
|
||||
<h3 class="title">创盈后台管理系统</h3>
|
||||
</h2>
|
||||
|
||||
<!-- 表单 -->
|
||||
|
@ -84,13 +84,6 @@
|
|||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 教程说明 -->
|
||||
<el-form-item style="width:100%; margin-top:-25px">
|
||||
<el-link href="https://doc.iocoder.cn/" target="_blank">📚开发指南</el-link>
|
||||
<el-link href="https://doc.iocoder.cn/video/" target="_blank" style="padding-left: 10px">🔥视频教程</el-link>
|
||||
<el-link href="https://www.iocoder.cn/Interview/good-collection/" target="_blank" style="padding-left: 10px">⚡面试手册</el-link>
|
||||
<el-link href="http://static.yudao.iocoder.cn/mp/Aix9975.jpeg" target="_blank" style="padding-left: 10px">🤝外包咨询</el-link>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -145,7 +138,7 @@ export default {
|
|||
mobile: "",
|
||||
mobileCode: "",
|
||||
rememberMe: false,
|
||||
tenantName: "芋道源码",
|
||||
tenantName: "创盈",
|
||||
},
|
||||
scene: 21,
|
||||
|
||||
|
|
|
@ -0,0 +1,217 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="档位名称" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入档位名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||
v-hasPermi="['shop:recharge-gear:create']">新增</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"-->
|
||||
<!-- v-hasPermi="['shop:recharge-gear:export']">导出</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="主键" align="center" prop="id" />
|
||||
<el-table-column label="档位名称" align="center" prop="name" />
|
||||
<el-table-column label="档位备注" align="center" prop="gearRemarks" />
|
||||
<el-table-column label="档位显示金额" align="center" prop="gearAmount" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['shop:recharge-gear:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['shop:recharge-gear:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="档位名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入档位名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="显示金额" prop="gearAmount">
|
||||
<el-input v-model="form.gearAmount" placeholder="请输入显示金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="gearRemarks">
|
||||
<el-input v-model="form.gearRemarks" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createRechargeGear, updateRechargeGear, deleteRechargeGear, getRechargeGear, getRechargeGearPage, exportRechargeGearExcel } from "@/api/shop/rechargeGear";
|
||||
|
||||
export default {
|
||||
name: "RechargeGear",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 充值档位列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [{ required: true, message: "档位名称不能为空", trigger: "blur" }],
|
||||
gearRemarks: [{ required: true, message: "档位备注不能为空", trigger: "blur" }],
|
||||
gearAmount: [{ required: true, message: "档位显示金额不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getRechargeGearPage(this.queryParams).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
gearRemarks: undefined,
|
||||
gearAmount: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加充值档位";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getRechargeGear(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改充值档位";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateRechargeGear(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createRechargeGear(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除充值档位编号为"' + id + '"的数据项?').then(function() {
|
||||
return deleteRechargeGear(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有充值档位数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportRechargeGearExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '充值档位.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue