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") @PostMapping("/export")
public void export(HttpServletResponse response, HitCompetitionStudentInfo hitCompetitionStudentInfo) 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); ExcelUtil<HitCompetitionStudentInfo> util = new ExcelUtil<HitCompetitionStudentInfo>(HitCompetitionStudentInfo.class);
util.exportExcel(response, list, "大赛学生数据"); util.exportExcel(response, list, "大赛学生数据");
} }

View File

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

View File

@ -31,6 +31,13 @@ public interface IHitCompetitionStudentInfoService extends IService<HitCompetiti
* @return 大赛学生集合 * @return 大赛学生集合
*/ */
public List<HitCompetitionStudentInfo> selectHitCompetitionStudentInfoList(HitCompetitionStudentInfo hitCompetitionStudentInfo); 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.mapper.SysUserMapper;
import com.ruoyi.system.service.ISysDictDataService; import com.ruoyi.system.service.ISysDictDataService;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -59,6 +61,8 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti
private ISysDictDataService sysDictDataService; private ISysDictDataService sysDictDataService;
@Autowired @Autowired
private IHitRegInfoService regInfoService; private IHitRegInfoService regInfoService;
private static final Logger log = LoggerFactory.getLogger(HitCompetitionStudentInfoServiceImpl.class);
@ -95,6 +99,27 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti
PageUtils.startPage(); PageUtils.startPage();
return hitCompetitionStudentInfoMapper.selectHitCompetitionStudentInfoList(hitCompetitionStudentInfo); 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 @Override
public int updateHitCompetitionStudentInfo(HitCompetitionStudentInfo hitCompetitionStudentInfo) 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()); hitCompetitionStudentInfo.setUpdateTime(DateUtils.getNowDate());
return hitCompetitionStudentInfoMapper.updateHitCompetitionStudentInfo(hitCompetitionStudentInfo); return hitCompetitionStudentInfoMapper.updateHitCompetitionStudentInfo(hitCompetitionStudentInfo);
} }

View File

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

View File

@ -215,11 +215,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteUserById" parameterType="Long"> <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>
<delete id="deleteUserByIds" parameterType="Long"> <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=")"> <foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId} #{userId}
</foreach> </foreach>

View File

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