双向表-controller

package com.lzl.controller;

import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.github.pagehelper.PageInfo;
import com.lzl.pojo.Mingxi;
import com.lzl.pojo.Wuliao;
import com.lzl.service.MingxiService;

@Controller
public class MingxiController {

@Reference
MingxiService service;

@RequestMapping("long")
public String select(Model m,@RequestParam(defaultValue = "1")Integer pageNum,
@RequestParam(defaultValue = "3")Integer pageSize,
String ctime1,String ctime2,String cqid,String cname,String ctel) {

PageInfo<Mingxi> info = service.select(pageNum,pageSize,ctime1,ctime2,cqid,cname,ctel);
m.addAttribute("info", info);
m.addAttribute("ctime1", ctime1);
m.addAttribute("ctime2", ctime2);
m.addAttribute("cqid", cqid);
m.addAttribute("cname", cname);
m.addAttribute("ctel", ctel);


return "list";
}

@RequestMapping("/add")
public String toadd() {
return "add";
}

@RequestMapping("/addmingxi")
public String add(Mingxi mingxi,Wuliao wuliao) {

service.addWuliao(wuliao);
service.addMingxi(mingxi);

return "redirect:long";

}

}

原文地址:https://www.cnblogs.com/liuzhaolong/p/12971402.html