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,8 +32,7 @@ public class ArchivesDepotController extends BaseController
32 @PostMapping("/shelve") 32 @PostMapping("/shelve")
33 public AjaxResult shelve(@Validated @RequestBody ArchivesDepot archivesDepot) 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 @PreAuthorize("@ss.hasPermi('service:archivesDepot:shelveDown')") 38 @PreAuthorize("@ss.hasPermi('service:archivesDepot:shelveDown')")
@@ -41,8 +40,11 @@ public class ArchivesDepotController extends BaseController @@ -41,8 +40,11 @@ public class ArchivesDepotController extends BaseController
41 @PostMapping("/shelveDown") 40 @PostMapping("/shelveDown")
42 public AjaxResult shelveDown(@Validated @RequestBody ArchivesDepot archivesDepot) 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,4 +15,6 @@ public interface ArchivesDepotMapper
15 int insert(ArchivesDepot archivesDepot); 15 int insert(ArchivesDepot archivesDepot);
16 16
17 int shelveDown(Long[] ids); 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,4 +15,6 @@ public interface ArchivesDepotService
15 int shelve(ArchivesDepot archivesDepot); 15 int shelve(ArchivesDepot archivesDepot);
16 16
17 int shelveDown(ArchivesDepot archivesDepot); 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,7 +21,7 @@ import java.util.List;
21 * @author ym 21 * @author ym
22 */ 22 */
23 @Service 23 @Service
24 -public class ArchivesDepotImpl implements ArchivesDepotService 24 +public class ArchivesDepotServiceImpl implements ArchivesDepotService
25 { 25 {
26 @Resource 26 @Resource
27 private ArchivesDepotMapper archivesDepotMapper; 27 private ArchivesDepotMapper archivesDepotMapper;
@@ -86,4 +86,9 @@ public class ArchivesDepotImpl implements ArchivesDepotService @@ -86,4 +86,9 @@ public class ArchivesDepotImpl implements ArchivesDepotService
86 return ids.length; 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,4 +28,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
28 </foreach> 28 </foreach>
29 </update> 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 </mapper> 41 </mapper>
32 \ No newline at end of file 42 \ No newline at end of file