Commit 3cb8e014 authored by linruibiao's avatar linruibiao

接口编写

parent 821d102d
package com.syc.slm.slmbi.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.syc.slm.common.core.constant.SlmConstants;
import com.syc.slm.common.core.util.R;
import com.syc.slm.slmbi.entity.BaseEntity;
import com.syc.slm.slmbi.entity.InstrumentPanelGroup;
import com.syc.slm.slmbi.service.CompanyService;
import com.syc.slm.slmbi.service.InstrumentPanelGroupService;
import com.syc.slm.slmbi.service.InstrumentPanelInitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
......@@ -9,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Set;
/**
......@@ -24,6 +31,11 @@ public class InitController extends BaseRestController{
@Autowired
private CompanyService companyService;
@Autowired
private InstrumentPanelInitService panelInitService;
@Autowired
private InstrumentPanelGroupService groupService;
@GetMapping("/app-id")
@ApiOperation("测试")
@ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class)
......@@ -37,4 +49,17 @@ public class InitController extends BaseRestController{
public R<Boolean> initGroupAndTree(HttpServletRequest request, @PathVariable String appId) {
return call(()-> companyService.initGroupAndTree(appId));
}
@PostMapping("/panel/init")
@ApiOperation("初始化顶级分组和树结构")
@ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class)
public R<Object> initPanel(HttpServletRequest request, @PathVariable String appId) {
return call(()->{
LambdaQueryWrapper<InstrumentPanelGroup> where = new LambdaQueryWrapper<>();
where.eq(BaseEntity::getRecordStatus, SlmConstants.DATA_VALID);
where.eq(InstrumentPanelGroup::getName, "全部分组");
List<InstrumentPanelGroup> list = groupService.list(where);
list.forEach(x-> panelInitService.initOnePanel(x.getAppId(), request));
});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment