Helius
2021-04-06 997831bb8c314d781e6cc5533898ffbe077dd3b6
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
package com.matrix.system.hive.action;
 
import javax.annotation.Resource;
 
import com.matrix.core.constance.MatrixConstance;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.hive.service.SysSupplierTypeService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
 
 
import com.matrix.core.anotations.RemoveRequestToken;
import com.matrix.core.anotations.SaveRequestToken;
 
import com.matrix.system.hive.bean.SysSupplierType;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.core.tools.WebUtil;
import com.matrix.core.pojo.AjaxResult;
 
/**往来单位类型
 * @author jiangyouyao
 * @date 2016-07-17
 */
@Controller
@RequestMapping(value = "admin/suppliertype")
public class SupplierTypeController extends BaseController{
    @Resource
    private SysSupplierTypeService currentService;
    
 
 
    
    
    
    //记录编辑前的值Before_Edit_Value
    public static final String BEV="Suppliertype_BEV";
    
    public static final String fnCode = "suppliertype";
    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";
    /**所有
     * @param sysSupplierType
     * @return
     */
    @RequestMapping(value = "/all")
    public @ResponseBody AjaxResult all(SysSupplierType sysSupplierType) {
        QueryUtil.setQueryLimit(sysSupplierType);
        return new AjaxResult(AjaxResult.STATUS_SUCCESS,    currentService.findByModel(sysSupplierType), 0);
    }
    
    /**
     * 分页列表显示
     */
    @RequestMapping(value = "/showList")
    public @ResponseBody AjaxResult showList(SysSupplierType sysSupplierType, PaginationVO pageVo) {
        SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        sysSupplierType.setShopId(sysUsers.getShopId());
        sysSupplierType.setCompanyId(sysUsers.getCompanyId());
        return showList(currentService, sysSupplierType, pageVo);
    }
       
    /**
     * 新增或修改页面
     */       
       @RequestMapping(value = "/addOrModify")
       @RemoveRequestToken
    public @ResponseBody AjaxResult addOrModify(SysSupplierType sysSupplierType) {
           SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        if (sysSupplierType.getId() != null) {
 
            return modify(currentService, sysSupplierType, "往来单位类型");
        } else {
            sysSupplierType.setShopId(sysUsers.getShopId());
            sysSupplierType.setCompanyId(sysUsers.getCompanyId());
            return add(currentService, sysSupplierType, "往来单位类型");
        }
    }
    
       /**
     * 进入修改界面
     */   
       @RequestMapping(value = "/editForm")
       @SaveRequestToken
    public String editForm(Long id) {
           SysSupplierType sysSupplierType;
        if (id != null) {
            sysSupplierType = currentService.findById(id);
            WebUtil.getRequest().setAttribute("obj", sysSupplierType);
        }
        return "admin/hive/instore/suppliertype-form";
    }
       
       
       /**
     * 删除
     */  
     @RequestMapping(value = "/del")
    public @ResponseBody AjaxResult del(String keys) {
 
        return remove(currentService, keys);
    }
  
     
}