• 实现目录数据的上移(up)、下移(down)、置顶(top)、置底(bottom)的操作


    @ApiOperation("标签设置排序")
        @ApiImplicitParams({
                @ApiImplicitParam(name = "id", value = "id", dataType = "string", required = true),
                @ApiImplicitParam(name = "orgnCode", value = "机构标识", dataType = "string", required = true),
                @ApiImplicitParam(name = "sortId", value = "排序id", dataType = "string", required = true),
                @ApiImplicitParam(name = "sectionCode", value = "科室标识", dataType = "string", required = true),
                @ApiImplicitParam(name = "button", value = "上移(up)、下移(down)、置顶(top)、置底(bottom)", dataType = "string", required = true),
        })
        @GetMapping("sortOperate")
        public ResponseEntity<Object> sortOperate(@RequestParam("id") String id,
                                                  @RequestParam("orgnCode") String orgnCode,
                                                  @RequestParam("sortId") String sortId,
                                                  @RequestParam("sectionCode") String sectionCode,
                                                  @RequestParam("button") String button) {
            return shiftService.sortOperate(id, orgnCode, sortId, sectionCode, button);
        }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    ResponseEntity<Object> sortOperate(String id, String orgnCode, String sortId, String sectionCode, String button);
    
    • 1
    @Override
        public ResponseEntity<Object> sortOperate(String id, String orgnCode, String sortId, String sectionCode, String button) {
            ResponseMessage<Object> responseMessage = new ResponseMessage();
            //上移(up)、下移(down)、置顶(top)、置底(bottom)
            if (button != null && button.equals("up")) {
            	//查出小于排序id的第一个
                HashMap<String, String> sortMap = nursingHandoverMapper.infoBySortUp(orgnCode, sectionCode, sortId);
                if (sortMap != null && !sortMap.isEmpty()) {
                    String upId = sortMap.get("id");
                    String upSortId = sortMap.get("sortId");
                    if (StringUtil.isNotEmpty(upId) && StringUtil.isNotEmpty(upSortId)) {
                        nursingHandoverMapper.updateBySort(upId, sortId);
                        nursingHandoverMapper.updateBySort(id, upSortId);
                    }
                }
            } else if (button != null && button.equals("down")) {
                HashMap<String, String> sortMap = nursingHandoverMapper.infoBySortDown(orgnCode, sectionCode, sortId);
                if (sortMap != null && !sortMap.isEmpty()) {
                    String downId = sortMap.get("id");
                    String downSortId = sortMap.get("sortId");
                    if (StringUtil.isNotEmpty(downId) && StringUtil.isNotEmpty(downSortId)) {
                        nursingHandoverMapper.updateBySort(downId, sortId);
                        nursingHandoverMapper.updateBySort(id, downSortId);
                    }
                }
            } else if (button != null && button.equals("top")) {
                HashMap<String, String> sortMap = nursingHandoverMapper.infoBySortTop(orgnCode, sectionCode);
                if (sortMap != null && !sortMap.isEmpty()) {
                    String topId = sortMap.get("id");
                    String topSortId = sortMap.get("sortId");
                    if (StringUtil.isNotEmpty(topId) && StringUtil.isNotEmpty(topSortId)) {
                        nursingHandoverMapper.updateBySort(topId, sortId);
                        nursingHandoverMapper.updateBySort(id, topSortId);
                    }
                }
            } else if (button != null && button.equals("bottom")) {
                HashMap<String, String> sortMap = nursingHandoverMapper.infoBySortTop(orgnCode, sectionCode);
                if (sortMap != null && !sortMap.isEmpty()) {
                    String bottomId = sortMap.get("id");
                    String bottomSortId = sortMap.get("sortId");
                    if (StringUtil.isNotEmpty(bottomId) && StringUtil.isNotEmpty(bottomSortId)) {
                        nursingHandoverMapper.updateBySort(bottomId, sortId);
                        nursingHandoverMapper.updateBySort(id, bottomSortId);
                    }
                }
            }
            responseMessage.setCode("T").setMessage("success");
            return new ResponseEntity<>(responseMessage, HttpStatus.OK);
        }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    HashMap<String, String> infoBySortUp(@Param("orgnCode") String orgnCode, @Param("sectionCode") String sectionCode, @Param("sortId") String sortId);
    
    <select id="infoBySortUp" resultType="java.util.HashMap">
            SELECT top 1 ID id, SORT_ID sortId
            from NEMR_SET_SHIFT
            WHERE ORGN_CODE = #{orgnCode}
              AND SECTION_CODE = #{sectionCode}
              AND SORT_ID &lt; #{sortId}
            ORDER BY SORT_ID DESC
        </select>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    HashMap<String, String> infoBySortDown(@Param("orgnCode") String orgnCode, @Param("sectionCode") String sectionCode, @Param("sortId") String sortId);
    
    <select id="infoBySortDown" resultType="java.util.HashMap">
            SELECT top 1 ID id, SORT_ID sortId
            from NEMR_SET_SHIFT
            WHERE ORGN_CODE = #{orgnCode}
              AND SECTION_CODE = #{sectionCode}
              AND SORT_ID &gt; #{sortId}
            ORDER BY SORT_ID asc
        </select>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    HashMap<String, String> infoBySortTop(@Param("orgnCode") String orgnCode, @Param("sectionCode") String sectionCode);
    
    <select id="infoBySortTop" resultType="java.util.HashMap">
            SELECT top 1 ID id, SORT_ID sortId
            FROM NEMR_SET_SHIFT(nolock)
            WHERE ORGN_CODE = #{orgnCode}
              AND SECTION_CODE = #{sectionCode}
            order by SORT_ID asc
        </select>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    HashMap<String, String> infoBySortTop(@Param("orgnCode") String orgnCode, @Param("sectionCode") String sectionCode);
    
    
    <select id="infoBySortTop" resultType="java.util.HashMap">
            SELECT top 1 ID id, SORT_ID sortId
            FROM NEMR_SET_SHIFT(nolock)
            WHERE ORGN_CODE = #{orgnCode}
              AND SECTION_CODE = #{sectionCode}
            order by SORT_ID asc
        </select>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
  • 相关阅读:
    IDA详细使用教程
    React学习笔记二
    [附源码]Python计算机毕业设计Django校园快递柜存取件系统
    Spring的创建和使用
    期末复习重点总结(5-9章)-计算机操作系统(慕课版)
    数据分析可视化常用图介绍以及相关代码实现(箱型图、Q-Q图、Kde图、线性回归图、热力图)
    OpenHarmony ArkTS工程目录结构(Stage模型)
    汽车螺丝扭力标准/汽车常见螺栓扭矩参照
    使用 PyTorch 的计算机视觉简介 (2/6)
    户外骑行运动耳机哪个好,几款适合在骑行佩戴的耳机推荐
  • 原文地址:https://blog.csdn.net/qq_49641620/article/details/134016550