lizijie
2021-09-23 5912cb4e4705b60875a2b1aa4beb1f7c94fc72e1
screen-manage/src/main/java/com/moral/api/controller/GovMonitorPoionController.java
@@ -3,7 +3,9 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.moral.api.entity.GovMonitorPoint;
import com.moral.api.entity.Organization;
import com.moral.api.mapper.GovMonitorPointMapper;
import com.moral.api.mapper.OrganizationMapper;
import com.moral.api.service.GovMonitorPointService;
import com.moral.constant.Constants;
import com.moral.constant.ResponseCodeEnum;
@@ -40,6 +42,9 @@
    @Resource
    private GovMonitorPointMapper govMonitorPointMapper;
    @Resource
    private OrganizationMapper organizationMapper;
    @RequestMapping(value = "getGovMonitorPointByCondition", method = RequestMethod.GET)
    @ResponseBody
@@ -119,4 +124,20 @@
        List<Map<String, Object>> response = govMonitorPointService.selectGovMonitorPoints(regionCode);
        return ResultMessage.ok(response);
    }
    @RequestMapping(value = "getGovMonitorPointsByOrgId", method = RequestMethod.GET)
    @ResponseBody
    public ResultMessage getGovMonitorPointsByOrgId(HttpServletRequest request){
        Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
        Object orgid = parameters.get("organization_id");
        if (ObjectUtils.isEmpty(orgid)){
            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
        }
        Organization organization = organizationMapper.selectById(Integer.parseInt(orgid.toString()));
        if (ObjectUtils.isEmpty(organization)){
            return ResultMessage.fail(ResponseCodeEnum.ORGANIZATION_NOT_EXIST.getCode(), ResponseCodeEnum.ORGANIZATION_NOT_EXIST.getMsg());
        }
        List<GovMonitorPoint> govMonitorPoints = govMonitorPointService.selectGovMonitorPointsByOrgid(parameters);
        return  ResultMessage.ok(govMonitorPoints);
    }
}