package com.landtool.lanbase.modules.res.controller;
|
|
import org.apache.shiro.SecurityUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.ui.Model;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import com.landtool.lanbase.modules.res.entity.Res_ExtApp;
|
import com.landtool.lanbase.modules.res.entity.Res_MainInfo;
|
import com.landtool.lanbase.modules.res.service.ResExtAppService;
|
import com.landtool.lanbase.modules.res.service.ResMainInfoService;
|
|
/**
|
* @Description:3系统资源扩展(应用程序)控制器
|
*
|
*/
|
|
@Controller
|
@RequestMapping("/res")
|
public class ResExtAppController {
|
|
@Autowired
|
private ResExtAppService resExtAppService;
|
|
@Autowired
|
private ResMainInfoService resMainInfoService;
|
|
/**
|
* 访问资源应用程序图层信息页面
|
*/
|
@RequestMapping("/ResManage/ResRegister/ExtApp")
|
public String ExtApp(Integer resMainInfoId, Model model) {
|
Res_ExtApp resExtApp = resExtAppService.selectByPrimaryKey(resMainInfoId);
|
if (resExtApp != null) {
|
model.addAttribute("resExtApp", resExtApp);
|
model.addAttribute("resMainInfoId", resMainInfoId);
|
Res_MainInfo res_mainInfo = resMainInfoService.selectByPrimaryKey(resMainInfoId);
|
model.addAttribute("resMainInfo",res_mainInfo);
|
} else {
|
Res_ExtApp resExtApp1 = new Res_ExtApp();
|
model.addAttribute("resExtApp", resExtApp1);
|
Res_MainInfo res_mainInfo = new Res_MainInfo();
|
model.addAttribute("resMainInfo", res_mainInfo);
|
}
|
if(SecurityUtils.getSubject().isPermitted("org_user_admin")) {
|
//判断当前用户是否是管理员,是管理员或是未提交的资源才可以修改资源相关信息
|
model.addAttribute("admin",true);
|
}
|
else {
|
model.addAttribute("admin",false);
|
}
|
return "ResManage/ResRegister/ExtApp";
|
}
|
|
/** 根据id 删除系统资源扩展(应用程序)列表功能*/
|
@ResponseBody
|
@RequestMapping("/resExtApp/deleteByPrimaryKey")
|
public int deleteByPrimaryKey(int resourceid) {
|
return resExtAppService.deleteByPrimaryKey(resourceid);
|
}
|
|
/** 插入系统资源扩展(应用程序)列表功能(所有元素不能为空)*/
|
@ResponseBody
|
@RequestMapping("/resExtApp/insert")
|
public int insert(Res_ExtApp record) {
|
return resExtAppService.insert(record);
|
}
|
|
/** 插入系统资源扩展(应用程序)列表功能(可填只填写必填子段)*/
|
@ResponseBody
|
@RequestMapping("/resExtApp/insertSelective")
|
public int insertSelective(Res_ExtApp record) {
|
|
return resExtAppService.insertSelective(record);
|
}
|
|
/** 插入系统资源扩展(应用程序)列表功能(可填只填写必填子段)*/
|
@ResponseBody
|
@RequestMapping("/resExtApp/insertSelectiveAndUpdate")
|
public int insertSelectiveAndUpdate(Res_ExtApp record) {
|
Res_ExtApp resExtApp=resExtAppService.selectByPrimaryKey(record.getResourceid());
|
if(resExtApp==null){
|
//添加
|
return resExtAppService.insertSelective(record);
|
}else {
|
//更新
|
return resExtAppService.updateByPrimaryKeySelective(record);
|
}
|
|
}
|
|
/** 根据Id查询系统资源扩展(应用程序)列表功能*/
|
@ResponseBody
|
@RequestMapping("/resExtApp/selectByPrimaryKey")
|
public Res_ExtApp selectByPrimaryKey(int resourceid) {
|
return resExtAppService.selectByPrimaryKey(resourceid);
|
}
|
|
/** 根据id更新系统资源扩展列表(更新部分数据)*/
|
@ResponseBody
|
@RequestMapping("/resExtApp/updateByPrimaryKeySelective")
|
public int updateByPrimaryKeySelective(Res_ExtApp record) {
|
return resExtAppService.updateByPrimaryKeySelective(record);
|
}
|
|
/** 根据id更新系统资源扩展列表(更新所有数据)*/
|
@ResponseBody
|
@RequestMapping("/resExtApp/updateByPrimaryKey")
|
public int updateByPrimaryKey(Res_ExtApp record) {
|
return resExtAppService.updateByPrimaryKey(record);
|
}
|
}
|