Helius
2021-03-17 8f9e3814fd49efd763f06305ffbfff6d87012627
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.core.pojo.AjaxResult;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.core.tools.WebUtil;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.hive.bean.SysShopInfo;
import com.matrix.system.hive.bean.SysSupplierInfo;
import com.matrix.system.hive.dao.SysShopInfoDao;
import com.matrix.system.hive.service.CodeService;
import com.matrix.system.hive.service.SysSupplierInfoService;
import org.springframework.beans.factory.annotation.Autowired;
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;
 
/**往来单位
 * @author jiangyouyao
 * @date 2016-07-17
 */
@Controller
@RequestMapping(value = "admin/supplier")
public class SupplierInfoController extends BaseController{
    @Resource
    private SysSupplierInfoService currentService;
    @Resource
    private CodeService codeService;
 
    @Autowired
    private SysShopInfoDao shopInfoDao;
 
 
    
    /**
     * 列表显示
     */
    @RequestMapping(value = "/showList")
    public @ResponseBody
    AjaxResult showList(PaginationVO pageVo, SysSupplierInfo sysSupplierInfo) {
        QueryUtil.setQueryLimit(sysSupplierInfo);
        return showList(currentService, sysSupplierInfo, pageVo);
    }
       
    /**
     * 新增或修改页面
     */       
       @RequestMapping(value = "/addOrModify")
       @RemoveRequestToken
    public @ResponseBody AjaxResult addOrModify(SysSupplierInfo sysSupplierInfo) {
        SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        if (sysSupplierInfo.getId() != null) {
 
            return modify(currentService, sysSupplierInfo, "往来单位");
        } else {
 
            sysSupplierInfo.setShopId(sysUsers.getShopId());
            sysSupplierInfo.setCompanyId(sysUsers.getCompanyId());
            return add(currentService, sysSupplierInfo, "往来单位");
        }
    }
    
       /**
     * 进入修改界面
     */   
       @RequestMapping(value = "/editForm")
       @SaveRequestToken
    public String editForm(Long id) {
           SysSupplierInfo sysSupplierInfo;
        if (id != null) {
            sysSupplierInfo = currentService.findById(id);
            WebUtil.getRequest().setAttribute("obj", sysSupplierInfo);
        }
        return "admin/hive/instore/supplierinfo-form";
    }
       
       
       /**
     * 删除
     */  
     @RequestMapping(value = "/del")
    public @ResponseBody AjaxResult del(String keys) {
 
        return remove(currentService, keys);
    }
 
    /**所有
     * @param sysSupplierInfo
     * @return
     */
    @RequestMapping(value = "/all")
    public @ResponseBody AjaxResult all(SysSupplierInfo sysSupplierInfo) {
        SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        SysShopInfo shopInfo = shopInfoDao.selectZbShop(sysUsers.getCompanyId());
        sysSupplierInfo.setShopId(shopInfo.getId());
        sysSupplierInfo.setCompanyId(shopInfo.getCompanyId());
 
        return new AjaxResult(AjaxResult.STATUS_SUCCESS,    currentService.findByModel(sysSupplierInfo), 0);
    }
    
}