935090232@qq.com
2021-02-03 0944bb0dedeaf1c0e1b3fa7caa38ebaf11831fa8
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
package com.matrix.system.hive.action;
 
import com.matrix.core.anotations.RemoveRequestToken;
import com.matrix.core.anotations.SaveRequestToken;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.hive.bean.SysProjType;
import com.matrix.system.hive.service.SysProjTypeService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
 
 
/**
 * @description 项目类型管理
 * @author jyy
 * @email 820786562@qqcom
 * @date 2016-07-14
 */
@Controller
@RequestMapping(value = "/admin/projtype")
public class ProjTypeController extends BaseController {
 
   @Resource
   private SysProjTypeService currentService;
    
    public static final String fnCode = "projType";
    public static final String search = fnCode + ":search";
    public static final String edit = fnCode + ":edit";
    public static final String del = fnCode + ":del";
    public static final String add = fnCode + ":add";
   @RequestMapping(value = "/all")
   public @ResponseBody
   AjaxResult all(SysProjType sysProjType) {
       QueryUtil.setQueryLimit(sysProjType);
       return new AjaxResult(AjaxResult.STATUS_SUCCESS,    currentService.findByModel(sysProjType), 0);
   }
   
   /**
    * 新增或修改页面
    */       
       @RequestMapping(value = "/addOrModify")
       @RemoveRequestToken
   public @ResponseBody AjaxResult addOrModify(SysProjType sysProjType) {
       if (sysProjType.getId() != null) {
 
           return modify(currentService, sysProjType, "项目");
       } else {
           QueryUtil.setQueryLimit(sysProjType);
           return add(currentService, sysProjType, "项目");
       }
   }
       
 
   @RequestMapping(value = "/editForm")
   @SaveRequestToken
   public String editForm(Long id, HttpServletRequest request) {
       SysProjType sysProjType;
       if (id != null) {
           sysProjType = currentService.findById(id);
           request.setAttribute("obj", sysProjType);
       }
       return "admin/hive/products/projtype-form";
   }
   
 
   @RequestMapping(value = "/del")
   public @ResponseBody AjaxResult del(Long keys) {
 
        int i = currentService.removeById(keys);
        if (i > 0) {
            return new AjaxResult(AjaxResult.STATUS_SUCCESS,  "成功删除" + i + "条数据");
        } else {
            return new AjaxResult(AjaxResult.STATUS_FAIL,  "删除失败");
        }
   }
   
   @RequestMapping(value = "/findById")
   public @ResponseBody AjaxResult findById(Long id) {
       SysProjType sysProjType = findById(currentService, id);
       return new AjaxResult(AjaxResult.STATUS_SUCCESS, Arrays.asList(sysProjType), 0);
   }
 
}