Commit 2a294a45 by zhangkb

添加短板和短板目录crud接口

parent 4fe84716
package com.keymobile.indicators.api.hytobacco;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.keymobile.indicators.model.entity.shortboard.ShortboardCatalog;
import com.keymobile.indicators.model.entity.shortboard.ShortboardRule;
import com.keymobile.indicators.service.hytobacco.ShortboardCatalogService;
import com.keymobile.indicators.service.hytobacco.ShortboardRuleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Api(tags={"短板筛选规则CRUD"})
@RestController
@RequestMapping(value = "/shortboardRule")
public class ShortboardRuleCtrl {
@Autowired
private ShortboardCatalogService shortboardCatalogService;
@Autowired
private ShortboardRuleService shortboardRuleService;
@ApiOperation(value = "新增/修改短板筛选规则目录", notes = "新增/修改短板筛选规则目录")
@PostMapping(value = "/saveOrUpdateCatalog")
public String saveOrUpdateCatalog(@RequestBody ShortboardCatalog shortboardCatalog)throws Exception{
shortboardCatalog = shortboardCatalogService.saveOrUpdate(shortboardCatalog);
return shortboardCatalog.getId();
}
@ApiOperation(value = "批量级联删除短板筛选规则目录", notes = "批量级联删除短板筛选规则目录")
@PostMapping(value = "/deleteCatalog")
public void deleteCatalog(@RequestParam List<String> ids) throws Exception{
shortboardCatalogService.recursionDelete(ids);
}
@ApiOperation(value = "获取短板筛选规则目录", notes = "获取短板筛选规则目录")
@PostMapping(value = "/getCatalog")
public List<ShortboardCatalog> getCatalog(@RequestParam(required=false) String parentId,
@RequestParam List<String> codes){
return shortboardCatalogService.getCatalog(parentId, codes);
}
@ApiOperation(value = "新增/修改", notes = "新增/修改")
@PostMapping(value = "/saveOrUpdate")
public String saveOrUpdate(@RequestBody ShortboardRule shortboardRule,@RequestParam String catalogId,
@RequestParam String catalogIdPath,@RequestParam String user) {
return shortboardRuleService.saveOrUpdate(shortboardRule,catalogId,catalogIdPath,user);
}
@ApiOperation(value = "删除", notes = "删除")
@PostMapping(value = "/delete")
public void delete(@RequestParam String id) {
shortboardRuleService.delete(id);
}
@ApiOperation(value = "根据短板筛选规则目录获取短板筛选规则", notes = "根据短板筛选规则目录获取短板筛选规则")
@PostMapping(value = "/getByCatalogId")
public Page<ShortboardRule> getByCatalogId(@RequestParam String catalogId,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "rows", required = false, defaultValue = "10") int rows){
return shortboardRuleService.getByCatalogId(catalogId,page,rows);
}
@ApiOperation(value = "根据id获取短板筛选规则", notes = "根据id获取短板筛选规则")
@PostMapping(value = "/findById")
public ShortboardRule findById(@RequestParam String id) {
return shortboardRuleService.getById(id);
}
}
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