应征入伍保留学籍申请表-附件上传

This commit is contained in:
2025-11-17 17:45:34 +08:00
parent 013eaa5d6d
commit 0aeb9f2dd8
10 changed files with 170 additions and 27 deletions

View File

@@ -200,6 +200,14 @@ private static final long serialVersionUID=1L;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date updateTime;
/**
* 附件id
*/
@ApiModelProperty("附件id")
@TableField("affix_id")
@Excel(name = "附件id")
private String affixId;
/**
* 入伍保留学籍申请表-审核记录
*/

View File

@@ -36,6 +36,12 @@ public interface RtEnlistmentReserveAttachMapper extends BaseMapper<RtEnlistment
*/
int insertRtEnlistmentReserveAttach(RtEnlistmentReserveAttach rtEnlistmentReserveAttach);
// 新增批量插入方法
int batchInsertRtEnlistmentReserveAttach(List<RtEnlistmentReserveAttach> attachList);
// 新增批量修改方法根据主键ID批量更新
int batchUpdateRtEnlistmentReserveAttach(List<RtEnlistmentReserveAttach> attachList);
/**
* 修改保留学籍申请附件(入伍通知书等)
*

View File

@@ -28,6 +28,12 @@ public interface IRtEnlistmentReserveAttachService extends IService<RtEnlistment
*/
List<RtEnlistmentReserveAttach> selectRtEnlistmentReserveAttachList(RtEnlistmentReserveAttach rtEnlistmentReserveAttach);
// 新增批量插入方法
int batchInsertRtEnlistmentReserveAttach(List<RtEnlistmentReserveAttach> attachList);
// 新增批量修改方法根据主键ID批量更新
int batchUpdateRtEnlistmentReserveAttach(List<RtEnlistmentReserveAttach> attachList);
/**
* 新增保留学籍申请附件(入伍通知书等)
*

View File

@@ -42,7 +42,7 @@ public interface IRtEnlistmentReserveService extends IService<RtEnlistmentReserv
* @param rtEnlistmentReserve 应征入伍保留学籍申请
* @return 结果
*/
int insertRtEnlistmentReserve(RtEnlistmentReserve rtEnlistmentReserve);
RtEnlistmentReserve insertRtEnlistmentReserve(RtEnlistmentReserve rtEnlistmentReserve);
/**
* 修改应征入伍保留学籍申请

View File

@@ -1,6 +1,8 @@
package com.srs.routine.service.impl;
import java.util.List;
import com.srs.common.exception.ServiceException;
import com.srs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -54,6 +56,43 @@ public class RtEnlistmentReserveAttachServiceImpl extends ServiceImpl<RtEnlistme
return rtEnlistmentReserveAttachMapper.insertRtEnlistmentReserveAttach(rtEnlistmentReserveAttach);
}
// 批量插入实现
@Override
public int batchInsertRtEnlistmentReserveAttach(List<RtEnlistmentReserveAttach> attachList) {
// 统一设置默认值(如创建时间)
for (RtEnlistmentReserveAttach attach : attachList) {
attach.setCreateTime(DateUtils.getNowDate()); // 批量设置创建时间
// 其他默认值(如状态等)
}
// 调用Mapper层批量插入方法
return rtEnlistmentReserveAttachMapper.batchInsertRtEnlistmentReserveAttach(attachList);
}
/**
* 批量修改附件信息根据ID
*/
@Override
public int batchUpdateRtEnlistmentReserveAttach(List<RtEnlistmentReserveAttach> attachList) {
// 1. 校验参数列表非空且每个元素必须包含ID
if (attachList == null || attachList.isEmpty()) {
throw new ServiceException("批量修改失败:附件列表不能为空");
}
for (RtEnlistmentReserveAttach attach : attachList) {
if (attach.getId() == null) {
throw new ServiceException("批量修改失败附件ID不能为空");
}
}
// 2. 统一设置更新时间
for (RtEnlistmentReserveAttach attach : attachList) {
attach.setUpdateTime(DateUtils.getNowDate()); // 若实体类有updateTime字段
}
// 3. 调用Mapper批量修改
return rtEnlistmentReserveAttachMapper.batchUpdateRtEnlistmentReserveAttach(attachList);
}
/**
* 修改保留学籍申请附件(入伍通知书等)
*

View File

@@ -81,7 +81,7 @@ public class RtEnlistmentReserveServiceImpl extends ServiceImpl<RtEnlistmentRese
* @return 结果
*/
@Override
public int insertRtEnlistmentReserve(RtEnlistmentReserve rtEnlistmentReserve) {
public RtEnlistmentReserve insertRtEnlistmentReserve(RtEnlistmentReserve rtEnlistmentReserve) {
rtEnlistmentReserve.setCreateTime(DateUtils.getNowDate());
// 先插入申请表数据,获取自增 ID数据库自动为 applyStatus 赋值 0 若未传值)
@@ -121,7 +121,7 @@ public class RtEnlistmentReserveServiceImpl extends ServiceImpl<RtEnlistmentRese
System.out.println("申请表[" + applyId + "]状态为" + rtEnlistmentReserve.getApplyStatus() + "" + statusDesc + "),暂不启动流程");
}
return insertCount;
return rtEnlistmentReserve;
}
/**

View File

@@ -96,6 +96,64 @@
where id = #{id}
</update>
<!-- 批量插入(复用单条的动态字段逻辑) -->
<insert id="batchInsertRtEnlistmentReserveAttach" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
insert into rt_enlistment_reserve_attach
<!-- 提取公共字段列表与单条插入的trim逻辑一致 -->
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="list != null and list.size() > 0">
<!-- 取列表第一个元素判断字段是否需要包含(避免循环判断,提升性能) -->
<if test="list[0].applyId != null">apply_id,</if>
<if test="list[0].fileName != null and list[0].fileName != ''">file_name,</if>
<if test="list[0].filePath != null and list[0].filePath != ''">file_path,</if>
<if test="list[0].fileSize != null">file_size,</if>
<if test="list[0].fileType != null and list[0].fileType != ''">file_type,</if>
<if test="list[0].createTime != null">create_time,</if>
<if test="list[0].applyNo != null and list[0].applyNo != ''">apply_no,</if>
<if test="list[0].studentName != null and list[0].studentName != ''">student_name,</if>
<if test="list[0].studentNo != null and list[0].studentNo != ''">student_no,</if>
</if>
</trim>
values
<!-- 循环列表项生成多个values -->
<foreach collection="list" item="item" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="item.applyId != null">#{item.applyId},</if>
<if test="item.fileName != null and item.fileName != ''">#{item.fileName},</if>
<if test="item.filePath != null and item.filePath != ''">#{item.filePath},</if>
<if test="item.fileSize != null">#{item.fileSize},</if>
<if test="item.fileType != null and item.fileType != ''">#{item.fileType},</if>
<if test="item.createTime != null">#{item.createTime},</if>
<if test="item.applyNo != null and item.applyNo != ''">#{item.applyNo},</if>
<if test="item.studentName != null and item.studentName != ''">#{item.studentName},</if>
<if test="item.studentNo != null and item.studentNo != ''">#{item.studentNo},</if>
</trim>
</foreach>
</insert>
<!-- 批量修改根据ID更新支持动态字段 -->
<update id="batchUpdateRtEnlistmentReserveAttach" parameterType="java.util.List">
<foreach collection="list" item="item" separator=";">
update rt_enlistment_reserve_attach
<set>
<!-- 动态更新字段(仅更新非空/非空字符串的字段) -->
<if test="item.applyId != null">apply_id = #{item.applyId},</if>
<if test="item.fileName != null and item.fileName != ''">file_name = #{item.fileName},</if>
<if test="item.filePath != null and item.filePath != ''">file_path = #{item.filePath},</if>
<if test="item.fileSize != null">file_size = #{item.fileSize},</if>
<if test="item.fileType != null and item.fileType != ''">file_type = #{item.fileType},</if>
<if test="item.createTime != null">create_time = #{item.createTime},</if>
<if test="item.applyNo != null and item.applyNo != ''">apply_no = #{item.applyNo},</if>
<if test="item.studentName != null and item.studentName != ''">student_name = #{item.studentName},</if>
<if test="item.studentNo != null and item.studentNo != ''">student_no = #{item.studentNo},</if>
<!-- 可选:添加更新时间字段 -->
<if test="item.updateTime != null">update_time = #{item.updateTime},</if>
</set>
<!-- 必须包含主键ID否则无法定位要修改的记录 -->
where id = #{item.id}
</foreach>
</update>
<delete id="deleteRtEnlistmentReserveAttachById" parameterType="Long">
delete
from rt_enlistment_reserve_attach

View File

@@ -27,6 +27,7 @@
<result property="approvalNo" column="approval_no"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="affixId" column="affix_id"/>
<!--入伍保留学籍申请表-审核记录 多条件查询column里传入了多条件【{studentName = student_name, studentNo = student_no}】javaType里面写了list表明你有多条件 studentName student_name字段-->
<collection property="enlistmentReserveApprovalList"
column="{studentName = student_name, studentNo = student_no}"
@@ -120,7 +121,8 @@
reserve_end_date,
approval_no,
create_time,
update_time
update_time,
affix_id
from rt_enlistment_reserve
</sql>
@@ -153,6 +155,7 @@
<if test="reserveStartDate != null ">and reserve_start_date = #{reserveStartDate}</if>
<if test="reserveEndDate != null ">and reserve_end_date = #{reserveEndDate}</if>
<if test="approvalNo != null and approvalNo != ''">and approval_no = #{approvalNo}</if>
<if test="affixId != null and affixId != ''">and affix_id = #{affixId}</if>
</where>
</select>
@@ -178,7 +181,7 @@
WHERE a.stu_no = #{stuNo}
</select>
<insert id="insertRtEnlistmentReserve" parameterType="EnlistmentReserve" useGeneratedKeys="true" keyProperty="id">
<insert id="insertRtEnlistmentReserve" parameterType="RtEnlistmentReserve" useGeneratedKeys="true" keyProperty="id">
insert into rt_enlistment_reserve
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="applyNo != null and applyNo != ''">apply_no,</if>
@@ -202,6 +205,7 @@
<if test="approvalNo != null">approval_no,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="affixId != null">affix_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="applyNo != null and applyNo != ''">#{applyNo},</if>
@@ -225,10 +229,11 @@
<if test="approvalNo != null">#{approvalNo},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="affixId != null">#{affixId},</if>
</trim>
</insert>
<update id="updateRtEnlistmentReserve" parameterType="EnlistmentReserve">
<update id="updateRtEnlistmentReserve" parameterType="RtEnlistmentReserve">
update rt_enlistment_reserve
<trim prefix="SET" suffixOverrides=",">
<if test="applyNo != null and applyNo != ''">apply_no = #{applyNo},</if>
@@ -252,6 +257,7 @@
<if test="approvalNo != null">approval_no = #{approvalNo},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="affixId != null">affix_id = #{affixId},</if>
</trim>
where id = #{id}
</update>