diff --git a/srs-admin/src/main/java/com/srs/web/controller/routine/RtEnlistmentReserveAttachController.java b/srs-admin/src/main/java/com/srs/web/controller/routine/RtEnlistmentReserveAttachController.java index 1ae5909..4e5a911 100644 --- a/srs-admin/src/main/java/com/srs/web/controller/routine/RtEnlistmentReserveAttachController.java +++ b/srs-admin/src/main/java/com/srs/web/controller/routine/RtEnlistmentReserveAttachController.java @@ -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 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 list = rtEnlistmentReserveAttachService.selectRtEnlistmentReserveAttachList(rtEnlistmentReserveAttach); ExcelUtil util = new ExcelUtil(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 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 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)); } } diff --git a/srs-admin/src/main/java/com/srs/web/controller/routine/RtEnlistmentReserveController.java b/srs-admin/src/main/java/com/srs/web/controller/routine/RtEnlistmentReserveController.java index a9d33df..6808230 100644 --- a/srs-admin/src/main/java/com/srs/web/controller/routine/RtEnlistmentReserveController.java +++ b/srs-admin/src/main/java/com/srs/web/controller/routine/RtEnlistmentReserveController.java @@ -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)); } /** diff --git a/srs-routine/src/main/java/com/srs/routine/domain/RtEnlistmentReserve.java b/srs-routine/src/main/java/com/srs/routine/domain/RtEnlistmentReserve.java index 9e84492..942e034 100644 --- a/srs-routine/src/main/java/com/srs/routine/domain/RtEnlistmentReserve.java +++ b/srs-routine/src/main/java/com/srs/routine/domain/RtEnlistmentReserve.java @@ -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; + /** * 入伍保留学籍申请表-审核记录 */ diff --git a/srs-routine/src/main/java/com/srs/routine/mapper/RtEnlistmentReserveAttachMapper.java b/srs-routine/src/main/java/com/srs/routine/mapper/RtEnlistmentReserveAttachMapper.java index df58dd5..1bdee46 100644 --- a/srs-routine/src/main/java/com/srs/routine/mapper/RtEnlistmentReserveAttachMapper.java +++ b/srs-routine/src/main/java/com/srs/routine/mapper/RtEnlistmentReserveAttachMapper.java @@ -36,6 +36,12 @@ public interface RtEnlistmentReserveAttachMapper extends BaseMapper attachList); + + // 新增批量修改方法(根据主键ID批量更新) + int batchUpdateRtEnlistmentReserveAttach(List attachList); + /** * 修改保留学籍申请附件(入伍通知书等) * diff --git a/srs-routine/src/main/java/com/srs/routine/service/IRtEnlistmentReserveAttachService.java b/srs-routine/src/main/java/com/srs/routine/service/IRtEnlistmentReserveAttachService.java index 4d49547..2a82054 100644 --- a/srs-routine/src/main/java/com/srs/routine/service/IRtEnlistmentReserveAttachService.java +++ b/srs-routine/src/main/java/com/srs/routine/service/IRtEnlistmentReserveAttachService.java @@ -28,6 +28,12 @@ public interface IRtEnlistmentReserveAttachService extends IService selectRtEnlistmentReserveAttachList(RtEnlistmentReserveAttach rtEnlistmentReserveAttach); + // 新增批量插入方法 + int batchInsertRtEnlistmentReserveAttach(List attachList); + + // 新增批量修改方法(根据主键ID批量更新) + int batchUpdateRtEnlistmentReserveAttach(List attachList); + /** * 新增保留学籍申请附件(入伍通知书等) * diff --git a/srs-routine/src/main/java/com/srs/routine/service/IRtEnlistmentReserveService.java b/srs-routine/src/main/java/com/srs/routine/service/IRtEnlistmentReserveService.java index 4aa39c5..24f4908 100644 --- a/srs-routine/src/main/java/com/srs/routine/service/IRtEnlistmentReserveService.java +++ b/srs-routine/src/main/java/com/srs/routine/service/IRtEnlistmentReserveService.java @@ -42,7 +42,7 @@ public interface IRtEnlistmentReserveService extends IService attachList) { + // 统一设置默认值(如创建时间) + for (RtEnlistmentReserveAttach attach : attachList) { + attach.setCreateTime(DateUtils.getNowDate()); // 批量设置创建时间 + // 其他默认值(如状态等) + } + // 调用Mapper层批量插入方法 + return rtEnlistmentReserveAttachMapper.batchInsertRtEnlistmentReserveAttach(attachList); + } + + /** + * 批量修改附件信息(根据ID) + */ + @Override + public int batchUpdateRtEnlistmentReserveAttach(List 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); + } + /** * 修改保留学籍申请附件(入伍通知书等) * diff --git a/srs-routine/src/main/java/com/srs/routine/service/impl/RtEnlistmentReserveServiceImpl.java b/srs-routine/src/main/java/com/srs/routine/service/impl/RtEnlistmentReserveServiceImpl.java index 620596b..c127476 100644 --- a/srs-routine/src/main/java/com/srs/routine/service/impl/RtEnlistmentReserveServiceImpl.java +++ b/srs-routine/src/main/java/com/srs/routine/service/impl/RtEnlistmentReserveServiceImpl.java @@ -81,7 +81,7 @@ public class RtEnlistmentReserveServiceImpl extends ServiceImpl + + + insert into rt_enlistment_reserve_attach + + + + + apply_id, + file_name, + file_path, + file_size, + file_type, + create_time, + apply_no, + student_name, + student_no, + + + values + + + + #{item.applyId}, + #{item.fileName}, + #{item.filePath}, + #{item.fileSize}, + #{item.fileType}, + #{item.createTime}, + #{item.applyNo}, + #{item.studentName}, + #{item.studentNo}, + + + + + + + + update rt_enlistment_reserve_attach + + + apply_id = #{item.applyId}, + file_name = #{item.fileName}, + file_path = #{item.filePath}, + file_size = #{item.fileSize}, + file_type = #{item.fileType}, + create_time = #{item.createTime}, + apply_no = #{item.applyNo}, + student_name = #{item.studentName}, + student_no = #{item.studentNo}, + + update_time = #{item.updateTime}, + + + where id = #{item.id} + + + delete from rt_enlistment_reserve_attach diff --git a/srs-routine/src/main/resources/mapper/routine/RtEnlistmentReserveMapper.xml b/srs-routine/src/main/resources/mapper/routine/RtEnlistmentReserveMapper.xml index 256247d..48cbe98 100644 --- a/srs-routine/src/main/resources/mapper/routine/RtEnlistmentReserveMapper.xml +++ b/srs-routine/src/main/resources/mapper/routine/RtEnlistmentReserveMapper.xml @@ -27,6 +27,7 @@ + @@ -153,6 +155,7 @@ and reserve_start_date = #{reserveStartDate} and reserve_end_date = #{reserveEndDate} and approval_no = #{approvalNo} + and affix_id = #{affixId} @@ -178,7 +181,7 @@ WHERE a.stu_no = #{stuNo} - + insert into rt_enlistment_reserve apply_no, @@ -202,6 +205,7 @@ approval_no, create_time, update_time, + affix_id, #{applyNo}, @@ -225,10 +229,11 @@ #{approvalNo}, #{createTime}, #{updateTime}, + #{affixId}, - + update rt_enlistment_reserve apply_no = #{applyNo}, @@ -252,6 +257,7 @@ approval_no = #{approvalNo}, create_time = #{createTime}, update_time = #{updateTime}, + affix_id = #{affixId}, where id = #{id}