net.groupbuy.controller.admin.ProductNotifyController.java Source code

Java tutorial

Introduction

Here is the source code for net.groupbuy.controller.admin.ProductNotifyController.java

Source

/*
 * Copyright 2005-2013 shopxx.net. All rights reserved.
 * Support: http://www.shopxx.net
 * License: http://www.shopxx.net/license
 */
package net.groupbuy.controller.admin;

import javax.annotation.Resource;

import net.groupbuy.Message;
import net.groupbuy.Pageable;
import net.groupbuy.service.ProductNotifyService;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Controller - 
 * 
 * @author SHOP++ Team
 * @version 3.0
 */
@Controller("ProductNotifyntroller")
@RequestMapping("/admin/product_notify")
public class ProductNotifyController extends BaseController {

    @Resource(name = "productNotifyServiceImpl")
    private ProductNotifyService productNotifyService;

    /**
     * ??
     */
    @RequestMapping(value = "/send", method = RequestMethod.POST)
    public @ResponseBody Message send(Long[] ids) {
        int count = productNotifyService.send(ids);
        return Message.success("admin.productNotify.sentSuccess", count);
    }

    /**
     * 
     */
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public String list(Boolean isMarketable, Boolean isOutOfStock, Boolean hasSent, Pageable pageable,
            ModelMap model) {
        model.addAttribute("isMarketable", isMarketable);
        model.addAttribute("isOutOfStock", isOutOfStock);
        model.addAttribute("hasSent", hasSent);
        model.addAttribute("page",
                productNotifyService.findPage(null, isMarketable, isOutOfStock, hasSent, pageable));
        return "/admin/product_notify/list";
    }

    /**
     * 
     */
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public @ResponseBody Message delete(Long[] ids) {
        productNotifyService.delete(ids);
        return SUCCESS_MESSAGE;
    }

}