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

@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<association property="dept" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap>
<resultMap id="deptResult" type="SysDept">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="leader" column="leader" />
<result property="status" column="dept_status" />
</resultMap>
<resultMap id="RoleResult" type="SysRole">
<id property="roleId" column="role_id" />
<result property="roleName" column="role_name" />
@ -45,9 +45,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="dataScope" column="data_scope" />
<result property="status" column="role_status" />
</resultMap>
<sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u
@ -55,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id
</sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
@ -84,7 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
from sys_user u
@ -101,7 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
from sys_user u
@ -119,25 +119,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.user_name = #{userName} and u.del_flag = '0'
</select>
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.user_id = #{userId}
</select>
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
select user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1
</select>
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
</select>
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
</select>
@ -201,28 +201,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</set>
where user_id = #{userId}
</update>
<update id="updateUserStatus" parameterType="SysUser">
update sys_user set status = #{status} where user_id = #{userId}
</update>
<update id="updateUserAvatar" parameterType="SysUser">
update sys_user set avatar = #{avatar} where user_name = #{userName}
</update>
<update id="resetUserPwd" parameterType="SysUser">
update sys_user set password = #{password} where user_name = #{userName}
</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>
</foreach>
</delete>
</mapper>
</mapper>

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>
@ -171,7 +171,7 @@
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -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`)
},