文章目录
- 超市进销存管理系统
- 一、项目演示
- 二、项目介绍
- 三、系统部分功能截图
- 四、七千字项目文档
- 五、部分代码展示
- 六、底部获取项目源码和七千字项目文档(9.9¥带走)
超市进销存管理系统
一、项目演示
超市进销存管理系统
二、项目介绍
角色分为管理员、员工
管理员:进货管理,商品信息管理,库存管理,销售管理,客户信息管理,供应商信息管理和员工信息管理功能!
员工:进货管理,商品信息管理,库存管理,销售管理,客户信息管理,供应商信息管理功能
语言:java
技术栈:Spring、Spring MVC、Mybatis、jsp
数据库:MySQL
三、系统部分功能截图
四、七千字项目文档
五、部分代码展示
package com.hbh.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hbh.entity.Ckin;
import com.hbh.service.imp.CkinServiceImp;
/**
* @Author Binvor
* @Date 2019年3月27日下午3:28:51
* @Des 进货管理
*/
@Controller
@RequestMapping("/staff/flatform/ckin")
public class CkinController {
@Autowired
CkinServiceImp ckinServiceImp;
// 获取所有进货信息
@RequestMapping("getall")
public String getlist(ModelMap model,
@RequestParam(defaultValue="1",required=true,value="pn") Integer pn
) {
PageHelper.startPage(pn, 4);
List<Ckin> ckin= ckinServiceImp.getall();
PageInfo<Ckin> pageInfo=new PageInfo<Ckin>(ckin);
model.addAttribute("pageInfo", pageInfo);
return "getall_ckin";
}
// 根据id查询单个信息
@RequestMapping("/getckin")
public String getbyid(String inid,HttpServletRequest request,Model model){
request.setAttribute("ckin", ckinServiceImp.getbyid(inid));
model.addAttribute("ckin",ckinServiceImp.getbyid(inid));
return "getckin";
}
// 根据条件查询
/* @RequestMapping("/getwhere")
public String getwhere(String id,String pname,String type ,HttpServletRequest request,Model model){
request.setAttribute(" duct", ckinServiceImp.getbywhere( id, pname, type));
model.addAttribute(" duct",ckinServiceImp.getbywhere( id, pname, type));
return "getlist";
}*/
@RequestMapping("edit")
public String edit(Ckin ckin,HttpServletRequest request,Model model){
model.addAttribute("ckin", ckinServiceImp.getbyid(ckin.getInid()));
return "editckin";
}
@RequestMapping("update")
public String update(Ckin ckin,HttpServletRequest request,Model model){
if(ckinServiceImp.update(ckin)) {
ckin=ckinServiceImp.getbyid(ckin.getInid());
model.addAttribute("ckin", ckin);
return "redirect:getall";
}
return null;
}
@RequestMapping("/delete")
public String deletete(String inid,HttpServletRequest request,Model model){
ckinServiceImp.delete(inid);
return "redirect:getall";
}
// 跳转到增加页面
@RequestMapping("/toadd")
public String toadd (){
return "addckin";
}
@RequestMapping("/insert")
// 先判断数据库有没有,有就更新,没有就新增
public String insert (Ckin ckin,HttpServletRequest request,Model model){
if(null==ckinServiceImp.getbyid(ckin.getInid())) {
ckinServiceImp.insert(ckin);
}else {
ckinServiceImp.update(ckin);
}
return "redirect:getall";
}
@InitBinder
protected void init(HttpServletRequest request, ServletRequestDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
}
// 按条件获取所有进货信息
@RequestMapping("getbyparams")
public String getbyparams(HttpServletRequest request,Model model,@RequestParam(value="proid",required=false)String proid,
@RequestParam(value="inid",required=false)String inid,@RequestParam(value="pname",required=false)String pname,
@RequestParam(value="indate",required=false)String indate,@RequestParam(defaultValue="1",required=true,value="pn") Integer pn
) {
PageHelper.startPage(pn, 100);
List<Ckin> ckin= ckinServiceImp.getbyparams(proid, inid, pname, indate);
PageInfo<Ckin> pageInfo=new PageInfo<Ckin>(ckin);
model.addAttribute("pageInfo", pageInfo);
return "getckinbyparams";
}
}
package com.hbh.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hbh.entity.Ckin;
import com.hbh.entity.Ckretire;
import com.hbh.service.imp.CkinServiceImp;
import com.hbh.service.imp.CkretireServiceImp;
/**
* @Author Binvor
* @Date 2019年3月28日上午9:42:09
* @Des
*/
@Controller
@RequestMapping("/staff/flatform/ckretire")
public class CkretireController {
@Autowired
CkretireServiceImp ckretireServiceImp;
@Autowired
CkinServiceImp ckinServiceImp;
// 获取所有退货信息
@RequestMapping("getall")
public String getlist(ModelMap model,
@RequestParam(defaultValue="1",required=true,value="pn") Integer pn
) {
PageHelper.startPage(pn, 4);
List<Ckretire> ckretire= ckretireServiceImp.getall();
PageInfo<Ckretire> pageInfo=new PageInfo<Ckretire>(ckretire);
model.addAttribute("pageInfo", pageInfo);
return "getall_ckretire";
}
// 根据id查询单个信息
@RequestMapping("/getckretire")
public String getbyid(String inid,HttpServletRequest request,Model model){
request.setAttribute("ckretire", ckretireServiceImp.getbyid(inid));
model.addAttribute("ckretire",ckretireServiceImp.getbyid(inid));
return "getckretire";
}
// 根据条件查询
/* @RequestMapping("/getwhere")
public String getwhere(String id,String pname,String type ,HttpServletRequest request,Model model){
request.setAttribute(" duct", ckretireServiceImp.getbywhere( id, pname, type));
model.addAttribute(" duct",ckretireServiceImp.getbywhere( id, pname, type));
return "getlist";
}*/
@RequestMapping("edit")
public String edit(Ckretire ckretire,HttpServletRequest request,Model model){
model.addAttribute("ckretire", ckretireServiceImp.getbyid(ckretire.getInid()));
return "editckretire";
}
@RequestMapping("update")
public String update(Ckretire ckretire,HttpServletRequest request,Model model){
if(ckretireServiceImp.update(ckretire)) {
ckretire=ckretireServiceImp.getbyid(ckretire.getInid());
model.addAttribute("ckretire", ckretire);
return "redirect:getall";
}
return null;
}
@RequestMapping("/delete")
public String deletete(String inid,HttpServletRequest request,Model model){
ckretireServiceImp.delete(inid);
return "redirect:getall";
}
// 跳转到增加页面
@RequestMapping("/toadd")
public String toadd (){
return "addckretire";
}
@RequestMapping("/insert")
// 先判断数据库有没有,有就更新,没有就新增
public String insert (Ckretire ckretire,HttpServletRequest request,Model model){
if(null==ckretireServiceImp.getbyid(ckretire.getInid())) {
ckretireServiceImp.insert(ckretire);
}else {
ckretireServiceImp.update(ckretire);
}
return "redirect:getall";
}
@InitBinder
protected void init(HttpServletRequest request, ServletRequestDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
}
// 按条件获取所有进货信息
@RequestMapping("getbyparams")
public String getbyparams(HttpServletRequest request,Model model,@RequestParam(value="proid",required=false)String proid,
@RequestParam(value="inid",required=false)String inid,@RequestParam(value="pname",required=false)String pname,
@RequestParam(value="retdate",required=false)String retdate,@RequestParam(defaultValue="1",required=true,value="pn") Integer pn
) {
PageHelper.startPage(pn, 100);
List<Ckretire> ckin= ckretireServiceImp.getbyparams(proid, inid, pname, retdate);
PageInfo<Ckretire> pageInfo=new PageInfo<Ckretire>(ckin);
model.addAttribute("pageInfo", pageInfo);
return "getckretirebyparams";
}
// 根据id查询单个信息
@RequestMapping("/getckret")
@ResponseBody
public Ckin ckretire(String inid,HttpServletRequest request,Model model){
Ckin ckretire=new Ckin();
ckretire= ckinServiceImp.getbyid(inid);
return ckretire;
}
}
package com.hbh.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hbh.entity.CusRetire;
import com.hbh.entity.Sale;
import com.hbh.service.imp.CusRetireServiceImp;
import com.hbh.service.imp.SaleServiceImp;
/**
* @Author Binvor
* @Date 2019年4月10日下午1:40:47
* @Des 退货控制器
*/
@Controller
@RequestMapping("/staff/flatform/cusretire")
public class CusRetireController {
@Autowired
CusRetireServiceImp cusRetireServiceImp;
@Autowired
SaleServiceImp saleServiceImp;
// 获取所有退货信息
@RequestMapping("getall")
public String getlist(ModelMap model,
@RequestParam(defaultValue="1",required=true,value="pn") Integer pn
) {
PageHelper.startPage(pn, 4);
List<CusRetire> CusRetire= cusRetireServiceImp.getall();
PageInfo<CusRetire> pageInfo=new PageInfo<CusRetire>(CusRetire);
model.addAttribute("pageInfo", pageInfo);
return "getall_CusRetire";
}
// 根据id查询单个信息
@RequestMapping("/getCusRetire")
public String getbyid(String saleid,HttpServletRequest request,Model model){
request.setAttribute("CusRetire", cusRetireServiceImp.getbyid(saleid));
model.addAttribute("CusRetire",cusRetireServiceImp.getbyid(saleid));
return "getCusRetire";
}
@RequestMapping("edit")
public String edit(CusRetire CusRetire,HttpServletRequest request,Model model){
model.addAttribute("CusRetire", cusRetireServiceImp.getbyid(CusRetire.getSaleid()));
return "editcusretire";
}
@RequestMapping("update")
public String update(CusRetire CusRetire,HttpServletRequest request,Model model){
if(cusRetireServiceImp.update(CusRetire)) {
CusRetire=cusRetireServiceImp.getbyid(CusRetire.getSaleid());
model.addAttribute("CusRetire", CusRetire);
return "redirect:getall";
}
return null;
}
@RequestMapping("/delete")
public String deletete(String saleid,HttpServletRequest request,Model model){
cusRetireServiceImp.delete(saleid);
return "redirect:getall";
}
// 跳转到增加页面
@RequestMapping("/toadd")
public String toadd (){
return "addcusretire";
}
@RequestMapping("/insert")
// 先判断数据库有没有,有就更新,没有就新增
public String insert (CusRetire CusRetire,HttpServletRequest request,Model model){
if(null==cusRetireServiceImp.getbyid(CusRetire.getSaleid())) {
cusRetireServiceImp.insert(CusRetire);
}else {
cusRetireServiceImp.update(CusRetire);
}
return "redirect:getall";
}
@InitBinder
protected void init(HttpServletRequest request, ServletRequestDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
}
// 按条件获取所有进货信息
@RequestMapping("getbyparams")
public String getbyparams(HttpServletRequest request,Model model,@RequestParam(value="proid",required=false)String proid,
@RequestParam(value="saleid",required=false)String saleid,@RequestParam(value="pname",required=false)String pname,
@RequestParam(value="retdate",required=false)String retdate,@RequestParam(defaultValue="1",required=true,value="pn") Integer pn
) {
PageHelper.startPage(pn, 100);
List<CusRetire> ckin= cusRetireServiceImp.getbyparams(proid, saleid, pname, retdate);
PageInfo<CusRetire> pageInfo=new PageInfo<CusRetire>(ckin);
model.addAttribute("pageInfo", pageInfo);
return "getCusRetirebyparams";
}
@RequestMapping("/getCus")
@ResponseBody
public Sale getCus(String saleid,HttpServletRequest request,Model model){
Sale sale=new Sale();
sale=saleServiceImp.getbyid(saleid);
return sale;
}
}
package com.hbh.service.imp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hbh.dao.CustomMapper;
import com.hbh.dao.KcxxMapper;
import com.hbh.dao.SaleMapper;
import com.hbh.entity.Custom;
import com.hbh.entity.Kcxx;
import com.hbh.entity.Sale;
import com.hbh.service.ISaleService;
@Service
public class SaleServiceImp implements ISaleService {
@Autowired
SaleMapper saleMapper;
@Autowired
KcxxMapper kcxxMapper;
@Autowired
CustomMapper customMapper;
public int delete(String saleid) {
return saleMapper.deleteByPrimaryKey(saleid);
}
public int insert(Sale record) {
String id=record.getProid();
String cusid=record.getCusid();
String name=record.getCusname();
Custom custom=new Custom();
if(customMapper.getbyparams(cusid, name).size()==0) {
custom.setCusid(cusid);
custom.setCusname(name);
if(record.getTotal()>500) {
int a=customMapper.insert(custom);
}
}else {
customMapper.updateByPrimaryKey(custom);
}
Kcxx kcxx=new Kcxx();
kcxx=kcxxMapper.selectByPrimaryKey(id);
int kcnum=kcxx.getNum();
int salenum=record.getNum();
int nownum=kcnum-salenum-kcnum;
kcxx.setNum(nownum);
kcxx.setPname(record.getPname());
kcxx.setProid(record.getProid());
kcxx.setMarks(record.getMarks());
kcxxMapper.updateByPrimaryKey(kcxx);
return saleMapper.insert(record);
}
public List<Sale> getall() {
// TODO Auto-generated method stub
return saleMapper.selectByExample(null);
}
public Sale getbyid(String saleid) {
// TODO Auto-generated method stub
return saleMapper.selectByPrimaryKey(saleid);
}
public boolean update(Sale record) {
// TODO Auto-generated method stub
return saleMapper.updateByPrimaryKey(record);
}
public List<Sale> getbyparams(String proid, String cusid, String pname, String cusname) {
// TODO Auto-generated method stub
return saleMapper.getbyparams(proid, cusid, pname, cusname);
}
public List<Map<String, Object>> pieData() {
List<Map<String,Object>> data =new ArrayList<Map<String, Object>>();
List<Map<String, Object>> listdata=saleMapper.count();
if(listdata.size()>0){
for(int i=0;i<listdata.size();i++){
Map<String,Object> map=new HashMap<String, Object>();
map.put("name", listdata.get(i).get("pname"));
map.put("value", listdata.get(i).get("num"));
data.add(map);
}
}
return data;
}
}
六、底部获取项目源码和七千字项目文档(9.9¥带走)
有问题,或者需要协助调试运行项目的也可以