首页>代码>SSM+bootstrap+jquery+maven编写的进存销后台管理系统>/HBtest/src/main/java/org/shop/controller/KuCunController.java
package org.shop.controller;
import java.util.List;
import org.shop.pojo.KuCun;
import org.shop.pojo.YuJin;
import org.shop.service.KuCunService;
import org.shop.service.YuJinService;
import org.shop.utils.Msg;
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.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException;
@RequestMapping("/kucun")
@Controller
public class KuCunController {
@Autowired
KuCunService kucunService;
@Autowired
YuJinService yujinService;
@RequestMapping("/main.do")
public String kucun() {
return "kucun/main";
}
@ResponseBody
@RequestMapping("/selectAll.do")
public Msg selectAll(int pn) {
List<YuJin> listYujin = yujinService.selectAll();
PageHelper.startPage(pn, 5);
List<KuCun> list = kucunService.selectAll();
//System.out.println("---------------------->:"+list.size());
PageInfo pageInfo = new PageInfo(list,5);
// List<YuJin> listYujin = yujinService.selectAll();
return Msg.success().add("pageInfo", pageInfo).add("listYujin", listYujin);
}
@ResponseBody
@RequestMapping("/selectOne.do")
public Msg selectOne(KuCun kucun) {
System.out.println("---------------------------->:"+kucun);
PageHelper.startPage(1, 5);
List<KuCun> list = kucunService.selectOne(kucun);
PageInfo pageInfo = new PageInfo(list,5);
return Msg.success().add("pageInfo", pageInfo);
}
@ResponseBody
@RequestMapping("/insert.do")
public Msg insert(KuCun kucun) {
System.out.println("---------------------------->:"+kucun);
int deptId = kucunService.selectByKey(kucun);
if(deptId!=0) {
return Msg.idCFfile();
}
int deptName = kucunService.selectByNameKey(kucun);
if(deptName!=0) {
return Msg.nameCFfile();
}
int dept = kucunService.insert(kucun);
if(dept==1) {
return Msg.success();
}else {
return Msg.file();
}
}
@ResponseBody
@RequestMapping("/update.do")
public Msg update(KuCun kucun) {
int dept = kucunService.update(kucun);
if(dept==1) {
return Msg.success();
}else {
return Msg.file();
}
}
@ResponseBody
@RequestMapping("/delete.do")
public Msg delete(int kucunId) {
int dept = kucunService.delete(kucunId);
if(dept==1) {
return Msg.success();
}else {
return Msg.file();
}
}
/*@ResponseBody
@RequestMapping("/ddd")
public Msg ddd() {
List<String> list = kucunService.selectAllNamess();
return Msg.success().add("list", list);
}*/
@ResponseBody
@RequestMapping("/selectFenlei.do")
public Msg selectFenlei(String shopName) {
List<String> list = kucunService.selectFenlei(shopName);
return Msg.success().add("list", list);
}
}
最近下载更多
奋斗的小蚂蚁 LV16
10月22日
飞翔的面包片 LV13
2023年2月15日
184445428 LV6
2022年11月29日
微信网友_6164511365238784 LV7
2022年10月10日
wuying8208 LV15
2022年6月7日
* LV4
2022年5月17日
wanglinddad LV55
2022年3月9日
暖茶1234 LV8
2021年9月14日
2105175744 LV1
2021年7月16日
862960632 LV14
2021年6月16日
最近浏览更多
sunlea LV20
2024年3月21日
black8angel LV4
2023年12月22日
shuangfu LV25
2023年12月2日
uni-code_0123 LV1
2023年11月27日
阳光男孩阿葵
2023年7月14日
暂无贡献等级
c469893928 LV2
2023年6月10日
刘春涛 LV2
2023年6月2日
哇塞塞哈哈哈 LV8
2023年5月5日
cuberbread LV6
2023年3月23日
飞翔的面包片 LV13
2023年2月15日

