应征入伍保留学籍申请表-附件上传
This commit is contained in:
@@ -2,6 +2,7 @@ package com.srs.web.controller.routine;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -37,11 +38,10 @@ public class RtEnlistmentReserveAttachController extends BaseController {
|
||||
/**
|
||||
* 查询保留学籍申请附件(入伍通知书等)列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('routine:enlistmentReserveAttach:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询保留学籍申请附件(入伍通知书等)列表")
|
||||
public TableDataInfo list(RtEnlistmentReserveAttach rtEnlistmentReserveAttach)
|
||||
{
|
||||
@PreAuthorize("@ss.hasPermi('routine:enlistmentReserveAttach:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询保留学籍申请附件(入伍通知书等)列表")
|
||||
public TableDataInfo list(RtEnlistmentReserveAttach rtEnlistmentReserveAttach) {
|
||||
startPage();
|
||||
List<RtEnlistmentReserveAttach> list = rtEnlistmentReserveAttachService.selectRtEnlistmentReserveAttachList(rtEnlistmentReserveAttach);
|
||||
return getDataTable(list);
|
||||
@@ -54,8 +54,7 @@ public class RtEnlistmentReserveAttachController extends BaseController {
|
||||
@Log(title = "保留学籍申请附件(入伍通知书等)", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出保留学籍申请附件(入伍通知书等)列表")
|
||||
public void export(HttpServletResponse response, RtEnlistmentReserveAttach rtEnlistmentReserveAttach)
|
||||
{
|
||||
public void export(HttpServletResponse response, RtEnlistmentReserveAttach rtEnlistmentReserveAttach) {
|
||||
List<RtEnlistmentReserveAttach> list = rtEnlistmentReserveAttachService.selectRtEnlistmentReserveAttachList(rtEnlistmentReserveAttach);
|
||||
ExcelUtil<RtEnlistmentReserveAttach> util = new ExcelUtil<RtEnlistmentReserveAttach>(RtEnlistmentReserveAttach.class);
|
||||
util.exportExcel(response, list, "保留学籍申请附件(入伍通知书等)数据");
|
||||
@@ -67,8 +66,7 @@ public class RtEnlistmentReserveAttachController extends BaseController {
|
||||
@PreAuthorize("@ss.hasPermi('routine:enlistmentReserveAttach:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation("获取保留学籍申请附件(入伍通知书等)详细信息")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(rtEnlistmentReserveAttachService.selectRtEnlistmentReserveAttachById(id));
|
||||
}
|
||||
|
||||
@@ -79,21 +77,44 @@ public class RtEnlistmentReserveAttachController extends BaseController {
|
||||
@Log(title = "保留学籍申请附件(入伍通知书等)", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增保留学籍申请附件(入伍通知书等)")
|
||||
public AjaxResult add(@RequestBody RtEnlistmentReserveAttach rtEnlistmentReserveAttach)
|
||||
{
|
||||
public AjaxResult add(@RequestBody RtEnlistmentReserveAttach rtEnlistmentReserveAttach) {
|
||||
return toAjax(rtEnlistmentReserveAttachService.insertRtEnlistmentReserveAttach(rtEnlistmentReserveAttach));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保留学籍申请附件(入伍通知书等)
|
||||
* 批量新增保留学籍申请附件(入伍通知书等)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('routine:enlistmentReserveAttach:add')")
|
||||
@Log(title = "保留学籍申请附件(入伍通知书等)", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/batchAdd") // 注意:修改接口路径避免与原单条接口冲突
|
||||
@ApiOperation("批量新增保留学籍申请附件(入伍通知书等)")
|
||||
public AjaxResult batchAdd(@RequestBody List<RtEnlistmentReserveAttach> attachList) {
|
||||
// 1. 校验参数合法性
|
||||
if (attachList == null || attachList.isEmpty()) {
|
||||
return AjaxResult.error("批量插入失败:附件列表不能为空");
|
||||
}
|
||||
|
||||
// 2. 调用Service层批量插入方法
|
||||
int rows = rtEnlistmentReserveAttachService.batchInsertRtEnlistmentReserveAttach(attachList);
|
||||
|
||||
// 3. 返回结果(rows为成功插入的条数)
|
||||
return rows > 0 ? AjaxResult.success("批量插入成功,共插入 " + rows + " 条记录")
|
||||
: AjaxResult.error("批量插入失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改保留学籍申请附件
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('routine:enlistmentReserveAttach:edit')")
|
||||
@Log(title = "保留学籍申请附件(入伍通知书等)", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改保留学籍申请附件(入伍通知书等)")
|
||||
public AjaxResult edit(@RequestBody RtEnlistmentReserveAttach rtEnlistmentReserveAttach)
|
||||
{
|
||||
return toAjax(rtEnlistmentReserveAttachService.updateRtEnlistmentReserveAttach(rtEnlistmentReserveAttach));
|
||||
@Log(title = "保留学籍申请附件", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/batchUpdate")
|
||||
@ApiOperation("批量修改保留学籍申请附件")
|
||||
public AjaxResult batchUpdate(@RequestBody List<RtEnlistmentReserveAttach> attachList) {
|
||||
|
||||
int rows = rtEnlistmentReserveAttachService.batchUpdateRtEnlistmentReserveAttach(attachList);
|
||||
return rows > 0 ? AjaxResult.success("批量修改成功,共更新 " + rows + " 条记录")
|
||||
: AjaxResult.error("批量修改失败,未找到匹配的记录");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,8 +124,7 @@ public class RtEnlistmentReserveAttachController extends BaseController {
|
||||
@Log(title = "保留学籍申请附件(入伍通知书等)", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/{ids}")
|
||||
@ApiOperation("删除保留学籍申请附件(入伍通知书等)")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(rtEnlistmentReserveAttachService.deleteRtEnlistmentReserveAttachByIds(ids));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class RtEnlistmentReserveController extends BaseController {
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增应征入伍保留学籍申请")
|
||||
public AjaxResult add(@RequestBody RtEnlistmentReserve rtEnlistmentReserve) {
|
||||
return toAjax(rtEnlistmentReserveService.insertRtEnlistmentReserve(rtEnlistmentReserve));
|
||||
return success(rtEnlistmentReserveService.insertRtEnlistmentReserve(rtEnlistmentReserve));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* 入伍保留学籍申请表-审核记录
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
* 修改保留学籍申请附件(入伍通知书等)
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
* 新增保留学籍申请附件(入伍通知书等)
|
||||
*
|
||||
|
||||
@@ -42,7 +42,7 @@ public interface IRtEnlistmentReserveService extends IService<RtEnlistmentReserv
|
||||
* @param rtEnlistmentReserve 应征入伍保留学籍申请
|
||||
* @return 结果
|
||||
*/
|
||||
int insertRtEnlistmentReserve(RtEnlistmentReserve rtEnlistmentReserve);
|
||||
RtEnlistmentReserve insertRtEnlistmentReserve(RtEnlistmentReserve rtEnlistmentReserve);
|
||||
|
||||
/**
|
||||
* 修改应征入伍保留学籍申请
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保留学籍申请附件(入伍通知书等)
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user