停车位共享系统|基于微信小程序的停车位共享系统设计与实现(附项目源码+论文)

这篇具有很好参考价值的文章主要介绍了停车位共享系统|基于微信小程序的停车位共享系统设计与实现(附项目源码+论文)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

基于微信小程序的停车位共享系统设计与实现

一、摘要

随着互联网技术的不断发展,互联网已经渗透到我们生活的方方面面。随着移动设备的普及,我们的生活发生了翻天覆地的变化,这也对我们的日常生活产生了深远的影响。微信是腾讯于2011年发布的实时通信软件。随着互联网技术的不断发展,微信的功能也在不断扩展。微信已成为“航空母舰级软件”,也是每部智能手机上必需的软件之一。在2017年发布“微信应用”之前,它还成为了该行业的热潮。无需安装微信小程序。使用它时,您只需扫描或搜索它,然后在使用它时就可以走了。对于用户而言,只要有微信,微信小程序就不需要从手机上下载软件。对于小程序开发人员来说,微信小程序开发可以直接调用自己的API接口,开发相对简单,节省了时间,人力和物力。同时,小型程序也可以实现与本机应用程序相同的流畅体验。

本课题题目是基于微信平台的停车位共享小程序设计与实现。本文从系统开发环境、系统目标、设计流程、功能设计等几个方面进行系统的总体设计,并详细描述了一个功能齐全的停车位共享系统的前台及后台开发、运作过程中的一些关键技术。 本文介绍了系统的需求分析和系统分析,并完成了数据流分析,进行了数据字典功能的模块划分,数据库设计及界面设计。 最后,对系统进行测试和分析,以确保其性能和功能完整性的稳定性。

关键词 :微信;小程序;停车位共享;java;

二、相关技术
java、tomcat、mysql、spring、sprigBoot、mybatis、query、vue
三、系统设计
(1)系统主界面

用户进入小程序后,便可看到程序的主界面,具体如图5-1所示。界面中首先展示的停车场展示页面。页面被分为三大块,顶端是推广动画。中间部分是停车场搜索和停车场展示。在下方各个模块的标签页。

停车位共享系统|基于微信小程序的停车位共享系统设计与实现(附项目源码+论文),微信小程序,数据库,java,后端,spring boot

(2)资讯信息界面 

在资讯信息界面中,用户可以查看发布的相关资讯信息

停车位共享系统|基于微信小程序的停车位共享系统设计与实现(附项目源码+论文),微信小程序,数据库,java,后端,spring boot

(3)车位信息界面 

在车位信息界面中,用户可以直接看到停车场的介绍,包含对其的评分,以及各个停车位的状态和价格

停车位共享系统|基于微信小程序的停车位共享系统设计与实现(附项目源码+论文),微信小程序,数据库,java,后端,spring boot停车位共享系统|基于微信小程序的停车位共享系统设计与实现(附项目源码+论文),微信小程序,数据库,java,后端,spring boot

(4)订单管理界面 

在订单管理界面中,将展示已经完成和正在进行的订单,将展示订单中的关键信息

停车位共享系统|基于微信小程序的停车位共享系统设计与实现(附项目源码+论文),微信小程序,数据库,java,后端,spring boot

(5)交流论坛界面 

在交流论坛界面中,用户可以发布帖子,也可以在别人的帖子下面回复信息

停车位共享系统|基于微信小程序的停车位共享系统设计与实现(附项目源码+论文),微信小程序,数据库,java,后端,spring boot

(6)车位共享界面 

在车位共享界面中,用户可以自己共享车位,发布共享信息

停车位共享系统|基于微信小程序的停车位共享系统设计与实现(附项目源码+论文),微信小程序,数据库,java,后端,spring boot

后台管理界面 

在后台管理界面中,用户可以进行用户管理、停车记录管理、交流讨论管理、资讯管理等

停车位共享系统|基于微信小程序的停车位共享系统设计与实现(附项目源码+论文),微信小程序,数据库,java,后端,spring boot

四、数据库设计 

如何设计数据库是软件系统设计与开发中最重要,最基本的要点。健壮和合理的数据库是卫生系统最需要的。数据库存储,维护,设计系统中所有数据,即如何开发系统核心也是最基本的技术,这与系统的整体稳定性和健壮性息息相关。如果在系统设计之初就没有对数据库进行良好的设计,它将带来一系列负面影响,留下许多隐藏的问题,并给系统的开发和维护蒙上阴影。因此,要实现系统的平稳运行,首先必须考虑一个好的数据库。

My SQL适用于批处理,低成本,正常性能和响应速度。它具有自己的标准语法。连接到服务器时,它也可以选择加密密码。因此,系统使用我的SQL数据库进行数据库管理,与其他数据管理工具相比,这是一个不错的选择。

数据库中需要存储用户及各个模块子功能等基本信息以及用户的历史行为信息,这些信息将会被展示在应用端的用户界面上并且会被用于进行数据分析。在该数据概念设计过程中,我们使用了实体联系模型(EntityRelationship Model,简称ER模型)来确定系统实体(Entity)、实体的属性(attribute)以及实体间的联系(relationship) 

五、核心代码  

package com.ideabobo.controller;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.ideabobo.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.alibaba.fastjson.JSON;
import com.ideabobo.model.Dbservice;
import com.ideabobo.model.Dbtablemapping;
import com.ideabobo.service.DatabaseService;

@CrossOrigin(origins="*")
@Controller
@RequestMapping(value = "/database")
public class DatabaseController {
    //private static final Logger logger = Logger.getLogger(DatabaseController.class);
    @Autowired
	private DatabaseService databaseService;
    
    @RequestMapping(value = "/list", produces = "application/json; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public List<Map<String,Object>> list(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	Object objectObj = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
    	//Robj robj = new Robj();
    	List<Map<String,Object>> list = null;
    	try {
			String sql = dbm.list(table,objectObj);
			list = databaseService.find(sql);
		} catch (Exception e) {
			
			e.printStackTrace();
		}  	
        return list;
    }
    
    @RequestMapping(value = "/listJ", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String listJ(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	Object objectObj = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
    	//Robj robj = new Robj();
    	List<Map<String,Object>> list = null;
    	try {
			String sql = dbm.list(table,objectObj);
			list = databaseService.find(sql);
		} catch (Exception e) {
			
			e.printStackTrace();
		}  	
        return renderJsonp(list, req);
    }
    
    @RequestMapping(value = "/find", produces = "application/json; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public Map<String,Object> find(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	Object objectObj = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
    	//Robj robj = new Robj();
    	List<Map<String,Object>> list = null;
    	try {
			String sql = dbm.list(table,objectObj,true);
			list = databaseService.find(sql);
		} catch (Exception e) {
			
			e.printStackTrace();
		}
    	if (list!=null && list.size()>0) {
    		return list.get(0);
		}else{
			return null;
		}
        
    }
    
    @RequestMapping(value = "/findJ", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String findJ(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	Object objectObj = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
    	//Robj robj = new Robj();
    	List<Map<String,Object>> list = null;
    	try {
			String sql = dbm.list(table,objectObj,true);
			list = databaseService.find(sql);
		} catch (Exception e) {
			
			e.printStackTrace();
		}
    	if (list!=null && list.size()>0) {
    		return renderJsonp(list.get(0), req);
		}else{
			return renderJsonp(null, req);
		}
        
    }
    

    
    
    @RequestMapping(value = "/listApp", produces = "application/json; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public List<Map<String,Object>> listApp(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	//Robj robj = new Robj();
    	List<Map<String,Object>> list = null;
    	try {
    		String object = req.getParameter("object");
    		//if(StringUtil.isNotNullOrEmpty(object)){
    			Object objectObj = Dbtablemapping.parseStringModel(object, table);
    			String sql = dbm.list(table,objectObj);
    			list = databaseService.find(sql);
    	    	//robj.setData(databaseService.find(sql));
    		//}
			
		} catch (Exception e) {
			
			e.printStackTrace();
		}  	
        return list;
    }
    
    @RequestMapping(value = "/listC", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String listC(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	//Robj robj = new Robj();
    	List<Map<String,Object>> list = null;
    	try {
    		String object = req.getParameter("object");
    		//if(StringUtil.isNotNullOrEmpty(object)){
    			Object objectObj = Dbtablemapping.parseStringModel(object, table);
    			String sql = dbm.list(table,objectObj);
    			list = databaseService.find(sql);
    	    	//robj.setData(databaseService.find(sql));
    		//}
			
		} catch (Exception e) {
			
			e.printStackTrace();
		}  	
        return renderJsonp(list, req);
    }
    
    @RequestMapping(value = "/findApp", produces = "application/json; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public Map<String,Object> findApp(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	//Robj robj = new Robj();
    	List<Map<String,Object>> list = null;
    	try {
    		String object = req.getParameter("object");
    		//if(StringUtil.isNotNullOrEmpty(object)){
    			Object objectObj = Dbtablemapping.parseStringModel(object, table);
    			String sql = dbm.list(table,objectObj);
    			list = databaseService.find(sql);
    	    	//robj.setData(databaseService.find(sql));
    		//}
			
		} catch (Exception e) {
			
			e.printStackTrace();
		}  	
    	if (list!=null && list.size()>0) {
    		return list.get(0);
		}else{
			return null;
		}
    }
    
    @RequestMapping(value = "/findC", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String findC(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	//Robj robj = new Robj();
    	List<Map<String,Object>> list = null;
    	try {
    		String object = req.getParameter("object");
    		//if(StringUtil.isNotNullOrEmpty(object)){
    			Object objectObj = Dbtablemapping.parseStringModel(object, table);
    			String sql = dbm.list(table,objectObj);
    			list = databaseService.find(sql);
    	    	//robj.setData(databaseService.find(sql));
    		//}
			
		} catch (Exception e) {
			
			e.printStackTrace();
		}  	
    	if (list!=null && list.size()>0) {
    		return renderJsonp(list.get(0), req);
		}else{
			return renderJsonp(null, req);
		}
    }
    
    @RequestMapping(value = "/listPage", produces = "application/json; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public Page listPage(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	Page page = new Page();
    	//Robj robj = new Robj();
    	try {
    		Object model = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
    		page.model = model;
    		String order = req.getParameter("order");
			String sort = req.getParameter("sort");
			String pageNo = req.getParameter("page");
			String pageSize = req.getParameter("rows");
			if (pageSize==null || pageSize.equals("")){
				pageSize = req.getParameter("limit");
			}
			page = dbm.getByPage(page, table,sort,order,pageNo,pageSize);
	    	//robj.setData(page);
		} catch (Exception e) {
			
			e.printStackTrace();
		}  	
        return page;
    }
    
    @RequestMapping(value = "/listPageJ", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String listPageJ(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	Page page = new Page();
    	//Robj robj = new Robj();
    	try {
    		Object model = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
    		page.model = model;
			page = dbm.getByPage(page, table,null,null,null,null);
	    	//robj.setData(page);
		} catch (Exception e) {
			
			e.printStackTrace();
		}  	
        return renderJsonp(page, req);
    }
    
    @RequestMapping(value = "/listPageApp", produces = "application/json; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public Page listPageApp(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	Page page = new Page();
    	//Robj robj = new Robj();
    	try {
    		String object = req.getParameter("object");
    		if(StringUtil.isNotNullOrEmpty(object)){
    			page.model = Dbtablemapping.parseStringModel(object, table);
    		}
			page = dbm.getByPage(page, table,null,null,null,null);
	    	//robj.setData(page);
		} catch (Exception e) {
			
			e.printStackTrace();
		}  	
        return page;
    }
    
    @RequestMapping(value = "/listPageC", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String listPageC(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	Page page = new Page();
    	//Robj robj = new Robj();
    	try {
    		String object = req.getParameter("object");
    		if(StringUtil.isNotNullOrEmpty(object)){
    			page.model = Dbtablemapping.parseStringModel(object, table);
    		}
			page = dbm.getByPage(page, table,null,null,null,null);
	    	//robj.setData(page);
		} catch (Exception e) {
			
			e.printStackTrace();
		}  	
        return renderJsonp(page, req);
    }
    
    
    @RequestMapping(value = "/addApp", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String addApp(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	//Robj robj = new Robj();
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	String object = req.getParameter("object");
    	Object obj = Dbtablemapping.parseStringModel(object, table);
    	try {
    		String sql = dbm.add(obj, table);
    		databaseService.executeAction(sql);
		} catch (Exception e) {
			
			return "操作失败"+e.getMessage();
		}
    	
    	return "操作成功";
        
    }
    
    @RequestMapping(value = "/add", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String add(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	//Robj robj = new Robj();
    	String tableReq = req.getParameter("table");
    	String table = Dbservice.getTableName(tableReq);
    	Object model = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
    	try {
    		String sql = dbm.add(model, table);
    		databaseService.executeAction(sql);
		} catch (Exception e) {
			
			return "操作失败"+e.getMessage();
		}
    	
    	return "操作成功";
        
    }
    
    @RequestMapping(value = "/saveWithFile", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String saveWithFile(@RequestParam(value = "file", required = false) MultipartFile[] files,HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
		String rstr = "0";
    	try {
    		String fileNames=null;
    		if(files!=null && files.length>0){
    			long fn = files[0].getSize();
    			if(fn>1){
    				fileNames = Common.copyFile2Upload(files);
    			}
    			
    		}
    		String tableReq = req.getParameter("table");
    		String fileField = req.getParameter("fileName");
        	String table = Dbservice.getTableName(tableReq);
        	Object model = Common.getByRequestSetfile(Dbtablemapping.getModelByTable(table),fileField,fileNames, req, false);
    		String sql = dbm.save(model, table);
    		databaseService.executeAction(sql);
			/**
			 * 判断是否插入操作,如果是返回插入的id
			 */
			String id = req.getParameter("id");

			if(id==null || id.equals("")){
				List<Map<String, Object>> rlist = databaseService.find("select LAST_INSERT_ID() as lastId");
				if(rlist!=null){
					rstr = rlist.get(0).get("lastId")+"";
				}
			}else{
				rstr = id;
			}
		} catch (Exception e) {
			
			return "操作失败"+e.getMessage();
		}
    	
    	return rstr;
        
    }
    
    @RequestMapping(value = "/upload", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String upload(@RequestParam(value = "file", required = false) MultipartFile[] files,HttpServletRequest req) {
    	String fileNames=null;
    	try {
    		if(files!=null && files.length>0){
    			fileNames = Common.copyFile2Upload(files);
    		}
    		
		} catch (Exception e) {
		}
    	return fileNames;
        
    }

	@RequestMapping(value = "/editorUpload", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
	@ResponseBody
	public String editorUpload(@RequestParam(value = "file", required = false) MultipartFile[] files,HttpServletRequest req) {
		String fileNames=null;
		EditorUpload eu = new EditorUpload();
		eu.setErrno(0);
		try {
			if(files!=null && files.length>0){
				fileNames = Common.copyFile2Upload(files);
				ArrayList<String> nl = new ArrayList<String>();
				String[] fns = fileNames.split(",");
				for (int i = 0; i < fns.length; i++) {
					nl.add("upload/"+fns[i]);
				}
				eu.setData(nl);
			}

		} catch (Exception e) {
		}
		return JSON.toJSONString(eu);

	}
    
    @RequestMapping(value = "/createQrcode", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String createQrcode(HttpServletRequest req) {
    	String fileNames="";
    	try {
    		String path = ResourceUtils.getURL("classpath:").getPath();
            String destPath = path+File.separator+"static"+File.separator+"upload"+File.separator;
            String content = req.getParameter("code");
        	fileNames=QRCodeUtil.encode(content, null, destPath, true);
		} catch (Exception e) {
			
		}
    	return fileNames;
        
    }
    
    @RequestMapping(value = "/createQrcodeJ", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String createQrcodeJ(HttpServletRequest req) {
    	String fileNames="";
    	try {
    		String path = ResourceUtils.getURL("classpath:").getPath();
            String destPath = path+File.separator+"static"+File.separator+"upload"+File.separator;
            String content = req.getParameter("code");
        	fileNames=QRCodeUtil.encode(content, null, destPath, true);
		} catch (Exception e) {
			
		}
    	return renderJsonpString(fileNames, req);
    }
    
    private String renderJsonpString(String str,HttpServletRequest req){
    	Map<String,String> obj = new HashMap<>();
		obj.put("info", str);
		String callbackFunctionName = req.getParameter("callback");	
		String json = JSON.toJSONString(obj);
		String r = callbackFunctionName+"("+json+")";
		return r;
    }
    
    private String renderJsonp(Object obj,HttpServletRequest req){
		String callbackFunctionName = req.getParameter("callback");	
		String json = JSON.toJSONString(obj);
		String r = callbackFunctionName+"("+json+")";
		return r;
    }
    
    @RequestMapping(value = "/updateApp", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String updateApp(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	//Robj robj = new Robj();
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	String object = req.getParameter("object");
    	Object obj = Dbtablemapping.parseStringModel(object, table);
    	try {
    		String sql = dbm.update(obj, table);
    		databaseService.executeAction(sql);
		} catch (Exception e) {
			
			return "操作失败"+e.getMessage();
		}
    	
    	return "操作成功";
        
    }
    
    
    @RequestMapping(value = "/update", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String update(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	//Robj robj = new Robj();
    	String tableReq = req.getParameter("table");
    	String table = Dbservice.getTableName(tableReq);
    	Object model = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
    	try {
    		String sql = dbm.update(model, table);
    		databaseService.executeAction(sql);
		} catch (Exception e) {
			
			return "操作失败"+e.getMessage();
		}
    	
    	return "操作成功";
        
    }
    
    @RequestMapping(value = "/updateSqlJ", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String updateSqlJ(HttpServletRequest req) {
    	String sql = req.getParameter("sql");
    	try {
    		databaseService.executeAction(sql);
		} catch (Exception e) {
			
			return renderJsonpString("0", req);
		}
    	
    	return renderJsonpString("1", req);
        
    }
    
    @RequestMapping(value = "/listSqlJ", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String listSqlJ(HttpServletRequest req) {
    	String sql = req.getParameter("sql");
    	List<Map<String,Object>> list = null;
    	try {
			list = databaseService.find(sql);
		} catch (Exception e) {
			
			e.printStackTrace();
		}  	
        return renderJsonp(list, req);
    }
    
    
    @RequestMapping(value = "/updateSql", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String updateSql(HttpServletRequest req) {
    	String sql = req.getParameter("sql");
    	try {
    		databaseService.executeAction(sql);
		} catch (Exception e) {
			
			return "操作失败"+e.getMessage();
		}
    	
    	return "操作成功";
        
    }

	@RequestMapping(value = "/listSql", produces = "application/json; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
	@ResponseBody
	public List<Map<String,Object>> listSql(HttpServletRequest req) {
		String sql = req.getParameter("sql");
		List<Map<String,Object>> list = null;
		try {
			list = databaseService.find(sql);
		} catch (Exception e) {

			e.printStackTrace();
		}
		return list;
	}
    
    @RequestMapping(value = "/save", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String save(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	//Robj robj = new Robj();
    	String tableReq = req.getParameter("table");
    	String table = Dbservice.getTableName(tableReq);
    	Object model = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
    	String rstr = "";
    	try {
    		String sql = dbm.save(model, table);
    		databaseService.executeAction(sql);
			/**
			 * 判断是否插入操作,如果是返回插入的id
			 */
			String id = req.getParameter("id");

			if(id==null || id.equals("")){
				List<Map<String, Object>> rlist = databaseService.find("select LAST_INSERT_ID() as lastId");
				if(rlist!=null){
					rstr = rlist.get(0).get("lastId")+"";
				}
			}else{
				rstr = id;
			}
		} catch (Exception e) {
			
			return "操作失败"+e.getMessage();
		}
    	
    	return rstr;
        
    }
    
    @RequestMapping(value = "/saveJ", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String saveJ(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	//Robj robj = new Robj();
    	String tableReq = req.getParameter("table");
    	String table = Dbservice.getTableName(tableReq);
    	Object model = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
    	String rstr = "0";
    	try {
    		String sql = dbm.save(model, table);
    		databaseService.executeAction(sql);
    		/**
    		 * 判断是否插入操作,如果是返回插入的id
    		 */
    		String id = req.getParameter("id");
    		rstr = "1";
    		if(id==null || id.equals("")){
    			List<Map<String, Object>> rlist = databaseService.find("select LAST_INSERT_ID() as lastId");
    			if(rlist!=null){
    				rstr = rlist.get(0).get("lastId")+"";
    			}
    		}
		} catch (Exception e) {
			
			return renderJsonpString(rstr, req);
		}
    	
    	return renderJsonpString(rstr, req);
        
    }
    
    @RequestMapping(value = "/saveApp", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String saveApp(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	//Robj robj = new Robj();
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	String object = req.getParameter("object");
    	Object obj = Dbtablemapping.parseStringModel(object, table);
    	try {
    		String sql = dbm.save(obj, table);
    		databaseService.executeAction(sql);
		} catch (Exception e) {
			
			return "操作失败"+e.getMessage();
		}
    	
    	return "操作成功";
        
    }
    
    @RequestMapping(value = "/saveC", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String saveC(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	//Robj robj = new Robj();
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	String object = req.getParameter("object");
    	Object obj = Dbtablemapping.parseStringModel(object, table);
    	try {
    		String sql = dbm.save(obj, table);
    		databaseService.executeAction(sql);
		} catch (Exception e) {
			return renderJsonpString("操作失败"+e.getMessage(), req);
		}
    	
    	return renderJsonpString("1", req);
        
    }
    
   
    @RequestMapping(value = "/deleteApp", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String deleteApp(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	//Robj robj = new Robj();
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	String object = req.getParameter("object");
    	
    	if(StringUtil.isNotNullOrEmpty(object)){
    		try {
    			Object paramsObj = Dbtablemapping.parseStringModel(object, table);
        		String sql = dbm.delete(table,paramsObj);
        		databaseService.executeAction(sql);
    		} catch (Exception e) {
    			return "操作失败"+e.getMessage();
    		}
    	}
    	return "操作成功";
    }
    
    @RequestMapping(value = "/deleteC", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String deleteC(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	//Robj robj = new Robj();
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	String object = req.getParameter("object");
    	
    	if(StringUtil.isNotNullOrEmpty(object)){
    		try {
    			Object paramsObj = Dbtablemapping.parseStringModel(object, table);
        		String sql = dbm.delete(table,paramsObj);
        		databaseService.executeAction(sql);
    		} catch (Exception e) {
    			return renderJsonpString("操作失败"+e.getMessage(), req);
    		}
    	}
    	return renderJsonpString("1", req);
    }
    
    @RequestMapping(value = "/delete", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String delete(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	//Robj robj = new Robj();
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	Object model = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
		try {
    		String sql = dbm.delete(table,model);
    		databaseService.executeAction(sql);
		} catch (Exception e) {
			return "操作失败"+e.getMessage();
		}
    	
    	return "操作成功";
    }

    @RequestMapping(value = "/deleteJ", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
			RequestMethod.POST })
    @ResponseBody
    public String deleteJ(HttpServletRequest req) {
    	Dbservice dbm = new Dbservice(databaseService);
    	//Robj robj = new Robj();
    	String table = Dbservice.getTableName(req.getParameter("table"));
    	Object model = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
		try {
    		String sql = dbm.delete(table,model);
    		databaseService.executeAction(sql);
		} catch (Exception e) {
			return renderJsonpString("操作失败"+e.getMessage(), req);
		}
    	
    	return renderJsonpString("1", req);
    }
}
六、论文参考 

停车位共享系统|基于微信小程序的停车位共享系统设计与实现(附项目源码+论文),微信小程序,数据库,java,后端,spring boot

七、源码获取:

 点赞、收藏、关注、评论啦。有任何问题欢迎咨询

👇🏻获取联系方式在文章末尾👇🏻

 文章来源地址https://www.toymoban.com/news/detail-847842.html

到了这里,关于停车位共享系统|基于微信小程序的停车位共享系统设计与实现(附项目源码+论文)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包