智慧保安后台管理-外网项目备份
Administrator
2021-07-18 5e3948796cb4171938ba23e39d071d371bb312a1
报名考试接口新增
1 files modified
7 files added
420 ■■■■■ changed files
src/main/java/org/springblade/modules/apply/controller/ApplyController.java 99 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/entity/Apply.java 145 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.xml 33 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/service/ApplyService.java 28 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/service/impl/ApplyServiceImpl.java 38 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/vo/ApplyVO.java 42 ●●●●● patch | view | raw | blame | history
src/main/resources/application.yml 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/controller/ApplyController.java
New file
@@ -0,0 +1,99 @@
package org.springblade.modules.apply.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
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.apply.entity.Apply;
import org.springblade.modules.apply.service.ApplyService;
import org.springblade.modules.apply.vo.ApplyVO;
import org.springframework.web.bind.annotation.*;
/**
 * @author zhongrj
 * @time 2021-07-17
 * @desc 考试报名管理控制层
 */
@RestController
@AllArgsConstructor
@RequestMapping("/apply")
public class ApplyController {
    private final ApplyService applyService;
    /**
     * 自定义分页
     * @param query page,size
     * @param apply 考试报名信息对象
     */
    @GetMapping("/page")
    public R<IPage<ApplyVO>> page(ApplyVO apply, Query query) {
        IPage<ApplyVO> pages = applyService.selectApplyPage(Condition.getPage(query), apply);
        return R.data(pages);
    }
    /**
     * 分页
     */
    @GetMapping("/list")
    public R<IPage<Apply>> list(Apply apply, Query query) {
        IPage<Apply> pages = applyService.page(Condition.getPage(query), Condition.getQueryWrapper(apply));
        return R.data(pages);
    }
    /**
     * 新增
     * @param apply 考试报名信息对象
     */
    @PostMapping("/save")
    @ApiOperation(value = "新增", notes = "传入apply")
    public R save(@RequestBody Apply apply) {
        return R.status(applyService.save(apply));
    }
    /**
     * 修改
     * @param apply 考试报名信息对象
     */
    @PostMapping("/update")
    public R update(@RequestBody Apply apply) {
        return R.status(applyService.updateById(apply));
    }
    /**
     * 新增或修改
     * @param apply 考试报名信息对象
     */
    @PostMapping("/submit")
    public R submit(@RequestBody Apply apply) {
        return R.status(applyService.saveOrUpdate(apply));
    }
    /**
     * 删除
     * @param ids 考试报名信息ids 数组
     */
    @PostMapping("/remove")
    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
        return R.status(applyService.removeByIds(Func.toLongList(ids)));
    }
    /**
     * 详情
     * @param apply 考试报名信息对象
     */
    @GetMapping("/detail")
    @ApiOperation(value = "详情", notes = "传入apply")
    public R<ApplyVO> details(Apply apply) {
        //查询考试报名详情
        ApplyVO detail = applyService.selectApplyInfo(apply);
        //返回
        return R.data(detail);
    }
}
src/main/java/org/springblade/modules/apply/entity/Apply.java
New file
@@ -0,0 +1,145 @@
/*
 *      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.apply.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
 * 考试报名实体类
 *
 * @author zhongrj
 * @since 2021-07-17
 */
@Data
@TableName("sys_apply")
public class Apply implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id",type = IdType.AUTO)
    private Long id;
    /**
     * 用户id
     */
    @TableField("user_id")
    private Long userId;
    /**
     * 姓名
     */
    private String name;
    /**
     * 身高
     */
    private String height;
    /**
     * 体重
     */
    private String weight;
    /**
     * 年龄
     */
    private Integer age;
    /**
     * 电子头像,用于打印准考证
     */
    private String avatar;
    /**
     * 邮箱
     */
    private String email;
    /**
     * 手机
     */
    private String phone;
    /**
     * 性别
     */
    private Integer sex;
    /**
     * 身份证
     */
    @TableField("id_card_no")
    private String idCardNo;
    /**
     * 准考证号,通过审核后生成
     */
    @TableField("candidate_no")
    private String candidateNo;
    /**
     * 报名时间
     */
    @TableField("apply_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date applyTime;
    /**
     * 审核时间
     */
    @TableField("audit_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date auditTime;
    /**
     * 考试类型
     */
    @TableField("apply_exam_type")
    private Integer applyExamType;
    /**
     * 报名状态
     */
    @TableField("apply_status")
    private Integer applyStatus;
    /**
     * 审核失败原因
     */
    @TableField("fail_reason")
    private String failReason;
}
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.java
New file
@@ -0,0 +1,34 @@
package org.springblade.modules.apply.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.apply.entity.Apply;
import org.springblade.modules.apply.vo.ApplyVO;
import java.util.List;
/**
 * 考试报名Mapper 接口
 * @author zhongrj
 */
public interface ApplyMapper extends BaseMapper<Apply> {
    /**
     * 自定义分页
     *
     * @param page  分页
     * @param apply 实体
     * @return
     */
    List<ApplyVO> selectApplyPage(IPage page, @Param("apply") ApplyVO apply);
    /**
     * 详情
     *
     * @param apply 考试报名信息对象
     */
    ApplyVO selectApplyInfo(@Param("apply") Apply apply);
}
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.xml
New file
@@ -0,0 +1,33 @@
<?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.apply.mapper.ApplyMapper">
    <!--考试报名分页信息-->
    <select id="selectApplyPage" resultType="org.springblade.modules.apply.vo.ApplyVO">
        SELECT
            *
        FROM
            sys_apply
        WHERE
            1=1
        <if test="apply.name!=null and  apply.name!=''">
            and name like concat('%', #{apply.name},'%')
        </if>
        <if test="apply.applyStatus!=null">
            and apply_status = #{apply.applyStatus}
        </if>
    </select>
    <!--考试报名详情信息-->
    <select id="selectApplyInfo" resultType="org.springblade.modules.apply.vo.ApplyVO">
        SELECT
            *
        FROM
            sys_apply
        WHERE
            1=1
        <if test="apply.id!=null">
            and id = #{apply.id}
        </if>
    </select>
</mapper>
src/main/java/org/springblade/modules/apply/service/ApplyService.java
New file
@@ -0,0 +1,28 @@
package org.springblade.modules.apply.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.apply.entity.Apply;
import org.springblade.modules.apply.vo.ApplyVO;
/**
 * 考试报名服务类
 * @author zhongrj
 */
public interface ApplyService extends IService<Apply> {
    /**
     * 自定义分页
     * @param page
     * @param apply
     * @return
     */
    IPage<ApplyVO> selectApplyPage(IPage<ApplyVO> page, ApplyVO apply);
    /**
     * 详情
     * @param apply 考试报名信息对象
     * @return
     */
    ApplyVO selectApplyInfo(Apply apply);
}
src/main/java/org/springblade/modules/apply/service/impl/ApplyServiceImpl.java
New file
@@ -0,0 +1,38 @@
package org.springblade.modules.apply.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.apply.entity.Apply;
import org.springblade.modules.apply.mapper.ApplyMapper;
import org.springblade.modules.apply.service.ApplyService;
import org.springblade.modules.apply.vo.ApplyVO;
import org.springframework.stereotype.Service;
/**
 * 考试报名服务实现类
 * @author zhongrj
 */
@Service
public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements ApplyService {
    /**
     * 自定义分页数据
     * @param page 分页条件
     * @param apply 考试报名对象
     * @return
     */
    @Override
    public IPage<ApplyVO> selectApplyPage(IPage<ApplyVO> page, ApplyVO apply) {
        return page.setRecords(baseMapper.selectApplyPage(page, apply));
    }
    /**
     * 详情
     * @param apply 考试报名信息对象
     */
    @Override
    public ApplyVO selectApplyInfo(Apply apply) {
        return baseMapper.selectApplyInfo(apply);
    }
}
src/main/java/org/springblade/modules/apply/vo/ApplyVO.java
New file
@@ -0,0 +1,42 @@
/*
 *      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.apply.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.springblade.modules.apply.entity.Apply;
import java.io.Serializable;
import java.util.Date;
/**
 * 考试报名实体类
 *
 * @author zhongrj
 * @since 2021-07-17
 */
@Data
@TableName("sys_apply")
public class ApplyVO extends Apply implements Serializable {
    private static final long serialVersionUID = 1L;
}
src/main/resources/application.yml
@@ -205,6 +205,7 @@
      - /exampaper/**
      - /examScore/**
      - /exampaper/**
      - /apply/**
    #授权认证配置
    auth:
      - method: ALL