实现登录接口操作
This commit is contained in:
parent
11e7596429
commit
29a700c7f3
@ -1,37 +0,0 @@
|
|||||||
package com;
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
|
|
||||||
import com.baomidou.mybatisplus.generator.config.OutputFile;
|
|
||||||
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
public class CodeGenerator {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String url = "jdbc:mysql://localhost:3306/zoo";
|
|
||||||
String username = "root";
|
|
||||||
String password = "83363083a";
|
|
||||||
String moduleName = "zoo";
|
|
||||||
String table = "admin,animal,keeper,veterinary";
|
|
||||||
String mapperLocation = "C:\\Users\\16058\\IdeaProjects\\zooSystem\\src\\main\\resources\\mapper\\";
|
|
||||||
FastAutoGenerator.create(url, username, password)
|
|
||||||
.globalConfig(builder -> {
|
|
||||||
builder.author("DJ") // 设置作者
|
|
||||||
// .enableSwagger() // 开启 swagger 模式
|
|
||||||
// .fileOverride() // 覆盖已生成文件
|
|
||||||
.outputDir("C:\\Users\\16058\\IdeaProjects\\zooSystem\\src\\main\\java"); // 指定输出目录
|
|
||||||
})
|
|
||||||
.packageConfig(builder -> {
|
|
||||||
builder.parent("com") // 设置父包名
|
|
||||||
.moduleName(moduleName) // 设置父包模块名
|
|
||||||
.pathInfo(Collections.singletonMap(OutputFile.xml,mapperLocation)); // 设置mapperXml生成路径
|
|
||||||
})
|
|
||||||
.strategyConfig(builder -> {
|
|
||||||
builder.addInclude(table) // 设置需要生成的表名
|
|
||||||
.addTablePrefix(); // 设置过滤表前缀
|
|
||||||
})
|
|
||||||
.templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板,默认的是Velocity引擎模板
|
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package com;
|
|
||||||
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
@MapperScan("com.zoo.mapper")
|
|
||||||
public class ZooSystemApplication {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(ZooSystemApplication.class, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
package com.zoo.config;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.web.cors.CorsConfiguration;
|
|
||||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
|
||||||
import org.springframework.web.filter.CorsFilter;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class MyCorsConfig {
|
|
||||||
//跨越处理
|
|
||||||
@Bean
|
|
||||||
public CorsFilter corsFilter(){
|
|
||||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
|
||||||
//允许跨域的地址
|
|
||||||
corsConfiguration.addAllowedOrigin("http://localhost:8888");
|
|
||||||
//http://localhost:8080
|
|
||||||
//是否发送cookie信息
|
|
||||||
corsConfiguration.setAllowCredentials(true);
|
|
||||||
corsConfiguration.addAllowedMethod("*");
|
|
||||||
corsConfiguration.addAllowedHeader("*");
|
|
||||||
//添加映射路径,拦截一切请求
|
|
||||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
|
||||||
source.registerCorsConfiguration("/**",corsConfiguration);
|
|
||||||
return new CorsFilter(source);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package com.zoo.controller;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.zoo.entity.Admin;
|
|
||||||
import com.zoo.entity.Result;
|
|
||||||
import com.zoo.service.IAdminService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 前端控制器
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/zoo/admin")
|
|
||||||
public class AdminController {
|
|
||||||
@Autowired
|
|
||||||
IAdminService iAdminService;
|
|
||||||
|
|
||||||
@PostMapping("login")
|
|
||||||
public Result login(Admin admin){
|
|
||||||
if (admin.getUsername()==null || admin.getPassword() == null){
|
|
||||||
return Result.error("用户名密码不能为空");
|
|
||||||
}
|
|
||||||
QueryWrapper<Admin> queryWrapper = new QueryWrapper<>();
|
|
||||||
queryWrapper.eq("username",admin.getUsername());
|
|
||||||
queryWrapper.eq("password", admin.getPassword());
|
|
||||||
Admin one = iAdminService.getOne(queryWrapper);
|
|
||||||
if (one == null){
|
|
||||||
return Result.error("用户名或密码错误,请重新登录");
|
|
||||||
}
|
|
||||||
return Result.ok(one,"登录成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package com.zoo.controller;
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 前端控制器
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("/zoo/animal")
|
|
||||||
public class AnimalController {
|
|
||||||
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package com.zoo.controller;
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 前端控制器
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("/zoo/keeper")
|
|
||||||
public class KeeperController {
|
|
||||||
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package com.zoo.controller;
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 前端控制器
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("/zoo/veterinary")
|
|
||||||
public class VeterinaryController {
|
|
||||||
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
package com.zoo.entity;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
*
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
public class Admin implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 管理员用户名
|
|
||||||
*/
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 管理员密码
|
|
||||||
*/
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Admin{" +
|
|
||||||
"username=" + username +
|
|
||||||
", password=" + password +
|
|
||||||
"}";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,166 +0,0 @@
|
|||||||
package com.zoo.entity;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
*
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
public class Animal implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 动物ID
|
|
||||||
*/
|
|
||||||
private Integer aId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 动物名
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 性别
|
|
||||||
*/
|
|
||||||
private String sex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 种类
|
|
||||||
*/
|
|
||||||
private String species;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 体重
|
|
||||||
*/
|
|
||||||
private Double weight;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 身高
|
|
||||||
*/
|
|
||||||
private Double height;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态(0正常 1异常)
|
|
||||||
*/
|
|
||||||
private Integer state;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 饲养员ID
|
|
||||||
*/
|
|
||||||
private Integer kId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 颜色
|
|
||||||
*/
|
|
||||||
private String color;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 特征
|
|
||||||
*/
|
|
||||||
private String features;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生活习性
|
|
||||||
*/
|
|
||||||
private String habit;
|
|
||||||
|
|
||||||
public Integer getaId() {
|
|
||||||
return aId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setaId(Integer aId) {
|
|
||||||
this.aId = aId;
|
|
||||||
}
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
public String getSex() {
|
|
||||||
return sex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSex(String sex) {
|
|
||||||
this.sex = sex;
|
|
||||||
}
|
|
||||||
public String getSpecies() {
|
|
||||||
return species;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpecies(String species) {
|
|
||||||
this.species = species;
|
|
||||||
}
|
|
||||||
public Double getWeight() {
|
|
||||||
return weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWeight(Double weight) {
|
|
||||||
this.weight = weight;
|
|
||||||
}
|
|
||||||
public Double getHeight() {
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeight(Double height) {
|
|
||||||
this.height = height;
|
|
||||||
}
|
|
||||||
public Integer getState() {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setState(Integer state) {
|
|
||||||
this.state = state;
|
|
||||||
}
|
|
||||||
public Integer getkId() {
|
|
||||||
return kId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setkId(Integer kId) {
|
|
||||||
this.kId = kId;
|
|
||||||
}
|
|
||||||
public String getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setColor(String color) {
|
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
public String getFeatures() {
|
|
||||||
return features;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFeatures(String features) {
|
|
||||||
this.features = features;
|
|
||||||
}
|
|
||||||
public String getHabit() {
|
|
||||||
return habit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHabit(String habit) {
|
|
||||||
this.habit = habit;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Animal{" +
|
|
||||||
"aId=" + aId +
|
|
||||||
", name=" + name +
|
|
||||||
", sex=" + sex +
|
|
||||||
", species=" + species +
|
|
||||||
", weight=" + weight +
|
|
||||||
", height=" + height +
|
|
||||||
", state=" + state +
|
|
||||||
", kId=" + kId +
|
|
||||||
", color=" + color +
|
|
||||||
", features=" + features +
|
|
||||||
", habit=" + habit +
|
|
||||||
"}";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,88 +0,0 @@
|
|||||||
package com.zoo.entity;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
*
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
public class Keeper implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 饲养员id
|
|
||||||
*/
|
|
||||||
private Integer kId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 性别
|
|
||||||
*/
|
|
||||||
private String sex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 饲养员用户名
|
|
||||||
*/
|
|
||||||
private String userName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 饲养员密码
|
|
||||||
*/
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 手机号码
|
|
||||||
*/
|
|
||||||
private String phone;
|
|
||||||
|
|
||||||
public Integer getkId() {
|
|
||||||
return kId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setkId(Integer kId) {
|
|
||||||
this.kId = kId;
|
|
||||||
}
|
|
||||||
public String getSex() {
|
|
||||||
return sex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSex(String sex) {
|
|
||||||
this.sex = sex;
|
|
||||||
}
|
|
||||||
public String getUserName() {
|
|
||||||
return userName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserName(String userName) {
|
|
||||||
this.userName = userName;
|
|
||||||
}
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
public String getPhone() {
|
|
||||||
return phone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPhone(String phone) {
|
|
||||||
this.phone = phone;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Keeper{" +
|
|
||||||
"kId=" + kId +
|
|
||||||
", sex=" + sex +
|
|
||||||
", userName=" + userName +
|
|
||||||
", password=" + password +
|
|
||||||
", phone=" + phone +
|
|
||||||
"}";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,101 +0,0 @@
|
|||||||
package com.zoo.entity;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author dj
|
|
||||||
*/
|
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
||||||
@Data
|
|
||||||
public class Result<T> {
|
|
||||||
/**
|
|
||||||
* 状态码
|
|
||||||
*/
|
|
||||||
private Integer code;
|
|
||||||
/**
|
|
||||||
* 提示信息,如果有错误时,前端可以获取该字段进行提示
|
|
||||||
*/
|
|
||||||
private String msg;
|
|
||||||
/**
|
|
||||||
* 查询到的结果数据,
|
|
||||||
*/
|
|
||||||
private T data;
|
|
||||||
|
|
||||||
public Result(Integer code, String msg) {
|
|
||||||
this.code = code;
|
|
||||||
this.msg = msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Result(Integer code, T data) {
|
|
||||||
this.code = code;
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Result(Integer code, T data,String msg) {
|
|
||||||
this.code = code;
|
|
||||||
this.data = data;
|
|
||||||
this.msg = msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回通用成功
|
|
||||||
* @return Result
|
|
||||||
*/
|
|
||||||
public static Result ok(){
|
|
||||||
|
|
||||||
return new Result(20000,"请求成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static Result ok(Object data,String msg){
|
|
||||||
|
|
||||||
return new Result(20000,data,msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回通用失败,未知错误
|
|
||||||
* @return Result
|
|
||||||
*/
|
|
||||||
public static Result error(){
|
|
||||||
|
|
||||||
return new Result(20001,"请求失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Result error(String msg){
|
|
||||||
|
|
||||||
return new Result(20001,msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCode(Integer code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMsg() {
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMsg(String msg) {
|
|
||||||
this.msg = msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setData(T data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Result(Integer code, String msg, T data) {
|
|
||||||
this.code = code;
|
|
||||||
this.msg = msg;
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
package com.zoo.entity;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
*
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
public class Veterinary implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 兽医id
|
|
||||||
*/
|
|
||||||
private Integer vId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户名
|
|
||||||
*/
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 密码
|
|
||||||
*/
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 治疗记录
|
|
||||||
*/
|
|
||||||
private String record;
|
|
||||||
|
|
||||||
public Integer getvId() {
|
|
||||||
return vId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setvId(Integer vId) {
|
|
||||||
this.vId = vId;
|
|
||||||
}
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
public String getRecord() {
|
|
||||||
return record;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRecord(String record) {
|
|
||||||
this.record = record;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Veterinary{" +
|
|
||||||
"vId=" + vId +
|
|
||||||
", username=" + username +
|
|
||||||
", password=" + password +
|
|
||||||
", record=" + record +
|
|
||||||
"}";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.zoo.mapper;
|
|
||||||
|
|
||||||
import com.zoo.entity.Admin;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Mapper 接口
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
public interface AdminMapper extends BaseMapper<Admin> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.zoo.mapper;
|
|
||||||
|
|
||||||
import com.zoo.entity.Animal;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Mapper 接口
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
public interface AnimalMapper extends BaseMapper<Animal> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.zoo.mapper;
|
|
||||||
|
|
||||||
import com.zoo.entity.Keeper;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Mapper 接口
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
public interface KeeperMapper extends BaseMapper<Keeper> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.zoo.mapper;
|
|
||||||
|
|
||||||
import com.zoo.entity.Veterinary;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Mapper 接口
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
public interface VeterinaryMapper extends BaseMapper<Veterinary> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.zoo.service;
|
|
||||||
|
|
||||||
import com.zoo.entity.Admin;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 服务类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
public interface IAdminService extends IService<Admin> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.zoo.service;
|
|
||||||
|
|
||||||
import com.zoo.entity.Animal;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 服务类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
public interface IAnimalService extends IService<Animal> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.zoo.service;
|
|
||||||
|
|
||||||
import com.zoo.entity.Keeper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 服务类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
public interface IKeeperService extends IService<Keeper> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.zoo.service;
|
|
||||||
|
|
||||||
import com.zoo.entity.Veterinary;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 服务类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
public interface IVeterinaryService extends IService<Veterinary> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package com.zoo.service.impl;
|
|
||||||
|
|
||||||
import com.zoo.entity.Admin;
|
|
||||||
import com.zoo.mapper.AdminMapper;
|
|
||||||
import com.zoo.service.IAdminService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 服务实现类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class AdminServiceImpl extends ServiceImpl<AdminMapper, Admin> implements IAdminService {
|
|
||||||
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package com.zoo.service.impl;
|
|
||||||
|
|
||||||
import com.zoo.entity.Animal;
|
|
||||||
import com.zoo.mapper.AnimalMapper;
|
|
||||||
import com.zoo.service.IAnimalService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 服务实现类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class AnimalServiceImpl extends ServiceImpl<AnimalMapper, Animal> implements IAnimalService {
|
|
||||||
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package com.zoo.service.impl;
|
|
||||||
|
|
||||||
import com.zoo.entity.Keeper;
|
|
||||||
import com.zoo.mapper.KeeperMapper;
|
|
||||||
import com.zoo.service.IKeeperService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 服务实现类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class KeeperServiceImpl extends ServiceImpl<KeeperMapper, Keeper> implements IKeeperService {
|
|
||||||
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package com.zoo.service.impl;
|
|
||||||
|
|
||||||
import com.zoo.entity.Veterinary;
|
|
||||||
import com.zoo.mapper.VeterinaryMapper;
|
|
||||||
import com.zoo.service.IVeterinaryService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 服务实现类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author DJ
|
|
||||||
* @since 2024-04-18
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class VeterinaryServiceImpl extends ServiceImpl<VeterinaryMapper, Veterinary> implements IVeterinaryService {
|
|
||||||
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2013-2018 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.zoo.web;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
|
|
||||||
*/
|
|
||||||
@Controller
|
|
||||||
public class BasicController {
|
|
||||||
|
|
||||||
// http://127.0.0.1:8080/hello?name=lisi
|
|
||||||
@RequestMapping("/hello")
|
|
||||||
@ResponseBody
|
|
||||||
public String hello(@RequestParam(name = "name", defaultValue = "unknown user") String name) {
|
|
||||||
return "Hello " + name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// http://127.0.0.1:8080/user
|
|
||||||
@RequestMapping("/user")
|
|
||||||
@ResponseBody
|
|
||||||
public User user() {
|
|
||||||
User user = new User();
|
|
||||||
user.setName("theonefx");
|
|
||||||
user.setAge(666);
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
|
|
||||||
// http://127.0.0.1:8080/save_user?name=newName&age=11
|
|
||||||
@RequestMapping("/save_user")
|
|
||||||
@ResponseBody
|
|
||||||
public String saveUser(User u) {
|
|
||||||
return "user will save: name=" + u.getName() + ", age=" + u.getAge();
|
|
||||||
}
|
|
||||||
|
|
||||||
// http://127.0.0.1:8080/html
|
|
||||||
@RequestMapping("/html")
|
|
||||||
public String html() {
|
|
||||||
return "index.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
@ModelAttribute
|
|
||||||
public void parseUser(@RequestParam(name = "name", defaultValue = "unknown user") String name
|
|
||||||
, @RequestParam(name = "age", defaultValue = "12") Integer age, User user) {
|
|
||||||
user.setName("zhangsan");
|
|
||||||
user.setAge(18);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2013-2018 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.zoo.web;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
|
|
||||||
*/
|
|
||||||
@Controller
|
|
||||||
public class PathVariableController {
|
|
||||||
|
|
||||||
// http://127.0.0.1:8080/user/123/roles/222
|
|
||||||
@RequestMapping(value = "/user/{userId}/roles/{roleId}", method = RequestMethod.GET)
|
|
||||||
@ResponseBody
|
|
||||||
public String getLogin(@PathVariable("userId") String userId, @PathVariable("roleId") String roleId) {
|
|
||||||
return "User Id : " + userId + " Role Id : " + roleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// http://127.0.0.1:8080/javabeat/somewords
|
|
||||||
@RequestMapping(value = "/javabeat/{regexp1:[a-z-]+}", method = RequestMethod.GET)
|
|
||||||
@ResponseBody
|
|
||||||
public String getRegExp(@PathVariable("regexp1") String regexp1) {
|
|
||||||
return "URI Part : " + regexp1;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2013-2018 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.zoo.web;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
|
|
||||||
*/
|
|
||||||
public class User {
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private Integer age;
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getAge() {
|
|
||||||
return age;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAge(Integer age) {
|
|
||||||
this.age = age;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user