新增根据学校上传参赛证明
This commit is contained in:
parent
49b7e570a2
commit
625eaccbd3
@ -1,6 +1,7 @@
|
||||
package com.ruoyi.cms.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.core.domain.HitRegistrationTeachInfo;
|
||||
@ -110,5 +111,17 @@ public class HitRegistrationTeachInfoController extends BaseController
|
||||
return AjaxResult.success(hitRegistrationTeachInfoService.getTeacherInfo(schoolName,division));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询学校名称
|
||||
* @param hitRegistrationTeachInfo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getSchoolName")
|
||||
public TableDataInfo getSchoolName(String schoolName,String year){
|
||||
List<Map> schoolNames = hitRegistrationTeachInfoService.getSchoolName(schoolName,year);
|
||||
return getDataTable(schoolNames);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,110 @@
|
||||
package com.ruoyi.cms.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.cms.domain.SchoolCertificate;
|
||||
import com.ruoyi.cms.service.ISchoolCertificateService;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
import com.ruoyi.framework.config.ServerConfig;
|
||||
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.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* certificateController
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/certificate")
|
||||
public class SchoolCertificateController extends BaseController {
|
||||
@Autowired
|
||||
private ISchoolCertificateService schoolCertificateService;
|
||||
|
||||
@Autowired
|
||||
private ServerConfig serverConfig;
|
||||
|
||||
/**
|
||||
* 查询certificate列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:certificate:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SchoolCertificate schoolCertificate) {
|
||||
startPage();
|
||||
List<SchoolCertificate> list = schoolCertificateService.selectSchoolCertificateList(schoolCertificate);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出certificate列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:certificate:export')")
|
||||
@Log(title = "certificate", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SchoolCertificate schoolCertificate) {
|
||||
List<SchoolCertificate> list = schoolCertificateService.selectSchoolCertificateList(schoolCertificate);
|
||||
ExcelUtil<SchoolCertificate> util = new ExcelUtil<SchoolCertificate>(SchoolCertificate.class);
|
||||
util.exportExcel(response, list, "certificate数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取certificate详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:certificate:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(schoolCertificateService.selectSchoolCertificateById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增certificate
|
||||
*/
|
||||
@Log(title = "certificate", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SchoolCertificate schoolCertificate) {
|
||||
return toAjax(schoolCertificateService.insertSchoolCertificate(schoolCertificate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改certificate
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:certificate:edit')")
|
||||
@Log(title = "certificate", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SchoolCertificate schoolCertificate) {
|
||||
return toAjax(schoolCertificateService.updateSchoolCertificate(schoolCertificate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除certificate
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:certificate:remove')")
|
||||
@Log(title = "certificate", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(schoolCertificateService.deleteSchoolCertificateByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/download")
|
||||
public AjaxResult download(SchoolCertificate schoolCertificate){
|
||||
return success(schoolCertificateService.download(schoolCertificate));
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* certificate对象 school_certificate
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-06
|
||||
*/
|
||||
public class SchoolCertificate extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
private Long id;
|
||||
|
||||
/** 学校名称 */
|
||||
@Excel(name = "学校名称")
|
||||
private String schooleName;
|
||||
|
||||
/** 文件地址 */
|
||||
@Excel(name = "文件地址")
|
||||
private String file;
|
||||
|
||||
/** 年份 */
|
||||
private String year;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setSchooleName(String schooleName)
|
||||
{
|
||||
this.schooleName = schooleName;
|
||||
}
|
||||
|
||||
public String getSchooleName()
|
||||
{
|
||||
return schooleName;
|
||||
}
|
||||
public void setFile(String file)
|
||||
{
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public String getFile()
|
||||
{
|
||||
return file;
|
||||
}
|
||||
public void setYear(String year)
|
||||
{
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public String getYear()
|
||||
{
|
||||
return year;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("schooleName", getSchooleName())
|
||||
.append("file", getFile())
|
||||
.append("year", getYear())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -1,9 +1,12 @@
|
||||
package com.ruoyi.cms.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.ruoyi.common.core.domain.HitRegistrationTeachInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 教师信息Mapper接口
|
||||
@ -67,4 +70,6 @@ public interface HitRegistrationTeachInfoMapper extends BaseMapper<HitRegistrat
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteHitRegistrationTeachInfoByIds(Long[] ids);
|
||||
|
||||
List<Map> selectSchoolName(@Param("schoolName") String schoolename,@Param("year") String year);
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
package com.ruoyi.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.cms.domain.SchoolCertificate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* certificateMapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-06
|
||||
*/
|
||||
public interface SchoolCertificateMapper extends BaseMapper<SchoolCertificate>
|
||||
{
|
||||
/**
|
||||
* 查询certificate
|
||||
*
|
||||
* @param id certificate主键
|
||||
* @return certificate
|
||||
*/
|
||||
public SchoolCertificate selectSchoolCertificateById(Long id);
|
||||
|
||||
/**
|
||||
* 查询certificate列表
|
||||
*
|
||||
* @param schoolCertificate certificate
|
||||
* @return certificate集合
|
||||
*/
|
||||
public List<SchoolCertificate> selectSchoolCertificateList(SchoolCertificate schoolCertificate);
|
||||
|
||||
/**
|
||||
* 新增certificate
|
||||
*
|
||||
* @param schoolCertificate certificate
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSchoolCertificate(SchoolCertificate schoolCertificate);
|
||||
|
||||
/**
|
||||
* 修改certificate
|
||||
*
|
||||
* @param schoolCertificate certificate
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSchoolCertificate(SchoolCertificate schoolCertificate);
|
||||
|
||||
/**
|
||||
* 删除certificate
|
||||
*
|
||||
* @param id certificate主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSchoolCertificateById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除certificate
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSchoolCertificateByIds(Long[] ids);
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.ruoyi.cms.domain.HitRegistrationStudentInfo;
|
||||
import com.ruoyi.common.core.domain.HitRegistrationTeachInfo;
|
||||
import com.ruoyi.common.core.domain.model.RegisterBody;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 教师信息Service接口
|
||||
@ -73,4 +75,12 @@ public interface IHitRegistrationTeachInfoService
|
||||
|
||||
List<HitRegistrationTeachInfo> getTeacherInfo(String schoolName, String division);
|
||||
void register(RegisterBody user) throws Exception;
|
||||
|
||||
/**
|
||||
*
|
||||
* 查询学校名称
|
||||
* @param schoolName
|
||||
* @return
|
||||
*/
|
||||
List<Map> getSchoolName(String schoolename,String year);
|
||||
}
|
||||
|
@ -0,0 +1,70 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.cms.domain.SchoolCertificate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* certificateService接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-06
|
||||
*/
|
||||
public interface ISchoolCertificateService
|
||||
{
|
||||
/**
|
||||
* 查询certificate
|
||||
*
|
||||
* @param id certificate主键
|
||||
* @return certificate
|
||||
*/
|
||||
public SchoolCertificate selectSchoolCertificateById(Long id);
|
||||
|
||||
/**
|
||||
* 查询certificate列表
|
||||
*
|
||||
* @param schoolCertificate certificate
|
||||
* @return certificate集合
|
||||
*/
|
||||
public List<SchoolCertificate> selectSchoolCertificateList(SchoolCertificate schoolCertificate);
|
||||
|
||||
/**
|
||||
* 新增certificate
|
||||
*
|
||||
* @param schoolCertificate certificate
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSchoolCertificate(SchoolCertificate schoolCertificate);
|
||||
|
||||
/**
|
||||
* 修改certificate
|
||||
*
|
||||
* @param schoolCertificate certificate
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSchoolCertificate(SchoolCertificate schoolCertificate);
|
||||
|
||||
/**
|
||||
* 批量删除certificate
|
||||
*
|
||||
* @param ids 需要删除的certificate主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSchoolCertificateByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除certificate信息
|
||||
*
|
||||
* @param id certificate主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSchoolCertificateById(Long id);
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SchoolCertificate download(SchoolCertificate schoolCertificate);
|
||||
}
|
@ -3,8 +3,10 @@ package com.ruoyi.cms.service.impl;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.ruoyi.cms.domain.HitRegistrationStudentInfo;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
@ -239,6 +241,17 @@ public class HitRegistrationTeachInfoServiceImpl implements IHitRegistrationTeac
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询学校名称
|
||||
*
|
||||
* @param schoolName
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map> getSchoolName(String schoolename,String year) {
|
||||
return hitRegistrationTeachInfoMapper.selectSchoolName(schoolename,year);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验验证码
|
||||
*
|
||||
|
@ -0,0 +1,131 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cms.domain.SchoolCertificate;
|
||||
import com.ruoyi.cms.mapper.SchoolCertificateMapper;
|
||||
import com.ruoyi.cms.service.ISchoolCertificateService;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* certificateService业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-06
|
||||
*/
|
||||
@Service
|
||||
public class SchoolCertificateServiceImpl extends ServiceImpl<SchoolCertificateMapper, SchoolCertificate> implements ISchoolCertificateService
|
||||
{
|
||||
@Autowired
|
||||
private SchoolCertificateMapper schoolCertificateMapper;
|
||||
|
||||
/**
|
||||
* 查询certificate
|
||||
*
|
||||
* @param id certificate主键
|
||||
* @return certificate
|
||||
*/
|
||||
@Override
|
||||
public SchoolCertificate selectSchoolCertificateById(Long id)
|
||||
{
|
||||
return schoolCertificateMapper.selectSchoolCertificateById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询certificate列表
|
||||
*
|
||||
* @param schoolCertificate certificate
|
||||
* @return certificate
|
||||
*/
|
||||
@Override
|
||||
public List<SchoolCertificate> selectSchoolCertificateList(SchoolCertificate schoolCertificate)
|
||||
{
|
||||
return schoolCertificateMapper.selectSchoolCertificateList(schoolCertificate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增certificate
|
||||
*
|
||||
* @param schoolCertificate certificate
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSchoolCertificate(SchoolCertificate schoolCertificate)
|
||||
{
|
||||
//判断当前年 当前学校是否有数据
|
||||
int year = DateUtil.year(DateUtil.date());
|
||||
SchoolCertificate schoolCertificate1 = baseMapper.selectOne(new LambdaQueryWrapper<>(SchoolCertificate.class)
|
||||
.eq(SchoolCertificate::getSchooleName, schoolCertificate.getSchooleName())
|
||||
.eq(SchoolCertificate::getYear, year));
|
||||
if (ObjectUtil.isNotNull(schoolCertificate1)) {
|
||||
//修改
|
||||
schoolCertificate1.setFile(schoolCertificate.getFile());
|
||||
return baseMapper.updateById(schoolCertificate1);
|
||||
}else {
|
||||
//新增
|
||||
schoolCertificate.setYear(year+"");
|
||||
schoolCertificate.setCreateTime(DateUtils.getNowDate());
|
||||
return schoolCertificateMapper.insertSchoolCertificate(schoolCertificate);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改certificate
|
||||
*
|
||||
* @param schoolCertificate certificate
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSchoolCertificate(SchoolCertificate schoolCertificate)
|
||||
{
|
||||
schoolCertificate.setUpdateTime(DateUtils.getNowDate());
|
||||
return schoolCertificateMapper.updateSchoolCertificate(schoolCertificate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除certificate
|
||||
*
|
||||
* @param ids 需要删除的certificate主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSchoolCertificateByIds(Long[] ids)
|
||||
{
|
||||
return schoolCertificateMapper.deleteSchoolCertificateByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除certificate信息
|
||||
*
|
||||
* @param id certificate主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSchoolCertificateById(Long id)
|
||||
{
|
||||
return schoolCertificateMapper.deleteSchoolCertificateById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SchoolCertificate download(SchoolCertificate schoolCertificate) {
|
||||
//通过年份与学校名查询
|
||||
SchoolCertificate schoolCertificate1 = baseMapper.selectOne(new LambdaQueryWrapper<>(SchoolCertificate.class)
|
||||
.eq(SchoolCertificate::getYear, schoolCertificate.getYear())
|
||||
.eq(SchoolCertificate::getSchooleName, schoolCertificate.getSchooleName()));
|
||||
if (ObjectUtil.isNull(schoolCertificate1)){
|
||||
throw new RuntimeException("当前学校并未上传");
|
||||
}
|
||||
return schoolCertificate1;
|
||||
}
|
||||
}
|
@ -58,7 +58,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where user_id = #{userId} and YEAR(create_time) = YEAR(CURRENT_DATE)
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectSchoolName" resultType="java.util.Map">
|
||||
select school_name schoolName
|
||||
from hit_registration_teach_info
|
||||
<where>
|
||||
<if test="schoolName != null and schoolName != ''"> and school_name like concat('%', #{schoolName}, '%')</if>
|
||||
<if test="year != null">
|
||||
create_time like concat(#{year},'%')
|
||||
</if>
|
||||
</where>
|
||||
group by school_name
|
||||
order by school_name asc
|
||||
</select>
|
||||
<insert id="insertHitRegistrationTeachInfo" parameterType="com.ruoyi.common.core.domain.HitRegistrationTeachInfo">
|
||||
insert into hit_registration_teach_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
@ -0,0 +1,76 @@
|
||||
<?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.cms.mapper.SchoolCertificateMapper">
|
||||
|
||||
<resultMap type="SchoolCertificate" id="SchoolCertificateResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="schooleName" column="schoole_name" />
|
||||
<result property="file" column="file" />
|
||||
<result property="year" column="year" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSchoolCertificateVo">
|
||||
select id, schoole_name, file, year, create_time, update_time from school_certificate
|
||||
</sql>
|
||||
|
||||
<select id="selectSchoolCertificateList" parameterType="SchoolCertificate" resultMap="SchoolCertificateResult">
|
||||
<include refid="selectSchoolCertificateVo"/>
|
||||
<where>
|
||||
<if test="schooleName != null and schooleName != ''"> and schoole_name like concat('%', #{schooleName}, '%')</if>
|
||||
<if test="file != null and file != ''"> and file = #{file}</if>
|
||||
<if test="year != null and year != ''"> and year = #{year}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSchoolCertificateById" parameterType="Long" resultMap="SchoolCertificateResult">
|
||||
<include refid="selectSchoolCertificateVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSchoolCertificate" parameterType="SchoolCertificate">
|
||||
insert into school_certificate
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="schooleName != null and schooleName != ''">schoole_name,</if>
|
||||
<if test="file != null">file,</if>
|
||||
<if test="year != null">year,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="schooleName != null and schooleName != ''">#{schooleName},</if>
|
||||
<if test="file != null">#{file},</if>
|
||||
<if test="year != null">#{year},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSchoolCertificate" parameterType="SchoolCertificate">
|
||||
update school_certificate
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="schooleName != null and schooleName != ''">schoole_name = #{schooleName},</if>
|
||||
<if test="file != null">file = #{file},</if>
|
||||
<if test="year != null">year = #{year},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSchoolCertificateById" parameterType="Long">
|
||||
delete from school_certificate where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSchoolCertificateByIds" parameterType="String">
|
||||
delete from school_certificate where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -25,12 +25,12 @@ public class FileUploadUtils
|
||||
/**
|
||||
* 默认大小 50M
|
||||
*/
|
||||
public static final long DEFAULT_MAX_SIZE = 1000 * 1024 * 1024L;
|
||||
public static final long DEFAULT_MAX_SIZE = 100000 * 1024 * 1024L;
|
||||
|
||||
/**
|
||||
* 默认的文件名最大长度 100
|
||||
*/
|
||||
public static final int DEFAULT_FILE_NAME_LENGTH = 100;
|
||||
public static final int DEFAULT_FILE_NAME_LENGTH = 1000;
|
||||
|
||||
/**
|
||||
* 默认上传的地址
|
||||
|
60
ruoyi-ui/src/api/hit/certificate.js
Normal file
60
ruoyi-ui/src/api/hit/certificate.js
Normal file
@ -0,0 +1,60 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询certificate列表
|
||||
export function listCertificate(query) {
|
||||
return request({
|
||||
url: '/system/certificate/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
// 查询certificate列表
|
||||
export function listSchooleName(query) {
|
||||
return request({
|
||||
url: '/HitRegistrationTeachInfo/HitRegistrationTeachInfo/getSchoolName',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询certificate详细
|
||||
export function getCertificate(id) {
|
||||
return request({
|
||||
url: '/system/certificate/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增certificate
|
||||
export function addCertificate(data) {
|
||||
return request({
|
||||
url: '/system/certificate',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改certificate
|
||||
export function updateCertificate(data) {
|
||||
return request({
|
||||
url: '/system/certificate',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除certificate
|
||||
export function delCertificate(id) {
|
||||
return request({
|
||||
url: '/system/certificate/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
// 删除certificate
|
||||
export function downCertificate(query) {
|
||||
return request({
|
||||
url: '/system/certificate/download',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
344
ruoyi-ui/src/views/hit/certificate/index.vue
Normal file
344
ruoyi-ui/src/views/hit/certificate/index.vue
Normal file
@ -0,0 +1,344 @@
|
||||
<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="schooleName">
|
||||
<el-input
|
||||
v-model="queryParams.schoolName"
|
||||
placeholder="请输入学校名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="年份" prop="year">
|
||||
<el-date-picker
|
||||
v-model="queryParams.year"
|
||||
type="year"
|
||||
placeholder="选择年">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="certificateList" @selection-change="handleSelectionChange">
|
||||
<!-- <el-table-column type="selection" width="55" align="center" />-->
|
||||
<!-- <el-table-column label="id" align="center" prop="id" />-->
|
||||
<el-table-column label="学校名称" align="center" prop="schoolName"/>
|
||||
<!-- <el-table-column label="文件地址" align="center" prop="file" />-->
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<!-- 导入 -->
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-upload"
|
||||
@click="handleImport(scope.row)"
|
||||
v-hasPermi="['system:certificate:import']"
|
||||
>上传
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-download"
|
||||
@click="downloads(scope.row)"
|
||||
>下载
|
||||
</el-button>
|
||||
<!-- <el-descriptions-item label="下载" >-->
|
||||
<!-- <el-link :href="`${baseUrl}${scope.row.file}`" type="primary" :underline="false" target="_blank" v-if="scope.row.file">-->
|
||||
<!-- <span class="el-icon-document"> 下载 </span>-->
|
||||
<!-- </el-link>-->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:limit="1"
|
||||
accept=".zip,.rar"
|
||||
:headers="upload.headers"
|
||||
:action="upload.url + '?updateSupport=' + upload.updateSupport"
|
||||
:disabled="upload.isUploading"
|
||||
:on-progress="handleFileUploadProgress"
|
||||
:on-success="handleFileSuccess"
|
||||
:auto-upload="false"
|
||||
drag
|
||||
>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<div class="el-upload__tip text-center" slot="tip">
|
||||
<!-- <div class="el-upload__tip" slot="tip">-->
|
||||
<!-- <el-checkbox v-model="upload.updateSupport"/>-->
|
||||
<!-- 是否更新已经存在的用户数据-->
|
||||
<!-- </div>-->
|
||||
<span>仅允许导入zip、rar格式文件。</span>
|
||||
</div>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
||||
<el-button @click="upload.open = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加或修改certificate对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="文件地址" prop="file">
|
||||
<file-upload v-model="form.file"/>
|
||||
</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 {
|
||||
listCertificate,
|
||||
getCertificate,
|
||||
delCertificate,
|
||||
addCertificate,
|
||||
updateCertificate,
|
||||
listSchooleName, downCertificate
|
||||
} from "@/api/hit/certificate";
|
||||
import {getToken} from "@/utils/auth";
|
||||
import download from "@/plugins/download";
|
||||
|
||||
export default {
|
||||
name: "Certificate",
|
||||
data() {
|
||||
return {
|
||||
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
baseUrl: process.env.VUE_APP_BASE_API,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// certificate表格数据
|
||||
certificateList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
schoolName: null,
|
||||
file: null,
|
||||
year: new Date().getFullYear().toString(),
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
schooleName: [
|
||||
{required: true, message: "学校名称不能为空", trigger: "blur"}
|
||||
],
|
||||
},
|
||||
schoolName: '',
|
||||
upload: {
|
||||
// 是否显示弹出层(用户导入)
|
||||
open: false,
|
||||
// 弹出层标题(用户导入)
|
||||
title: "",
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 是否更新已经存在的用户数据
|
||||
updateSupport: 0,
|
||||
// 设置上传的请求头部
|
||||
headers: {Authorization: "Bearer " + getToken()},
|
||||
// 上传的地址
|
||||
url: process.env.VUE_APP_BASE_API + "/common/upload"
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// this.getList();
|
||||
this.getSchoolNameList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询certificate列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCertificate(this.queryParams).then(response => {
|
||||
this.certificateList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 查询certificate列表 */
|
||||
getSchoolNameList() {
|
||||
console.log('year',new Date(this.queryParams.year).getFullYear().toString())
|
||||
this.queryParams.year = new Date(this.queryParams.year).getFullYear().toString()
|
||||
this.loading = true;
|
||||
listSchooleName(this.queryParams).then(response => {
|
||||
this.certificateList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
getFileExtension(url) {
|
||||
// 正则匹配文件扩展名
|
||||
const extensionMatch = url.match(/\.([a-zA-Z0-9]+)(\?|#|$)/);
|
||||
return extensionMatch ? extensionMatch[1].toLowerCase() : 'txt';
|
||||
},
|
||||
|
||||
|
||||
downloads(row) {
|
||||
console.log('row',row)
|
||||
let data = {
|
||||
schooleName: row.schoolName,
|
||||
year: this.queryParams.year
|
||||
}
|
||||
downCertificate(data).then(response => {
|
||||
console.log(
|
||||
'下载地址',
|
||||
response.data
|
||||
)
|
||||
const fileUrl = response.data.file;
|
||||
const name = new Date().getTime();
|
||||
const timestamp = new Date().toISOString().replace(/[-:T]/g, '').split('.')[0];
|
||||
// 获取文件的扩展名
|
||||
const fileExtension = this.getFileExtension(fileUrl);
|
||||
|
||||
// 根据文件扩展名生成带时间戳的文件名
|
||||
const fileNameWithTimestamp = `${name}_${timestamp}.${fileExtension}`;
|
||||
// const fileNameWithTimestamp = `${name}_${timestamp}`;
|
||||
download.zip(fileUrl, fileNameWithTimestamp);
|
||||
})
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
schooleName: null,
|
||||
file: null,
|
||||
year: null,
|
||||
createTime: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getSchoolNameList();
|
||||
},
|
||||
/** 导入按钮操作 */
|
||||
handleImport(row) {
|
||||
console.log("row", row.schoolName)
|
||||
this.upload.title = "上传";
|
||||
this.upload.open = true;
|
||||
this.schoolName = row.schoolName;
|
||||
},
|
||||
// 文件上传中处理
|
||||
handleFileUploadProgress(event, file, fileList) {
|
||||
this.upload.isUploading = true;
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
console.log("响应", response)
|
||||
console.log("成功之后调用")
|
||||
let data = {
|
||||
file: response.fileName,
|
||||
schooleName: this.schoolName
|
||||
}
|
||||
addCertificate(data).then(response => {
|
||||
this.upload.open = false;
|
||||
this.upload.isUploading = false;
|
||||
this.$refs.upload.clearFiles();
|
||||
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", {dangerouslyUseHTMLString: true});
|
||||
this.getSchoolNameList();
|
||||
});
|
||||
},
|
||||
|
||||
// 提交上传文件
|
||||
submitFileForm() {
|
||||
this.$refs.upload.submit();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加certificate";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getCertificate(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改certificate";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateCertificate(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addCertificate(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除certificate编号为"' + ids + '"的数据项?').then(function () {
|
||||
return delCertificate(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/certificate/export', {
|
||||
...this.queryParams
|
||||
}, `certificate_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user