2
13693261870
2022-09-16 653761a31dfeb50dd3d007e892d69c90bf0cdafc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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);
    }
}