完成登录接口的操作实现
This commit is contained in:
parent
29a700c7f3
commit
6178b11b43
124
.idea/uiDesigner.xml
Normal file
124
.idea/uiDesigner.xml
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
37
src/main/java/zoo/CodeGenerator.java
Normal file
37
src/main/java/zoo/CodeGenerator.java
Normal file
@ -0,0 +1,37 @@
|
||||
package zoo;
|
||||
|
||||
|
||||
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 = "account,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();
|
||||
}
|
||||
}
|
52
src/main/java/zoo/ThreadTest/Test.java
Normal file
52
src/main/java/zoo/ThreadTest/Test.java
Normal file
@ -0,0 +1,52 @@
|
||||
package zoo.ThreadTest;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
public class Test {
|
||||
public static void main(String[] args) throws ExecutionException, InterruptedException, TimeoutException {
|
||||
FutureTask<String> futureTask = new FutureTask<>(()->{
|
||||
System.out.println(Thread.currentThread().getName()+"/t ---come in");
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
return "task over";
|
||||
});
|
||||
Thread t1 = new Thread(futureTask, "t1");
|
||||
t1.start();
|
||||
System.out.println(Thread.currentThread()+"\t ----忙其他事情去了");
|
||||
while (true){
|
||||
if (futureTask.isDone()){
|
||||
System.out.println(futureTask.get());
|
||||
break;
|
||||
}else {
|
||||
//暂停毫秒
|
||||
TimeUnit.MICROSECONDS.sleep(2000);
|
||||
System.out.println("正在处理中,不要再催了");
|
||||
}
|
||||
}
|
||||
new A(()->{
|
||||
System.out.println("c");
|
||||
}).a();
|
||||
|
||||
//System.out.println(futureTask.get());
|
||||
// System.out.println(futureTask.get(3,TimeUnit.SECONDS));
|
||||
}
|
||||
}
|
||||
class A implements B{
|
||||
C c ;
|
||||
public A(C c){
|
||||
this.c = c;
|
||||
}
|
||||
@Override
|
||||
public void a() {
|
||||
c.c();
|
||||
System.out.println(1);
|
||||
}
|
||||
}
|
||||
interface B{
|
||||
public abstract void a();
|
||||
}
|
||||
interface C{
|
||||
public abstract void c();
|
||||
}
|
35
src/main/java/zoo/ThreadTest/Test1.java
Normal file
35
src/main/java/zoo/ThreadTest/Test1.java
Normal file
@ -0,0 +1,35 @@
|
||||
package zoo.ThreadTest;
|
||||
|
||||
import java.util.concurrent.*;
|
||||
|
||||
public class Test1 {
|
||||
public static void main(String[] args) {
|
||||
//CompletableFuture默认线程池是守护线程
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(3);
|
||||
CompletableFuture.supplyAsync(()->{
|
||||
System.out.println(Thread.currentThread().getName() + "...come in");
|
||||
int result = ThreadLocalRandom.current().nextInt(10);
|
||||
try{
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
}catch (InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("--1秒钟出结果"+result);
|
||||
return result;
|
||||
},executorService).whenComplete((v,e)->{
|
||||
if (e==null){
|
||||
System.out.println("==计算完成,更新系统updateValue"+v);
|
||||
}
|
||||
}).exceptionally(e->{
|
||||
e.printStackTrace();
|
||||
System.out.println("异常情况"+e.getCause()+"\t" + e.getMessage());
|
||||
return null;
|
||||
});
|
||||
System.out.println(Thread.currentThread().getName()+"线程先去忙其他任务");
|
||||
// try {
|
||||
// TimeUnit.SECONDS.sleep(3);
|
||||
// } catch (InterruptedException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
}
|
||||
}
|
18
src/main/java/zoo/ThreadTest/Test2.java
Normal file
18
src/main/java/zoo/ThreadTest/Test2.java
Normal file
@ -0,0 +1,18 @@
|
||||
package zoo.ThreadTest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class Test2 {
|
||||
public static void main(String[] args) {
|
||||
List<Integer> list = Arrays.asList(1,2,3,3,4);
|
||||
list.stream().distinct().filter(new Predicate<Integer>() {
|
||||
@Override
|
||||
public boolean test(Integer integer) {
|
||||
return integer > 1;
|
||||
}
|
||||
}).filter(Integer->Integer < 4).forEach(Integer -> System.out.println(Integer));
|
||||
}
|
||||
}
|
15
src/main/java/zoo/ZooSystemApplication.java
Normal file
15
src/main/java/zoo/ZooSystemApplication.java
Normal file
@ -0,0 +1,15 @@
|
||||
package zoo;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.demo.zoo.mapper")
|
||||
public class ZooSystemApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ZooSystemApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
56
src/main/java/zoo/common/JacksonObjectMapper.java
Normal file
56
src/main/java/zoo/common/JacksonObjectMapper.java
Normal file
@ -0,0 +1,56 @@
|
||||
package zoo.common;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
|
||||
|
||||
/**
|
||||
* 对象映射器:基于jackson将Java对象转为json,或者将json转为Java对象
|
||||
* 将JSON解析为Java对象的过程称为 [从JSON反序列化Java对象]
|
||||
* 从Java对象生成JSON的过程称为 [序列化Java对象到JSON]
|
||||
*/
|
||||
public class JacksonObjectMapper extends ObjectMapper {
|
||||
|
||||
public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd";
|
||||
public static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||
public static final String DEFAULT_TIME_FORMAT = "HH:mm:ss";
|
||||
|
||||
public JacksonObjectMapper() {
|
||||
super();
|
||||
//收到未知属性时不报异常
|
||||
this.configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
|
||||
//反序列化时,属性不存在的兼容处理
|
||||
this.getDeserializationConfig().withoutFeatures(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||
|
||||
|
||||
SimpleModule simpleModule = new SimpleModule()
|
||||
.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT)))
|
||||
.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT)))
|
||||
.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT)))
|
||||
|
||||
.addSerializer(BigInteger.class, ToStringSerializer.instance)
|
||||
.addSerializer(Long.class, ToStringSerializer.instance)
|
||||
.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT)))
|
||||
.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT)))
|
||||
.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT)));
|
||||
|
||||
//注册功能模块 例如,可以添加自定义序列化器和反序列化器
|
||||
this.registerModule(simpleModule);
|
||||
}
|
||||
}
|
38
src/main/java/zoo/common/R.java
Normal file
38
src/main/java/zoo/common/R.java
Normal file
@ -0,0 +1,38 @@
|
||||
package zoo.common;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class R<T> {
|
||||
|
||||
private Integer code; //编码:1成功,0和其它数字为失败
|
||||
|
||||
private String msg; //错误信息
|
||||
|
||||
private T data; //数据
|
||||
|
||||
private Map map = new HashMap(); //动态数据
|
||||
|
||||
public static <T> R<T> success(T object) {
|
||||
R<T> r = new R<T>();
|
||||
r.data = object;
|
||||
r.code = 1;
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> R<T> error(String msg) {
|
||||
R r = new R();
|
||||
r.msg = msg;
|
||||
r.code = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
public R<T> add(String key, Object value) {
|
||||
this.map.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
27
src/main/java/zoo/config/MyCorsConfig.java
Normal file
27
src/main/java/zoo/config/MyCorsConfig.java
Normal file
@ -0,0 +1,27 @@
|
||||
package 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);
|
||||
}
|
||||
}
|
19
src/main/java/zoo/config/MybatisPlusConfig.java
Normal file
19
src/main/java/zoo/config/MybatisPlusConfig.java
Normal file
@ -0,0 +1,19 @@
|
||||
package zoo.config;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 添加MybatisPlus分页插件
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor(){
|
||||
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
|
||||
mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
|
||||
return mybatisPlusInterceptor;
|
||||
}
|
||||
}
|
24
src/main/java/zoo/config/WebMvcConfig.java
Normal file
24
src/main/java/zoo/config/WebMvcConfig.java
Normal file
@ -0,0 +1,24 @@
|
||||
package zoo.config;
|
||||
|
||||
import com.demo.zoo.common.JacksonObjectMapper;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
public class WebMvcConfig extends WebMvcConfigurationSupport {
|
||||
|
||||
|
||||
@Override
|
||||
protected void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||
//创建消息转化器对象
|
||||
MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
|
||||
//设置对象转换器,底层使用Jackson对象转换为java
|
||||
mappingJackson2HttpMessageConverter.setObjectMapper(new JacksonObjectMapper());
|
||||
//将上面的消息转换器对象追加到mvc框架的集合中
|
||||
converters.add(0,mappingJackson2HttpMessageConverter);
|
||||
}
|
||||
}
|
18
src/main/java/zoo/controller/AccountController.java
Normal file
18
src/main/java/zoo/controller/AccountController.java
Normal file
@ -0,0 +1,18 @@
|
||||
package zoo.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/zoo/account")
|
||||
public class AccountController {
|
||||
|
||||
}
|
18
src/main/java/zoo/controller/AdminController.java
Normal file
18
src/main/java/zoo/controller/AdminController.java
Normal file
@ -0,0 +1,18 @@
|
||||
package zoo.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/zoo/admin")
|
||||
public class AdminController {
|
||||
|
||||
}
|
18
src/main/java/zoo/controller/AnimalController.java
Normal file
18
src/main/java/zoo/controller/AnimalController.java
Normal file
@ -0,0 +1,18 @@
|
||||
package zoo.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/zoo/animal")
|
||||
public class AnimalController {
|
||||
|
||||
}
|
18
src/main/java/zoo/controller/KeeperController.java
Normal file
18
src/main/java/zoo/controller/KeeperController.java
Normal file
@ -0,0 +1,18 @@
|
||||
package zoo.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/zoo/keeper")
|
||||
public class KeeperController {
|
||||
|
||||
}
|
64
src/main/java/zoo/controller/LoginController.java
Normal file
64
src/main/java/zoo/controller/LoginController.java
Normal file
@ -0,0 +1,64 @@
|
||||
package zoo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.demo.zoo.common.R;
|
||||
import com.demo.zoo.dto.AdminDto;
|
||||
import com.demo.zoo.dto.KeeperDto;
|
||||
import com.demo.zoo.dto.VeterinaryDto;
|
||||
import com.demo.zoo.entity.Account;
|
||||
import com.demo.zoo.entity.Admin;
|
||||
import com.demo.zoo.entity.Keeper;
|
||||
import com.demo.zoo.entity.Veterinary;
|
||||
import com.demo.zoo.service.IAccountService;
|
||||
import com.demo.zoo.service.IAdminService;
|
||||
import com.demo.zoo.service.IKeeperService;
|
||||
import com.demo.zoo.service.IVeterinaryService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/zoo/login")
|
||||
public class LoginController {
|
||||
@Autowired
|
||||
IAccountService iAccountService;
|
||||
@Autowired
|
||||
IAdminService iAdminService;
|
||||
@Autowired
|
||||
IKeeperService iKeeperService;
|
||||
@Autowired
|
||||
IVeterinaryService iVeterinaryService;
|
||||
|
||||
@PostMapping("/login")
|
||||
public R login(String username,String password){
|
||||
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("username",username);
|
||||
queryWrapper.eq("password",password);
|
||||
Account one = iAccountService.getOne(queryWrapper);
|
||||
if (one == null){
|
||||
return R.error("账号密码错误");
|
||||
}
|
||||
if (one.getPermissions()==0){
|
||||
Admin admin = iAdminService.selectById(one.getRoleid());
|
||||
AdminDto adminDto = new AdminDto();
|
||||
BeanUtils.copyProperties(admin,adminDto);
|
||||
adminDto.setPermissions(0);
|
||||
return R.success(adminDto);
|
||||
}else if (one.getPermissions()==1){
|
||||
Keeper keeper = iKeeperService.selectById(one.getRoleid());
|
||||
KeeperDto keeperDto = new KeeperDto();
|
||||
BeanUtils.copyProperties(keeper,keeperDto);
|
||||
keeperDto.setPermissions(1);
|
||||
return R.success(keeperDto);
|
||||
}else {
|
||||
Veterinary veterinary = iVeterinaryService.selectById(one.getRoleid());
|
||||
VeterinaryDto veterinaryDto = new VeterinaryDto();
|
||||
BeanUtils.copyProperties(veterinary,veterinaryDto);
|
||||
veterinaryDto.setPermissions(2);
|
||||
return R.success(veterinaryDto);
|
||||
}
|
||||
}
|
||||
}
|
18
src/main/java/zoo/controller/VeterinaryController.java
Normal file
18
src/main/java/zoo/controller/VeterinaryController.java
Normal file
@ -0,0 +1,18 @@
|
||||
package zoo.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/zoo/veterinary")
|
||||
public class VeterinaryController {
|
||||
|
||||
}
|
16
src/main/java/zoo/dto/AdminDto.java
Normal file
16
src/main/java/zoo/dto/AdminDto.java
Normal file
@ -0,0 +1,16 @@
|
||||
package zoo.dto;
|
||||
|
||||
import zoo.entity.Admin;
|
||||
|
||||
|
||||
public class AdminDto extends Admin {
|
||||
private Integer permissions;
|
||||
|
||||
public Integer getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public void setPermissions(Integer permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
}
|
15
src/main/java/zoo/dto/KeeperDto.java
Normal file
15
src/main/java/zoo/dto/KeeperDto.java
Normal file
@ -0,0 +1,15 @@
|
||||
package zoo.dto;
|
||||
|
||||
import zoo.entity.Keeper;
|
||||
|
||||
public class KeeperDto extends Keeper {
|
||||
private Integer permissions;
|
||||
|
||||
public Integer getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public void setPermissions(Integer permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
}
|
15
src/main/java/zoo/dto/VeterinaryDto.java
Normal file
15
src/main/java/zoo/dto/VeterinaryDto.java
Normal file
@ -0,0 +1,15 @@
|
||||
package zoo.dto;
|
||||
|
||||
import zoo.entity.Veterinary;
|
||||
|
||||
public class VeterinaryDto extends Veterinary {
|
||||
private Integer permissions;
|
||||
|
||||
public Integer getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public void setPermissions(Integer permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
}
|
88
src/main/java/zoo/entity/Account.java
Normal file
88
src/main/java/zoo/entity/Account.java
Normal file
@ -0,0 +1,88 @@
|
||||
package zoo.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public class Account implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private Integer roleid;
|
||||
|
||||
/**
|
||||
* 角色账号
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 角色密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
private Integer permissions;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Integer getRoleid() {
|
||||
return roleid;
|
||||
}
|
||||
|
||||
public void setRoleid(Integer roleid) {
|
||||
this.roleid = roleid;
|
||||
}
|
||||
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 Integer getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public void setPermissions(Integer permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Account{" +
|
||||
"id=" + id +
|
||||
", roleid=" + roleid +
|
||||
", username=" + username +
|
||||
", password=" + password +
|
||||
", permissions=" + permissions +
|
||||
"}";
|
||||
}
|
||||
}
|
49
src/main/java/zoo/entity/Admin.java
Normal file
49
src/main/java/zoo/entity/Admin.java
Normal file
@ -0,0 +1,49 @@
|
||||
package zoo.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public class Admin implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private Integer roleid;
|
||||
|
||||
/**
|
||||
* 管理员名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
public Integer getRoleid() {
|
||||
return roleid;
|
||||
}
|
||||
|
||||
public void setRoleid(Integer roleid) {
|
||||
this.roleid = roleid;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Admin{" +
|
||||
"roleid=" + roleid +
|
||||
", name=" + name +
|
||||
"}";
|
||||
}
|
||||
}
|
166
src/main/java/zoo/entity/Animal.java
Normal file
166
src/main/java/zoo/entity/Animal.java
Normal file
@ -0,0 +1,166 @@
|
||||
package zoo.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
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 roleId;
|
||||
|
||||
/**
|
||||
* 颜色
|
||||
*/
|
||||
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 getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Integer roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
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 +
|
||||
", roleId=" + roleId +
|
||||
", color=" + color +
|
||||
", features=" + features +
|
||||
", habit=" + habit +
|
||||
"}";
|
||||
}
|
||||
}
|
75
src/main/java/zoo/entity/Keeper.java
Normal file
75
src/main/java/zoo/entity/Keeper.java
Normal file
@ -0,0 +1,75 @@
|
||||
package zoo.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public class Keeper implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private Integer roleid;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 饲养员名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
public Integer getRoleid() {
|
||||
return roleid;
|
||||
}
|
||||
|
||||
public void setRoleid(Integer roleid) {
|
||||
this.roleid = roleid;
|
||||
}
|
||||
public String getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(String sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Keeper{" +
|
||||
"roleid=" + roleid +
|
||||
", sex=" + sex +
|
||||
", name=" + name +
|
||||
", phone=" + phone +
|
||||
"}";
|
||||
}
|
||||
}
|
62
src/main/java/zoo/entity/Veterinary.java
Normal file
62
src/main/java/zoo/entity/Veterinary.java
Normal file
@ -0,0 +1,62 @@
|
||||
package zoo.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public class Veterinary implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 兽医角色id
|
||||
*/
|
||||
private Integer roleid;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 治疗记录
|
||||
*/
|
||||
private String record;
|
||||
|
||||
public Integer getRoleid() {
|
||||
return roleid;
|
||||
}
|
||||
|
||||
public void setRoleid(Integer roleid) {
|
||||
this.roleid = roleid;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getRecord() {
|
||||
return record;
|
||||
}
|
||||
|
||||
public void setRecord(String record) {
|
||||
this.record = record;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Veterinary{" +
|
||||
"roleid=" + roleid +
|
||||
", name=" + name +
|
||||
", record=" + record +
|
||||
"}";
|
||||
}
|
||||
}
|
16
src/main/java/zoo/mapper/AccountMapper.java
Normal file
16
src/main/java/zoo/mapper/AccountMapper.java
Normal file
@ -0,0 +1,16 @@
|
||||
package zoo.mapper;
|
||||
|
||||
import com.demo.zoo.entity.Account;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public interface AccountMapper extends BaseMapper<Account> {
|
||||
|
||||
}
|
16
src/main/java/zoo/mapper/AdminMapper.java
Normal file
16
src/main/java/zoo/mapper/AdminMapper.java
Normal file
@ -0,0 +1,16 @@
|
||||
package zoo.mapper;
|
||||
|
||||
import com.demo.zoo.entity.Admin;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public interface AdminMapper extends BaseMapper<Admin> {
|
||||
|
||||
}
|
16
src/main/java/zoo/mapper/AnimalMapper.java
Normal file
16
src/main/java/zoo/mapper/AnimalMapper.java
Normal file
@ -0,0 +1,16 @@
|
||||
package zoo.mapper;
|
||||
|
||||
import com.demo.zoo.entity.Animal;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public interface AnimalMapper extends BaseMapper<Animal> {
|
||||
|
||||
}
|
16
src/main/java/zoo/mapper/KeeperMapper.java
Normal file
16
src/main/java/zoo/mapper/KeeperMapper.java
Normal file
@ -0,0 +1,16 @@
|
||||
package zoo.mapper;
|
||||
|
||||
import com.demo.zoo.entity.Keeper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public interface KeeperMapper extends BaseMapper<Keeper> {
|
||||
|
||||
}
|
16
src/main/java/zoo/mapper/VeterinaryMapper.java
Normal file
16
src/main/java/zoo/mapper/VeterinaryMapper.java
Normal file
@ -0,0 +1,16 @@
|
||||
package zoo.mapper;
|
||||
|
||||
import com.demo.zoo.entity.Veterinary;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public interface VeterinaryMapper extends BaseMapper<Veterinary> {
|
||||
|
||||
}
|
20
src/main/java/zoo/service/IAccountService.java
Normal file
20
src/main/java/zoo/service/IAccountService.java
Normal file
@ -0,0 +1,20 @@
|
||||
package zoo.service;
|
||||
|
||||
import com.demo.zoo.entity.Account;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public interface IAccountService extends IService<Account> {
|
||||
|
||||
|
||||
|
||||
}
|
18
src/main/java/zoo/service/IAdminService.java
Normal file
18
src/main/java/zoo/service/IAdminService.java
Normal file
@ -0,0 +1,18 @@
|
||||
package zoo.service;
|
||||
|
||||
import com.demo.zoo.entity.Admin;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public interface IAdminService extends IService<Admin> {
|
||||
Admin selectById(int roleId);
|
||||
}
|
16
src/main/java/zoo/service/IAnimalService.java
Normal file
16
src/main/java/zoo/service/IAnimalService.java
Normal file
@ -0,0 +1,16 @@
|
||||
package zoo.service;
|
||||
|
||||
import com.demo.zoo.entity.Animal;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public interface IAnimalService extends IService<Animal> {
|
||||
|
||||
}
|
19
src/main/java/zoo/service/IKeeperService.java
Normal file
19
src/main/java/zoo/service/IKeeperService.java
Normal file
@ -0,0 +1,19 @@
|
||||
package zoo.service;
|
||||
|
||||
import com.demo.zoo.entity.Admin;
|
||||
import com.demo.zoo.entity.Keeper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public interface IKeeperService extends IService<Keeper> {
|
||||
Keeper selectById(int roleId);
|
||||
}
|
19
src/main/java/zoo/service/IVeterinaryService.java
Normal file
19
src/main/java/zoo/service/IVeterinaryService.java
Normal file
@ -0,0 +1,19 @@
|
||||
package zoo.service;
|
||||
|
||||
import com.demo.zoo.entity.Admin;
|
||||
import com.demo.zoo.entity.Veterinary;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public interface IVeterinaryService extends IService<Veterinary> {
|
||||
Veterinary selectById(int roleId);
|
||||
}
|
20
src/main/java/zoo/service/impl/AccountServiceImpl.java
Normal file
20
src/main/java/zoo/service/impl/AccountServiceImpl.java
Normal file
@ -0,0 +1,20 @@
|
||||
package zoo.service.impl;
|
||||
|
||||
import com.demo.zoo.entity.Account;
|
||||
import com.demo.zoo.mapper.AccountMapper;
|
||||
import zoo.service.IAccountService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
@Service
|
||||
public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements IAccountService {
|
||||
|
||||
}
|
28
src/main/java/zoo/service/impl/AdminServiceImpl.java
Normal file
28
src/main/java/zoo/service/impl/AdminServiceImpl.java
Normal file
@ -0,0 +1,28 @@
|
||||
package zoo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.demo.zoo.entity.Admin;
|
||||
import com.demo.zoo.entity.Keeper;
|
||||
import com.demo.zoo.mapper.AdminMapper;
|
||||
import zoo.service.IAdminService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
@Service
|
||||
public class AdminServiceImpl extends ServiceImpl<AdminMapper, Admin> implements IAdminService {
|
||||
|
||||
@Override
|
||||
public Admin selectById(int roleId) {
|
||||
QueryWrapper<Admin> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("roleId",roleId);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
}
|
20
src/main/java/zoo/service/impl/AnimalServiceImpl.java
Normal file
20
src/main/java/zoo/service/impl/AnimalServiceImpl.java
Normal file
@ -0,0 +1,20 @@
|
||||
package zoo.service.impl;
|
||||
|
||||
import com.demo.zoo.entity.Animal;
|
||||
import com.demo.zoo.mapper.AnimalMapper;
|
||||
import zoo.service.IAnimalService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
@Service
|
||||
public class AnimalServiceImpl extends ServiceImpl<AnimalMapper, Animal> implements IAnimalService {
|
||||
|
||||
}
|
28
src/main/java/zoo/service/impl/KeeperServiceImpl.java
Normal file
28
src/main/java/zoo/service/impl/KeeperServiceImpl.java
Normal file
@ -0,0 +1,28 @@
|
||||
package zoo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.demo.zoo.entity.Keeper;
|
||||
import com.demo.zoo.entity.Veterinary;
|
||||
import com.demo.zoo.mapper.KeeperMapper;
|
||||
import zoo.service.IKeeperService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
@Service
|
||||
public class KeeperServiceImpl extends ServiceImpl<KeeperMapper, Keeper> implements IKeeperService {
|
||||
|
||||
@Override
|
||||
public Keeper selectById(int roleId) {
|
||||
QueryWrapper<Keeper> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("roleId",roleId);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
}
|
27
src/main/java/zoo/service/impl/VeterinaryServiceImpl.java
Normal file
27
src/main/java/zoo/service/impl/VeterinaryServiceImpl.java
Normal file
@ -0,0 +1,27 @@
|
||||
package zoo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.demo.zoo.entity.Veterinary;
|
||||
import com.demo.zoo.mapper.VeterinaryMapper;
|
||||
import zoo.service.IVeterinaryService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author DJ
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
@Service
|
||||
public class VeterinaryServiceImpl extends ServiceImpl<VeterinaryMapper, Veterinary> implements IVeterinaryService {
|
||||
|
||||
@Override
|
||||
public Veterinary selectById(int roleId) {
|
||||
QueryWrapper<Veterinary> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("roleId",roleId);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user