Compare commits

...

5 Commits

@ -0,0 +1,24 @@
package com.liu.covid;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* COVID
* Spring BootMyBatis Mapper
*/
@SpringBootApplication
@MapperScan("com.liu.covid.mapper")
public class CovidApplication {
/**
*
* 使SpringApplication.run()Spring Boot
*
* @param args
*/
public static void main(String[] args) {
SpringApplication.run(CovidApplication.class, args);
}
}

@ -0,0 +1,34 @@
package com.liu.covid.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
*
* 访访
*/
@Configuration
public class CrosConfig implements WebMvcConfigurer {
/**
* addCorsMappings 访
* 访访
*
* @param registry
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
// 允许所有路径的跨域请求
registry.addMapping("/**")
// 允许的来源,"*" 表示任意来源
.allowedOrigins("*")
// 允许的 HTTP 方法,这里列出了常用的几种方法
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
// 是否允许携带凭据(如 Cookietrue 表示允许
.allowCredentials(true)
// 预检请求的缓存时间单位为秒这里设置为3600秒即1小时
.maxAge(3600)
// 允许的请求头,"*" 表示任意请求头
.allowedHeaders("*");
}
}

@ -0,0 +1,22 @@
package com.liu.covid.config;
import com.baomidou.mybatisplus.annotation.DbType;
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;
// 配置类,用于设置 MyBatis Plus 的拦截器
@Configuration
public class MybatisPlusConfig {
// 声明一个 MybatisPlusInterceptor Bean
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
// 创建 MybatisPlusInterceptor 对象
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 添加分页拦截器,指定数据库类型为 MySQL
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
// 返回配置完成的拦截器实例
return interceptor;
}
}

@ -0,0 +1,29 @@
package com.liu.covid.controller;
import com.liu.covid.entity.Department;
import com.liu.covid.mapper.DepartMapper;
import com.liu.covid.service.DepartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
// 控制器类,用于处理与部门相关的请求
@RestController
@RequestMapping("/depart")
public class DepartController {
// 自动注入 DepartService 服务
@Autowired
DepartService service;
// 处理 GET 请求,返回所有部门信息的列表// 处理 GET 请求,返回所有部门信息的列表
@GetMapping("/findAll")
private List<String> findAll(){
return service.getAll();
}// 调用服务层方法获取所有部门信息
}

@ -0,0 +1,123 @@
package com.liu.covid.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.liu.covid.entity.EmpHealth;
import com.liu.covid.mapper.EmpMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
* HTTP
*/
@RestController
@RequestMapping("/emp")
public class EmpController {
/**
* EmpMapper
* EmpMapperMyBatis PlusMapper
*/
@Autowired
private EmpMapper mapper;
/**
*
*
*
* @param page
* @param size
* @return
*/
@GetMapping("/findAll/{page}/{size}")
public Page<EmpHealth> findAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size) {
// 创建查询条件,按创建时间降序排列
QueryWrapper<EmpHealth> wrapper = new QueryWrapper<>();
wrapper.orderByDesc("createTime");
// 创建分页对象
Page<EmpHealth> page1 = new Page<>(page, size);
// 执行分页查询并返回结果
Page<EmpHealth> result = mapper.selectPage(page1, wrapper).addOrder();
return result;
}
/**
*
*
*
* @param emp
* @return "success""error"
*/
@PostMapping("/save")
public String save(@RequestBody EmpHealth emp) {
// 插入数据并返回操作结果
int result = mapper.insert(emp);
if (result == 1) {
return "success";
} else {
return "error";
}
}
/**
* ID
* ID
*
* @param id ID
* @return
*/
@GetMapping("/findById/{id}")
public EmpHealth findById(@PathVariable("id") Integer id) {
return mapper.selectById(id);
}
/**
*
*
*
* @param emp
* @return "success""error"
*/
@PutMapping("/update")
public String update(@RequestBody EmpHealth emp) {
// 更新数据并返回操作结果
int result = mapper.updateById(emp);
if (result == 1) {
return "success";
} else {
return "error";
}
}
/**
* ID
* ID
*
* @param id ID
*/
@DeleteMapping("/deleteById/{id}")
public void deleteById(@PathVariable("id") Long id) {
// 这里有一个错误应该是直接传递id而不是id+"L"
mapper.deleteById(id);
}
/**
*
*
*
* @param searchkey
* @param stext
* @return
*/
@GetMapping("/search/{searchkey}/{stext}")
public List<EmpHealth> search(@PathVariable("searchkey") String searchkey, @PathVariable("stext") String stext) {
// 创建查询条件,按指定字段进行模糊搜索
QueryWrapper<EmpHealth> userQueryWrapper = Wrappers.query();
userQueryWrapper.like(searchkey, stext);
// 返回符合条件的数据列表
return mapper.selectList(userQueryWrapper);
}
}

@ -0,0 +1,122 @@
package com.liu.covid.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.liu.covid.entity.EmpIden;
import com.liu.covid.mapper.EmpIdenMapper;
import com.liu.covid.service.ChartService;
import com.liu.covid.vo.LineVO;
import com.liu.covid.vo.PieVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
*
*/
@RestController
@RequestMapping("/empiden")
public class EmpIdenController {
@Autowired
private ChartService chartService; // 图表服务
@Autowired
private EmpIdenMapper mapper; // 员工身份信息的 Mapper
/**
*
* @param page
* @param size
* @return
*/
@GetMapping("/findAll/{page}/{size}")
public Page<EmpIden> findAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size) {
Page<EmpIden> page1 = new Page<>(page, size);
Page<EmpIden> result = mapper.selectPage(page1, null);
return result;
}
/**
*
* @param empIden
* @return "success" "error"
*/
@PostMapping("/save")
public String save(@RequestBody EmpIden empIden) {
int result = mapper.insert(empIden);
if (result == 1) {
return "success";
} else {
return "error";
}
}
/**
* 线
* @return 线
*/
@GetMapping("/LineVO")
public LineVO getLineVO() {
return this.chartService.lineVOList();
}
/**
*
* @return
*/
@GetMapping("/PieVO")
public List<PieVo> getPieVO() {
return this.chartService.pieVOMap();
}
/**
* ID
* @param id ID
* @return
*/
@GetMapping("/findById/{id}")
public EmpIden findById(@PathVariable("id") Integer id) {
return mapper.selectById(id);
}
/**
*
* @param empIden
* @return "success" "error"
*/
@PutMapping("/update")
public String update(@RequestBody EmpIden empIden) {
int result = mapper.updateById(empIden);
if (result == 1) {
return "success";
} else {
return "error";
}
}
/**
* ID
* @param id ID
*/
@DeleteMapping("/deleteById/{id}")
public void deleteById(@PathVariable("id") Long id) {
mapper.deleteById(id + "L");
}
/**
*
* @param searchkey
* @param stext
* @return
*/
@GetMapping("/search/{searchkey}/{stext}")
public List<EmpIden> search(@PathVariable("searchkey") String searchkey, @PathVariable("stext") String stext) {
QueryWrapper<EmpIden> userQueryWrapper = Wrappers.query();
userQueryWrapper.like(searchkey, stext);
return mapper.selectList(userQueryWrapper);
}
}

@ -0,0 +1,117 @@
package com.liu.covid.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.liu.covid.entity.EmpIs;
import com.liu.covid.mapper.EmpIsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
*
*/
@RestController
@RequestMapping("/empis")
public class EmpIsController {
@Autowired
private EmpIsMapper mapper; // 员工身份信息的 Mapper
/**
*
* @param page
* @param size
* @return
*/
@GetMapping("/findAll/{page}/{size}")
public Page<EmpIs> findAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size) {
Page<EmpIs> page1 = new Page<>(page, size);
Page<EmpIs> result = mapper.selectPage(page1, null);
return result;
}
/**
*
* @param empis
* @return "success" "error"
*/
@PostMapping("/save")
public String save(@RequestBody EmpIs empis) {
// 设置结束日期为开始日期后14天
Format f = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.setTime(empis.getBegin());
c.add(Calendar.DAY_OF_MONTH, 14); // 增加14天
Date end = c.getTime();
empis.setEnd(end);
int result = mapper.insert(empis);
if (result == 1) {
return "success";
} else {
return "error";
}
}
/**
* ID
* @param id ID
* @return
*/
@GetMapping("/findById/{id}")
public EmpIs findById(@PathVariable("id") Integer id) {
return mapper.selectById(id);
}
/**
*
* @param empis
* @return "success" "error"
*/
@PutMapping("/update")
public String update(@RequestBody EmpIs empis) {
// 设置结束日期为开始日期后14天
Format f = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.setTime(empis.getBegin());
c.add(Calendar.DAY_OF_MONTH, 14); // 增加14天
Date end = c.getTime();
empis.setEnd(end);
int result = mapper.updateById(empis);
if (result == 1) {
return "success";
} else {
return "error";
}
}
/**
* ID
* @param id ID
*/
@DeleteMapping("/deleteById/{id}")
public void deleteById(@PathVariable("id") Long id) {
mapper.deleteById(id + "L");
}
/**
*
* @param searchkey
* @param stext
* @return
*/
@GetMapping("/search/{searchkey}/{stext}")
public List<EmpIs> search(@PathVariable("searchkey") String searchkey, @PathVariable("stext") String stext) {
QueryWrapper<EmpIs> userQueryWrapper = Wrappers.query();
userQueryWrapper.like(searchkey, stext); // 模糊查询
return mapper.selectList(userQueryWrapper);
}
}

@ -0,0 +1,41 @@
package com.liu.covid.controller;
import com.liu.covid.entity.User;
import com.liu.covid.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
*
*/
@RestController
@RequestMapping("/userlogin")
public class LoginController {
@Autowired
UserService userService; // 用户服务,用于处理登录和注册逻辑
/**
*
* @param loginform
* @return
*/
@PostMapping("/user")
public String login(@RequestBody User loginform) {
// 调用 userService 的 login 方法进行登录验证
String message = userService.login(loginform);
return message; // 返回登录结果消息
}
/**
*
* @param reUser
* @return
*/
@PostMapping("/register")
public String register(@RequestBody User reUser) {
// 调用 userService 的 register 方法进行用户注册
String message = userService.register(reUser);
return message; // 返回注册结果消息
}
}

@ -0,0 +1,115 @@
package com.liu.covid.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.liu.covid.entity.MaterialManage;
import com.liu.covid.mapper.MaterialMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
* HTTP
*/
@RestController
@RequestMapping("/Material")
public class MaterialController {
/**
* MaterialMapper
* MaterialMapperMyBatis PlusMapper
*/
@Autowired
private MaterialMapper mapper;
/**
*
* 使MyBatis Plus
*
* @param page
* @param size
* @return
*/
@GetMapping("/findAll/{page}/{size}")
public Page<MaterialManage> findAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size) {
Page<MaterialManage> page1 = new Page<>(page, size);
Page<MaterialManage> result = mapper.selectPage(page1, null);
return result;
}
/**
*
*
*
* @param material
* @return "success" "error"
*/
@PostMapping("/save")
public String save(@RequestBody MaterialManage material) {
int result = mapper.insert(material);
if (result == 1) {
return "success";
} else {
return "error";
}
}
/**
* ID
* ID
*
* @param id ID
* @return
*/
@GetMapping("/findById/{id}")
public MaterialManage findById(@PathVariable("id") Integer id) {
return mapper.selectById(id);
}
/**
*
*
*
* @param material
* @return "success" "error"
*/
@PutMapping("/update")
public String update(@RequestBody MaterialManage material) {
int result = mapper.updateById(material);
if (result == 1) {
return "success";
} else {
return "error";
}
}
/**
* ID
* ID
*
* @param id ID
*/
@DeleteMapping("/deleteById/{id}")
public void deleteById(@PathVariable("id") Long id) {
// 这里有一个错误应该是直接传递id而不是id+"L"
mapper.deleteById(id);
}
/**
*
* 使MyBatis PlusQueryWrapper
*
* @param searchkey
* @param stext
* @return
*/
@GetMapping("/search/{searchkey}/{stext}")
public List<MaterialManage> search(@PathVariable("searchkey") String searchkey, @PathVariable("stext") String stext) {
QueryWrapper<MaterialManage> userQueryWrapper = Wrappers.query();
userQueryWrapper.like(searchkey, stext); // 模糊查询
return mapper.selectList(userQueryWrapper);
}
}

@ -0,0 +1,30 @@
package com.liu.covid.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
*
* ID
*/
@Data
public class Department {
/**
* ID
* ID
*/
@TableId
private Integer id;
/**
*
* "人力资源部""财务部"
*/
private String name;
/**
*
*
*/
private String charge;
}

@ -0,0 +1,58 @@
package com.liu.covid.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.liu.covid.entity.Enum.GenderEnum;
import lombok.Data;
import java.util.Date;
/**
*
*
*/
@Data
public class EmpHealth {
// 员工健康记录的唯一标识,主键自增长
@TableId(type = IdType.AUTO)
private Long id;
// 员工姓名
private String name;
// 员工性别,使用 GenderEnum 枚举类型
private GenderEnum sex;
// 员工联系电话
private Long phonenum;
// 员工体温
private float temp;
// 健康风险评估
private String risk;
// 员工健康状态(如:健康、需要隔离等)
private String health;
// 健康内容的详细说明
private String content;
// 员工所属部门
private String depart;
// 记录的创建时间,插入时自动填充,格式为 "yyyy-MM-dd HH:mm:ss"
@TableField(value = "createTime", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
}
//
//
//
//
//
//

@ -0,0 +1,53 @@
package com.liu.covid.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.liu.covid.entity.Enum.GenderEnum;
import lombok.Data;
import java.util.Date;
/**
*
*
*/
@Data
public class EmpIden {
// 员工身份记录的唯一标识,主键自增长
@TableId(type = IdType.AUTO)
private Long id;
// 员工姓名
private String name;
// 员工状态(例如:在职、离职等)
private String status;
// 员工性别,使用 GenderEnum 枚举类型
private GenderEnum sex;
// 员工身份证号码
private Long idcard;
// 员工身份证发证日期,格式为 "yyyy-MM-dd"
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date idate;
// 员工出生地
private String place;
// 员工所属部门
private String depart;
// 员工联系电话
private Long phonenum;
// 员工注册时间,插入时自动填充,格式为 "yyyy-MM-dd HH:mm:ss"
@TableField(value = "register", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date register;
}

@ -0,0 +1,59 @@
package com.liu.covid.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.liu.covid.entity.Enum.GenderEnum;
import lombok.Data;
import java.util.Date;
/**
*
*
*/
@Data
public class EmpIs {
// 员工隔离记录的唯一标识,主键自增长
@TableId(type = IdType.AUTO)
private Long id;
// 员工姓名
private String name;
// 员工性别,使用 GenderEnum 枚举类型
private GenderEnum sex;
// 员工联系电话
private Long phone;
// 员工体温
private float temp;
// 隔离类型(例如:居家、集中等)
private String type;
// 隔离地点
private String place;
// 隔离开始日期,格式为 "yyyy-MM-dd"
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date begin;
// 隔离结束日期,格式为 "yyyy-MM-dd"
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date end;
// 是否离开隔离地点
private String leaved;
// 隔离期间的健康内容说明
private String content;
// 是否已到达隔离地点
private String arrived;
// 员工所属部门
private String depart;
}

@ -0,0 +1,23 @@
package com.liu.covid.entity.Enum;
import com.baomidou.mybatisplus.annotation.EnumValue;
/**
*
*
*/
public enum GenderEnum {
(1, "男"), // 男性code为1
(0, "女"); // 女性code为0
// 枚举类的构造函数传入code和gender值
GenderEnum(Integer code, String gender) {
this.code = code;
this.gender = gender;
}
@EnumValue // 标记该字段为数据库存储的值
private Integer code; // 性别代码1为男性0为女性
private String gender; // 性别名称:男或女
}

@ -0,0 +1,51 @@
package com.liu.covid.entity.Enum;
import com.baomidou.mybatisplus.annotation.EnumValue;
/**
*
*
*/
public enum ImpEnum {
(1, "是"), // 表示重要code为1
(0, "否"); // 表示不重要code为0
/**
*
* codeisImp
*
* @param code 10
* @param isImp
*/
ImpEnum(Integer code, String isImp) {
this.code = code;
this.isImp = isImp;
}
/**
*
* MyBatis Plus使
*/
@EnumValue
private Integer code; // 是否重要的代码1为“是”0为“否”
private String isImp; // 是否重要的名称:是或否
// Getter和Setter方法
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getIsImp() {
return isImp;
}
public void setIsImp(String isImp) {
this.isImp = isImp;
}
}

@ -0,0 +1,45 @@
package com.liu.covid.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.liu.covid.entity.Enum.ImpEnum;
import lombok.Data;
import java.util.Date;
/**
*
*
*/
@Data
@TableName(value = "material_manage")
public class MaterialManage {
// 物资管理记录的唯一标识,主键自增长
@TableId(type = IdType.AUTO)
private Long id;
// 物资名称
private String name;
// 物资数量
private int count;
// 物资类型
private String type;
// 物资是否重要,使用 ImpEnum 枚举类型(例如:是、否)
@TableField(value = "isImp")
private ImpEnum isImp;
// 物资负责人
private String charge;
// 物资负责人联系方式
private Long cnum;
// 物资管理记录的更新时间,插入或更新时自动填充,格式为 "yyyy-MM-dd HH:mm:ss"
@TableField(value = "updateTime", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
}

@ -0,0 +1,37 @@
package com.liu.covid.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
*
* ID
*/
@Data
public class User {
/**
* ID
* ID
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
*
*
*/
private String username;
/**
*
*
*/
private String password;
/**
*
* ID
*/
private String depart;
}

@ -0,0 +1,45 @@
package com.liu.covid.handler;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* MyMetaObjectHandler
*
*/
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {
/**
*
* createTimeupdateTime
* 使 createTime register
* register
*
* @param metaObject
*/
@Override
public void insertFill(MetaObject metaObject) {
// 设置 createTime 字段为当前时间
this.setFieldValByName("createTime", new Date(), metaObject);
// 设置 register 字段为当前时间,这里假设 register 字段有其他特定用途
this.setFieldValByName("register", new Date(), metaObject);
// 设置 updateTime 字段为当前时间
this.setFieldValByName("updateTime", new Date(), metaObject);
}
/**
*
* updateTime
*
* @param metaObject
*/
@Override
public void updateFill(MetaObject metaObject) {
// 设置 updateTime 字段为当前时间
this.setFieldValByName("updateTime", new Date(), metaObject);
}
}

@ -0,0 +1,9 @@
package com.liu.covid.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liu.covid.entity.Department;
import org.springframework.stereotype.Repository;
@Repository
public interface DepartMapper extends BaseMapper<Department> {
}

@ -0,0 +1,9 @@
package com.liu.covid.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liu.covid.entity.EmpIden;
import org.springframework.stereotype.Repository;
@Repository
public interface EmpIdenMapper extends BaseMapper<EmpIden> {
}

@ -0,0 +1,9 @@
package com.liu.covid.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liu.covid.entity.EmpIs;
import org.springframework.stereotype.Repository;
@Repository
public interface EmpIsMapper extends BaseMapper<EmpIs> {
}

@ -0,0 +1,9 @@
package com.liu.covid.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liu.covid.entity.EmpHealth;
import org.springframework.stereotype.Repository;
@Repository
public interface EmpMapper extends BaseMapper<EmpHealth> {
}

@ -0,0 +1,9 @@
package com.liu.covid.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liu.covid.entity.MaterialManage;
import org.springframework.stereotype.Repository;
@Repository
public interface MaterialMapper extends BaseMapper<MaterialManage> {
}

@ -0,0 +1,9 @@
package com.liu.covid.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liu.covid.entity.User;
import org.springframework.stereotype.Repository;
@Repository
public interface UserMapper extends BaseMapper<User> {
}

@ -0,0 +1,31 @@
package com.liu.covid.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.liu.covid.entity.EmpIden;
import com.liu.covid.vo.LineVO;
import com.liu.covid.vo.PieVo;
import java.util.List;
import java.util.Map;
/**
*
* 线
*/
public interface ChartService extends IService<EmpIden> {
/**
* 线
* 线
*
* @return 线线
*/
public LineVO lineVOList();
/**
*
*
*
* @return
*/
public List<PieVo> pieVOMap();
}

@ -0,0 +1,20 @@
package com.liu.covid.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.liu.covid.entity.Department;
import java.util.List;
/**
*
*
*/
public interface DepartService extends IService<Department> {
/**
*
*
*
* @return
*/
public List<String> getAll();
}

@ -0,0 +1,28 @@
package com.liu.covid.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.liu.covid.entity.User;
/**
*
*
*/
public interface UserService extends IService<User> {
/**
*
*
*
* @param user
* @return
*/
public String login(User user);
/**
*
*
*
* @param user
* @return
*/
public String register(User user);
}

@ -0,0 +1,108 @@
package com.liu.covid.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liu.covid.entity.EmpIden;
import com.liu.covid.entity.EmpIs;
import com.liu.covid.entity.MaterialManage;
import com.liu.covid.mapper.EmpIdenMapper;
import com.liu.covid.mapper.EmpIsMapper;
import com.liu.covid.mapper.MaterialMapper;
import com.liu.covid.service.ChartService;
import com.liu.covid.vo.LineVO;
import com.liu.covid.vo.PieVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* ChartServiceImpl ChartService
* 线
*/
@Service
public class ChartServiceImpl extends ServiceImpl<EmpIdenMapper, EmpIden> implements ChartService {
@Autowired
private EmpIdenMapper empIdenMapper; // 自动注入 EmpIdenMapper用于操作身份证信息表
@Autowired
private EmpIsMapper empIsMapper; // 自动注入 EmpIsMapper用于操作隔离信息表
@Autowired
private MaterialMapper materialMapper; // 自动注入 MaterialMapper用于操作物资管理表
/**
* lineVOList 线 7
* @return LineVO 线
*/
@Override
public LineVO lineVOList() {
LineVO lineVO = new LineVO(); // 创建 LineVO 对象,用于存储折线图数据
Date date = new Date(); // 当前时间
Calendar cal = Calendar.getInstance(); // 获取当前时间的 Calendar 对象
List<String> month = new ArrayList<>(); // 用于存储过去 7 个月的月份
List<Integer> list = new ArrayList<>(); // 用于存储隔离人数的数量
Map<String, List> all = new HashMap<>(); // 存储每个疾病状态的数量
String type[] = {"确诊", "疑似", "治愈", "死亡"}; // 疾病状态类型数组
// 获取过去 7 个月的月份
for (int i = 0; i < 7; i++) {
cal.setTime(date);
cal.set(Calendar.MONTH, cal.get(Calendar.MONTH) - i); // 设置当前月份减去 i 个月
SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM"); // 格式化日期为 "yyyy-MM" 格式
String mon = ft.format(cal.getTime()); // 获取当前月份
month.add(mon); // 将月份添加到 month 列表中
}
Collections.reverse(month); // 翻转月份列表,确保月份顺序从过去到现在
lineVO.setMonth(month); // 设置 LineVO 中的月份
// 获取每个疾病状态类型在过去 7 个月内的数量
for (String t : type) {
List<Integer> cot = new ArrayList<>();
int j = 0;
while (j < 7) {
QueryWrapper<EmpIden> userQueryWrapper = Wrappers.query(); // 创建查询条件
userQueryWrapper.like("status", t).likeRight("idate", month.get(j++)); // 根据状态和月份查询
Integer count = empIdenMapper.selectCount(userQueryWrapper); // 获取符合条件的记录数量
cot.add(count); // 将数量添加到 cot 列表中
userQueryWrapper.clear(); // 清除查询条件
}
all.put(t, cot); // 将疾病状态和数量添加到 all 映射中
}
// 获取过去 7 个月内的隔离人数
int j = 0;
while (j < 7) {
QueryWrapper<EmpIs> userQueryWrapper = Wrappers.query(); // 创建查询条件
userQueryWrapper.likeRight("begin", month.get(j++)); // 根据月份查询
Integer count = empIsMapper.selectCount(userQueryWrapper); // 获取隔离人数
list.add(count); // 将隔离人数添加到 list 列表中
}
all.put("隔离", list); // 将隔离人数添加到 all 映射中
lineVO.setStatus(all); // 设置 LineVO 中的疾病状态数量映射
return lineVO; // 返回 LineVO 对象
}
/**
* pieVOMap
* @return List<PieVo>
*/
@Override
public List<PieVo> pieVOMap() {
List<PieVo> pielist = new ArrayList<>(); // 用于存储饼图数据的列表
QueryWrapper queryWrapper = new QueryWrapper(); // 创建查询条件
queryWrapper.eq("isImp", "1"); // 查询 isImp 字段为 1 的记录,表示重要物资
List<MaterialManage> list = materialMapper.selectList(queryWrapper); // 获取符合条件的物资记录
// 遍历所有重要物资,创建 PieVo 对象存储物资名称和数量
for (MaterialManage mat : list) {
PieVo pieVo = new PieVo();
pieVo.setName(mat.getName()); // 设置物资名称
pieVo.setValue(mat.getCount()); // 设置物资数量
pielist.add(pieVo); // 将 PieVo 对象添加到 pielist 列表中
}
return pielist; // 返回饼图数据列表
}
}

@ -0,0 +1,38 @@
package com.liu.covid.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liu.covid.entity.Department;
import com.liu.covid.entity.EmpIden;
import com.liu.covid.mapper.DepartMapper;
import com.liu.covid.mapper.EmpIdenMapper;
import com.liu.covid.service.DepartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* DepartServiceImpl DepartService
*/
@Service
public class DepartServiceImpl extends ServiceImpl<DepartMapper, Department> implements DepartService {
@Autowired
private DepartMapper mapper; // 自动注入 DepartMapper用于操作部门数据表
/**
*
* @return List<String>
*/
@Override
public List<String> getAll() {
List<Department> list; // 用于存储从数据库中查询到的所有部门信息
List<String> name = new ArrayList<>(); // 用于存储所有部门名称的列表
list = mapper.selectList(null); // 查询所有部门记录
for (Department de : list) { // 遍历查询到的部门记录
name.add(de.getName()); // 将部门名称添加到 name 列表中
}
return name; // 返回部门名称列表
}
}

@ -0,0 +1,95 @@
package com.liu.covid.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liu.covid.entity.EmpIden;
import com.liu.covid.entity.User;
import com.liu.covid.mapper.EmpIdenMapper;
import com.liu.covid.mapper.UserMapper;
import com.liu.covid.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;
import java.util.List;
/**
* UserServiceImpl UserService
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
@Autowired
UserMapper mapper; // 自动注入 UserMapper用于操作用户数据表
/**
*
* @param user
* @return "success" "error"
*/
@Override
public String login(User user) {
// 创建查询条件,根据用户名查询用户
QueryWrapper<User> userQueryWrapper = Wrappers.query();
userQueryWrapper.like("username", user.getUsername());
// 查询用户列表
List<User> list = mapper.selectList(userQueryWrapper);
// 如果用户存在
if (list.size() != 0) {
// 对用户输入的密码进行MD5加密
String password = DigestUtils.md5DigestAsHex(user.getPassword().getBytes());
// 比较加密后的密码与数据库中的密码是否一致
if (list.get(0).getPassword().equals(password)) {
return "success"; // 密码匹配,登录成功
} else {
return "error"; // 密码不匹配,登录失败
}
} else {
return "error"; // 用户不存在,登录失败
}
}
/**
*
* @param user
* @return "success""error""repeat"
*/
@Override
public String register(User user) {
// 判断用户信息是否为空
if (user != null) {
boolean flag = true;
// 检查用户名是否已经存在
for (User list : mapper.selectList(null)) {
if (list.getUsername().equals(user.getUsername())) {
flag = false; // 如果用户名已存在,则标记为 false
break;
}
}
// 如果用户名没有重复
if (flag) {
// 对用户输入的密码进行MD5加密
String pw = DigestUtils.md5DigestAsHex(user.getPassword().getBytes());
user.setPassword(pw); // 设置加密后的密码
// 插入用户数据
int index = mapper.insert(user);
// 判断插入是否成功
if (index == 1) {
return "success"; // 注册成功
} else {
return "error"; // 注册失败
}
} else {
return "repeat"; // 用户名重复,不能注册
}
} else {
return "error"; // 用户信息为空,注册失败
}
}
}

@ -0,0 +1,53 @@
package com.liu.covid.util;
import java.sql.*;
/**
* JDBCUtils
* 使 MySQL
*/
public class JDBCUtils {
/**
* URL
*/
static final String url = "jdbc:mysql://localhost:3306/covid?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai";
/**
*
*/
static final String user = "root";
/**
*
*/
static final String password = "123456";
/**
*
*/
private static Connection con;
/**
*
*
* @return null
*/
public static Connection getConnection(){
// 加载数据库驱动
try {
Class.forName("com.mysql.cj.jdbc.Driver"); // 加载 MySQL 驱动8.0 版本及以上)
} catch (ClassNotFoundException e) {
e.printStackTrace(); // 如果驱动加载失败,打印异常
}
// 进行数据库连接
try {
con = DriverManager.getConnection(url, user, password); // 使用 JDBC URL、用户名和密码进行连接
con.setAutoCommit(false); // 设置自动提交事务为 false以便管理事务
} catch (SQLException e) {
e.printStackTrace(); // 如果连接失败,打印异常
}
return con; // 返回连接对象
}
}

@ -0,0 +1,30 @@
package com.liu.covid.util;
import java.sql.Connection;
import java.sql.SQLException;
/**
*
*
*/
public class Test {
/**
*
* JDBCUtils
*
* @param args 使
* @throws SQLException
*/
public static void main(String[] args) throws SQLException {
// 实例化JDBCUtils工具类
JDBCUtils jdbcConnection = new JDBCUtils();
// 通过JDBCUtils获取数据库连接
Connection connection = jdbcConnection.getConnection();
// 检查连接是否成功,并打印相应信息
if (connection != null) {
System.out.println("数据库连接成功");
} else {
System.out.println("数据库连接失败");
}
}
}

@ -0,0 +1,27 @@
package com.liu.covid.vo;
import lombok.Data;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 线
* 线
*/
@Data
public class LineVO {
/**
*
* 线
*/
private List<String> month;
/**
*
* 线
*
*/
private Map<String, List> status;
}

@ -0,0 +1,22 @@
package com.liu.covid.vo;
import lombok.Data;
/**
*
*
*/
@Data
public class PieVo {
/**
*
*
*/
private String name;
/**
*
*
*/
private Integer value;
}

@ -0,0 +1,13 @@
package org.example;
/**
* Hello world! wangciurui
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,15 @@
# 应用名称
spring:
datasource:
url: jdbc:mysql://localhost:3306/covid?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
server:
port: 8080
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
type-enums-package:
com.liu.covid.entity

@ -3,42 +3,60 @@
import Vue from 'vue';
import axios from "axios";
// Full config: https://github.com/axios/axios#request-config
// Full config: https://github.com/axios/axios#request-config
// axios.defaults.baseURL = process.env.baseURL || process.env.apiUrl || '';
// axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
/**
* Axios configuration object
* Defines the default settings for axios instances created by this configuration.
*/
let config = {
// baseURL: process.env.baseURL || process.env.apiUrl || ""
// timeout: 60 * 1000, // Timeout
// baseURL: process.env.baseURL || process.env.apiUrl || "",
// timeout: 60 * 1000, // Timeout in milliseconds
// withCredentials: true, // Check cross-site Access-Control
};
/**
* Creates an axios instance with the specified configuration.
*/
const _axios = axios.create(config);
/**
* Adds a request interceptor to the axios instance.
* The interceptor modifies the request configuration before it is sent.
*/
_axios.interceptors.request.use(
function(config) {
// Do something before request is sent
// Do something before request is sent, e.g., add authentication tokens
return config;
},
function(error) {
// Do something with request error
// Do something with request error, e.g., log the error
return Promise.reject(error);
}
);
// Add a response interceptor
/**
* Adds a response interceptor to the axios instance.
* The interceptor modifies the response data before it is handled by `then` or `catch`.
*/
_axios.interceptors.response.use(
function(response) {
// Do something with response data
// Do something with response data, e.g., transform the data format
return response;
},
function(error) {
// Do something with response error
// Do something with response error, e.g., display an error message
return Promise.reject(error);
}
);
/**
* Plugin installation function for Vue.
* This function integrates the axios instance into Vue, making it accessible as `this.$axios` in Vue components.
*/
Plugin.install = function(Vue, options) {
Vue.axios = _axios;
window.axios = _axios;
@ -56,6 +74,7 @@ Plugin.install = function(Vue, options) {
});
};
// Automatically install the plugin if Vue is available
Vue.use(Plugin)
export default Plugin;
export default Plugin;

@ -1,85 +1,97 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/Index.vue'
import Login from '../views/login.vue'
import Login from '../views/Login.vue'
Vue.use(VueRouter)
/**
* Router configuration for the application
* Defines the routes and their corresponding components.
*/
const routes = [
//配置默认的路径,默认显示登录页
{ path: '/', meta:false, component: () => import('../views/login.vue')},
// Configure the default path to display the login page
{
path: '/',
meta: false,
component: () => import('../views/Login.vue')
},
{
path: "/Index",
name:"日常防控管理",
component:Index,
meta:true,
children:[
name: "日常防控管理",
component: Index,
meta: true,
children: [
{
path:"/RecordManage",
name:"打卡记录",
component:() => import('../views/RecordManage.vue')
path: "/RecordManage",
name: "打卡记录",
component: () => import('../views/RecordManage.vue')
},
{
path:"/AddRecord",
name:"健康打卡申报",
component:()=>import('../views/AddRecord.vue')
path: "/AddRecord",
name: "健康打卡申报",
component: () => import('../views/AddRecord.vue')
}
]
},
{
path: "/Index",
name:"异常人员管理",
component:Index,
meta:true,
children:[
name: "异常人员管理",
component: Index,
meta: true,
children: [
{
path:"/IdenManage",
name:"疑似/确诊人员登记",
component:() => import(/* webpackChunkName: "BlogManage" */ '../views/IdenManage.vue')
//const Foo = () => import(/* webpackChunkName: "group-foo" */ './Foo.vue')
path: "/IdenManage",
name: "疑似/确诊人员登记",
component: () => import('../views/IdenManage.vue')
},
{
path:"/IsManage",
name:"隔离人员登记",
component:()=>import(/* webpackChunkName:"AddBlog" */ '../views/IsManage.vue')
path: "/IsManage",
name: "隔离人员登记",
component: () => import('../views/IsManage.vue')
}
]
},
{
path: "/Index",
name:"防疫物资管理",
component:Index,
meta:true,
children:[{
path:"/MaterialManage",
name:"防疫物资查看",
component:()=>import(/* webpackChunkName:"MaterialManage" */ '../views/MaterialManage.vue')
},{
path:"/AddMaterial",
name:"新增防疫物资",
component:()=>import(/* webpackChunkName:"AddMaterial" */ '../views/AddMaterial.vue')
}
]
name: "防疫物资管理",
component: Index,
meta: true,
children: [
{
path: "/MaterialManage",
name: "防疫物资查看",
component: () => import('../views/MaterialManage.vue')
},
{
path: "/AddMaterial",
name: "新增防疫物资",
component: () => import('../views/AddMaterial.vue')
}
]
},
{
path: "/Index",
name:"疫情概况",
component:Index,
meta:true,
children:[{
path:"/EChart",
name:"防疫数据可视化",
component:()=>import(/* webpackChunkName:"MaterialManage" */ '../views/EChart.vue')
}
name: "疫情概况",
component: Index,
meta: true,
children: [
{
path: "/EChart",
name: "防疫数据可视化",
component: () => import('../views/EChart.vue')
}
]
}
]
/**
* Creates a new VueRouter instance with the defined routes.
*/
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
mode: 'history', // Use HTML5 history mode
base: process.env.BASE_URL, // Base URL for the application
routes // Define the routes
})
export default router
export default router

@ -3,13 +3,58 @@ import Vuex from 'vuex'
Vue.use(Vuex)
/**
* Creates a new Vuex store instance.
* This store will be used to manage the state, mutations, actions, and modules of the Vue application.
*/
export default new Vuex.Store({
/**
* The state object contains the initial state of the Vuex store.
* It can be mutated only by using mutations or actions.
*/
state: {
// Initial state properties go here. For example:
// user: null,
// isAuthenticated: false,
},
/**
* The mutations object contains functions that can mutate the state.
* These functions are the only way to actually change state in the store.
*/
mutations: {
// Mutation functions go here. For example:
// SET_USER(state, user) {
// state.user = user;
// },
// SET_AUTHENTICATION(state, status) {
// state.isAuthenticated = status;
// },
},
/**
* The actions object contains functions that cause side effects.
* These functions can call mutations or other actions, but they shouldn't mutate the state directly.
*/
actions: {
// Action functions go here. For example:
// loginUser({ commit }, user) {
// // Perform login logic here, then commit a mutation
// commit('SET_USER', user);
// commit('SET_AUTHENTICATION', true);
// },
},
/**
* The modules object contains other Vuex modules.
* This allows you to split your store into smaller chunks of logic.
*/
modules: {
// Vuex module objects go here. For example:
// user: {
// state: { /* user-specific state */ },
// mutations: { /* user-specific mutations */ },
// actions: { /* user-specific actions */ },
// },
}
})
})

@ -0,0 +1,13 @@
package com.liu.covid;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class CovidApplicationTests {
@Test
void contextLoads() {
}
}

@ -0,0 +1,28 @@
package com.liu.covid.controller;
import com.liu.covid.entity.User;
import com.liu.covid.mapper.UserMapper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.util.DigestUtils;
@SpringBootTest
class LoginServiceTest {
@Autowired
private UserMapper mapper; // 注入UserMapper用于数据库操作
/**
*
*
*/
@Test
void register() {
User user = new User(); // 创建一个新的User对象
String pw = DigestUtils.md5DigestAsHex("99409".getBytes()); // 使用MD5加密密码
user.setUsername("994091246"); // 设置用户名
user.setPassword(pw); // 设置加密后的密码
int message = mapper.insert(user); // 将用户信息插入数据库,并返回影响的行数
System.out.println(message); // 打印插入结果
}
}

@ -0,0 +1,61 @@
package com.liu.covid.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.liu.covid.entity.EmpIden;
import com.liu.covid.vo.LineVO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.text.SimpleDateFormat;
import java.util.*;
@SpringBootTest
class MaterialControllerTest {
@Autowired
private EmpIdenMapper mapper; // 注入EmpIdenMapper用于数据库操作
/**
* 线
* 线
*/
@Test
void find() {
LineVO lineVO = new LineVO(); // 创建LineVO对象用于存储折线图数据
Date date = new Date(); // 获取当前日期
Calendar cal = Calendar.getInstance(); // 获取日历实例
List<String> month = new ArrayList<>(); // 存储月份的列表
Map<String, Integer> status = new HashMap<>(); // 存储每个月份的状态计数
Map<String, Map> all = new HashMap<>(); // 存储所有状态的数据
String type[] = {"确诊", "疑似", "治愈", "死亡"}; // 定义状态类型
// 向前推算7个月的月份数据
for (int i = 0; i < 7; i++) {
cal.setTime(date);
cal.set(Calendar.MONTH, cal.get(Calendar.MONTH) - i);
SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM");
String mon = ft.format(cal.getTime());
month.add(mon);
}
// 设置折线图月份
lineVO.setMonth(month);
// 遍历每种状态类型,查询并设置数据
for (String t : type) {
int j = 0;
while (j < 7) {
QueryWrapper<EmpIden> userQueryWrapper = Wrappers.query();
userQueryWrapper.like("status", t).likeRight("idate", month.get(j));
Integer count = mapper.selectCount(userQueryWrapper);
status.put(month.get(j++), count);
userQueryWrapper.clear();
}
all.put(t, status);
}
// 打印所有数据
System.out.println(all.toString());
}
}

@ -0,0 +1,36 @@
package org.example;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
*
* junit.framework.TestCase
*/
public class AppTest extends TestCase {
/**
*
*
* @param testName
*/
public AppTest(String testName) {
super(testName); // 调用父类的构造函数,设置测试用例的名称
}
/**
*
*
*/
public static Test suite() {
return new TestSuite(AppTest.class); // 创建并返回一个包含当前类中所有测试方法的测试套件
}
/**
*
* assertTrue(true)
*/
public void testApp() {
assertTrue(true); // 测试一个恒真命题,确保测试框架运行正常
}
}

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="main" />
</component>
</module>
Loading…
Cancel
Save