项目介绍
该项目为后管系统,主要功能包括:
登录、分类管理、库存管理、入库管理、预警信息设置、出库管理、修改密码等
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
6.是否Maven项目:否;
技术栈
1. 后端:spring+spring mvc+mybatis
2. 前端:bootstrap+jQuery
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,地址:http://localhost:8080/tologin.do
进货管理控制层:
@RestController
@RequestMapping("/inport")
public class InportController {
@Autowired
private InportService inportService;
@Autowired
private GoodsService goodsService;
@Autowired
private ProviderService providerService;
/**
* 进货查询
*
* @param
* @return
*/
@SysLog("进货查询操作")
@RequestMapping("/inportList")
public DataGridViewResult inportList(InportVO inportVO) {
//创建分页信息 参数1 当前页 参数2 每页显示条数
IPage<Inport> page = new Page<>(inportVO.getPage(), inportVO.getLimit());
QueryWrapper<Inport> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(inportVO.getProviderid() != null && inportVO.getProviderid() != 0, "providerid", inportVO.getProviderid());
queryWrapper.eq(inportVO.getGoodsid() != null && inportVO.getGoodsid() != 0, "goodsid", inportVO.getGoodsid());
queryWrapper.ge(inportVO.getStartTime() != null, "inptime", inportVO.getStartTime());
queryWrapper.le(inportVO.getEndTime() != null, "inptime", inportVO.getEndTime());
queryWrapper.orderByDesc("inptime");
IPage<Inport> inportIPage = inportService.page(page, queryWrapper);
List<Inport> records = inportIPage.getRecords();
for (Inport inport : records) {
inport.setAllinpprice(inport.getInpprice()*inport.getNumber());
Provider provider = providerService.getById(inport.getProviderid());
if (null != provider) {
inport.setProvidername(provider.getProvidername());
}
Goods goods = goodsService.getById(inport.getGoodsid());
if (null != goods) {
inport.setGoodsname(goods.getGname());
}
}
return new DataGridViewResult(inportIPage.getTotal(), records);
}
/**
* 添加进货信息
*
* @param inport
* @return
*/
@SysLog("进货添加操作")
@PostMapping("/addinport")
public Result addInport(Inport inport, HttpSession session) {
if (inport.getGoodsid()==0||inport.getProviderid()==0){
return Result.error(false, null, "添加失败!未选供应商或商品");
}
User user = (User) session.getAttribute("username");
inport.setOperateperson(user.getUname());
inport.setInptime(new Date());
boolean bool = inportService.save(inport);
if (bool) {
return Result.success(true, "200", "添加成功!");
}
return Result.error(false, null, "添加失败!");
}
/**
* 删除单条数据
*
* @param id
* @return
*/
@SysLog("进货删除操作")
@RequestMapping("/deleteOne")
public Result deleteOne(int id) {
boolean bool = inportService.removeById(id);
if (bool) {
return Result.success(true, "200", "删除成功!");
}
return Result.error(false, null, "删除失败!");
}
/**
* 修改进货信息
*
* @param inport
* @return
*/
@SysLog("进货修改操作")
@PostMapping("/updateinport")
public Result updateGoods(Inport inport, HttpSession session) {
User user = (User) session.getAttribute("username");
inport.setOperateperson(user.getUname());
inport.setInptime(new Date());
boolean bool = inportService.updateById(inport);
if (bool) {
return Result.success(true, "200", "修改成功!");
}
return Result.error(false, null, "修改失败!");
}
}
类型管理控制层:
@RestController
@RequestMapping("/category")
public class CategoryController {
@Autowired
private CategoryService categoryService;
/**
* 类别模糊查询
* @param
* @return
*/
@SysLog("类别查询操作")
@RequestMapping("/categoryList")
public DataGridViewResult categoryList(CategoryVO categoryVO) {
//创建分页信息 参数1 当前页 参数2 每页显示条数
IPage<Category> page = new Page<>(categoryVO.getPage(), categoryVO.getLimit());
QueryWrapper<Category> queryWrapper = new QueryWrapper<>();
queryWrapper.like(!StringUtils.isEmpty(categoryVO.getCatename()),"catename", categoryVO.getCatename());
IPage<Category> categoryIPage = categoryService.page(page, queryWrapper);
/**
* logsIPage.getTotal() 总条数
* logsIPage.getRecords() 分页记录列表
*/
return new DataGridViewResult(categoryIPage.getTotal(),categoryIPage.getRecords());
}
/**
* 类别批量删除
* @param ids
* @return
*/
@SysLog("类别删除操作")
@RequestMapping("/deleteList")
public Result deleteList(String ids) {
//将字符串拆分成数组
String[] idsStr = ids.split(",");
List<String> list = Arrays.asList(idsStr);
boolean bool = categoryService.removeByIds(list);
if(bool){
return Result.success(true,"200","删除成功!");
}
return Result.error(false,null,"删除失败!");
}
/**
* 添加类别信息
* @param category
* @return
*/
@SysLog("类别添加操作")
@PostMapping("/addcategory")
public Result addCategory(Category category){
boolean bool = categoryService.save(category);
if(bool){
return Result.success(true,"200","添加成功!");
}
return Result.error(false,null,"添加失败!");
}
/**
* 修改类别信息
* @param category
* @return
*/
@SysLog("类别修改操作")
@PostMapping("/updatecategory")
public Result updateCategory(Category category){
boolean bool = categoryService.updateById(category);
if(bool){
return Result.success(true,"200","修改成功!");
}
return Result.error(false,null,"修改失败!");
}
/**
* 删除单条数据
* @param id
* @return
*/
@SysLog("类别删除操作")
@RequestMapping("/deleteOne")
public Result deleteOne(int id) {
boolean bool = categoryService.removeById(id);
if(bool){
return Result.success(true,"200","删除成功!");
}
return Result.error(false,null,"删除失败!");
}
}
用户信息管理控制层:
@RestController
@RequestMapping("/customer")
public class CustomerController {
@Autowired
private CustomerService customerService;
/**
* 客户模糊查询
* @param
* @return
*/
@SysLog("客户查询操作")
@RequestMapping("/customerList")
public DataGridViewResult customerList(CustomerVO customerVO) {
//创建分页信息 参数1 当前页 参数2 每页显示条数
IPage<Customer> page = new Page<>(customerVO.getPage(), customerVO.getLimit());
QueryWrapper<Customer> queryWrapper = new QueryWrapper<>();
queryWrapper.like(!StringUtils.isEmpty(customerVO.getCustvip()),"custvip", customerVO.getCustvip());
IPage<Customer> customerIPage = customerService.page(page, queryWrapper);
/**
* logsIPage.getTotal() 总条数
* logsIPage.getRecords() 分页记录列表
*/
return new DataGridViewResult(customerIPage.getTotal(),customerIPage.getRecords());
}
/**
* 客户批量删除
* @param ids
* @return
*/
@SysLog("客户删除操作")
@RequestMapping("/deleteList")
public Result deleteList(String ids) {
//将字符串拆分成数组
String[] idsStr = ids.split(",");
List<String> list = Arrays.asList(idsStr);
boolean bool = customerService.removeByIds(list);
if(bool){
return Result.success(true,"200","删除成功!");
}
return Result.error(false,null,"删除失败!");
}
/**
* 添加客户信息
* @param customer
* @return
*/
@SysLog("客户添加操作")
@PostMapping("/addcustomer")
public Result addCustomer(Customer customer){
String id = RandomStringUtils.randomAlphanumeric(10);
customer.setCustvip(id);
boolean bool = customerService.save(customer);
if(bool){
return Result.success(true,"200","添加成功!");
}
return Result.error(false,null,"添加失败!");
}
/**
* 修改客户信息
* @param customer
* @return
*/
@SysLog("客户修改操作")
@PostMapping("/updatecustomer")
public Result updateCustomer(Customer customer){
boolean bool = customerService.updateById(customer);
if(bool){
return Result.success(true,"200","修改成功!");
}
return Result.error(false,null,"修改失败!");
}
/**
* 删除单条数据
* @param id
* @return
*/
@SysLog("客户删除操作")
@RequestMapping("/deleteOne")
public Result deleteOne(int id) {
boolean bool = customerService.removeById(id);
if(bool){
return Result.success(true,"200","删除成功!");
}
return Result.error(false,null,"删除失败!");
}
/**
*
* 加载下拉框
* @return
*/
@RequestMapping("/loadAllCustomer")
public DataGridViewResult loadAllCustomer(){
QueryWrapper<Customer> queryWrapper = new QueryWrapper<>();
List<Customer> list = customerService.list(queryWrapper);
return new DataGridViewResult(list);
}
}