基于javaweb+mysql的ssm+maven超市库存管理系统(java+ssm+jsp+js+jquery+layui+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM+Maven超市库存管理系统(java+ssm+jsp+js+jquery+layui+mysql)
项目介绍
基于SSM的超市库存管理系统
管理员:超市库存管理系统,管理员进入系统可以查看个人中心,订货员管理,销售员管理,供应商信息管理,客户信息管理,公告信息管理,库区信息管理,订货信息管理,库存信息管理,销售信息管理等内容,并进行详细操作
订货员:订货员登录系统后,可以对个人中心,供应商信息管理,公告信息管理,库区信息管理,订货信息管理,库存信息管理,销售信息管理等功能进行相应的操作管理
销售员:销售员登录进入超市库存管理系统可以对个人中心,客户信息管理,公告信息管理,库区信息管理,库存信息管理,销售信息管理等功能进行相应操作
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 4.数据库:MySql 5.7/8.0版本均可; 5.是否Maven项目:是;
技术栈
后端:SSM(Spring+SpringMVC+Mybatis)
前端:JSP+CSS+JS+JQUERY+Layui
使用说明
项目运行: 1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
/**
* 公告信息
* 后端接口
* @email
/**
* 商品信息
* 后端接口
* @email
*/
@RestController
@RequestMapping("/shangpinxinxi")
public class ShangpinxinxiController {
@Autowired
private ShangpinxinxiService shangpinxinxiService;
/**
* 后端列表
*/
@RequestMapping("/page")
PageUtils page = gonggaoxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, gonggaoxinxi), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( GonggaoxinxiEntity gonggaoxinxi){
EntityWrapper<GonggaoxinxiEntity> ew = new EntityWrapper<GonggaoxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( gonggaoxinxi, "gonggaoxinxi"));
return R.ok().put("data", gonggaoxinxiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(GonggaoxinxiEntity gonggaoxinxi){
EntityWrapper< GonggaoxinxiEntity> ew = new EntityWrapper< GonggaoxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( gonggaoxinxi, "gonggaoxinxi"));
GonggaoxinxiView gonggaoxinxiView = gonggaoxinxiService.selectView(ew);
return R.ok("查询公告信息成功").put("data", gonggaoxinxiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
GonggaoxinxiEntity gonggaoxinxi = gonggaoxinxiService.selectById(id);
return R.ok().put("data", gonggaoxinxi);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
GonggaoxinxiEntity gonggaoxinxi = gonggaoxinxiService.selectById(id);
return R.ok().put("data", gonggaoxinxi);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody GonggaoxinxiEntity gonggaoxinxi, HttpServletRequest request){
gonggaoxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<KucunxinxiEntity> wrapper = new EntityWrapper<KucunxinxiEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("dinghuoyuan")) {
wrapper.eq("dinghuoyuanzhanghao", (String)request.getSession().getAttribute("username"));
}
int count = kucunxinxiService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* (按值统计)
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}")
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
EntityWrapper<KucunxinxiEntity> ew = new EntityWrapper<KucunxinxiEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("dinghuoyuan")) {
ew.eq("dinghuoyuanzhanghao", (String)request.getSession().getAttribute("username"));
}
List<Map<String, Object>> result = kucunxinxiService.selectValue(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
@IgnoreAuth
@PostMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
if(user==null || !user.getPassword().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@PostMapping(value = "/register")
public R register(@RequestBody UserEntity user){
// ValidatorUtils.validateEntity(user);
if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
return R.error("用户已存在");
}
userService.insert(user);
return R.ok();
}
/**
* 退出
*/
@GetMapping(value = "logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
if(user==null) {
return R.error("账号不存在");
}
user.setPassword("123456");
userService.update(user,null);
return R.ok("密码已重置为:123456");
}
/**
* 销售信息
* 后端接口
* @email
*/
@RestController
@RequestMapping("/xiaoshouxinxi")
public class XiaoshouxinxiController {
@Autowired
private XiaoshouxinxiService xiaoshouxinxiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,XiaoshouxinxiEntity xiaoshouxinxi,
@RequestParam(required = false) @DateTimeFormat(pattern="yyyy-MM-dd") Date xiaoshouriqistart,
@RequestParam(required = false) @DateTimeFormat(pattern="yyyy-MM-dd") Date xiaoshouriqiend,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("dinghuoyuan")) {
xiaoshouxinxi.setDinghuoyuanzhanghao((String)request.getSession().getAttribute("username"));
}
if(tableName.equals("xiaoshouyuan")) {
xiaoshouxinxi.setXiaoshouyuanzhanghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<XiaoshouxinxiEntity> ew = new EntityWrapper<XiaoshouxinxiEntity>();
if(xiaoshouriqistart!=null) ew.ge("xiaoshouriqi", xiaoshouriqistart);
if(xiaoshouriqiend!=null) ew.le("xiaoshouriqi", xiaoshouriqiend);
PageUtils page = xiaoshouxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xiaoshouxinxi), params), params));
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<DinghuoyuanEntity> wrapper = new EntityWrapper<DinghuoyuanEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = dinghuoyuanService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
/**
* 公告信息
* 后端接口
* @email
*/
@RestController
@RequestMapping("/gonggaoxinxi")
public class GonggaoxinxiController {
@Autowired
private GonggaoxinxiService gonggaoxinxiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,GonggaoxinxiEntity gonggaoxinxi,
HttpServletRequest request){
EntityWrapper<GonggaoxinxiEntity> ew = new EntityWrapper<GonggaoxinxiEntity>();
PageUtils page = gonggaoxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, gonggaoxinxi), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,GonggaoxinxiEntity gonggaoxinxi,
HttpServletRequest request){
EntityWrapper<GonggaoxinxiEntity> ew = new EntityWrapper<GonggaoxinxiEntity>();
PageUtils page = gonggaoxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, gonggaoxinxi), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
* 列表
*/
/**
* 商品信息
* 后端接口
* @email
*/
@RestController
@RequestMapping("/shangpinxinxi")
public class ShangpinxinxiController {
@Autowired
private ShangpinxinxiService shangpinxinxiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ShangpinxinxiEntity shangpinxinxi,
HttpServletRequest request){
/**
* 通用接口
*/
@RestController
public class CommonController{
@Autowired
private CommonService commonService;
private static AipFace client = null;
@Autowired
private ConfigService configService;
/**
* 获取table表中的column列表(联动接口)
* @param table
* @param column
* @return
*/
@RequestMapping("/option/{tableName}/{columnName}")
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<DinghuoxinxiEntity> wrapper = new EntityWrapper<DinghuoxinxiEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("dinghuoyuan")) {
wrapper.eq("dinghuoyuanzhanghao", (String)request.getSession().getAttribute("username"));
}
int count = dinghuoxinxiService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* (按值统计)
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}")
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
EntityWrapper<DinghuoxinxiEntity> ew = new EntityWrapper<DinghuoxinxiEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("dinghuoyuan")) {
ew.eq("dinghuoyuanzhanghao", (String)request.getSession().getAttribute("username"));
}
List<Map<String, Object>> result = dinghuoxinxiService.selectValue(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
//ValidatorUtils.validateEntity(kucunxinxi);
kucunxinxiService.insert(kucunxinxi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody KucunxinxiEntity kucunxinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(kucunxinxi);
kucunxinxiService.updateById(kucunxinxi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
kucunxinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<KuquxinxiEntity> wrapper = new EntityWrapper<KuquxinxiEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = kuquxinxiService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
@RestController
@RequestMapping("/shangpinxinxi")
public class ShangpinxinxiController {
@Autowired
private ShangpinxinxiService shangpinxinxiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ShangpinxinxiEntity shangpinxinxi,
HttpServletRequest request){
EntityWrapper<ShangpinxinxiEntity> ew = new EntityWrapper<ShangpinxinxiEntity>();
PageUtils page = shangpinxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shangpinxinxi), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ShangpinxinxiEntity shangpinxinxi,
HttpServletRequest request){
EntityWrapper<ShangpinxinxiEntity> ew = new EntityWrapper<ShangpinxinxiEntity>();
PageUtils page = shangpinxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shangpinxinxi), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ShangpinxinxiEntity shangpinxinxi){
EntityWrapper<ShangpinxinxiEntity> ew = new EntityWrapper<ShangpinxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( shangpinxinxi, "shangpinxinxi"));
return R.ok().put("data", shangpinxinxiService.selectListView(ew));
}
/**
* 库存信息
* 后端接口
* @email
*/
/**
* (按值统计)
*/
@RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}")
@IgnoreAuth
public R value(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
List<Map<String, Object>> result = commonService.selectValue(params);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
/**
* (按值统计)时间统计类型
*/
@IgnoreAuth
@RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}/{timeStatType}")
public R valueDay(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
params.put("timeStatType", timeStatType);
List<Map<String, Object>> result = commonService.selectTimeStatValue(params);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
/**
* 人脸比对
*
* @param face1 人脸1
* @param face2 人脸2
* @return
*/
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<XiaoshouyuanEntity> wrapper = new EntityWrapper<XiaoshouyuanEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = xiaoshouyuanService.selectCount(wrapper);
return R.ok().put("count", count);
}
}