Commit 3aa05140369595bc7798549e81a79ffb350715ad

Authored by yiming
1 parent eb00ed17

增加存在未归还档案不可下架的限制

ruoyi-service/src/main/java/com/ruoyi/service/controller/ArchivesDepotController.java
... ... @@ -32,8 +32,7 @@ public class ArchivesDepotController extends BaseController
32 32 @PostMapping("/shelve")
33 33 public AjaxResult shelve(@Validated @RequestBody ArchivesDepot archivesDepot)
34 34 {
35   - archivesDepotService.shelve(archivesDepot);
36   - return AjaxResult.success();
  35 + return AjaxResult.success(archivesDepotService.shelve(archivesDepot));
37 36 }
38 37  
39 38 @PreAuthorize("@ss.hasPermi('service:archivesDepot:shelveDown')")
... ... @@ -41,8 +40,11 @@ public class ArchivesDepotController extends BaseController
41 40 @PostMapping("/shelveDown")
42 41 public AjaxResult shelveDown(@Validated @RequestBody ArchivesDepot archivesDepot)
43 42 {
44   - archivesDepotService.shelveDown(archivesDepot);
45   - return AjaxResult.success();
  43 + Long[] ids=archivesDepot.getIds();
  44 + if(archivesDepotService.selectCountBox(ids)>0){
  45 + return AjaxResult.error("存在未归还文件不可下架");
  46 + }
  47 + return AjaxResult.success(archivesDepotService.shelveDown(archivesDepot));
46 48 }
47 49  
48 50 }
... ...
ruoyi-service/src/main/java/com/ruoyi/service/mapper/ArchivesDepotMapper.java
... ... @@ -15,4 +15,6 @@ public interface ArchivesDepotMapper
15 15 int insert(ArchivesDepot archivesDepot);
16 16  
17 17 int shelveDown(Long[] ids);
  18 +
  19 + int selectCountBox(Long[] ids);
18 20 }
... ...
ruoyi-service/src/main/java/com/ruoyi/service/service/ArchivesDepotService.java
... ... @@ -15,4 +15,6 @@ public interface ArchivesDepotService
15 15 int shelve(ArchivesDepot archivesDepot);
16 16  
17 17 int shelveDown(ArchivesDepot archivesDepot);
  18 +
  19 + int selectCountBox(Long[] ids);
18 20 }
... ...
ruoyi-service/src/main/java/com/ruoyi/service/service/impl/ArchivesDepotImpl.java renamed to ruoyi-service/src/main/java/com/ruoyi/service/service/impl/ArchivesDepotServiceImpl.java
... ... @@ -21,7 +21,7 @@ import java.util.List;
21 21 * @author ym
22 22 */
23 23 @Service
24   -public class ArchivesDepotImpl implements ArchivesDepotService
  24 +public class ArchivesDepotServiceImpl implements ArchivesDepotService
25 25 {
26 26 @Resource
27 27 private ArchivesDepotMapper archivesDepotMapper;
... ... @@ -86,4 +86,9 @@ public class ArchivesDepotImpl implements ArchivesDepotService
86 86 return ids.length;
87 87 }
88 88  
  89 + @Override
  90 + public int selectCountBox(Long[] ids) {
  91 + return archivesDepotMapper.selectCountBox(ids);
  92 + }
  93 +
89 94 }
... ...
ruoyi-service/src/main/resources/mapper/sevice/ArchivesDepotMapper.xml
... ... @@ -28,4 +28,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
28 28 </foreach>
29 29 </update>
30 30  
  31 + <select id="selectCountBox" parameterType="Long" resultType="int">
  32 + SELECT count(*) FROM archives_collect_box where box_id in
  33 + <foreach item="id" collection="array" open="(" separator="," close=")">
  34 + #{id}
  35 + </foreach>
  36 + and borrow_status='0'
  37 + </select>
  38 +
  39 +
  40 +
31 41 </mapper>
32 42 \ No newline at end of file
... ...