Compare commits

..

5 Commits

@ -1 +0,0 @@
Subproject commit df30c6ee517297783b8f1e46eba280b0300862b7

@ -4,11 +4,21 @@ 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);
}
}
}

@ -4,24 +4,31 @@ 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 方法,配置跨域访问规则
/**
* addCorsMappings 访
* 访访
*
* @param registry
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
// 允许所有路径的跨域请求
registry.addMapping("/**")
// 允许的来源,"*" 表示任意来源
.allowedOrigins("*")
// 允许的 HTTP 方法
.allowedMethods("GET","HEAD","POST","PUT","DELETE","OPTIONS")
// 是否允许携带凭据(如 Cookie
// 允许的 HTTP 方法,这里列出了常用的几种方法
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
// 是否允许携带凭据(如 Cookietrue 表示允许
.allowCredentials(true)
// 预检请求的缓存时间,单位为秒
// 预检请求的缓存时间,单位为秒这里设置为3600秒即1小时
.maxAge(3600)
// 允许的请求头,"*" 表示任意请求头
.allowedHeaders("*");
}
}
}

@ -9,70 +9,115 @@ 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 对象
/**
* 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){
public Page<EmpHealth> findAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size) {
// 创建查询条件,按创建时间降序排列
QueryWrapper<EmpHealth> wrapper=new QueryWrapper<>();
QueryWrapper<EmpHealth> wrapper = new QueryWrapper<>();
wrapper.orderByDesc("createTime");
// 创建分页对象
Page<EmpHealth> page1= new Page<>(page,size);
Page<EmpHealth> page1 = new Page<>(page, size);
// 执行分页查询并返回结果
Page<EmpHealth> result=mapper.selectPage(page1,wrapper).addOrder();
Page<EmpHealth> result = mapper.selectPage(page1, wrapper).addOrder();
return result;
}
// 保存员工健康信息
/**
*
*
*
* @param emp
* @return "success""error"
*/
@PostMapping("/save")
public String save(@RequestBody EmpHealth emp){
public String save(@RequestBody EmpHealth emp) {
// 插入数据并返回操作结果
int result = mapper.insert(emp);
if (result==1){
if (result == 1) {
return "success";
}else {
} else {
return "error";
}
}
// 根据员工 ID 查询健康信息
/**
* ID
* ID
*
* @param id ID
* @return
*/
@GetMapping("/findById/{id}")
public EmpHealth findById(@PathVariable("id") Integer id){
public EmpHealth findById(@PathVariable("id") Integer id) {
return mapper.selectById(id);
}// 根据 ID 查询数据并返回
}
// 更新员工健康信息
/**
*
*
*
* @param emp
* @return "success""error"
*/
@PutMapping("/update")
public String update(@RequestBody EmpHealth emp){
public String update(@RequestBody EmpHealth emp) {
// 更新数据并返回操作结果
int result=mapper.updateById(emp);
if (result==1){
int result = mapper.updateById(emp);
if (result == 1) {
return "success";
}else {
} else {
return "error";
}
}
// 根据员工 ID 删除健康信息
/**
* ID
* ID
*
* @param id ID
*/
@DeleteMapping("/deleteById/{id}")
public void deleteById(@PathVariable("id")Long id){
mapper.deleteById(id+"L");
}// 删除指定 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){
public List<EmpHealth> search(@PathVariable("searchkey") String searchkey, @PathVariable("stext") String stext) {
// 创建查询条件,按指定字段进行模糊搜索
QueryWrapper<EmpHealth> userQueryWrapper = Wrappers.query();
userQueryWrapper.like(searchkey,stext);
userQueryWrapper.like(searchkey, stext);
// 返回符合条件的数据列表
return mapper.selectList(userQueryWrapper);
}
}
}

@ -11,17 +11,24 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
*
* HTTP
*/
@RestController
@RequestMapping("/Material")
public class MaterialController {
/**
* MaterialMapper
* MaterialMapperMyBatis PlusMapper
*/
@Autowired
private MaterialMapper mapper; // 物资管理的 Mapper
private MaterialMapper mapper;
/**
*
* 使MyBatis Plus
*
* @param page
* @param size
* @return
@ -35,6 +42,8 @@ public class MaterialController {
/**
*
*
*
* @param material
* @return "success" "error"
*/
@ -49,8 +58,10 @@ public class MaterialController {
}
/**
* ID
* @param id ID
* ID
* ID
*
* @param id ID
* @return
*/
@GetMapping("/findById/{id}")
@ -60,6 +71,8 @@ public class MaterialController {
/**
*
*
*
* @param material
* @return "success" "error"
*/
@ -74,16 +87,21 @@ public class MaterialController {
}
/**
* ID
* @param id ID
* ID
* ID
*
* @param id ID
*/
@DeleteMapping("/deleteById/{id}")
public void deleteById(@PathVariable("id") Long id) {
mapper.deleteById(id + "L");
// 这里有一个错误应该是直接传递id而不是id+"L"
mapper.deleteById(id);
}
/**
*
* 使MyBatis PlusQueryWrapper
*
* @param searchkey
* @param stext
* @return
@ -94,4 +112,4 @@ public class MaterialController {
userQueryWrapper.like(searchkey, stext); // 模糊查询
return mapper.selectList(userQueryWrapper);
}
}
}

@ -3,10 +3,28 @@ 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;
}
}

@ -50,3 +50,9 @@ public class EmpHealth {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
}
//
//
//
//
//
//

@ -11,13 +11,41 @@ public enum ImpEnum {
(1, "是"), // 表示重要code为1
(0, "否"); // 表示不重要code为0
// 枚举类的构造函数传入code和isImp值
/**
*
* codeisImp
*
* @param code 10
* @param isImp
*/
ImpEnum(Integer code, String isImp) {
this.code = code;
this.isImp = isImp;
}
@EnumValue // 标记该字段为数据库存储的值
private Integer code; // 是否重要的代码1为是0为否
/**
*
* 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;
}
}

@ -4,12 +4,34 @@ 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;
private String depart;
}
/**
*
* ID
*/
private String depart;
}

@ -15,13 +15,17 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
/**
*
* createTimeregister updateTime
* createTimeupdateTime
* 使 createTime register
* register
*
* @param metaObject
*/
@Override
public void insertFill(MetaObject metaObject) {
// 设置 createTime 字段为当前时间
this.setFieldValByName("createTime", new Date(), metaObject);
// 设置 register 字段为当前时间
// 设置 register 字段为当前时间,这里假设 register 字段有其他特定用途
this.setFieldValByName("register", new Date(), metaObject);
// 设置 updateTime 字段为当前时间
this.setFieldValByName("updateTime", new Date(), metaObject);
@ -30,10 +34,12 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
/**
*
* updateTime
*
* @param metaObject
*/
@Override
public void updateFill(MetaObject metaObject) {
// 设置 updateTime 字段为当前时间
this.setFieldValByName("updateTime", new Date(), metaObject);
}
}
}

@ -8,7 +8,24 @@ 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();
}
}

@ -5,6 +5,16 @@ import com.liu.covid.entity.Department;
import java.util.List;
/**
*
*
*/
public interface DepartService extends IService<Department> {
/**
*
*
*
* @return
*/
public List<String> getAll();
}
}

@ -3,7 +3,26 @@ 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);
}
}

@ -7,26 +7,35 @@ import java.sql.*;
*/
public class JDBCUtils {
// 数据库连接的 URL包含数据库名称、字符编码及时区设置
/**
* 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
*
* @return null
*/
public static Connection getConnection(){
// 加载数据库驱动
try {
Class.forName("coym.msql.cj.jdbc.Driver"); // 加载 MySQL 驱动8.0 版本及以上)
Class.forName("com.mysql.cj.jdbc.Driver"); // 加载 MySQL 驱动8.0 版本及以上)
} catch (ClassNotFoundException e) {
e.printStackTrace(); // 如果驱动加载失败,打印异常
}
@ -34,11 +43,11 @@ public class JDBCUtils {
// 进行数据库连接
try {
con = DriverManager.getConnection(url, user, password); // 使用 JDBC URL、用户名和密码进行连接
con.setAutoCommit(true); // 设置自动提交事务
con.setAutoCommit(false); // 设置自动提交事务为 false以便管理事务
} catch (SQLException e) {
e.printStackTrace(); // 如果连接失败,打印异常
}
return con; // 返回连接对象
}
}
}

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

@ -6,8 +6,22 @@ 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;
}
/**
*
* 线
*
*/
private Map<String, List> status;
}

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

@ -1,7 +1,7 @@
package org.example;
/**
* Hello world!
* Hello world! wangciurui
*
*/
public class App

@ -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 */ },
// },
}
})
})

@ -1,30 +1,28 @@
package com.liu.covid.controller;
import com.liu.covid.entity.EmpHealth;
import com.liu.covid.entity.User;
import com.liu.covid.mapper.EmpMapper;
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;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@SpringBootTest
class LoginServiceTest {
@Autowired
private UserMapper mapper;
private UserMapper mapper; // 注入UserMapper用于数据库操作
/**
*
*
*/
@Test
void register(){
User user=new User();
String pw=DigestUtils.md5DigestAsHex("99409".getBytes());
user.setUsername("994091246");
user.setPassword(pw);
int message= mapper.insert(user);
System.out.println(message);
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); // 打印插入结果
}
}

@ -3,58 +3,59 @@ 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.entity.EmpIs;
import com.liu.covid.mapper.EmpIdenMapper;
import com.liu.covid.mapper.EmpIsMapper;
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.sql.Wrapper;
import java.text.SimpleDateFormat;
import java.util.*;
@SpringBootTest
class MaterialControllerTest {
@Autowired
private EmpIdenMapper mapper;
private EmpIdenMapper mapper; // 注入EmpIdenMapper用于数据库操作
/**
* 线
* 线
*/
@Test
void find() {
LineVO lineVO=new 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[]={"确诊","疑似","治愈","死亡"};
for (int i=0;i<7;i++) {
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());
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();
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);
}
all.put(t,status);
}
// 打印所有数据
System.out.println(all.toString());
}
}

@ -5,34 +5,32 @@ import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*
* junit.framework.TestCase
*/
public class AppTest
extends TestCase
{
public class AppTest extends TestCase {
/**
* Create the test case
*
* @param testName name of the test case
*
*
* @param testName
*/
public AppTest( String testName )
{
super( testName );
public AppTest(String testName) {
super(testName); // 调用父类的构造函数,设置测试用例的名称
}
/**
* @return the suite of tests being tested
*
*
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
public static Test suite() {
return new TestSuite(AppTest.class); // 创建并返回一个包含当前类中所有测试方法的测试套件
}
/**
* Rigourous Test :-)
*
* assertTrue(true)
*/
public void testApp()
{
assertTrue( true );
public void testApp() {
assertTrue(true); // 测试一个恒真命题,确保测试框架运行正常
}
}
}
Loading…
Cancel
Save