package com.fgkj.controller;
|
|
import com.fgkj.util.*;
|
|
import com.fgkj.dto.Custompage;
|
import com.fgkj.dto.ServiceModel;
|
import com.fgkj.services.CustompageService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.List;
|
|
import javax.annotation.Resource;
|
|
@RequestMapping("customPage")
|
@RestController
|
@Api(tags = "customPage接口")
|
public class CustompageController{
|
|
@Resource
|
private CustompageService service;
|
|
// private Custompage cust;
|
|
//页面定制下添加导航或者子页面
|
@PostMapping("/")
|
@ApiOperation(notes = "",value="页面定制下添加导航或者子页面")
|
public ServiceModel add(@RequestBody Custompage cust) {
|
// cust=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(result,Custompage.class);
|
ServiceModel model=service.add(cust);
|
|
return model;
|
}
|
|
//页面定制可以看到的子菜单和子模块
|
@PutMapping("/")
|
@ApiOperation(notes = "[{ \"num\": 78, \"subflag\": 0, \"subenable\": 0 }]",value="页面定制可以看到的子菜单和子模块")
|
public ServiceModel update(@RequestBody List<Custompage> list) {
|
|
ServiceModel model = service.update(list);
|
return model;
|
}
|
|
|
//页面定制修改主导航下子页面的顺序
|
@PutMapping("order")
|
@ApiOperation(notes = "[{ \"num\": 78, \"page_order\": 0 }]",value="页面定制修改主导航下子页面的顺序")
|
public ServiceModel updateOrder(@RequestBody List<Custompage> list) {
|
// List<Custompage> list = ActionUtil.getGson().fromJson(result, new TypeToken<ArrayList<Custompage>>(){}.getType() );
|
ServiceModel model=service.updateOrder(list);
|
|
|
return model;
|
}
|
|
@DeleteMapping("/")
|
@ApiOperation(notes = "未完成功能",value="删除")
|
public ServiceModel delete() {
|
// Custompage cust = new Custompage();
|
// ServiceModel model = service.delete(cust);
|
|
return new ServiceModel();
|
}
|
|
@PostMapping("byCondition")
|
@ApiOperation(notes = "",value="页面查询子模块/子菜单")
|
public ServiceModel serchByCondition(@RequestParam String navigate,@RequestParam Integer subjudge) {
|
Custompage cust = new Custompage();
|
cust.setNavigate(navigate);
|
cust.setSubjudge(subjudge);
|
ServiceModel model = service.serchByCondition(cust);
|
|
return model;
|
}
|
|
//查询所有的菜单(页面定制可以看到的子菜单和子模块)
|
@GetMapping("all")
|
@ApiOperation(notes = "",value="查询所有的菜单(页面定制可以看到的子菜单和子模块)")
|
public ServiceModel searchAll(){
|
ServiceModel model=service.searchAll();
|
setCust(model);
|
|
return model;
|
}
|
|
//根据主导航的名字查询所有的子页面
|
@PostMapping("byInfo")
|
@ApiOperation(notes = "",value="主导航的名字查询所有的子页")
|
public ServiceModel serchByInfo(@RequestParam String navigate){
|
// "navigate": "Monitor_data"
|
Custompage cust = new Custompage();
|
cust.setNavigate(navigate);
|
ServiceModel model=service.serchByInfo(cust);
|
|
return model;
|
}
|
|
|
//将导航对象数组存入session
|
@PostMapping("custom2Session")
|
@ApiOperation(notes = "参数:{ \"code\": 0, \"msg\": \"\", \"data\": {} } 返回值类型void",value="将导航对象数组存入session")
|
public static void setCust(ServiceModel obj) {
|
if (obj != null) {
|
ServiceModel model = (ServiceModel) obj;
|
ActionUtil.getSession().setAttribute("custompages", model.getData());
|
ActionUtil.getSession().setAttribute("custompages_json", ActionUtil.tojson(model.getData()));
|
}
|
}
|
|
}
|