基于javaweb的农资采购销售系统(java+ssm+easyui+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的农资采购销售系统(java+SSM+Easyui+maven+Mysql)
项目描述:
一个完整的农资采购销售系统,系统分为前台会员注册登陆,农资信息浏览,农资详情信息查看,加入购物车,提交订单,付款购买农资等;后台管理员对人员信息的管理,首页图片管理(系统可配置化),农资订单管理,图标统计,农资信息管理
运行环境:
jdk8+tomca8+mysql+IntelliJ IDEA+maven
项目技术:
spring+spring mvc+mybatis+jquery+jquery.easyui.min.js
前端登录:http://localhost:8080/snack/shop/index
后台登录:http://localhost:8080/snack//admin/login/adminLogin
商品参数管理代码:
/**
- Item Controller
*/
@Controller
@RequestMapping(“/item”)
public class ItemController extends BaseController {
@Autowired
private ItemService itemService;
@Autowired
private ItemCategoryService itemCategoryService;
@RequestMapping(“/findbysql”)
public String findBySql(Model model, Item item) {
String sql = “select * from item where 1=1 and isDelete = 0”;
if (!isEmpty(item.getName())) {
sql += " and name like ‘%" + item.getName() + "%’ ";
sql += " order by id";
Pager itemList = itemService.findBySqlRerturnEntity(sql);
model.addAttribute(“pagers”, itemList);
model.addAttribute(“obj”, item);
return “item/itemList”;
/**
-
转到添加商品页面
-
@param model
-
@return
*/
@RequestMapping(“/add”)
public String addItem(Model model) {
String sql = “select * from item_category where isDelete = 0 and pid is not null order by id”;
Pager pagers = itemCategoryService.findBySqlRerturnEntity(sql);
model.addAttribute(“types”, pagers);
return “item/addItem”;
/**
-
执行添加操作
-
@param item
-
@param files CommonsMultipartFile用于文件上传
-
@return
*/
@RequestMapping(“/exadd”)
public String exaddItem(Item item, @RequestParam(“file”) CommonsMultipartFile[] files, HttpServletRequest request) throws IOException {
itemCommon(item, files, request);
item.setGmNum(0);
item.setIsDelete(0);
item.setScNum(0);
itemService.insert(item);
return “redirect:/item/findbysql.action”;
/**
-
跳转到修改商品页面
-
@param id 选中的商品主键
-
@param model
-
@return
*/
@RequestMapping(“/update”)
public String updateItem(Integer id, Model model) {
Item obj = itemService.load(id);
String sql = “select * from item_category where isDelete = 0 and pid is not null order by id”;
List listBySqlReturnEntity = itemCategoryService.listBySqlReturnEntity(sql);
model.addAttribute(“types”, listBySqlReturnEntity);
model.addAttribute(“obj”, obj);
return “/item/updateItem”;
/**
-
执行修改
-
@param item
-
@param files
-
@param request
-
@return
-
@throws IOException
*/
@RequestMapping(“exUpdateItem”)
public String exUpdateItem(Item item, @RequestParam(“file”) CommonsMultipartFile[] files, HttpServletRequest request) throws IOException {
itemCommon(item, files, request);
itemService.updateById(item);
return “redirect:/item/findbysql.action”;
/**
-
商品下架
-
@param id
-
@return
*/
@RequestMapping(“/remove”)
public String removeItem(Integer id) {
String sql = “update item set isDelete = 1 where id=”;
String sql1 = Integer.toString(id) ;
itemService.updateBysql(sql+sql1);
return “redirect:/item/findbysql.action”;
/**
-
上传文件的公共方法
-
@param item
-
@param files
-
@param request
-
@throws IOException
*/
private void itemCommon(Item item, @RequestParam(“file”) CommonsMultipartFile[] files, HttpServletRequest request) throws IOException {
if (files.length > 0) {
for (int s = 0; s < files.length; s++) {
String n = UUIDUtils.create();
String path = SystemContext.getRealPath() + “\resource\uedito