智慧保安后台管理-外网项目备份
钟日健
2022-02-21 536a94fb285c41958ed9a315f9909a157f908ec8
用户会员,会员题库crud 新增
14 files added
560 ■■■■■ changed files
src/main/java/org/springblade/modules/vip/controller/UserVipController.java 106 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/vip/controller/VipTopticController.java 105 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/vip/entity/UserVip.java 71 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/vip/entity/VipTopic.java 49 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/vip/mapper/UserVipMapper.java 27 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/vip/mapper/UserVipMapper.xml 14 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/vip/mapper/VipTopicMapper.java 28 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/vip/mapper/VipTopicMapper.xml 14 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/vip/service/UserVipService.java 26 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/vip/service/VipTopicService.java 26 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/vip/service/impl/UserVipServiceImpl.java 32 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/vip/service/impl/VipTopticServiceImpl.java 31 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/vip/vo/UserVipVO.java 15 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/vip/vo/VipTopicVO.java 16 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/vip/controller/UserVipController.java
New file
@@ -0,0 +1,106 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.vip.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.vip.entity.UserVip;
import org.springblade.modules.vip.service.UserVipService;
import org.springblade.modules.vip.vo.UserVipVO;
import org.springframework.web.bind.annotation.*;
/**
 * 用户会员控制器
 * @author zhongrj
 * @since 2022-02-21
 */
@RestController
@AllArgsConstructor
@RequestMapping("/userVip")
@Api(value = "", tags = "接口")
public class UserVipController extends BladeController {
    private final UserVipService userVipService;
    /**
     * 详情
     */
    @GetMapping("/detail")
    public R<UserVip> detail(UserVip userVip) {
        UserVip detail = userVipService.getOne(Condition.getQueryWrapper(userVip));
        return R.data(detail);
    }
    /**
     * 分页
     */
    @GetMapping("/list")
    public R<IPage<UserVip>> list(UserVip userVip, Query query) {
        IPage<UserVip> pages = userVipService.page(Condition.getPage(query), Condition.getQueryWrapper(userVip));
        return R.data(pages);
    }
    /**
     * 自定义分页
     */
    @GetMapping("/page")
    public R<IPage<UserVipVO>> page(UserVipVO userVip, Query query) {
        IPage<UserVipVO> pages = userVipService.selectUserVipPage(Condition.getPage(query), userVip);
        return R.data(pages);
    }
    /**
     * 新增
     */
    @PostMapping("/save")
    public R save(@RequestBody UserVip userVip) {
        return R.data(userVipService.save(userVip));
    }
    /**
     * 修改
     */
    @PostMapping("/update")
    public R update(@RequestBody UserVip userVip) {
        return R.data(userVipService.updateById(userVip));
    }
    /**
     * 新增或修改
     */
    @PostMapping("/submit")
    public R submit(@RequestBody UserVip userVip) {
        return R.status(userVipService.saveOrUpdate(userVip));
    }
    /**
     * 删除
     */
    @PostMapping("/remove")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(userVipService.removeByIds(Func.toLongList(ids)));
    }
}
src/main/java/org/springblade/modules/vip/controller/VipTopticController.java
New file
@@ -0,0 +1,105 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.vip.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.vip.entity.VipTopic;
import org.springblade.modules.vip.service.VipTopicService;
import org.springblade.modules.vip.vo.VipTopicVO;
import org.springframework.web.bind.annotation.*;
/**
 * 用户会员题库控制器
 * @author zhongrj
 * @since 2022-02-21
 */
@RestController
@AllArgsConstructor
@RequestMapping("/vipTopic")
public class VipTopticController extends BladeController {
    private final VipTopicService vipTopicService;
    /**
     * 详情
     */
    @GetMapping("/detail")
    public R<VipTopic> detail(VipTopic vipTopic) {
        VipTopic detail = vipTopicService.getOne(Condition.getQueryWrapper(vipTopic));
        return R.data(detail);
    }
    /**
     * 分页
     */
    @GetMapping("/list")
    public R<IPage<VipTopic>> list(VipTopic vipTopic, Query query) {
        IPage<VipTopic> pages = vipTopicService.page(Condition.getPage(query), Condition.getQueryWrapper(vipTopic));
        return R.data(pages);
    }
    /**
     * 自定义分页
     */
    @GetMapping("/page")
    public R<IPage<VipTopicVO>> page(VipTopicVO vipTopic, Query query) {
        IPage<VipTopicVO> pages = vipTopicService.selectVipTopicPage(Condition.getPage(query), vipTopic);
        return R.data(pages);
    }
    /**
     * 新增
     */
    @PostMapping("/save")
    public R save(@RequestBody VipTopic vipTopic) {
        return R.data(vipTopicService.save(vipTopic));
    }
    /**
     * 修改
     */
    @PostMapping("/update")
    public R update(@RequestBody VipTopic vipTopic) {
        return R.data(vipTopicService.updateById(vipTopic));
    }
    /**
     * 新增或修改
     */
    @PostMapping("/submit")
    public R submit(@RequestBody VipTopic vipTopic) {
        return R.status(vipTopicService.saveOrUpdate(vipTopic));
    }
    /**
     * 删除
     */
    @PostMapping("/remove")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(vipTopicService.removeByIds(Func.toLongList(ids)));
    }
}
src/main/java/org/springblade/modules/vip/entity/UserVip.java
New file
@@ -0,0 +1,71 @@
package org.springblade.modules.vip.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
 * 用户会员实体类
 *
 * @author zhongrj
 * @since 2020-02-21
 */
@Data
@TableName("sys_user_vip")
public class UserVip implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     */
    @TableId(value = "id",type = IdType.ASSIGN_ID)
    private Long id;
    /**
     * 用户id
     */
    private Long userId;
    /**
     * 身份证号码
     */
    private String idCardNo;
    /**
     * 会员编号
     */
    private String code;
    /**
     * 缴费url
     */
    private String voucher;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    /**
     * 报名id
     */
    private Integer applyId;
}
src/main/java/org/springblade/modules/vip/entity/VipTopic.java
New file
@@ -0,0 +1,49 @@
package org.springblade.modules.vip.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
 * 用户会员题库实体类
 *
 * @author zhongrj
 * @since 2020-02-21
 */
@Data
@TableName("sys_vip_topic")
public class VipTopic implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     */
    @TableId(value = "id",type = IdType.ASSIGN_ID)
    private Long id;
    /**
     * 用户会员id
     */
    private Long userVipId;
    /**
     * 题目id
     */
    private String topicIds;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
}
src/main/java/org/springblade/modules/vip/mapper/UserVipMapper.java
New file
@@ -0,0 +1,27 @@
package org.springblade.modules.vip.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.vip.entity.UserVip;
import org.springblade.modules.vip.vo.UserVipVO;
import java.util.List;
/**
 *  Mapper 接口
 *
 * @author zhongrj
 * @since 2022-02-21
 */
public interface UserVipMapper extends BaseMapper<UserVip> {
    /**
     * 自定义分页
     *
     * @param page
     * @param userVip
     * @return
     */
    List<UserVipVO> selectUserVipPage(IPage<UserVipVO> page, @Param("userVip") UserVipVO userVip);
}
src/main/java/org/springblade/modules/vip/mapper/UserVipMapper.xml
New file
@@ -0,0 +1,14 @@
<?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="org.springblade.modules.vip.mapper.UserVipMapper">
    <!--自定义查询用户会员分页数据-->
    <select id="selectUserVipPage" resultType="org.springblade.modules.vip.vo.UserVipVO">
        select * from sys_user_vip
        where 1=1
        <if test="userVip.idCardNo!=null and userVip.idCardNo!=''">
            and id_card_no=#{userVip.idCardNo}
        </if>
    </select>
</mapper>
src/main/java/org/springblade/modules/vip/mapper/VipTopicMapper.java
New file
@@ -0,0 +1,28 @@
package org.springblade.modules.vip.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.vip.entity.VipTopic;
import org.springblade.modules.vip.vo.VipTopicVO;
import java.util.List;
/**
 *  Mapper 接口
 *
 * @author zhongrj
 * @since 2022-02-21
 */
public interface VipTopicMapper extends BaseMapper<VipTopic> {
    /**
     * 自定义分页
     *
     * @param page
     * @param vipTopic
     * @return
     */
    List<VipTopicVO> selectVipTopicPage(IPage<VipTopicVO> page, @Param("vipTopic") VipTopicVO vipTopic);
}
src/main/java/org/springblade/modules/vip/mapper/VipTopicMapper.xml
New file
@@ -0,0 +1,14 @@
<?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="org.springblade.modules.vip.mapper.VipTopicMapper">
    <!--自定义查询用户会员分页数据-->
    <select id="selectVipTopicPage" resultType="org.springblade.modules.vip.vo.VipTopicVO">
        select * from sys_vip_topic
        where 1=1
        <if test="vipTopic.userVipId!=null">
            and user_vip_id =#{vipTopic.userVipId}
        </if>
    </select>
</mapper>
src/main/java/org/springblade/modules/vip/service/UserVipService.java
New file
@@ -0,0 +1,26 @@
package org.springblade.modules.vip.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.vip.entity.UserVip;
import org.springblade.modules.vip.vo.UserVipVO;
/**
 *  用户会员服务类
 *
 * @author zhongrj
 * @since 2022-02-21
 */
public interface UserVipService extends IService<UserVip> {
    /**
     * 自定义分页
     *
     * @param page
     * @param userVipVO
     * @return
     */
    IPage<UserVipVO> selectUserVipPage(IPage<UserVipVO> page, @Param("userVipVO") UserVipVO userVipVO);
}
src/main/java/org/springblade/modules/vip/service/VipTopicService.java
New file
@@ -0,0 +1,26 @@
package org.springblade.modules.vip.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.vip.entity.VipTopic;
import org.springblade.modules.vip.vo.VipTopicVO;
/**
 *  用户会员题库服务类
 *
 * @author zhongrj
 * @since 2022-02-21
 */
public interface VipTopicService extends IService<VipTopic> {
    /**
     * 自定义分页
     *
     * @param page
     * @param vipTopicVO
     * @return
     */
    IPage<VipTopicVO> selectVipTopicPage(IPage<VipTopicVO> page, @Param("vipTopicVO") VipTopicVO vipTopicVO);
}
src/main/java/org/springblade/modules/vip/service/impl/UserVipServiceImpl.java
New file
@@ -0,0 +1,32 @@
package org.springblade.modules.vip.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.vip.entity.UserVip;
import org.springblade.modules.vip.mapper.UserVipMapper;
import org.springblade.modules.vip.service.UserVipService;
import org.springblade.modules.vip.vo.UserVipVO;
import org.springframework.stereotype.Service;
/**
 *  用户会员服务实现类
 *
 * @author zhongrj
 * @since 2022-02-21
 */
@Service
public class UserVipServiceImpl extends ServiceImpl<UserVipMapper, UserVip> implements UserVipService {
    /**
     * 自定义分页查询用户会员数据
     * @param page
     * @param userVip
     * @return
     */
    @Override
    public IPage<UserVipVO> selectUserVipPage(IPage<UserVipVO> page, UserVipVO userVip) {
        return page.setRecords(baseMapper.selectUserVipPage(page, userVip));
    }
}
src/main/java/org/springblade/modules/vip/service/impl/VipTopticServiceImpl.java
New file
@@ -0,0 +1,31 @@
package org.springblade.modules.vip.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.vip.entity.VipTopic;
import org.springblade.modules.vip.mapper.VipTopicMapper;
import org.springblade.modules.vip.service.VipTopicService;
import org.springblade.modules.vip.vo.VipTopicVO;
import org.springframework.stereotype.Service;
/**
 *  用户会员题库服务实现类
 *
 * @author zhongrj
 * @since 2022-02-21
 */
@Service
public class VipTopticServiceImpl extends ServiceImpl<VipTopicMapper, VipTopic> implements VipTopicService {
    /**
     * 自定义分页查询用户会员数据
     * @param page
     * @param vipTopic
     * @return
     */
    @Override
    public IPage<VipTopicVO> selectVipTopicPage(IPage<VipTopicVO> page, VipTopicVO vipTopic) {
        return page.setRecords(baseMapper.selectVipTopicPage(page, vipTopic));
    }
}
src/main/java/org/springblade/modules/vip/vo/UserVipVO.java
New file
@@ -0,0 +1,15 @@
package org.springblade.modules.vip.vo;
import lombok.Data;
import org.springblade.modules.vip.entity.UserVip;
/**
 * 视图实体类
 * @author zhongrj
 * @since 2022-02-21
 */
@Data
public class UserVipVO extends UserVip {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/vip/vo/VipTopicVO.java
New file
@@ -0,0 +1,16 @@
package org.springblade.modules.vip.vo;
import lombok.Data;
import org.springblade.modules.vip.entity.UserVip;
import org.springblade.modules.vip.entity.VipTopic;
/**
 * 视图实体类
 * @author zhongrj
 * @since 2022-02-21
 */
@Data
public class VipTopicVO extends VipTopic {
    private static final long serialVersionUID = 1L;
}