ssm+vue宠物领养系统源码和论文103
开发工具:idea
数据库mysql5.7+
数据库链接工具:navcat,小海豚等
技术:ssm
摘 要
本课题是根据用户的需要以及网络的优势建立的一个宠物领养系统,来满足用宠物领养的需求。
本宠物领养系统应用JSP技术,Java语言,MYSQL数据库存储数据,基于B/S结构开发。在网站的整个开发过程中,首先对系统进行了需求分析,设计出系统的主要功能模块,其次对网站进行总体规划和详细设计,最后对宠物领养系统进行了系统测试,包括测试概述,测试方法,测试方案等,并对测试结果进行了分析和总结,进而得出系统的不足及需要改进的地方,为以后的系统维护和扩展提供了方便。
本系统布局合理、色彩搭配和谐、框架结构设计清晰,具有操作简单,界面清晰,管理方便,功能完善等优势,有很高的使用价值。
关键词:JSP技术,宠物领养,MYSQL数据库,B/S结构
在当今的社会,可以说是信息技术的发展时代,在社会的方方面面无不涉及到各种信息的处理。信息是人们对客观世界的具体描述,是人们进行交流与联系的重要途径。人类社会就处在一个对信息进行有效合理的加工中。它将促进整个社会的发展。随着社会信息技术的提高,计算机已被广泛应用于当今社会的各个领域,成为推动社会发展的首要技术动力。
在现在的社会生活中,人们的生活品质不断的提高,物质的需求也相应的得到了满足。但是也有一些人在物质上的满足并不能填满心里的孤寂。当一个人在外拼搏,就算在工作氛围中有很多人的陪伴,但是回家也可能会是一个冷冷清清的环境。所以这时候如果有了一个宠物的陪伴,心里的孤寂也会得到很大的慰藉,饲养宠物可以给我们带来快乐,也让我们的心灵得到慰藉。这让用户宠物领养的需求日益在增加,但是人们在领养宠物方面却缺乏一个很好的平台,针对这一情况,开发了本宠物领养系统,为用户通过一个全新的宠物领养的平台,提高效率。
package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
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.annotation.IgnoreAuth;
import com.entity.ChongwuxiuEntity;
import com.entity.view.ChongwuxiuView;
import com.service.ChongwuxiuService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 宠物秀
* 后端接口
* @author
* @email
* @date 2021-03-29 18:02:25
*/
@RestController
@RequestMapping("/chongwuxiu")
public class ChongwuxiuController {
@Autowired
private ChongwuxiuService chongwuxiuService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map params,ChongwuxiuEntity chongwuxiu,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("shouyangren")) {
chongwuxiu.setShouyanghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper ew = new EntityWrapper();
PageUtils page = chongwuxiuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chongwuxiu), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map params,ChongwuxiuEntity chongwuxiu, HttpServletRequest request){
EntityWrapper ew = new EntityWrapper();
PageUtils page = chongwuxiuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chongwuxiu), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ChongwuxiuEntity chongwuxiu){
EntityWrapper ew = new EntityWrapper();
ew.allEq(MPUtil.allEQMapPre( chongwuxiu, "chongwuxiu"));
return R.ok().put("data", chongwuxiuService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(ChongwuxiuEntity chongwuxiu){
EntityWrapper< ChongwuxiuEntity> ew = new EntityWrapper< ChongwuxiuEntity>();
ew.allEq(MPUtil.allEQMapPre( chongwuxiu, "chongwuxiu"));
ChongwuxiuView chongwuxiuView = chongwuxiuService.selectView(ew);
return R.ok("查询宠物秀成功").put("data", chongwuxiuView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ChongwuxiuEntity chongwuxiu = chongwuxiuService.selectById(id);
chongwuxiu.setClicktime(new Date());
chongwuxiuService.updateById(chongwuxiu);
return R.ok().put("data", chongwuxiu);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
ChongwuxiuEntity chongwuxiu = chongwuxiuService.selectById(id);
chongwuxiu.setClicktime(new Date());
chongwuxiuService.updateById(chongwuxiu);
return R.ok().put("data", chongwuxiu);
}
/**
* 赞或踩
*/
@RequestMapping("/thumbsup/{id}")
public R thumbsup(@PathVariable("id") String id,String type){
ChongwuxiuEntity chongwuxiu = chongwuxiuService.selectById(id);
if(type.equals("1")) {
chongwuxiu.setThumbsupnum(chongwuxiu.getThumbsupnum()+1);
} else {
chongwuxiu.setCrazilynum(chongwuxiu.getCrazilynum()+1);
}
chongwuxiuService.updateById(chongwuxiu);
return R.ok();
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ChongwuxiuEntity chongwuxiu, HttpServletRequest request){
chongwuxiu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(chongwuxiu);
chongwuxiuService.insert(chongwuxiu);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ChongwuxiuEntity chongwuxiu, HttpServletRequest request){
chongwuxiu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(chongwuxiu);
chongwuxiuService.insert(chongwuxiu);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody ChongwuxiuEntity chongwuxiu, HttpServletRequest request){
//ValidatorUtils.validateEntity(chongwuxiu);
chongwuxiuService.updateById(chongwuxiu);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
chongwuxiuService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper wrapper = new EntityWrapper();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("shouyangren")) {
wrapper.eq("shouyanghao", (String)request.getSession().getAttribute("username"));
}
int count = chongwuxiuService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* 前端智能排序
*/
@IgnoreAuth
@RequestMapping("/autoSort")
public R autoSort(@RequestParam Map params,ChongwuxiuEntity chongwuxiu, HttpServletRequest request,String pre){
EntityWrapper ew = new EntityWrapper();
Map newMap = new HashMap();
Map param = new HashMap();
Iterator> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = it.next();
String key = entry.getKey();
String newKey = entry.getKey();
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}
params.put("sort", "clicktime");
params.put("order", "desc");
PageUtils page = chongwuxiuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chongwuxiu), params), params));
return R.ok().put("data", page);
}
}
package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
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.annotation.IgnoreAuth;
import com.entity.DaichushenshenqingEntity;
import com.entity.view.DaichushenshenqingView;
import com.service.DaichushenshenqingService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 待初审申请
* 后端接口
* @author
* @email
* @date 2021-03-29 18:02:25
*/
@RestController
@RequestMapping("/daichushenshenqing")
public class DaichushenshenqingController {
@Autowired
private DaichushenshenqingService daichushenshenqingService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map params,DaichushenshenqingEntity daichushenshenqing,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("songyangren")) {
daichushenshenqing.setSongyanghao((String)request.getSession().getAttribute("username"));
}
if(tableName.equals("shouyangren")) {
daichushenshenqing.setShouyanghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper ew = new EntityWrapper();
PageUtils page = daichushenshenqingService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, daichushenshenqing), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map params,DaichushenshenqingEntity daichushenshenqing, HttpServletRequest request){
EntityWrapper ew = new EntityWrapper();
PageUtils page = daichushenshenqingService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, daichushenshenqing), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( DaichushenshenqingEntity daichushenshenqing){
EntityWrapper ew = new EntityWrapper();
ew.allEq(MPUtil.allEQMapPre( daichushenshenqing, "daichushenshenqing"));
return R.ok().put("data", daichushenshenqingService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(DaichushenshenqingEntity daichushenshenqing){
EntityWrapper< DaichushenshenqingEntity> ew = new EntityWrapper< DaichushenshenqingEntity>();
ew.allEq(MPUtil.allEQMapPre( daichushenshenqing, "daichushenshenqing"));
DaichushenshenqingView daichushenshenqingView = daichushenshenqingService.selectView(ew);
return R.ok("查询待初审申请成功").put("data", daichushenshenqingView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
DaichushenshenqingEntity daichushenshenqing = daichushenshenqingService.selectById(id);
return R.ok().put("data", daichushenshenqing);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
DaichushenshenqingEntity daichushenshenqing = daichushenshenqingService.selectById(id);
return R.ok().put("data", daichushenshenqing);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody DaichushenshenqingEntity daichushenshenqing, HttpServletRequest request){
daichushenshenqing.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(daichushenshenqing);
daichushenshenqingService.insert(daichushenshenqing);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody DaichushenshenqingEntity daichushenshenqing, HttpServletRequest request){
daichushenshenqing.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(daichushenshenqing);
daichushenshenqingService.insert(daichushenshenqing);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody DaichushenshenqingEntity daichushenshenqing, HttpServletRequest request){
//ValidatorUtils.validateEntity(daichushenshenqing);
daichushenshenqingService.updateById(daichushenshenqing);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
daichushenshenqingService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper wrapper = new EntityWrapper();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("songyangren")) {
wrapper.eq("songyanghao", (String)request.getSession().getAttribute("username"));
}
if(tableName.equals("shouyangren")) {
wrapper.eq("shouyanghao", (String)request.getSession().getAttribute("username"));
}
int count = daichushenshenqingService.selectCount(wrapper);
return R.ok().put("count", count);
}
}