This commit is contained in:
许允枞 2024-09-18 19:04:49 +08:00
parent fc557fda5e
commit 128667a085
7 changed files with 87 additions and 36 deletions

View File

@ -63,7 +63,7 @@ public class HitCompetitionStudentInfoController extends BaseController {
@PostMapping("/export")
public void export(HttpServletResponse response, HitCompetitionStudentInfo hitCompetitionStudentInfo)
{
List<HitCompetitionStudentInfo> list = hitCompetitionStudentInfoService.selectHitCompetitionStudentInfoList(hitCompetitionStudentInfo);
List<HitCompetitionStudentInfo> list = hitCompetitionStudentInfoService.selectHitCompetitionStudentInfoListExport(hitCompetitionStudentInfo);
ExcelUtil<HitCompetitionStudentInfo> util = new ExcelUtil<HitCompetitionStudentInfo>(HitCompetitionStudentInfo.class);
util.exportExcel(response, list, "大赛学生数据");
}

View File

@ -21,6 +21,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import static com.ruoyi.common.annotation.Excel.Type.EXPORT;
/**
* <p>
* 大赛学生表
@ -44,6 +46,7 @@ public class HitCompetitionStudentInfo implements Serializable {
@ApiModelProperty(value = "团队报名主键")
private String hitRegId;
@Excel(name = "学生姓名",type = EXPORT)
@ApiModelProperty(value = "学生姓名")
private String stuName;
@ -53,9 +56,11 @@ public class HitCompetitionStudentInfo implements Serializable {
@ApiModelProperty(value = "学号")
private String studentId;
@Excel(name = "学校名称",type = EXPORT)
@ApiModelProperty(value = "学校名称")
private String schoolName;
@Excel(name = "院系名称",type = EXPORT)
@ApiModelProperty(value = "院系名称")
private String collegeName;
private String sex;
@ -63,6 +68,7 @@ public class HitCompetitionStudentInfo implements Serializable {
@ApiModelProperty(value = "专业")
private String major;
@Excel(name = "所属赛区",type = EXPORT)
@ApiModelProperty(value = "所属赛区")
private String division;
@ -77,16 +83,18 @@ public class HitCompetitionStudentInfo implements Serializable {
@ApiModelProperty(value = "手机号")
private String phoneNumber;
@Excel(name = "邮箱",type = EXPORT)
@ApiModelProperty(value = "邮箱")
private String email;
@ApiModelProperty(value = "学生证")
private String studentIdCard;
@Excel(name = "个人选拔赛分数")
// @Excel(name = "个人选拔赛分数")
@ApiModelProperty(value = "个人选拔赛分数")
private BigDecimal trialsScore;
// @Excel(name = "是否被选为参加地区选拔赛人员", readConverterExp = "false=待审核,true=已入选",type = EXPORT)
@ApiModelProperty(value = "是否被选为参加初赛人员 (0: 否, 1: 是)")
private Boolean isPreliminary;

View File

@ -31,6 +31,13 @@ public interface IHitCompetitionStudentInfoService extends IService<HitCompetiti
* @return 大赛学生集合
*/
public List<HitCompetitionStudentInfo> selectHitCompetitionStudentInfoList(HitCompetitionStudentInfo hitCompetitionStudentInfo);
/**
* 导出查询大赛学生列表
*
* @param hitCompetitionStudentInfo 大赛学生
* @return 大赛学生集合
*/
public List<HitCompetitionStudentInfo> selectHitCompetitionStudentInfoListExport(HitCompetitionStudentInfo hitCompetitionStudentInfo);
/**
* 新增大赛学生

View File

@ -24,6 +24,8 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.ISysDictDataService;
import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -59,6 +61,8 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti
private ISysDictDataService sysDictDataService;
@Autowired
private IHitRegInfoService regInfoService;
private static final Logger log = LoggerFactory.getLogger(HitCompetitionStudentInfoServiceImpl.class);
@ -95,6 +99,27 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti
PageUtils.startPage();
return hitCompetitionStudentInfoMapper.selectHitCompetitionStudentInfoList(hitCompetitionStudentInfo);
}
/**
* 查询大赛学生列表
*
* @param hitCompetitionStudentInfo 大赛学生
* @return 大赛学生
*/
@Override
public List<HitCompetitionStudentInfo> selectHitCompetitionStudentInfoListExport(HitCompetitionStudentInfo hitCompetitionStudentInfo)
{
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
hitCompetitionStudentInfo.setYear(String.valueOf(year));
//当前教师的学校
LoginUser loginUser = SecurityUtils.getLoginUser();
HitRegistrationTeachInfo hitRegistrationTeachInfo = hitRegistrationTeachInfoMapper.selectHitRegistrationTeachInfoByUserId(loginUser.getUserId());
if(ObjectUtils.isNotEmpty(hitRegistrationTeachInfo)&&hitRegistrationTeachInfo.getStatus().equals("1")){
hitCompetitionStudentInfo.setSchoolName(hitRegistrationTeachInfo.getSchoolName());
}
// PageUtils.startPage();
return hitCompetitionStudentInfoMapper.selectHitCompetitionStudentInfoList(hitCompetitionStudentInfo);
}
/**
* 新增大赛学生
@ -120,6 +145,16 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti
@Override
public int updateHitCompetitionStudentInfo(HitCompetitionStudentInfo hitCompetitionStudentInfo)
{
LambdaQueryWrapper<HitCompetitionStudentInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(HitCompetitionStudentInfo::getSchoolName, hitCompetitionStudentInfo.getSchoolName());
DateTime now = DateUtil.date();
DateTime dateTime = DateUtil.beginOfYear(now);
DateTime dateTime1 = DateUtil.endOfYear(now);
queryWrapper.between(HitCompetitionStudentInfo::getCreateTime, dateTime, dateTime1);
List<HitCompetitionStudentInfo> hitCompetitionStudentInfos = hitCompetitionStudentInfoMapper.selectList(queryWrapper);
if (CollectionUtil.isNotEmpty(hitCompetitionStudentInfos)&&hitCompetitionStudentInfos.size() >= 15 && hitCompetitionStudentInfo.getIsPreliminary()) {
throw new RuntimeException("该学校入选人数已超过15人无法再添加");
}
hitCompetitionStudentInfo.setUpdateTime(DateUtils.getNowDate());
return hitCompetitionStudentInfoMapper.updateHitCompetitionStudentInfo(hitCompetitionStudentInfo);
}

View File

@ -49,6 +49,7 @@
<if test="isPreliminary != null "> and is_preliminary = #{isPreliminary}</if>
<if test="year != null "> and create_time like concat(#{year},'%') </if>
</where>
order by school_name desc
</select>
<select id="selectHitCompetitionStudentInfoById" parameterType="String"

View File

@ -215,11 +215,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteUserById" parameterType="Long">
update sys_user set del_flag = '2' where user_id = #{userId}
delete from sys_user where user_id = #{userId}
</delete>
<delete id="deleteUserByIds" parameterType="Long">
update sys_user set del_flag = '2' where user_id in
delete from sys_user where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>

View File

@ -34,16 +34,16 @@
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
@click="handleDelete">删除</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['system:info:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:info:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -404,7 +404,7 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
this.download('system/info/export', {
this.download('system/hit_stu_info/export', {
...this.queryParams
}, `info_${new Date().getTime()}.xlsx`)
},