项目介绍
随着我国经济水平的快速发展,很多人在业余生活中都过会养一些宠物来丰富自己的业余生活,宠物一旦生病就需要到专门宠物医院进行救治,但是传统的宠物医院管理模式一般都比较落后,没有一个成套的管理系统帮助管理人员和医护人员对这些宠物和疾病信息进行管理,于是我们提出了宠物医院管理系统的设计与开发。
开发环境
开发语言:Java
数据库 :MySQL
系统架构:B/S
后端框架:SSM
前端框架:Vue
开发工具:IDEA或者Eclipse,JDK1.8,Maven
系统截图
部分代码
package com.controller;
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.MessageEntity;
import com.service.MessageService;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
@RestController
@RequestMapping("/message")
public class MessageController {
@Autowired
private MessageService messageService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, MessageEntity message,
HttpServletRequest request){
EntityWrapper<MessageEntity> ew = new EntityWrapper<MessageEntity>();
if(request.getSession().getAttribute("role").toString().equals("考生")) {
ew.eq("yonghuid",(Long)request.getSession().getAttribute("userId"));
}
PageUtils page = messageService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, message), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, MessageEntity message, HttpServletRequest request){
EntityWrapper<MessageEntity> ew = new EntityWrapper<MessageEntity>();
PageUtils page = messageService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, message), params), params));
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
MessageEntity message = messageService.selectById(id);
return R.ok().put("data", message);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
MessageEntity message = messageService.selectById(id);
return R.ok().put("data", message);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody MessageEntity message, HttpServletRequest request){
if(request.getSession().getAttribute("role").toString().equals("考生")) {
message.setYonghuid((Long)request.getSession().getAttribute("userId"));
message.setYonghuming((String) request.getSession().getAttribute("username"));
}
message.setAdddate(new Date());
messageService.insert(message);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody MessageEntity message, HttpServletRequest request){
if(request.getSession().getAttribute("role").toString().equals("考生")) {
message.setYonghuid((Long)request.getSession().getAttribute("userId"));
message.setYonghuming((String) request.getSession().getAttribute("username"));
}
message.setAdddate(new Date());
messageService.insert(message);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody MessageEntity message, HttpServletRequest request){
messageService.updateById(message);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
messageService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}