123
This commit is contained in:
@@ -0,0 +1,95 @@
|
|||||||
|
package com.ruoyi.cai.controller.admin;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.cai.domain.MemberPrice;
|
||||||
|
import com.ruoyi.cai.service.MemberPriceService;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员价格
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-01-03
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/cai/memberPrice")
|
||||||
|
public class MemberPriceController extends BaseController {
|
||||||
|
|
||||||
|
private final MemberPriceService memberPriceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询会员价格列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("cai:memberPrice:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<MemberPrice> list(MemberPrice bo, PageQuery pageQuery) {
|
||||||
|
Page<MemberPrice> page = memberPriceService.page(pageQuery.build(), Wrappers.lambdaQuery(bo));
|
||||||
|
return TableDataInfo.build(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取会员价格详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("cai:memberPrice:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<MemberPrice> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Integer id) {
|
||||||
|
return R.ok(memberPriceService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增会员价格
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("cai:memberPrice:add")
|
||||||
|
@Log(title = "会员价格", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody MemberPrice bo) {
|
||||||
|
return toAjax(memberPriceService.save(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改会员价格
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("cai:memberPrice:edit")
|
||||||
|
@Log(title = "会员价格", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody MemberPrice bo) {
|
||||||
|
return toAjax(memberPriceService.updateById(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除会员价格
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("cai:memberPrice:remove")
|
||||||
|
@Log(title = "会员价格", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Integer[] ids) {
|
||||||
|
return toAjax(memberPriceService.removeBatchByIds(Arrays.asList(ids)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.ruoyi.cai.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员价格对象 cai_member_price
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-01-03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("cai_member_price")
|
||||||
|
public class MemberPrice implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 类型 0 普通 1 超级
|
||||||
|
*/
|
||||||
|
private Integer memberType;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 价格
|
||||||
|
*/
|
||||||
|
private BigDecimal price;
|
||||||
|
/**
|
||||||
|
* 图片地址
|
||||||
|
*/
|
||||||
|
private String img;
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String desc;
|
||||||
|
/**
|
||||||
|
* 有效期(天)
|
||||||
|
*/
|
||||||
|
private Integer expires;
|
||||||
|
/**
|
||||||
|
* 状态 0 可用 1不可用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 永久状态 0 不是 1是
|
||||||
|
*/
|
||||||
|
private Integer longs;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ruoyi.cai.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.cai.domain.MemberPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员价格Mapper接口
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-01-03
|
||||||
|
*/
|
||||||
|
public interface MemberPriceMapper extends BaseMapper<MemberPrice> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ruoyi.cai.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.cai.domain.MemberPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员价格Service接口
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-01-03
|
||||||
|
*/
|
||||||
|
public interface MemberPriceService extends IService<MemberPrice> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.ruoyi.cai.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.cai.domain.MemberPrice;
|
||||||
|
import com.ruoyi.cai.mapper.MemberPriceMapper;
|
||||||
|
import com.ruoyi.cai.service.MemberPriceService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员价格Service业务层处理
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-01-03
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MemberPriceServiceImpl extends ServiceImpl<MemberPriceMapper,MemberPrice> implements MemberPriceService {
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?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="com.ruoyi.cai.mapper.MemberPriceMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.ruoyi.cai.domain.MemberPrice" id="MemberPriceResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="memberType" column="member_type"/>
|
||||||
|
<result property="name" column="name"/>
|
||||||
|
<result property="price" column="price"/>
|
||||||
|
<result property="img" column="img"/>
|
||||||
|
<result property="desc" column="desc"/>
|
||||||
|
<result property="expires" column="expires"/>
|
||||||
|
<result property="status" column="status"/>
|
||||||
|
<result property="longs" column="longs"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user