Helius
2021-01-25 89e17a219d8a6d208e4cb32a43e90abb89b3c93b
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
package com.matrix.system.hive.action;
 
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.bean.SysVipLevel;
import com.matrix.system.hive.service.SysVipLevelService;
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;
 
/**
 * @description 会员卡等级信息管理action
 * @author jyy
 * @date 2016-07-13
 */
@Controller
@RequestMapping(value = "admin/cardLevel")
public class CardLevelController extends BaseController{
 
 
    @Resource
    private SysVipLevelService cardLevelService;
    
    /**
     * 显示所有的会员卡等级信息
     */
    @RequestMapping(value = "/showList")
    public @ResponseBody AjaxResult showList(SysVipLevel vipLevel,PaginationVO pageVo) {
        SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        vipLevel.setShopId(users.getShopId());
        return showList(cardLevelService,vipLevel,pageVo);
    }
    /**
     * 添加或修改会员卡等级信息
     */
    @RequestMapping(value = "/addOrModify")
    public @ResponseBody AjaxResult addOrModify(SysVipLevel vipLevel) {
        SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        vipLevel.setShopId(users.getShopId());
        vipLevel.setCompanyId(users.getCompanyId());
        if (vipLevel.getId() != null) {
 
            return modify(cardLevelService, vipLevel, "会员卡信息");
        } else {
 
            return add(cardLevelService, vipLevel, "会员卡信息");
        }
    }
    /**
     * 删除会员卡信息
     */
    @RequestMapping(value = "/del")
    public @ResponseBody AjaxResult del(String keys) {
 
        return remove(cardLevelService, keys);
    }
    /**
     * 弹出框,会员卡信息
     */
    @RequestMapping(value = "/editForm")
    public String editForm(Long id, HttpServletRequest request) {
        SysVipLevel vipLevel;
        if (id != null) {
            vipLevel = cardLevelService.findById(id); 
            request.setAttribute("obj", vipLevel);
        }
        return "admin/hive/vip/cardLevel-form";
    }
    
    /**
     * 显示所有的会员卡等级信息,不分页
     */
    @RequestMapping(value = "/all")
    public @ResponseBody AjaxResult all(SysVipLevel sysVipLevel) {
        SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        sysVipLevel.setShopId(users.getShopId());
        return new AjaxResult(AjaxResult.STATUS_SUCCESS, cardLevelService.findByModel(sysVipLevel), null);
    }
}