Commit ce37fc4b authored by linruibiao's avatar linruibiao

接口编写

parent 9ec9b401
......@@ -58,7 +58,7 @@ public class InstrumentPanelGroupController extends BaseRestController{
@ApiOperation("删除仪表板分组")
@ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class)
public R<String> delGroup(@PathVariable String appId, @PathVariable String groupId) {
return call(()->instrumentPanelGroupService.delGroup(groupId));
return call(()->instrumentPanelGroupService.delGroup(groupId,false));
}
}
package com.syc.slm.slmbi.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.syc.slm.common.core.constant.SlmConstants;
import com.syc.slm.common.core.util.R;
import com.syc.slm.slmbi.dto.InstrumentPanelGroupDTO;
import com.syc.slm.slmbi.entity.BaseEntity;
import com.syc.slm.slmbi.entity.CurrentUser;
import com.syc.slm.slmbi.entity.InstrumentPanelGroup;
import com.syc.slm.slmbi.service.InstrumentPanelGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* slm-bi
* 提供给dc调用
* @author : lin
* @date : 2021-05-28 14:22
**/
@RestController
@RequestMapping("/{appId}/tenant")
@Api(value = "租户", tags = "租户")
public class TenantController extends BaseRestController{
@Autowired
private InstrumentPanelGroupService groupService;
@PostMapping
@ApiOperation("新增租户初始化分组")
@ApiImplicitParam(name = "appId", value = "租户id", required = true, dataTypeClass = String.class)
public R<String> initGroup(@PathVariable String appId) {
return call(() -> {
InstrumentPanelGroupDTO groupDTO = new InstrumentPanelGroupDTO();
groupDTO.setParentId(null);
groupDTO.setName("全部分组");
return groupService.saveGroup(groupDTO,appId);
});
}
@DeleteMapping
@ApiOperation("删除租户初始化分组数据")
@ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class)
public R<String> delGroup(HttpServletRequest request, @PathVariable String appId) {
return call(() -> {
CurrentUser currentUser = getCurrentUser(request);
LambdaQueryWrapper<InstrumentPanelGroup> where = new LambdaQueryWrapper<>();
where.eq(BaseEntity::getAppId, currentUser.getAppId());
where.eq(InstrumentPanelGroup::getName, "全部分组");
where.eq(BaseEntity::getRecordStatus, SlmConstants.DATA_VALID);
InstrumentPanelGroup one = groupService.getOne(where);
if(ObjectUtils.isNotEmpty(one)) {
return groupService.delGroup(one.getId(), true);
}else{
return null;
}
});
}
}
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