入伍申请-恢复被覆盖的代码

This commit is contained in:
962704835@qq.com
2026-03-19 19:41:53 +08:00
parent ae92e4372b
commit b4b2dd078a
5 changed files with 45 additions and 14 deletions

View File

@@ -216,6 +216,14 @@ private static final long serialVersionUID=1L;
@Excel(name = "流程部署编号")
private String deployId;
/**
* 学院名称
*/
@ApiModelProperty("学院名称")
@TableField("dept_name")
@Excel(name = "学院名称")
private String deptName;
/**
* 入伍保留学籍申请表-审核记录
*/

View File

@@ -31,6 +31,7 @@ public interface RtEnlistmentReserveMapper extends BaseMapper<RtEnlistmentReserv
*/
public RtEnlistmentReserve selectRtEnlistmentReserveByProcessInstanceId(String processInstanceId);
/**
* 查询应征入伍保留学籍申请
*
@@ -62,6 +63,13 @@ public interface RtEnlistmentReserveMapper extends BaseMapper<RtEnlistmentReserv
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int insertRtEnlistmentReserve(RtEnlistmentReserve rtEnlistmentReserve);
/**
* Mapper接口方法统计指定年份的保留学籍记录数
* @param year 年份如2026
* @return 该年份的记录总数
*/
int countByYear(@Param("year") String year);
/**
* 修改应征入伍保留学籍申请
*

View File

@@ -114,22 +114,22 @@ public class RtEnlistmentReserveServiceImpl extends ServiceImpl<RtEnlistmentRese
}
// ========== 生成保留学籍编号 ==========
// 查询申请记录数量
List<RtEnlistmentReserve> rtEnlistmentReserves = rtEnlistmentReserveMapper.getEnlistmentReserves();
int total = rtEnlistmentReserves.size();
// 设置保留学籍编号 LBXJ0001LBXJ是固定的0001根据数据数量累加 + 时间根据系统时间但是格式要20260304
// 1. 获取当前系统时间格式化为8位日期yyyyMMdd
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
String dateStr = sdf.format(new Date());
// 1. 获取当前系统年份(用于编号和序号重置判断)
SimpleDateFormat yearSdf = new SimpleDateFormat("yyyy");
String currentYear = yearSdf.format(new Date()); // 如2026
// 2. 计算自增序号(总数+1确保新编号是下一个序号补零为4位
int seq = total + 1;
String seqStr = String.format("%04d", seq); // 不足4位时前面补0如1→000110→0010
// 2. 查询「当前年份」的记录总数(按年份分组统计,实现每年序号重置)
// 统计rt_enlistment_reserve表中reserve_no以"BLXJ("+currentYear+")"开头的记录数
int yearTotal = rtEnlistmentReserveMapper.countByYear(currentYear);
// 3. 拼接保留学籍编号LBXJ + 4位序号 + 8位日期
String reserveNo = "LBXJ" + seqStr + dateStr;
// 3. 计算当年自增序号(总数+1补零为4位0001、0002...9999
int seq = yearTotal + 1;
String seqStr = String.format("%04d", seq); // 不足4位补0如1→000110→0010100→0100
// 4. 设置到实体对象中
// 4. 拼接最终编号BLXJ(年份)序号
String reserveNo = "BLXJ(" + currentYear + ")" + seqStr;
// 5. 设置到实体对象中
rtEnlistmentReserve.setReserveNo(reserveNo);
rtEnlistmentReserve.setCreateTime(DateUtils.getNowDate());

View File

@@ -46,6 +46,7 @@
<result property="updateTime" column="update_time"/>
<result property="affixId" column="affix_id"/>
<result property="deployId" column="deploy_id" />
<result property="deptName" column="dept_name"/>
<!--入伍保留学籍申请表-审核记录 多条件查询column里传入了多条件【{studentName = student_name, studentNo = student_no}】javaType里面写了list表明你有多条件 studentName student_name字段-->
<collection property="enlistmentReserveApprovalList"
column="{studentName = student_name, studentNo = student_no}"

View File

@@ -29,6 +29,7 @@
<result property="updateTime" column="update_time"/>
<result property="affixId" column="affix_id"/>
<result property="deployId" column="deploy_id"/>
<result property="deptName" column="dept_name" />
<!--入伍保留学籍申请表-审核记录 多条件查询column里传入了多条件【{studentName = student_name, studentNo = student_no}】javaType里面写了list表明你有多条件 studentName student_name字段-->
<collection property="enlistmentReserveApprovalList"
column="{studentName = student_name, studentNo = student_no}"
@@ -125,7 +126,8 @@
create_time,
update_time,
affix_id,
deploy_id
deploy_id,
dept_name
from rt_enlistment_reserve
</sql>
@@ -160,7 +162,9 @@
<if test="approvalNo != null and approvalNo != ''">and approval_no = #{approvalNo}</if>
<if test="affixId != null and affixId != ''">and affix_id = #{affixId}</if>
<if test="deployId != null and deployId != ''">and deploy_id = #{deployId}</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
</where>
order by id desc
</select>
<select id="selectRtEnlistmentReserveById" parameterType="Long" resultMap="RtEnlistmentReserveResult">
@@ -188,6 +192,13 @@
select * from rt_enlistment_reserve
</select>
<!-- 匹配reserve_no以"BLXJ(年份)"开头的记录-->
<select id="countByYear" resultType="int">
SELECT COUNT(*)
FROM rt_enlistment_reserve
WHERE reserve_no LIKE CONCAT('BLXJ(', #{year}, ')%')
</select>
<!-- 根据流程编号查询申请记录 -->
<select id="selectRtEnlistmentReserveByProcessInstanceId" parameterType="String"
resultMap="RtEnlistmentReserveResult">
@@ -231,6 +242,7 @@
<if test="updateTime != null">update_time,</if>
<if test="affixId != null">affix_id,</if>
<if test="deployId != null">deploy_id,</if>
<if test="deptName != null">dept_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="applyNo != null and applyNo != ''">#{applyNo},</if>
@@ -256,6 +268,7 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="affixId != null">#{affixId},</if>
<if test="deployId != null">#{deployId},</if>
<if test="deptName != null">#{deptName},</if>
</trim>
</insert>
@@ -285,6 +298,7 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="affixId != null">affix_id = #{affixId},</if>
<if test="deployId != null">deploy_id = #{deployId},</if>
<if test="deptName != null">dept_name = #{deptName},</if>
</trim>
where id = #{id}
</update>