In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how Java implements the florist mall system. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
I. brief introduction of the project
The functions of this system include:
Classified display of goods, user registration, shopping cart, order settlement, shopping cart addition and subtraction, background commodity management, classification management, order management and other functions.
II. Project operation
Environment configuration:
Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX (Webstorm is also fine) + Eclispe (both supported by IntelliJ IDEA,Eclispe,MyEclispe,Sts).
Project technology:
It is composed of Springboot + Maven + mybatis+ Vue and so on, and BCMIS mode + Maven management and so on.
User management control layer:
/ * * user * * / @ RestController@RequestMapping ("user") public class UserController {@ Autowired UserService userService; @ Autowired UserDao dao; @ RequestMapping ("/ test") R test () {R r = new R (); return r.setCode (4000) .setMsg (Constant.IMG_PATH) .setData (dao.findAll ()) } @ RequestMapping ("/ queryInfoByAccount") R queryInfoByAccount (@ RequestParam ("account") String account) {R r = new R (); if (StringUtil.isEmpty (account)) {return r.setCode (4000) .setMsg (HttpMsg.INVALID_PARAM);} User loginUser = userService.queryInfo (account) If (loginUser = = null) {return r.setCode (4000) .setMsg (HttpMsg.INVALID_USER);} return r.setCode (2000) .setData (loginUser);} @ RequestMapping ("/ find") R find (@ RequestParam ("page") int page, @ RequestParam ("searchKey") String searchKey) {R r = new R (); Map map = new HashMap () List users = userService.find (searchKey); if (users = = null) {return r.setCode (2000);} List items = users.size () > = page * Constant.PAGE_SIZE? Users.subList ((page-1) * Constant.PAGE_SIZE, page * Constant.PAGE_SIZE): users.subList ((page-1) * Constant.PAGE_SIZE, users.size ()); int len = users.size ()% Constant.PAGE_SIZE = = 0? Users.size () / Constant.PAGE_SIZE: (users.size () / Constant.PAGE_SIZE + 1); map.put ("items", items); map.put ("len", len); return r.setCode (2000) .setData (map);} @ RequestMapping ("/ create") R create (@ RequestBody User user) {R r = new R () Int ans = userService.add (user); if (ans = = 1) {return r.setCode (2000) .setMsg (HttpMsg.ADD_USER_OK);} return r.setCode (4000) .setMsg (HttpMsg.ADD_USER_FAILED);} @ RequestMapping ("/ update") R update (@ RequestBody User user) {R r = new R (); int ans = userService.update (user) If (ans > = 0) {return r.setCode (2000) .setMsg (HttpMsg.UPDATE_USER_OK);} return r.setCode (4000) .setMsg (HttpMsg.UPDATE_USER_FAILED);} @ DeleteMapping ("/ delete") R delete (@ RequestParam ("id") int id) {R r = new R (); int ans = userService.delete (id) If (ans = = 1) {return r.setCode (2000) .setMsg (HttpMsg.DELETE_USER_OK);} return r.setCode (4000) .setMsg (HttpMsg.DELETE_USER_FAILED);}}
Order management control layer:
/ * * user * * / @ RestController@RequestMapping ("order") public class OrderController {@ Autowired OrderService orderService; @ Autowired UserDao userDao; @ Autowired OrderDao orderDao; @ Autowired FlowersDao flowersDao; @ RequestMapping ("/ test") R test () {R r = new R (); return r.setCode (4000) .setMsg (Constant.IMG_PATH) .setData (orderDao.findAll (null)) } @ RequestMapping ("/ queryByAccount") R queryByAccount (@ RequestParam ("account") String account) {R r = new R (); if (StringUtil.isEmpty (account)) {return r.setCode (4000) .setMsg (HttpMsg.INVALID_PARAM);} List orders = orderService.queryByAccount (account); return r.setCode (2000) .setData (orders) } @ RequestMapping ("/ find") R find (@ RequestParam ("page") int page, @ RequestParam ("searchKey") String searchKey, @ RequestParam ("account") String account) {R r = new R (); Map map = new HashMap (); List orders = orderService.find (searchKey, account); if (orders = null) {return r.setCode (2000) } map.put ("items", orders); map.put ("len", orders.size ()); return r.setCode (2000) .setData (map);} @ RequestMapping ("/ findAll") R findAll (@ RequestParam ("page") int page, @ RequestParam ("searchKey") String searchKey) {R r = new R (); Map map = new HashMap () List orders = orderService.findAll (searchKey); if (orders = = null) {return r.setCode (2000);} List items = orders.size () > = page * Constant.PAGE_SIZE? Orders.subList ((page-1) * Constant.PAGE_SIZE, page * Constant.PAGE_SIZE): orders.subList ((page-1) * Constant.PAGE_SIZE, orders.size ()); int len = orders.size ()% Constant.PAGE_SIZE = = 0? Orders.size () / Constant.PAGE_SIZE: (orders.size () / Constant.PAGE_SIZE + 1); List vos = new ArrayList (); for (Order item: items) {User user = userDao.queryById (item.getUid ()); OrderVo vo = new OrderVo () Vo.setAddress (user.getAddress ()) .setPhone (user.getPhone ()) .setUsername (user.getName ()) .setAmount (item.getAmount ()) .setFlower (item.getFlower ()) .setId (item.getId ()) .setUid (item.getUid ()). SetOrder_guid (item.getOrder_guid ()) .setPrice (item.getPrice ()) .setState (item.getState () Vos.add (vo);} map.put ("items", vos); map.put ("len", len); return r.setCode (2000) .setData (map);} @ RequestMapping ("/ update") R update (@ RequestBody Order order) {R r = new R (); int ans = orderService.update (order) If (ans > = 0) {return r.setCode (2000) .setMsg (HttpMsg.UPDATE_USER_OK);} return r.setCode (4000) .setMsg (HttpMsg.UPDATE_USER_FAILED);} @ RequestMapping ("/ changeState") R changeState (@ RequestBody Order order) {orderDao.changeState (order); return new R () .setCode (2000) .setMsg (HttpMsg.UPDATE_ORDER_OK) @ DeleteMapping ("/ delete") R delete (@ RequestParam ("id") int id) {R r = new R (); int ans = orderService.delete (id); if (ans = = 1) {return r.setCode (2000) .setMsg (HttpMsg.DELETE_USER_OK);} return r.setCode (4000) .setMsg (HttpMsg.DELETE_USER_FAILED);}}
Shopping cart control layer:
/ * * user * * / @ RestController@RequestMapping ("cart") public class CartController {@ Autowired CartService cartService; @ Autowired OrderService orderService; @ Autowired CartDao dao; @ Autowired FlowersDao flowersDao; @ RequestMapping ("/ test") R test () {R r = new R (); return r.setCode (4000) .setMsg (Constant.IMG_PATH) .setData (dao.findAll ()) } @ RequestMapping ("/ queryByAccount") R queryByAccount (@ RequestParam ("account") String account) {R r = new R (); if (StringUtil.isEmpty (account)) {return r.setCode (4000) .setMsg (HttpMsg.INVALID_PARAM);} List carts = cartService.queryByAccount (account) For (Cart cart: carts) {float price = flowersDao.queryPrice (cart.getFid ()); cart.setPrice (cart.getAmount () * price);} return r.setCode (2000) .setData (carts) } @ RequestMapping ("/ find") R find (@ RequestParam ("page") int page, @ RequestParam ("searchKey") String searchKey, @ RequestParam ("account") String account) {R r = new R (); Map map = new HashMap (); List carts = cartService.find (searchKey, account); if (carts = null) {return r.setCode (2000) } List items = carts.size () > = page * Constant.PAGE_SIZE? Carts.subList ((page-1) * Constant.PAGE_SIZE, page * Constant.PAGE_SIZE): carts.subList ((page-1) * Constant.PAGE_SIZE, carts.size ()); int len = carts.size ()% Constant.PAGE_SIZE = = 0? Carts.size () / Constant.PAGE_SIZE: (carts.size () / Constant.PAGE_SIZE + 1); map.put ("items", items); map.put ("len", len); return r.setCode (2000) .setData (map);} @ RequestMapping ("/ buy") R buy (@ RequestParam ("account") String account) {R r = new R () / / check the user's shopping cart List carts = (List) queryByAccount (account). GetData (); for (Cart cart: carts) {/ / add order data orderService.add (cart); / / delete shopping cart data cartService.delete (cart.getId ()) } return r.setCode (2000) .setMsg (HttpMsg.BUY_OK);} @ RequestMapping ("/ create") R create (@ RequestBody Cart cart) {R r = new R (); int ans = cartService.add (cart); if (ans = = 1) {return r.setCode (2000) .setMsg (HttpMsg.ADD_CART_OK) } return r.setCode (4000) .setMsg (HttpMsg.ADD_CART_FAILED);} @ RequestMapping ("/ update") R update (@ RequestBody Cart cart) {R r = new R (); int ans = cartService.update (cart); if (ans > = 0) {return r.setCode (2000) .setMsg (HttpMsg.UPDATE_USER_OK) } return r.setCode (4000) .setMsg (HttpMsg.UPDATE_USER_FAILED);} @ DeleteMapping ("/ delete") R delete (@ RequestParam ("id") int id) {R r = new R (); int ans = cartService.delete (id); if (ans = = 1) {return r.setCode (2000) .setMsg (HttpMsg.DELETE_USER_OK) } return r.setCode (4000) .setMsg (HttpMsg.DELETE_USER_FAILED);}} Thank you for reading! This is the end of the article on "how to realize the florist mall system in Java". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.