
项目使用java SpringMVC、springboot mybatis、layui为核心技术编写
首页登录有可爱的小猫咪:
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
Listmw = new ArrayList<>(); List mh = new ArrayList<>(); List ma = new ArrayList<>(); for(Pet p: rows){ // 获取预约次数 Appointment appointment = new Appointment(); appointment.setPetId(p.getId()); appointment.setPage(1); appointment.setLimit(1000); MMGridPageVoBean as = (MMGridPageVoBean ) appointmentService.getAllByLimit(appointment); applyCount.add(as==null? 0L : as.getTotal()); // 获取就诊记录 Diagnosis diagnosis = new Diagnosis(); diagnosis.setPetId(p.getId()); diagnosis.setPage(1); diagnosis.setLimit(10); MMGridPageVoBean ds = (MMGridPageVoBean ) diagnosisService.getAllByLimit(diagnosis); List dsRows = ds.getRows(); int diagnosisStatus = 0; for (Diagnosis d: dsRows){ diagnosisStatus += d.getStatus(); } int sw = diagnosisStatus / dsRows.size(); switch (sw){ case 1:dsCount.add(p.getName() + " 宠物健康,请继续保持");break;
try {
petDailyService.deleteById(id);
return "SUCCESS";
} catch (Exception e) {
logger.error("删除异常", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return "ERROR";
}
}
@RequestMapping(value = "/add")
public String add(Model model) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
Pet pet = new Pet();
pet.setUserId(user.getId());
pet.setPage(1);
pet.setLimit(100);
MMGridPageVoBean voBean = (MMGridPageVoBean) petService.getAllByLimit(pet);
List rows = voBean.getRows();
// 获取到该用户下所有的宠物
model.addAttribute("pets", rows);
return "user/petDailyAdd";
}
case 4:dsCount.add(p.getName() + " 很抱歉宠物已无法治疗!");break;
default:dsCount.add(p.getName() + " 宠物基本健康,请继续保持");break;
}
// 获取宠物日志
PetDaily petDaily = new PetDaily();
petDaily.setPetId(p.getId());
petDaily.setPage(1);
petDaily.setLimit(10);
MMGridPageVoBean ps = (MMGridPageVoBean) petDailyService.getAllByLimit(petDaily);
List psRows = ps.getRows();
double t = 0;
double w = 0;
double h = 0;
double a = 0;
for (PetDaily petDaily1 : psRows){
t+=petDaily1.getTemperature();
w+=petDaily1.getWeight();
h+=petDaily1.getHeight();
a+=petDaily1.getAppetite();
}
t = t/psRows.size();
w = w/psRows.size();
h = h/psRows.size();
a = a/psRows.size();
pt.add(t);
}else {
model.addAttribute("petId", "petId");
}
return "user/petDailyList";
}
@RequestMapping("/getAllByLimit")
@ResponseBody
public Object getAllByLimit(PetDaily pojo) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
pojo.setUserId(user.getId());
return petDailyService.getAllByLimit(pojo);
}
@RequestMapping("/getAllByLimit")
@ResponseBody
public Object getAllByLimit(PetDaily pojo) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
pojo.setUserId(user.getId());
return petDailyService.getAllByLimit(pojo);
}