kaiyu
2021-09-26 d6428820434c9a54eb4063b74ece253924708ede
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
package com.moral.api.controller;
 
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.moral.api.service.OrganizationLayoutService;
import com.moral.constant.ResponseCodeEnum;
import com.moral.constant.ResultMessage;
import com.moral.util.WebUtils;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
@Slf4j
@Api(tags = {"页面布局"})
@RestController
@RequestMapping("/organizationLayout")
public class OrganizationLayoutController {
 
    @Resource
    private OrganizationLayoutService organizationLayoutService;
 
    @RequestMapping(value = "getLayoutByMac", method = RequestMethod.GET)
    @ResponseBody
    public ResultMessage getLayoutByMac(HttpServletRequest request){
        Map<String,Object> parameters = WebUtils.getParametersStartingWith(request,null);
        if (ObjectUtils.isEmpty(parameters.get("mac"))){
            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
        }
        Map<String,Object> resultMap = organizationLayoutService.getLayoutByMac(parameters.get("mac").toString());
        if (ObjectUtils.isEmpty(resultMap)){
            return null;
        }
        return ResultMessage.ok(resultMap);
    }
}