频道管理控制器
修改项目
gaming-server-web-admin
Controller
package com.ooqiu.gaming.server.web.admin.controller;
import com.alibaba.dubbo.config.annotation.Reference;
import com.ooqiu.gaming.server.domain.Channel;
import com.ooqiu.gaming.service.admin.api.ChannelService;
import com.ooqui.gaming.server.commons.constant.DubboVersionConstant;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.List;
@Controller
@RequestMapping(value = "channel")
public class ChannelController {
@Reference(version = DubboVersionConstant.DUBBO_VERSION_GAMING_SERVER_SERVICE_ADMIN)
private ChannelService channelService;
/**
* 跳转频道列表页
* @return
*/
@RequestMapping(value = "list", method = RequestMethod.GET)
public String list(Model model) {
List<Channel> channels = channelService.selectAll();
model.addAttribute("channels", channels);
return "modules/channel/list";
}
/**
* 跳转频道表单页
* @return
*/
@RequestMapping(value = "form", method = RequestMethod.GET)
public String form() {
return "modules/channel/form";
}
/**
* 保存频道
* @param channel
* @return
*/
@RequestMapping(value = "save", method = RequestMethod.POST)
public String save(Channel channel) {
int result = channelService.save(channel);
return "redirect:/channel/list";
}
}