diff --git a/pom.xml b/pom.xml
index 5253c70..57018f7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,16 +60,31 @@
spring-boot-starter-test
test
-
+
mysql
mysql-connector-java
8.0.25
+
+ com.baomidou
+ mybatis-plus-spring-boot3-starter
+ 3.5.7
+
+
+ com.baomidou
+ mybatis-plus-generator
+ 3.5.7
+
+
+ org.freemarker
+ freemarker
+ 2.3.31
+
diff --git a/src/main/java/com/c202201020128/task2/powermanagement/AI.java b/src/main/java/com/c202201020128/task2/powermanagement/AI.java
new file mode 100644
index 0000000..d8b84a9
--- /dev/null
+++ b/src/main/java/com/c202201020128/task2/powermanagement/AI.java
@@ -0,0 +1,33 @@
+package com.c202201020128.task2.powermanagement;
+
+import com.baomidou.mybatisplus.generator.FastAutoGenerator;
+import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
+
+import java.nio.file.Paths;
+
+public class AI {
+ public static void main(String[] args) {
+ FastAutoGenerator.create("jdbc:mysql://10.33.66.120:3306/smallcoursedesign202201020128?serverTimezone=UTC",
+ "202201020128", "@hnucm1254")
+ .globalConfig(builder -> builder
+ .author("Baomidou")
+ .outputDir(Paths.get(System.getProperty("user.dir")) + "/src/ai")
+ .commentDate("yyyy-MM-dd")
+ )
+ .packageConfig(builder -> builder
+ .parent("com.baomidou.mybatisplus")
+ .entity("entity")
+ .mapper("mapper")
+ .service("service")
+ .serviceImpl("service.impl")
+ .xml("mapper.xml")
+ )
+ .strategyConfig(builder -> builder
+ .entityBuilder()
+ .enableLombok()
+ )
+ .templateEngine(new FreemarkerTemplateEngine())
+ .execute();
+ }
+}
+
diff --git a/src/main/java/com/c202201020128/task2/powermanagement/controller/PersonController.java b/src/main/java/com/c202201020128/task2/powermanagement/controller/PersonController.java
new file mode 100644
index 0000000..57603b3
--- /dev/null
+++ b/src/main/java/com/c202201020128/task2/powermanagement/controller/PersonController.java
@@ -0,0 +1,37 @@
+package com.c202201020128.task2.powermanagement.controller;
+
+import com.c202201020128.task2.powermanagement.model.Person;
+import com.c202201020128.task2.powermanagement.model.Result;
+import com.c202201020128.task2.powermanagement.service.IPersonService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.List;
+
+/**
+ *
+ * 前端控制器
+ *
+ *
+ * @author Baomidou
+ * @since 2024-10-30
+ */
+@Controller
+@RequestMapping("/person")
+public class PersonController {
+
+ @Autowired
+ IPersonService iPersonService;
+
+ @ResponseBody
+ @RequestMapping("/personlist")
+ public Result getPersonList(){
+ List personList = iPersonService.list();
+ return Result.ok().put("data",personList);
+ }
+
+
+
+}
diff --git a/src/main/java/com/c202201020128/task2/powermanagement/dao/PersonMapper.java b/src/main/java/com/c202201020128/task2/powermanagement/dao/PersonMapper.java
new file mode 100644
index 0000000..2d04a96
--- /dev/null
+++ b/src/main/java/com/c202201020128/task2/powermanagement/dao/PersonMapper.java
@@ -0,0 +1,18 @@
+package com.c202201020128.task2.powermanagement.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.c202201020128.task2.powermanagement.model.Person;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ *
+ * Mapper 接口
+ *
+ *
+ * @author Baomidou
+ * @since 2024-10-30
+ */
+@Mapper
+public interface PersonMapper extends BaseMapper {
+
+}
diff --git a/src/main/java/com/c202201020128/task2/powermanagement/model/Person.java b/src/main/java/com/c202201020128/task2/powermanagement/model/Person.java
index ba4833b..784b5a0 100644
--- a/src/main/java/com/c202201020128/task2/powermanagement/model/Person.java
+++ b/src/main/java/com/c202201020128/task2/powermanagement/model/Person.java
@@ -1,4 +1,29 @@
package com.c202201020128.task2.powermanagement.model;
-public class Person {
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ *
+ *
+ *
+ *
+ * @author Baomidou
+ * @since 2024-10-30
+ */
+@Getter
+@Setter
+public class Person implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ private String person;
+
+ private String password;
}
diff --git a/src/main/java/com/c202201020128/task2/powermanagement/model/Result.java b/src/main/java/com/c202201020128/task2/powermanagement/model/Result.java
new file mode 100644
index 0000000..4ffb72b
--- /dev/null
+++ b/src/main/java/com/c202201020128/task2/powermanagement/model/Result.java
@@ -0,0 +1,58 @@
+package com.c202201020128.task2.powermanagement.model;
+
+import java.util.HashMap;
+import java.util.Map;
+/**
+ * 返回数据封装类
+ */
+public class Result extends HashMap {
+ private static final long serialVersionUID = 1L;
+
+ public Result() {
+ put("code", 0);
+ put("msg", "success");
+ }
+
+ public static Result error() {
+ return error(500, "未知异常,请联系管理员");
+ }
+
+ public static Result error(String msg) {
+ return error(500, msg);
+ }
+
+ public static Result error(int code, String msg) {
+ Result r = new Result();
+ r.put("code", code);
+ r.put("msg", msg);
+ return r;
+ }
+
+ public static Result ok(String msg) {
+ Result r = new Result();
+ r.put("msg", msg);
+ return r;
+ }
+
+
+ public static Result ok(Object obj) {
+ Result r = new Result();
+ r.put("data", obj);
+ return r;
+ }
+
+ public static Result ok(Map map) {
+ Result r = new Result();
+ r.putAll(map);
+ return r;
+ }
+
+ public static Result ok() {
+ return new Result();
+ }
+
+ public Result put(String key, Object value) {
+ super.put(key, value);
+ return this;
+ }
+}
diff --git a/src/main/java/com/c202201020128/task2/powermanagement/service/IPersonService.java b/src/main/java/com/c202201020128/task2/powermanagement/service/IPersonService.java
new file mode 100644
index 0000000..6569342
--- /dev/null
+++ b/src/main/java/com/c202201020128/task2/powermanagement/service/IPersonService.java
@@ -0,0 +1,17 @@
+package com.c202201020128.task2.powermanagement.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.c202201020128.task2.powermanagement.model.Person;
+
+
+/**
+ *
+ * 服务类
+ *
+ *
+ * @author Baomidou
+ * @since 2024-10-30
+ */
+public interface IPersonService extends IService {
+
+}
diff --git a/src/main/java/com/c202201020128/task2/powermanagement/service/Impl/PersonServiceImpl.java b/src/main/java/com/c202201020128/task2/powermanagement/service/Impl/PersonServiceImpl.java
new file mode 100644
index 0000000..eb2ee46
--- /dev/null
+++ b/src/main/java/com/c202201020128/task2/powermanagement/service/Impl/PersonServiceImpl.java
@@ -0,0 +1,21 @@
+package com.c202201020128.task2.powermanagement.service.Impl;
+
+import com.c202201020128.task2.powermanagement.dao.PersonMapper;
+import com.c202201020128.task2.powermanagement.model.Person;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.c202201020128.task2.powermanagement.service.IPersonService;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 服务实现类
+ *
+ *
+ * @author Baomidou
+ * @since 2024-10-30
+ */
+@Service
+public class PersonServiceImpl extends ServiceImpl implements IPersonService {
+
+}
diff --git a/src/main/resources/Mapper/PersonMapper.xml b/src/main/resources/Mapper/PersonMapper.xml
new file mode 100644
index 0000000..8af9b41
--- /dev/null
+++ b/src/main/resources/Mapper/PersonMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 084d322..cb8fa97 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -10,8 +10,8 @@ spring.datasource.username=202201020128
spring.datasource.password=@hnucm1254
#??????????MyBatis??
#??Mybatis?Mapper??
-mybatis.mapper-locations=classpath:mapper/*.xml
+mybatis-plus.mapper-locations=classpath:mapper/*.xml
#??Mybatis?????
-mybatis.type-aliases-package=com.c202201020128.task2.powermanagement.model
+mybatis-plus.type-aliases-package=com.c202201020128.task2.powermanagement.model
logging.level.com.c202201020128.task2.powermanagement = debug