如今的信息时代,对信息的共享性,信息的流通性有着较高要求,因此传统管理方式就不适合。为了让亚盛汽车配件销售信息的管理模式进行升级,也为了更好的维护亚盛汽车配件销售信息,亚盛汽车配件销售业绩管理系统的开发运用就显得很有必要。并且通过开发亚盛汽车配件销售业绩管理系统,不仅可以让所学的JSP技术得到实际运用,也可以掌握MySQL的使用方法,对自身编程能力也有一个检验和提升的过程。尤其是通过实践,可以对系统的开发流程加深印象,无论是前期的分析与设计,还是后期的编码测试等环节,都可以有一个深刻的了解。
亚盛汽车配件销售业绩管理系统根据调研,确定管理员管理客户,供应商,员工,管理配件和配件的进货以及出售信息。员工只能管理配件和配件的出售以及进货信息,可以修改密码和个人信息。
借助于亚盛汽车配件销售业绩管理系统这样的工具,让信息系统化,流程化,规范化是最终的发展结果,让其遵循实际操作流程的情况下,对亚盛汽车配件销售信息实施规范化处理,让亚盛汽车配件销售信息通过电子的方式进行保存,无论是管理人员检索亚盛汽车配件销售信息,维护亚盛汽车配件销售信息都可以便利化操作,真正缩短信息处理时间,节省人力和信息管理的成本。
2.1 JAVA简介
Java主要采用CORBA技术和安全模型,可以在互联网应用的数据保护。它还提供了对EJB(Enterprise JavaBeans)的全面支持,java servlet API,JSP(java server pages),和XML技术。Java是一种计算机编程语言,具有封装、继承和多态性三个主要特性,广泛应用于企业Web应用程序开发和移动应用程序开发。Java语言和一般编译器以及直译的区别在于,Java首先将源代码转换为字节码,然后将其转换为JVM的可执行文件,JVM可以在各种不同的JVM上运行。因此,实现了它的跨平台特性。虽然这使得Java在早期非常缓慢,但是随着Java的开发,它已经得到了改进。
2.2 B/S架构
B/S结构的特点也非常多,例如在很多浏览器中都可以做出信号请求。并且可以适当的减轻学生的工作量,通过对客户端安装或者是配置少量的运行软件就能够逐步减少学生的工作量,这些功能的操作主要是由服务器来进行控制的,由于该软件的技术不断成熟,最主要的特点就是与浏览器相互配合为软件开发带来了极大的便利,不仅能够减少开发成本,还能够不断加强系统的软件功能,层层相互独立和展现层是该B/S结构完成相互连接的主要特性。
2.3系统对MySQL数据库的两种连接方式
活动的MySQL/ MySQL库,或使用ODBC接口,MySQL数据库是一个双向链接。永久及非永久连接。
(1)永久连接:一个更永久的连接请求的最大优点是可以非常有效的客户站在密切的联系,当连接到MySQL服务器,就更好了。在起草该页面每一个孩子在这个过程中,而不是仅仅在任何时候,只有在到MySQL服务器请求连接的生命周期,一旦连接。此子过程是建立到服务器的单独连接可以是永久性的。
(2)非永久连接:他是短路。提交顺路到Web服务器,服务器处理请求并请求的页面,你要发送的浏览器客户端,然后连接断开。对于大多数网站,它经常通过有效高效率有关,但在大多数情况下,所使用的连接,但它是一个完整的时间,以避免出现任何问题,并可以增加的容量服务器承载。
2.4 MySql数据库
Mysql的语言是非结构化的,学生可以在数据上进行工作。因为Mysql的语言和结构比较简单,但是功能和存储信息量很强大,其速度、可靠性和适应性而备受关注并得到了普遍的应用。Mysql数据库在编程过程中的作用是很广泛的,为学生进行数据查询带来了方便。Mysql数据库的应用特点:灵活性强,功能强大,语言相对要简洁很多。
数据流程分析主要就是数据存储的储藏室,它是在计算机上进行的,而不是现实中的储藏室。数据库管理主要是数据存储、修改和增加以及数据表的建立。数据表的建立,可以对数据表中的数据进行调整,数据的重新组合及重新构造,保证数据的安全性。介于数据库的功能强大等特点,本系统的开发主要应用了Mysql进行对数据的管理。
2.5 SSM三大框架
1.Spring的优势:
通过Spring的IOC特性,将对象之间的依赖关系交给了Spring控制,方便解耦,简化了开发。
2.Spring MVC的优势:
SpringMVC是使用了MVC设计思想的轻量级web框架,对web层进行解耦,使我们的开发更简洁。
3.Mybatis的优势:
数据库的操作(sql)采用xml文件配置,解除了sql和代码的耦合,提供映射标签,支持对象和和数据库orm字段关系的映射,支持对象关系映射标签,支持对象关系的组建提供了xml标签,支持动态的sql。
package com.controller;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.PeijianleixingEntity;
import com.service.PeijianleixingService;
import com.utils.PageUtils;
import com.utils.R;
/**
* 配件类型
* 后端接口
* @author
* @email
* @date 2021-02-02
*/
@RestController
@Controller
@RequestMapping("/peijianleixing")
public class PeijianleixingController {
private static final Logger logger = LoggerFactory.getLogger(PeijianleixingController.class);
@Autowired
private PeijianleixingService peijianleixingService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params){
logger.debug("Controller:"+this.getClass().getName()+",page方法");
PageUtils page = peijianleixingService.queryPage(params);
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
logger.debug("Controller:"+this.getClass().getName()+",info方法");
PeijianleixingEntity peijianleixing = peijianleixingService.selectById(id);
if(peijianleixing!=null){
return R.ok().put("data", peijianleixing);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody PeijianleixingEntity peijianleixing, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",save");
Wrapper<PeijianleixingEntity> queryWrapper = new EntityWrapper<PeijianleixingEntity>()
.eq("pjname", peijianleixing.getPjname())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
PeijianleixingEntity peijianleixingEntity = peijianleixingService.selectOne(queryWrapper);
if(peijianleixingEntity==null){
peijianleixingService.insert(peijianleixing);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody PeijianleixingEntity peijianleixing, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",update");
//根据字段查询是否有相同数据
Wrapper<PeijianleixingEntity> queryWrapper = new EntityWrapper<PeijianleixingEntity>()
.notIn("id",peijianleixing.getId())
.eq("pjname", peijianleixing.getPjname())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
PeijianleixingEntity peijianleixingEntity = peijianleixingService.selectOne(queryWrapper);
if(peijianleixingEntity==null){
peijianleixingService.updateById(peijianleixing);//根据id更新
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
logger.debug("Controller:"+this.getClass().getName()+",delete");
peijianleixingService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}
package com.controller;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import com.entity.PeijianxinxiEntity;
import com.service.PeijianxinxiService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.XiaoshouxinxiEntity;
import com.service.XiaoshouxinxiService;
import com.utils.PageUtils;
import com.utils.R;
/**
* 销售信息
* 后端接口
* @author
* @email
* @date 2021-02-02
*/
@RestController
@Controller
@RequestMapping("/xiaoshouxinxi")
public class XiaoshouxinxiController {
private static final Logger logger = LoggerFactory.getLogger(XiaoshouxinxiController.class);
@Autowired
private XiaoshouxinxiService xiaoshouxinxiService;
@Autowired
private PeijianxinxiService peijianxinxiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",page方法");
Object role = request.getSession().getAttribute("role");
PageUtils page = null;
if(role.equals("员工")){
params.put("yh",request.getSession().getAttribute("userId"));
page = xiaoshouxinxiService.queryPage(params);
}else{
page = xiaoshouxinxiService.queryPage(params);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
logger.debug("Controller:"+this.getClass().getName()+",info方法");
XiaoshouxinxiEntity xiaoshouxinxi = xiaoshouxinxiService.selectById(id);
if(xiaoshouxinxi!=null){
return R.ok().put("data", xiaoshouxinxi);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody XiaoshouxinxiEntity xiaoshouxinxi, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",save");
Wrapper<XiaoshouxinxiEntity> queryWrapper = new EntityWrapper<XiaoshouxinxiEntity>()
.eq("numbered", xiaoshouxinxi.getNumbered());
logger.info("sql语句:"+queryWrapper.getSqlSegment());
XiaoshouxinxiEntity xiaoshouxinxiEntity = xiaoshouxinxiService.selectOne(queryWrapper);
xiaoshouxinxi.setNumbered(String.valueOf(new Date().getTime()));
PeijianxinxiEntity peijian = peijianxinxiService.selectOne(new EntityWrapper<PeijianxinxiEntity>().eq("name", xiaoshouxinxi.getName()));
if(peijian == null){
return R.error(511,"配件仓库暂时没有这个配件商品,请输入正确后再出售");
}
xiaoshouxinxi.setCreateTime(new Date());
if(peijian.getSell()==null){
peijian.setSell(0);
}
if(xiaoshouxinxi.getSell()==null){
return R.error("请输入出售数量");
}
int sell = peijian.getRepertory() - xiaoshouxinxi.getSell();
if(sell >= 0){
peijian.setSell(xiaoshouxinxi.getSell());
peijian.setRepertory(sell);
}else{
return R.error("库存不足,请进货");
}
xiaoshouxinxi.setMaxmoney(xiaoshouxinxi.getSell() * peijian.getMoney());
xiaoshouxinxi.setPjTypes(peijian.getPjTypes());
if(xiaoshouxinxiEntity==null){
peijianxinxiService.updateById(peijian);
xiaoshouxinxiService.insert(xiaoshouxinxi);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody XiaoshouxinxiEntity xiaoshouxinxi, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",update");
//根据字段查询是否有相同数据
Wrapper<XiaoshouxinxiEntity> queryWrapper = new EntityWrapper<XiaoshouxinxiEntity>()
.notIn("id",xiaoshouxinxi.getId())
.eq("numbered", xiaoshouxinxi.getNumbered());
logger.info("sql语句:"+queryWrapper.getSqlSegment());
XiaoshouxinxiEntity xiaoshouxinxiEntity = xiaoshouxinxiService.selectOne(queryWrapper);
if(xiaoshouxinxiEntity==null){
xiaoshouxinxiService.updateById(xiaoshouxinxi);//根据id更新
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
logger.debug("Controller:"+this.getClass().getName()+",delete");
xiaoshouxinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}