no message

This commit is contained in:
2026-04-01 07:43:05 +08:00
parent f2387876f9
commit 1e3ac65d34
371 changed files with 49827 additions and 0 deletions

View File

@@ -0,0 +1,212 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.dao
* @author: 李洪涛
* @date: 2025年5月3日 下午8:09:18
*/
package com.chinasofti.dao;
import java.util.List;
import com.chinasofti.model.Clazz;
import com.chinasofti.model.view.Page;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: ClazzDao.java
* @Description: 班级数据层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月3日 下午8:09:18
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月3日 李洪涛 v1.0.0 新建文件
*/
public interface ClazzDao {
/**
*
* @Function: insertClazz
* @Description: 添加
*
* @param: 班级实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public Clazz insertClazz(Clazz clazz);
/**
*
* @Function: updateClazz
* @Description: 修改
*
* @param: 班级实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void updateClazz(Clazz clazz);
/**
*
* @Function: removeClazz
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void removeClazz(long id);
/**
*
* @Function: removeTeacherClazzByClazzId
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void removeTeacherClazzByClazzId(long clazzId);
/**
*
* @Function: findClazzPage
* @Description: 查询所有记录
*
* @param: 班级实体
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Clazz> findClazzPage(Clazz clazz,Page page);
/**
*
* @Function: findClazzsByClazzIds
* @Description: 根据班级查询班级实体
*
* @param: 班级实体
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Clazz> findClazzsByClazzIds(String clazzIds,Clazz clazz,Page page);
/**
*
* @Function: findClazzsByTeacherId
* @Description: 根据教师Id查询班级实体
*
* @param: 教师Id
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Clazz> findClazzsByTeacherId(long teacherId);
/**
*
* @Function: findClazzByClazzName
* @Description: 根据班级名称查询
*
* @param: 班级名称
* @return班级实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public Clazz findClazzByClazzName(String clazzName);
/**
*
* @Function: findClazzsByUserIds
* @Description: 根据责任人查询班级实体
*
* @param: 班级实体
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Clazz> findClazzsByUserIds(String uderIds);
}

View File

@@ -0,0 +1,73 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.dao
* @author: 李洪涛
* @date: 2025年5月3日 下午8:09:18
*/
package com.chinasofti.dao;
import java.util.List;
import com.chinasofti.model.CreditRecords;
import com.chinasofti.model.view.Page;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: CreditRecordsDao.java
* @Description: 学分记录信息数据层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月3日 下午8:09:18
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月3日 李洪涛 v1.0.0 新建文件
*/
public interface CreditRecordsDao {
/**
*
* @Function: insertCreditRecords
* @Description: 添加
*
* @param: 学分实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public CreditRecords insertCreditRecords(Long studentId,CreditRecords creditRecords);
/**
*
* @Function: findCreditRecordsPages
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<CreditRecords> findCreditRecordsPages(String startTime,String endTime,CreditRecords creditRecords,String clazzIds,Page page);
}

View File

@@ -0,0 +1,214 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.dao
* @author: 李洪涛
* @date: 2025年5月9日 下午1:03:49
*/
package com.chinasofti.dao;
import java.util.List;
import com.chinasofti.model.Leave;
import com.chinasofti.model.view.LeaveView;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.TeacherView;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: LeaveDao.java
* @Description: 请假记录数据层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月9日 下午1:03:49
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月9日 李洪涛 v1.0.0 新建文件
*/
public interface LeaveDao {
/**
*
* @Function: insertLeave
* @Description: 添加
*
* @param: 角色实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void insertLeave(Leave leave);
/**
*
* @Function: updateLeave
* @Description: 修改
*
* @param: 角色实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void updateLeave(Leave leave);
/**
*
* @Function: removeLeave
* @Description: 删除
*
* @param: Leave
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void removeLeave(Leave leave);
/**
*
* @Function: findLeavePages
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Leave> findLeavePages(Leave leave,Page page);
/**
*
* @Function: findLeavePagesByClazzIds
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Leave> findLeavePagesByClazzIds(Leave leave,Page page,String clazzIds);
/**
*
* @Function: findLeaveViews
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<LeaveView> findLeaveViews(Leave leave);
/**
*
* @Function: findLeaveViewsByClazzIds
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<LeaveView> findLeaveViewsByClazzIds(Leave leave,String clazzIds);
/**
*
* @Function: findLeaveByTeacherIdsAndStatus
* @Description: 根据教师id与状态查询
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Leave> findLeaveByTeacherIdsAndStatus(String teacherIds);
/**
*
* @Function: findApproveTeacherViews
* @Description: 获取审批教师信息
*
* @param: 教师ID
* @return审批教师实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月17日 上午9:12:14
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月17日 李洪涛 v1.0.0 新建方法
*/
public List<TeacherView> findApproveTeacherViews(Long teacherId);
}

View File

@@ -0,0 +1,50 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.dao
* @author: 李洪涛
* @date: 2025年4月8日 上午9:06:00
*/
package com.chinasofti.dao;
import com.chinasofti.model.Role;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: RoleDao.java
* @Description: 角色类数据层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月8日 上午9:06:00
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月8日 李洪涛 v1.0.0 新建文件
*/
public interface RoleDao {
/**
*
* @Function: findRoleById
* @Description: 根据id查询
*
* @param: id值
* @return角色实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public Role findRoleById(long id);
}

View File

@@ -0,0 +1,174 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.dao
* @author: 李洪涛
* @date: 2025年4月6日 上午10:45:18
*/
package com.chinasofti.dao;
import java.util.List;
import com.chinasofti.model.Student;
import com.chinasofti.model.User;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.StudentView;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: StudentDao.java
* @Description: 学生类数据层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:45:18
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建文件
*/
public interface StudentDao {
/**
*
* @Function: insertStudent
* @Description: 添加
*
* @param: 学生实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public String insertStudent(Student student,User user);
/**
*
* @Function: updateStudent
* @Description: 修改
*
* @param: 学生实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public String updateStudent(Student student,User user);
/**
*
* @Function: removeStudent
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public String removeStudent(String studentIds,String userIds);
/**
*
* @Function: findStudentByUserId
* @Description: 根据id查询
*
* @param: userId值
* @return学生实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public Student findStudentByUserId(long userId);
/**
*
* @Function: findStudentViews
* @Description: 查询所有记录
*
* @param: 学生实体
* @return学生实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<StudentView> findStudentViews(StudentView studentView,Page page);
/**
*
* @Function: findStudentViewsByClazzIds
* @Description: 根据班级查询学生实体
*
* @param: 学生实体
* @return学生实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<StudentView> findStudentViewsByClazzIds(StudentView studentView,String clazzIds,Page page);
/**
*
* @Function: updateStudentScoreNow
* @Description: 修改
*
* @param: 本周学分变动
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void updateStudentScoreNow(int score,Student student);
}

View File

@@ -0,0 +1,214 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.dao
* @author: 李洪涛
* @date: 2025年5月4日 下午10:53:00
*/
package com.chinasofti.dao;
import java.util.List;
import com.chinasofti.model.Teacher;
import com.chinasofti.model.TeacherClazz;
import com.chinasofti.model.User;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.TeacherView;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: TeacherDao.java
* @Description: 教师数据层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月4日 下午10:53:00
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月4日 李洪涛 v1.0.0 新建文件
*/
public interface TeacherDao {
/**
*
* @Function: insertTeacher
* @Description: 添加
*
* @param: 教师实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public String insertTeacher(Teacher teacher,User user,TeacherClazz teacherClazz,String [] clazzIds);
/**
*
* @Function: updateTeacher
* @Description: 修改
*
* @param: 教师实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public String updateTeacher(Teacher teacher,String [] clazzIds,User user);
/**
*
* @Function: removeTeacher
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void removeTeacher(long id);
/**
*
* @Function: findTeacher
* @Description: 查询
*
* @param: 教师实体
* @return教师实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public Teacher findTeacher(Teacher teacher);
/**
*
* @Function: findClazzIdsByTeacherId
* @Description: 查询
*
* @param: teacherID
* @returnList<Long>
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Long> findClazzIdsByTeacherId(Long teacherID);
/**
*
* @Function: findTeacherViews
* @Description: 查询所有记录
*
* @param: 教师实体
* @return教师实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<TeacherView> findTeacherViews(TeacherView teacherView,Page page);
/**
*
* @Function: insertTeacherClazz
* @Description: 添加
*
* @param: 教师与班级关联关系实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public TeacherClazz insertTeacherClazz(TeacherClazz teacherClazz);
/**
*
* @Function: removeTeacherClazz
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void removeTeacherClazz(long teacherId);
/**
*
* @Function: findTeacherByStudentId
* @Description: 查询
*
* @param: 教师实体
* @return教师实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public Teacher findTeacherByStudentId(Long studentId);
}

View File

@@ -0,0 +1,132 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.dao
* @author: 李洪涛
* @date: 2025年4月6日 上午10:45:53
*/
package com.chinasofti.dao;
import java.util.List;
import com.chinasofti.model.User;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: UserDao.java
* @Description: 用户类数据层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:45:53
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建文件
*/
public interface UserDao {
/**
*
* @Function: insertUser
* @Description: 添加
*
* @param: 用户实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public User insertUser(User user);
/**
*
* @Function: updateUser
* @Description: 修改
*
* @param: 用户实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void updateUser(User user);
/**
*
* @Function: removeUser
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void removeUser(long id);
/**
*
* @Function: findUser
* @Description: 查询单个用户
*
* @param: User
* @return用户实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public User findUser(User user);
/**
*
* @Function: findUsers
* @Description: 查询所有记录
*
* @param: 用户实体
* @return用户实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<User> findUsers(User user);
}

View File

@@ -0,0 +1,164 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.dao.impl
* @author: 李洪涛
* @date: 2025年4月6日 上午10:39:52
*/
package com.chinasofti.dao.impl;
import org.apache.commons.dbutils.BasicRowProcessor;
import org.apache.commons.dbutils.GenerousBeanProcessor;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.apache.commons.dbutils.handlers.ScalarHandler;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: BasicDaoImpl.java
* @Description: 该类的功能描述
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:39:52
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建文件
*/
public class BasicDaoImpl {
/**
*
* @Function: getBean
* @Description: 封装查询返回一条记录
*
* @param: 连接
* @param: sql语句
* @param: where条件
* @return实际对象
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:41:11
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public <T> T getBean(Connection conn,String sql,Class<T> type,Object...params) {
QueryRunner runner = new QueryRunner();
BasicRowProcessor basicRowProcessor = new BasicRowProcessor(new GenerousBeanProcessor());
BeanHandler<T> beanHandler = new BeanHandler<T>(type,basicRowProcessor);
try {
T t = runner.query(conn, sql, beanHandler,params);
return t;
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
/**
*
* @Function: getListBean
* @Description: 封装查询返回多条记录
*
* @param: 连接
* @param: sql语句
* @param: where条件
* @return实际对象集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:43:15
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public <T> List<T> getListBean(Connection conn,String sql,Class<T> type,Object...params) {
QueryRunner runner = new QueryRunner();
BasicRowProcessor basicRowProcessor = new BasicRowProcessor(new GenerousBeanProcessor());
BeanListHandler<T> beanListHandler = new BeanListHandler<T>(type,basicRowProcessor);
try {
List<T> list = runner.query(conn, sql, beanListHandler,params);
return list;
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
/**
*
* @Function: update
* @Description: 修改
*
* @param: 连接
* @param: sql语句
* @param: where条件
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:43:15
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public int update(Connection conn,String sql,Object...params) {
int res = 0;
QueryRunner runner = new QueryRunner();
try {
res = runner.update(conn, sql, params);
} catch (SQLException e) {
e.printStackTrace();
}
return res;
}
/**
*
* @Function: insert
* @Description: 新增
*
* @param: 连接
* @param: sql语句
* @param: where条件
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:43:15
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public <T> T insert(Connection conn,String sql,Class<T> type,Object...params) {
QueryRunner runner = new QueryRunner();
try {
T t = runner.insert(conn, sql, new ScalarHandler<T>(),params);
return t;
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
}

View File

@@ -0,0 +1,337 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.dao.impl
* @author: 李洪涛
* @date: 2025年5月3日 下午8:11:53
*/
package com.chinasofti.dao.impl;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.druid.util.StringUtils;
import com.chinasofti.dao.ClazzDao;
import com.chinasofti.model.Clazz;
import com.chinasofti.model.view.Page;
import com.chinasofti.pool.JdbcUtils;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: ClazzDaoImpl.java
* @Description: 班级数据层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月3日 下午8:09:18
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月3日 李洪涛 v1.0.0 新建文件
*/
public class ClazzDaoImpl extends BasicDaoImpl implements ClazzDao {
/**
* @see com.chinasofti.dao.ClazzDao#insertClazz(com.chinasofti.model.Clazz)
* @Function: insertClazz
* @Description: 添加
*
* @param: 班级实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public Clazz insertClazz(Clazz clazz) {
String sql = "INSERT INTO smms_clazz (user_id, clazz_name, clazz_code, clazzs, clazz_ads, create_by, create_time) VALUES (?, ?, ?, ?, ?, ?, ?)";
List<Object> paramList = new ArrayList<Object>();
paramList.add(clazz.getUserId());
paramList.add(clazz.getClazzName());
paramList.add(clazz.getClazzCode());
paramList.add(clazz.getClazzs());
paramList.add(clazz.getClazzAds());
paramList.add(clazz.getCreateBy());
paramList.add(clazz.getCreateTime());
BigInteger primaryKey = insert(JdbcUtils.getConnection(), sql, BigInteger.class,paramList.toArray());
clazz.setId(primaryKey.longValue());
JdbcUtils.closeResource();
return clazz;
}
/**
* @see com.chinasofti.dao.ClazzDao#updateClazz(com.chinasofti.model.Clazz)
* @Function: updateClazz
* @Description: 修改
*
* @param: 班级实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void updateClazz(Clazz clazz) {
String updateBy = " update_by = ?,update_time = ?";
List<Object> paramList = new ArrayList<Object>();
paramList.add(clazz.getUpdateBy());
paramList.add(clazz.getUpdateTime());
String update = "";
if (null != clazz.getUserId() && 0 < clazz.getUserId()) {
update += ",user_id = ?";
paramList.add(clazz.getUserId());
}
if (!StringUtils.isEmpty(clazz.getClazzName())) {
update += ",clazz_name = ?";
paramList.add(clazz.getClazzName());
}
if (!StringUtils.isEmpty(clazz.getClazzCode())) {
update += ",clazz_code = ?";
paramList.add(clazz.getClazzCode());
}
if (!StringUtils.isEmpty(clazz.getClazzs())) {
update += ",clazzs = ?";
paramList.add(clazz.getClazzs());
}
if (!StringUtils.isEmpty(clazz.getClazzAds())) {
update += ",clazz_ads = ?";
paramList.add(clazz.getClazzAds());
}
paramList.add(clazz.getId());
String sql = "update smms_clazz set"+updateBy+update+" where id = ?";
update(JdbcUtils.getConnection(), sql,paramList.toArray());
JdbcUtils.closeResource();
}
/**
* @see com.chinasofti.dao.ClazzDao#removeClazz(long)
* @Function: removeClazz
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void removeClazz(long id) {
String sql = "delete from smms_clazz where id = ?";
update(JdbcUtils.getConnection(), sql,id);
JdbcUtils.closeResource();
}
/**
* @see com.chinasofti.dao.ClazzDao#findClazzPage(com.chinasofti.model.Clazz, com.chinasofti.model.view.Page)
* @Function: findClazzPage
* @Description: 查询所有记录
*
* @param: 班级实体
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Clazz> findClazzPage(Clazz clazz, Page page) {
String sql = "select * from smms_clazz where 1 = 1";
List<Object> paramList = new ArrayList<Object>();
if (!StringUtils.isEmpty(clazz.getClazzName())) {
sql += " and clazz_name like ?";
paramList.add("%"+clazz.getClazzName()+"%");
}
if (null != clazz.getUserId() && clazz.getUserId() > 0) {
sql += " and user_id = ?";
paramList.add(clazz.getUserId());
}
if (!StringUtils.isEmpty(clazz.getClazzAds())) {
sql += " and clazz_ads = ?";;
paramList.add(clazz.getClazzAds());
}
sql += " limit ?,?";
paramList.add(page.getStart());
paramList.add(page.getPageSize());
List<Clazz> clazzs = getListBean(JdbcUtils.getConnection(), sql, Clazz.class,paramList.toArray());
JdbcUtils.closeResource();
return clazzs;
}
/**
* @see com.chinasofti.dao.ClazzDao#findClazzsByClazzIds(java.lang.String, com.chinasofti.model.view.Page)
* @Function: findClazzsByClazzIds
* @Description: 根据班级查询班级实体
*
* @param: 班级实体
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Clazz> findClazzsByClazzIds(String clazzIds,Clazz clazz, Page page) {
String sql = "select * from smms_clazz where 1 = 1";
List<Object> paramList = new ArrayList<Object>();
if (!StringUtils.isEmpty(clazz.getClazzName())) {
sql += " and clazz_name like ?";
paramList.add("%"+clazz.getClazzName()+"%");
}
if (null != clazz.getUserId() && clazz.getUserId() > 0) {
sql += " and user_id = ?";
paramList.add(clazz.getUserId());
}
if (!StringUtils.isEmpty(clazz.getClazzAds())) {
sql += " and clazz_ads = ?";;
paramList.add(clazz.getClazzAds());
}
sql += " and id in ("+clazzIds+") limit ?,?";
paramList.add(page.getStart());
paramList.add(page.getPageSize());
List<Clazz> clazzs = getListBean(JdbcUtils.getConnection(), sql, Clazz.class,paramList.toArray());
JdbcUtils.closeResource();
return clazzs;
}
/**
* @see com.chinasofti.dao.ClazzDao#removeTeacherClazzByClazzId(long)
* @Function: removeTeacherClazzByClazzId
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void removeTeacherClazzByClazzId(long clazzId) {
String sql = "delete from smms_teacher_clazz where clazz_id = ?";
update(JdbcUtils.getConnection(), sql,clazzId);
JdbcUtils.closeResource();
}
/**
* @see com.chinasofti.dao.ClazzDao#findClazzsByTeacherId(long)
* @Function: findClazzsByTeacherId
* @Description: 根据教师Id查询班级实体
*
* @param: 教师Id
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Clazz> findClazzsByTeacherId(long teacherId) {
String sql = "select * from smms_clazz c where EXISTS(SELECT 1 FROM smms_teacher_clazz tc where c.id = tc.clazz_id and tc.teacher_id = ?)";
List<Clazz> clazzs = getListBean(JdbcUtils.getConnection(), sql, Clazz.class,teacherId);
JdbcUtils.closeResource();
return clazzs;
}
/**
* @see com.chinasofti.dao.ClazzDao#findClazzByClazzName(java.lang.String)
* @Function: findClazzByClazzName
* @Description: 根据班级名称查询
*
* @param: 班级名称
* @return班级实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public Clazz findClazzByClazzName(String clazzName) {
String sql = "select * from smms_clazz where clazz_name = ?";
Clazz clazz = getBean(JdbcUtils.getConnection(), sql, Clazz.class,clazzName);;
JdbcUtils.closeResource();
return clazz;
}
/**
* @see com.chinasofti.dao.ClazzDao#findClazzsByUserIds(java.lang.String)
* @Function: findClazzsByUserIds
* @Description: 根据责任人查询班级实体
*
* @param: 班级实体
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Clazz> findClazzsByUserIds(String uderIds) {
List<Object> paramList = new ArrayList<Object>();
String sql = "select * from smms_clazz where user_id in (" +uderIds+")";
List<Clazz> clazzs = getListBean(JdbcUtils.getConnection(), sql, Clazz.class,paramList.toArray());
JdbcUtils.closeResource();
return clazzs;
}
}

View File

@@ -0,0 +1,130 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.dao
* @author: 李洪涛
* @date: 2025年5月3日 下午8:09:18
*/
package com.chinasofti.dao.impl;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.druid.util.StringUtils;
import com.chinasofti.dao.CreditRecordsDao;
import com.chinasofti.model.CreditRecords;
import com.chinasofti.model.view.Page;
import com.chinasofti.pool.JdbcUtils;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: CreditRecordsDaoImpl.java
* @Description: 学分记录信息数据层实现类
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月3日 下午8:09:18
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月3日 李洪涛 v1.0.0 新建文件
*/
public class CreditRecordsDaoImpl extends BasicDaoImpl implements CreditRecordsDao {
/**
* @see com.chinasofti.dao.CreditRecordsDao#insertCreditRecords(com.chinasofti.model.CreditRecords)
* @Function: insertCreditRecords
* @Description: 添加
*
* @param: 学分实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public CreditRecords insertCreditRecords(Long studentId,CreditRecords creditRecords) {
String sql = "INSERT INTO smms_credit_records (credit, credit_type, remark, number, student_name, clazz_id, clazz_name, user_name, create_by, create_time) SELECT ?,?,?,s.number,u.name,c.id,c.clazz_name,?,?,? FROM smms_student s LEFT JOIN smms_clazz c ON s.clazz_id = c.id LEFT JOIN smms_user u ON s.user_id = u.id WHERE s.id = ?;";
List<Object> paramList = new ArrayList<Object>();
paramList.add(creditRecords.getCredit());
paramList.add(creditRecords.getCreditType());
paramList.add(creditRecords.getRemark());
paramList.add(creditRecords.getUserName());
paramList.add(creditRecords.getCreateBy());
paramList.add(creditRecords.getCreateTime());
paramList.add(studentId);
BigInteger primaryKey = insert(JdbcUtils.getConnection(), sql, BigInteger.class,paramList.toArray());
creditRecords.setId(primaryKey.longValue());
JdbcUtils.closeResource();
return creditRecords;
}
/**
* @see com.chinasofti.dao.CreditRecordsDao#findCreditRecordsPages(com.chinasofti.model.CreditRecords, com.chinasofti.model.view.Page)
* @Function: findCreditRecordsPages
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<CreditRecords> findCreditRecordsPages(String startTime,String endTime,CreditRecords creditRecords,String clazzIds, Page page) {
String sql = "select * from smms_credit_records where 1 = 1";
if (!StringUtils.isEmpty(clazzIds)) {
sql = "select * from smms_credit_records where clazz_id in ("+clazzIds+")";
}
List<Object> paramList = new ArrayList<Object>();
if (!StringUtils.isEmpty(startTime)) {
sql += " and create_time >= ?";
paramList.add(startTime);
}
if (!StringUtils.isEmpty(endTime)) {
sql += " and create_time <= ?";
paramList.add(endTime);
}
if (!StringUtils.isEmpty(creditRecords.getStudentName())) {
sql += " and student_name like ?";
paramList.add("%"+creditRecords.getStudentName()+"%");
}
if (null != creditRecords.getNumber() && creditRecords.getNumber() > 0) {
sql += " and number = ?";
paramList.add(creditRecords.getNumber());
}
if (!StringUtils.isEmpty(creditRecords.getClazzName())) {
sql += " and clazz_name like ?";
paramList.add("%"+creditRecords.getClazzName()+"%");
}
if (!StringUtils.isEmpty(creditRecords.getCreditType())) {
sql += " and credit_type = ?";
paramList.add(creditRecords.getCreditType());
}
sql += " limit ?,?";
paramList.add(page.getStart());
paramList.add(page.getPageSize());
List<CreditRecords> res = getListBean(JdbcUtils.getConnection(), sql, CreditRecords.class,paramList.toArray());
JdbcUtils.closeResource();
return res;
}
}

View File

@@ -0,0 +1,370 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.dao.impl
* @author: 李洪涛
* @date: 2025年5月9日 下午1:07:54
*/
package com.chinasofti.dao.impl;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.druid.util.StringUtils;
import com.chinasofti.dao.LeaveDao;
import com.chinasofti.enums.LeaveStatus;
import com.chinasofti.model.Leave;
import com.chinasofti.model.view.LeaveView;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.TeacherView;
import com.chinasofti.pool.JdbcUtils;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: LeaveDaoImpl.java
* @Description: 请假记录数据层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月9日 下午1:03:49
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月9日 李洪涛 v1.0.0 新建文件
*/
public class LeaveDaoImpl extends BasicDaoImpl implements LeaveDao {
/**
* @see com.chinasofti.dao.LeaveDao#insertLeave(com.chinasofti.model.Leave)
* @Function: insertLeave
* @Description: 添加
*
* @param: 角色实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void insertLeave(Leave leave) {
String sql = "INSERT INTO smms_leave (student_id, teacher_id, info, status, apply_time, create_by, create_time) VALUES (?,?,?,?,?,?,?)";
List<Object> paramList = new ArrayList<Object>();
paramList.add(leave.getStudentId());
paramList.add(leave.getTeacherId());
paramList.add(leave.getInfo());
paramList.add(leave.getStatus());
paramList.add(leave.getApplyTime());
paramList.add(leave.getCreateBy());
paramList.add(leave.getCreateTime());
insert(JdbcUtils.getConnection(), sql, BigInteger.class,paramList.toArray());
JdbcUtils.closeResource();
}
/**
* @see com.chinasofti.dao.LeaveDao#updateLeave(com.chinasofti.model.Leave)
* @Function: updateLeave
* @Description: 修改
*
* @param: 角色实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void updateLeave(Leave leave) {
String updateBy = " update_by = ?,update_time = ?";
List<Object> paramList = new ArrayList<Object>();
paramList.add(leave.getUpdateBy());
paramList.add(leave.getUpdateTime());
String update = "";
if (!StringUtils.isEmpty(leave.getStatus())) {
update += ",status = ?";
paramList.add(leave.getStatus());
}
if (!StringUtils.isEmpty(leave.getRemark())) {
update += ",remark = ?";
paramList.add(leave.getRemark());
}
if (null != leave.getApproveTime()) {
update += ",approve_time = ?";
paramList.add(leave.getApproveTime());
}
paramList.add(leave.getId());
String sql = "update smms_leave set"+updateBy+update+" where id = ?";
update(JdbcUtils.getConnection(), sql,paramList.toArray());
JdbcUtils.closeResource();
}
/**
* @see com.chinasofti.dao.LeaveDao#removeLeave(long)
* @Function: removeLeave
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void removeLeave(Leave leave) {
if (null != leave.getStudentId() && leave.getStudentId() > 0) {
String sql = "delete from smms_leave where student_id = ?";
update(JdbcUtils.getConnection(), sql,leave.getStudentId());
JdbcUtils.closeResource();
}
if (null != leave.getTeacherId() && leave.getTeacherId() > 0) {
String sql = "delete from smms_leave where teacher_id = ?";
update(JdbcUtils.getConnection(), sql,leave.getTeacherId());
JdbcUtils.closeResource();
}
}
/**
* @see com.chinasofti.dao.LeaveDao#findfindLeavePages(com.chinasofti.model.Leave, com.chinasofti.model.view.Page)
* @Function: findLeavePages
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Leave> findLeavePages(Leave leave, Page page) {
String sql = "select * from smms_leave where 1 = 1";
List<Object> paramList = new ArrayList<Object>();
if (null != leave.getStudentId() && leave.getStudentId() > 0) {
sql += " and student_id = ?";
paramList.add(leave.getStudentId());
}
if (null != leave.getTeacherId() && leave.getTeacherId() > 0) {
sql += " and teacher_id = ?";
paramList.add(leave.getTeacherId());
}
if (!StringUtils.isEmpty(leave.getStatus())) {
sql += " and status = ?";
paramList.add(leave.getStatus());
}
sql += " limit ?,?";
paramList.add(page.getStart());
paramList.add(page.getPageSize());
List<Leave> res = getListBean(JdbcUtils.getConnection(), sql, Leave.class,paramList.toArray());
JdbcUtils.closeResource();
return res;
}
/**
* @see com.chinasofti.dao.LeaveDao#findLeaveViews(com.chinasofti.model.Leave)
* @Function: findLeaveViews
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<LeaveView> findLeaveViews(Leave leave) {
String sql = "select (select u1.name from smms_user u1,smms_student s where u1.id = s.user_id and s.id = l.student_id) student_name,(select u2.name from smms_user u2,smms_teacher t where u2.id = t.user_id and t.id = l.teacher_id) teacher_name,l.info,(CASE WHEN l.`status` = '0' THEN '等待审核' WHEN l.`status` = 1 THEN '审核通过' ELSE '审核不通过' END) AS `status`,l.remark,l.apply_time,l.approve_time from smms_leave l where 1 = 1";
List<Object> paramList = new ArrayList<Object>();
if (null != leave.getStudentId() && leave.getStudentId() > 0) {
sql += " and l.student_id = ?";
paramList.add(leave.getStudentId());
}
if (null != leave.getTeacherId() && leave.getTeacherId() > 0) {
sql += " and l.teacher_id = ?";
paramList.add(leave.getTeacherId());
}
if (!StringUtils.isEmpty(leave.getStatus())) {
sql += " and l.status = ?";
paramList.add(leave.getStatus());
}
List<LeaveView> res = getListBean(JdbcUtils.getConnection(), sql, LeaveView.class,paramList.toArray());
JdbcUtils.closeResource();
return res;
}
/**
* @see com.chinasofti.dao.LeaveDao#findLeaveByTeacherIdsAndStatus(java.lang.String)
* @Function: findLeaveByTeacherIdsAndStatus
* @Description: 根据教师id与状态查询
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Leave> findLeaveByTeacherIdsAndStatus(String teacherIds) {
List<Object> paramList = new ArrayList<Object>();
String sql = "select * from smms_leave where status = ? and teacher_id in (" +teacherIds+")";
paramList.add(LeaveStatus.WAIT.getstatus());
List<Leave> res = getListBean(JdbcUtils.getConnection(), sql, Leave.class,paramList.toArray());
JdbcUtils.closeResource();
return res;
}
/**
* @see com.chinasofti.dao.LeaveDao#findLeavePagesByClazzIds(com.chinasofti.model.Leave, com.chinasofti.model.view.Page, java.lang.String)
* @Function: findLeavePagesByClazzIds
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Leave> findLeavePagesByClazzIds(Leave leave, Page page, String clazzIds) {
String sql = "select l.* from smms_leave l where EXISTS (select 1 from smms_student s where s.id = l.student_id and s.clazz_id in ("+clazzIds+"))";
List<Object> paramList = new ArrayList<Object>();
if (null != leave.getStudentId() && leave.getStudentId() > 0) {
sql += " and l.student_id = ?";
paramList.add(leave.getStudentId());
}
if (null != leave.getTeacherId() && leave.getTeacherId() > 0) {
sql += " and l.teacher_id = ?";
paramList.add(leave.getTeacherId());
}
if (!StringUtils.isEmpty(leave.getStatus())) {
sql += " and l.status = ?";
paramList.add(leave.getStatus());
}
sql += " limit ?,?";
paramList.add(page.getStart());
paramList.add(page.getPageSize());
List<Leave> res = getListBean(JdbcUtils.getConnection(), sql, Leave.class,paramList.toArray());
JdbcUtils.closeResource();
return res;
}
/**
* @see com.chinasofti.dao.LeaveDao#findLeaveViewsByClazzIds(com.chinasofti.model.Leave, java.lang.String)
* @Function: findLeaveViewsByClazzIds
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<LeaveView> findLeaveViewsByClazzIds(Leave leave, String clazzIds) {
String sql = "select (select u1.name from smms_user u1,smms_student s where u1.id = s.user_id and s.id = l.student_id) student_name,(select u2.name from smms_user u2,smms_teacher t where u2.id = t.user_id and t.id = l.teacher_id) teacher_name,l.info,(CASE WHEN l.`status` = '0' THEN '等待审核' WHEN l.`status` = 1 THEN '审核通过' ELSE '审核不通过' END) AS `status`,l.remark,l.apply_time,l.approve_time from smms_leave l where EXISTS (select 1 from smms_student s where s.id = l.student_id and s.clazz_id in ("+clazzIds+"))";
List<Object> paramList = new ArrayList<Object>();
if (null != leave.getStudentId() && leave.getStudentId() > 0) {
sql += " and l.student_id = ?";
paramList.add(leave.getStudentId());
}
if (null != leave.getTeacherId() && leave.getTeacherId() > 0) {
sql += " and l.teacher_id = ?";
paramList.add(leave.getTeacherId());
}
if (!StringUtils.isEmpty(leave.getStatus())) {
sql += " and l.status = ?";
paramList.add(leave.getStatus());
}
List<LeaveView> res = getListBean(JdbcUtils.getConnection(), sql, LeaveView.class,paramList.toArray());
JdbcUtils.closeResource();
return res;
}
/**
* @see com.chinasofti.dao.LeaveDao#findApproveTeacherViews(long)
* @Function: findApproveTeacherViews
* @Description: 获取审批教师信息
*
* @param: 教师ID
* @return审批教师实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月17日 上午9:12:14
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月17日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<TeacherView> findApproveTeacherViews(Long teacherId) {
String sql = "select distinct u.id user_id,t.id teacher_id,u.name,u.sex,u.user_name,u.phone,t.is_counselor from smms_teacher t,smms_user u,smms_clazz c where t.user_id = u.id and u.id = c.user_id";
List<Object> paramList = new ArrayList<Object>();
if (null != teacherId && teacherId > 0) {
sql += " and exists(select 1 from smms_teacher_clazz tc where c.id = tc.clazz_id and tc.teacher_id = ?)";
paramList.add(teacherId);
}
List<TeacherView> res = getListBean(JdbcUtils.getConnection(), sql, TeacherView.class,paramList.toArray());
JdbcUtils.closeResource();
return res;
}
}

View File

@@ -0,0 +1,58 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.dao.impl
* @author: 李洪涛
* @date: 2025年4月8日 上午9:13:06
*/
package com.chinasofti.dao.impl;
import com.chinasofti.dao.RoleDao;
import com.chinasofti.model.Role;
import com.chinasofti.pool.JdbcUtils;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: RoleDaoImpl.java
* @Description: 角色类数据层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月8日 上午9:13:06
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月8日 李洪涛 v1.0.0 新建文件
*/
public class RoleDaoImpl extends BasicDaoImpl implements RoleDao {
/**
* @see com.chinasofti.dao.RoleDao#findRoleById(long)
* @Function: findRoleById
* @Description: 根据id查询
*
* @param: id值
* @return角色实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public Role findRoleById(long id) {
String sql = "select * from smms_role where id = ?";
Role role = getBean(JdbcUtils.getConnection(), sql, Role.class,id);
JdbcUtils.closeResource();
return role;
}
}

View File

@@ -0,0 +1,370 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.dao
* @author: 李洪涛
* @date: 2025年3月27日 上午10:57:29
*/
package com.chinasofti.dao.impl;
import java.math.BigInteger;
import java.sql.Connection;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.druid.util.StringUtils;
import com.chinasofti.dao.StudentDao;
import com.chinasofti.enums.OperationResult;
import com.chinasofti.model.Student;
import com.chinasofti.model.User;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.StudentView;
import com.chinasofti.pool.JdbcUtils;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: StudentDao.java
* @Description: 学生类数据层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午10:57:29
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建文件
*/
public class StudentDaoImpl extends BasicDaoImpl implements StudentDao {
/**
* @see com.chinasofti.dao.StudentDao#insertStudent(com.chinasofti.model.Student)
* @Function: StudentDaoImpl.java
* @Description: 该函数的功能描述
*
* @param:描述1描述
* @return返回结果描述
* @throws异常描述
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月3日 上午9:03:35
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月3日 李洪涛 v1.0.0 新建方法
*/
@Override
public String insertStudent(Student student,User user) {
String res = OperationResult.ERROR.getResult();
try {
Connection connection = JdbcUtils.getAutoConnection();
String sql2 = "INSERT INTO smms_user (role_id, name, sex, user_name, pass_word, phone, create_by, create_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
List<Object> paramList2 = new ArrayList<Object>();
paramList2.add(user.getRoleId());
paramList2.add(user.getName());
paramList2.add(user.getSex());
paramList2.add(user.getUserName());
paramList2.add(user.getPassWord());
paramList2.add(user.getPhone());
paramList2.add(user.getCreateBy());
paramList2.add(user.getCreateTime());
BigInteger primaryKey2 = insert(connection, sql2, BigInteger.class,paramList2.toArray());
user.setId(primaryKey2.longValue());
String sql1 = "INSERT INTO smms_student (clazz_id, user_id, number, birthday, major, honor, score_now, create_by, create_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);";
List<Object> paramList1 = new ArrayList<Object>();
paramList1.add(student.getClazzId());
paramList1.add(user.getId());
paramList1.add(student.getNumber());
paramList1.add(student.getBirthday());
paramList1.add(student.getMajor());
paramList1.add(student.getHonor());
paramList1.add(student.getScoreNow());
paramList1.add(student.getCreateBy());
paramList1.add(student.getCreateTime());
BigInteger primaryKey1 = insert(connection, sql1, BigInteger.class,paramList1.toArray());
student.setId(primaryKey1.longValue());
connection.commit();
res = OperationResult.SUCCESS.getResult();
} catch (SQLException e) {
e.printStackTrace();
} finally {
JdbcUtils.closeResource();
}
return res;
}
/**
* @see com.chinasofti.dao.StudentDao#updateStudent(com.chinasofti.model.Student)
* @Function: StudentDaoImpl.java
* @Description: 该函数的功能描述
*
* @param:描述1描述
* @return返回结果描述
* @throws异常描述
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月3日 上午9:03:35
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月3日 李洪涛 v1.0.0 新建方法
*/
@Override
public String updateStudent(Student student,User user) {
String res = OperationResult.ERROR.getResult();
try {
Connection connection = JdbcUtils.getAutoConnection();
String updateBy1 = " update_by = ?,update_time = ?";
List<Object> paramList1 = new ArrayList<Object>();
paramList1.add(student.getUpdateBy());
paramList1.add(student.getUpdateTime());
String update1 = "";
if (null != student.getNumber() && 0 < student.getNumber()) {
update1 += ",number = ?";
paramList1.add(student.getNumber());
}
if (!StringUtils.isEmpty(student.getHonor())) {
update1 += ",honor = ?";
paramList1.add(student.getHonor());
}
if (null != student.getClazzId() && 0 < student.getClazzId()) {
update1 += ",clazz_id = ?";
paramList1.add(student.getClazzId());
}
if (0 < student.getScoreNow()) {
update1 += ",score_now = ?";
paramList1.add(student.getScoreNow());
}
paramList1.add(student.getId());
String sql1 = "update smms_student set"+updateBy1+update1+" where id = ?";
String updateBy2 = " update_by = ?,update_time = ?";
List<Object> paramList2 = new ArrayList<Object>();
paramList2.add(user.getUserName());
paramList2.add(LocalDateTime.now());
String update2 = "";
if (!StringUtils.isEmpty(user.getPassWord())) {
update2 += ",pass_word = ?";
paramList2.add(user.getPassWord());
}
if (!StringUtils.isEmpty(user.getName())) {
update2 += ",name = ?";
paramList2.add(user.getName());
}
if (!StringUtils.isEmpty(user.getSex())) {
update2 += ",sex = ?";
paramList2.add(user.getSex());
}
if (!StringUtils.isEmpty(user.getUserName())) {
update2 += ",user_name = ?";
paramList2.add(user.getUserName());
}
if (!StringUtils.isEmpty(user.getPhone())) {
update2 += ",phone = ?";
paramList2.add(user.getPhone());
}
paramList2.add(user.getId());
String sql2 = "update smms_user set"+updateBy2+update2+"where id = ?";
int res1 = update(connection, sql1,paramList1.toArray());
int res2 = update(connection, sql2,paramList2.toArray());
if (res1+res2 > 0) {
res = OperationResult.SUCCESS.getResult();
}
connection.commit();
} catch (SQLException e) {
e.printStackTrace();
} finally {
JdbcUtils.closeResource();
}
return res;
}
/**
* @see com.chinasofti.dao.StudentDao#removeStudent(long)
* @Function: StudentDaoImpl.java
* @Description: 该函数的功能描述
*
* @param:描述1描述
* @return返回结果描述
* @throws异常描述
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月3日 上午9:03:35
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月3日 李洪涛 v1.0.0 新建方法
*/
@Override
public String removeStudent(String studentIds,String userIds) {
String res = OperationResult.ERROR.getResult();
try {
String sql1 = "delete from smms_student where id in ("+studentIds+")";
String sql2 = "delete from smms_leave where student_id in ("+studentIds+")";
String sql3 = "delete from smms_user where id in ("+userIds+")";
List<Object> paramList = new ArrayList<Object>();
Connection connection = JdbcUtils.getAutoConnection();
update(connection, sql1,paramList.toArray());
update(connection, sql2,paramList.toArray());
int updateCount = update(connection, sql3,paramList.toArray());
if (updateCount > 0) {
res = OperationResult.SUCCESS.getResult();
}
connection.commit();
} catch (SQLException e) {
e.printStackTrace();
} finally {
JdbcUtils.closeResource();
}
return res;
}
/**
* @see com.chinasofti.dao.StudentDao#findStudentByUserId(long)
* @Function: findStudentByUserId
* @Description: 根据id查询
*
* @param: userId值
* @return学生实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public Student findStudentByUserId(long userId) {
String sql = "select * from smms_student where user_id = ?";
Student resStudent = getBean(JdbcUtils.getConnection(), sql, Student.class,userId);
JdbcUtils.closeResource();
return resStudent;
}
/**
* @see com.chinasofti.dao.StudentDao#findStudentViews(com.chinasofti.model.Student, com.chinasofti.model.view.Page)
* @Function: findStudentViews
* @Description: 查询所有记录
*
* @param: 学生实体
* @return学生实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<StudentView> findStudentViews(StudentView studentView, Page page) {
String sql = "select u.id user_id ,s.id student_id,u.name,u.phone,u.sex,u.user_name,s.number,s.birthday,s.major,s.honor,s.score_now,s.clazz_id from smms_user u,smms_student s where u.id = s.user_id";
List<Object> paramList = new ArrayList<Object>();
if (!StringUtils.isEmpty(studentView.getName())) {
sql += " and u.name like ?";
paramList.add("%"+studentView.getName()+"%");
}
if (null != studentView.getClazzId() && studentView.getClazzId() > 0) {
sql += " and s.clazz_id = ?";
paramList.add(studentView.getClazzId());
}
sql += " limit ?,?";
paramList.add(page.getStart());
paramList.add(page.getPageSize());
List<StudentView> res = getListBean(JdbcUtils.getConnection(), sql, StudentView.class,paramList.toArray());
JdbcUtils.closeResource();
return res;
}
/**
* @see com.chinasofti.dao.StudentDao#findStudentViewsByClazzIds(java.lang.String, com.chinasofti.model.view.Page)
* @Function: findStudentViewsByClazzIds
* @Description: 根据班级查询学生实体
*
* @param: 学生实体
* @return学生实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<StudentView> findStudentViewsByClazzIds(StudentView studentView,String clazzIds, Page page) {
String sql = "select u.id user_id ,s.id student_id,u.name,u.phone,u.sex,u.user_name,s.number,s.birthday,s.major,s.honor,s.score_now,s.clazz_id from smms_user u,smms_student s where u.id = s.user_id and s.clazz_id in ("+clazzIds+")";
List<Object> paramList = new ArrayList<Object>();
if (!StringUtils.isEmpty(studentView.getName())) {
sql += " and u.name like ?";
paramList.add("%"+studentView.getName()+"%");
}
if (null != studentView.getClazzId() && studentView.getClazzId() > 0) {
sql += " and s.clazz_id = ?";
paramList.add(studentView.getClazzId());
}
sql += " limit ?,?";
paramList.add(page.getStart());
paramList.add(page.getPageSize());
List<StudentView> res = getListBean(JdbcUtils.getConnection(), sql, StudentView.class,paramList.toArray());
JdbcUtils.closeResource();
return res;
}
/**
* @see com.chinasofti.dao.StudentDao#updateStudentScoreNow(int)
* @Function: updateStudentScoreNow
* @Description: 修改
*
* @param: 本周学分变动
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void updateStudentScoreNow(int score,Student student) {
List<Object> paramList = new ArrayList<Object>();
paramList.add(score);
paramList.add(student.getUpdateBy());
paramList.add(student.getUpdateTime());
paramList.add(student.getId());
String sql = "update smms_student set score_now = score_now + ?,update_by = ?,update_time = ? where id = ?";
update(JdbcUtils.getConnection(), sql,paramList.toArray());
JdbcUtils.closeResource();
}
}

View File

@@ -0,0 +1,417 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.dao.impl
* @author: 李洪涛
* @date: 2025年5月4日 下午10:55:15
*/
package com.chinasofti.dao.impl;
import java.math.BigInteger;
import java.sql.Connection;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.druid.util.StringUtils;
import com.chinasofti.dao.TeacherDao;
import com.chinasofti.enums.OperationResult;
import com.chinasofti.model.Teacher;
import com.chinasofti.model.TeacherClazz;
import com.chinasofti.model.User;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.TeacherView;
import com.chinasofti.pool.JdbcUtils;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: TeacherDaoImpl.java
* @Description: 教师数据层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月4日 下午10:55:15
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月4日 李洪涛 v1.0.0 新建文件
*/
public class TeacherDaoImpl extends BasicDaoImpl implements TeacherDao{
/**
* @see com.chinasofti.dao.TeacherDao#insertTeacher(com.chinasofti.model.Teacher)
* @Function: insertTeacher
* @Description: 添加
*
* @param: 教师实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public String insertTeacher(Teacher teacher,User user,TeacherClazz teacherClazz,String [] clazzIds) {
String res = OperationResult.ERROR.getResult();
try {
Connection connection = JdbcUtils.getAutoConnection();
String sql1 = "INSERT INTO smms_user (role_id, name, sex, user_name, pass_word, phone, create_by, create_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
List<Object> paramList1 = new ArrayList<Object>();
paramList1.add(user.getRoleId());
paramList1.add(user.getName());
paramList1.add(user.getSex());
paramList1.add(user.getUserName());
paramList1.add(user.getPassWord());
paramList1.add(user.getPhone());
paramList1.add(user.getCreateBy());
paramList1.add(user.getCreateTime());
BigInteger primaryKey1 = insert(connection, sql1, BigInteger.class,paramList1.toArray());
user.setId(primaryKey1.longValue());
String sql2 = "INSERT INTO smms_teacher (user_id, is_counselor, create_by, create_time) VALUES (?, ?, ?, ?);";
List<Object> paramList2 = new ArrayList<Object>();
paramList2.add(user.getId());
paramList2.add(teacher.getIsCounselor());
paramList2.add(teacher.getCreateBy());
paramList2.add(teacher.getCreateTime());
BigInteger primaryKey2 = insert(connection, sql2, BigInteger.class,paramList2.toArray());
teacher.setId(primaryKey2.longValue());
for (String clazzId : clazzIds) {
teacherClazz.setClazzId(Long.parseLong(clazzId));
String sql = "INSERT INTO smms_teacher_clazz (teacher_id, clazz_id) VALUES (?, ?);";
List<Object> paramList = new ArrayList<Object>();
paramList.add(teacher.getId());
paramList.add(teacherClazz.getClazzId());
insert(JdbcUtils.getConnection(), sql, BigInteger.class,paramList.toArray());
}
connection.commit();
res = OperationResult.SUCCESS.getResult();
} catch (SQLException e) {
e.printStackTrace();
} finally {
JdbcUtils.closeResource();
}
return res;
}
/**
* @see com.chinasofti.dao.TeacherDao#updateTeacher(com.chinasofti.model.Teacher)
* @Function: updateTeacher
* @Description: 修改
*
* @param: 教师实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public String updateTeacher(Teacher teacher,String [] clazzIds,User user) {
String res = OperationResult.ERROR.getResult();
try {
Connection connection = JdbcUtils.getAutoConnection();
String updateBy1 = " update_by = ?,update_time = ?";
List<Object> paramList1 = new ArrayList<Object>();
paramList1.add(teacher.getUpdateBy());
paramList1.add(teacher.getUpdateTime());
String update1 = "";
if (!StringUtils.isEmpty(teacher.getIsCounselor())) {
update1 += ",is_counselor = ?";
paramList1.add(teacher.getIsCounselor());
}
paramList1.add(teacher.getId());
String sql1 = "update smms_teacher set"+updateBy1+update1+" where id = ?";
update(connection, sql1,paramList1.toArray());
String updateBy2 = " update_by = ?,update_time = ?";
List<Object> paramList2 = new ArrayList<Object>();
paramList2.add(user.getUserName());
paramList2.add(LocalDateTime.now());
String update2 = "";
if (!StringUtils.isEmpty(user.getPassWord())) {
update2 += ",pass_word = ?";
paramList2.add(user.getPassWord());
}
if (!StringUtils.isEmpty(user.getName())) {
update2 += ",name = ?";
paramList2.add(user.getName());
}
if (!StringUtils.isEmpty(user.getSex())) {
update2 += ",sex = ?";
paramList2.add(user.getSex());
}
if (!StringUtils.isEmpty(user.getUserName())) {
update2 += ",user_name = ?";
paramList2.add(user.getUserName());
}
if (!StringUtils.isEmpty(user.getPhone())) {
update2 += ",phone = ?";
paramList2.add(user.getPhone());
}
paramList2.add(user.getId());
String sql2 = "update smms_user set"+updateBy2+update2+"where id = ?";
update(connection, sql2,paramList2.toArray());
String sql3 = "delete from smms_teacher_clazz where teacher_id = ?";
update(connection, sql3,teacher.getId());
for (String clazzId : clazzIds) {
TeacherClazz teacherClazz = new TeacherClazz();
teacherClazz.setTeacherId(teacher.getId());
teacherClazz.setClazzId(Long.parseLong(clazzId));
String sql = "INSERT INTO smms_teacher_clazz (teacher_id, clazz_id) VALUES (?, ?);";
List<Object> paramList = new ArrayList<Object>();
paramList.add(teacherClazz.getTeacherId());
paramList.add(teacherClazz.getClazzId());
BigInteger primaryKey = insert(JdbcUtils.getConnection(), sql, BigInteger.class,paramList.toArray());
teacherClazz.setId(primaryKey.longValue());
}
connection.commit();
res = OperationResult.SUCCESS.getResult();
} catch (SQLException e) {
e.printStackTrace();
} finally {
JdbcUtils.closeResource();
}
return res;
}
/**
* @see com.chinasofti.dao.TeacherDao#removeTeacher(long)
* @Function: removeTeacher
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void removeTeacher(long id) {
String sql = "delete from smms_teacher where id = ?";
update(JdbcUtils.getConnection(), sql,id);
JdbcUtils.closeResource();
}
/**
* @see com.chinasofti.dao.TeacherDao#findTeacher(com.chinasofti.model.Teacher)
* @Function: findTeacher
* @Description: 查询
*
* @param: 教师实体
* @return教师实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public Teacher findTeacher(Teacher teacher) {
List<Object> paramList = new ArrayList<Object>();
String where = "";
if (null != teacher.getUserId() && teacher.getUserId() > 0) {
where += " and user_id = ?";
paramList.add(teacher.getUserId());
}
String sql = "select * from smms_teacher where 1=1" + where;
Teacher resTeacher = getBean(JdbcUtils.getConnection(), sql, Teacher.class,paramList.toArray());
JdbcUtils.closeResource();
return resTeacher;
}
/**
* @see com.chinasofti.dao.TeacherDao#findClazzIdsByTeacherId(java.lang.Long)
* @Function: findClazzIdsByTeacherId
* @Description: 查询
*
* @param: teacherID
* @returnList<Long>
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Long> findClazzIdsByTeacherId(Long teacherID) {
String sql = "select * from smms_teacher_clazz where teacher_id = ?";
List<TeacherClazz> teacherClazzs = getListBean(JdbcUtils.getConnection(), sql, TeacherClazz.class,teacherID);
List<Long> clazzIds = new ArrayList<Long>();
for (TeacherClazz teacherClazz : teacherClazzs) {
clazzIds.add(teacherClazz.getClazzId());
}
JdbcUtils.closeResource();
return clazzIds;
}
/**
* @see com.chinasofti.dao.TeacherDao#findTeacherViews(com.chinasofti.model.view.TeacherView, com.chinasofti.model.view.Page)
* @Function: findTeacherViews
* @Description: 查询所有记录
*
* @param: 教师实体
* @return教师实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<TeacherView> findTeacherViews(TeacherView teacherView, Page page) {
String sqlExists = "";
String sqlWhere = "";
List<Object> paramList = new ArrayList<Object>();
if (null != teacherView.getClazzId() && teacherView.getClazzId() > 0) {
sqlExists += " and tc.clazz_id = ?";
paramList.add(teacherView.getClazzId());
}
if (!StringUtils.isEmpty(teacherView.getName())) {
sqlWhere += " and u.name like ?";
paramList.add("%"+teacherView.getName()+"%");
}
if (null != teacherView.getUserId() && teacherView.getUserId() > 0) {
sqlWhere += " and u.id = ?";
paramList.add(teacherView.getUserId());
}
String sql = "select u.id user_id,t.id teacher_id,u.name,u.sex,u.user_name,u.phone,t.is_counselor from smms_teacher t,smms_user u where t.user_id = u.id and EXISTS(SELECT 1 FROM smms_teacher_clazz tc where t.id = tc.teacher_id"+sqlExists+")";
sql += sqlWhere;
sql += " limit ?,?";
paramList.add(page.getStart());
paramList.add(page.getPageSize());
List<TeacherView> res = getListBean(JdbcUtils.getConnection(), sql, TeacherView.class,paramList.toArray());
JdbcUtils.closeResource();
return res;
}
/**
* @see com.chinasofti.dao.TeacherDao#insertTeacherClazz(com.chinasofti.model.TeacherClazz)
* @Function: insertTeacherClazz
* @Description: 添加
*
* @param: 教师与班级关联关系实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public TeacherClazz insertTeacherClazz(TeacherClazz teacherClazz) {
String sql = "INSERT INTO smms_teacher_clazz (teacher_id, clazz_id) VALUES (?, ?);";
List<Object> paramList = new ArrayList<Object>();
paramList.add(teacherClazz.getTeacherId());
paramList.add(teacherClazz.getClazzId());
BigInteger primaryKey = insert(JdbcUtils.getConnection(), sql, BigInteger.class,paramList.toArray());
teacherClazz.setId(primaryKey.longValue());
JdbcUtils.closeResource();
return teacherClazz;
}
/**
* @see com.chinasofti.dao.TeacherDao#removeTeacherClazz(long)
* @Function: removeTeacherClazz
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void removeTeacherClazz(long teacherId) {
String sql = "delete from smms_teacher_clazz where teacher_id = ?";
update(JdbcUtils.getConnection(), sql,teacherId);
JdbcUtils.closeResource();
}
/**
* @see com.chinasofti.dao.TeacherDao#findTeacherByStudentId(java.lang.Long)
* @Function: findTeacherByStudentId
* @Description: 查询
*
* @param: 教师实体
* @return教师实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public Teacher findTeacherByStudentId(Long studentId) {
String sql = "select * from smms_teacher where user_id = (select c.user_id from smms_student s ,smms_clazz c,smms_user u where s.clazz_id = c.id and c.user_id = u.id and s.id = ?)";
Teacher resTeacher = getBean(JdbcUtils.getConnection(), sql, Teacher.class,studentId);
JdbcUtils.closeResource();
return resTeacher;
}
}

View File

@@ -0,0 +1,221 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.dao
* @author: 李洪涛
* @date: 2025年3月27日 上午10:58:43
*/
package com.chinasofti.dao.impl;
import java.math.BigInteger;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.druid.util.StringUtils;
import com.chinasofti.dao.UserDao;
import com.chinasofti.model.User;
import com.chinasofti.pool.JdbcUtils;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: UserDao.java
* @Description: 用户数据层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午10:58:43
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建文件
*/
public class UserDaoImpl extends BasicDaoImpl implements UserDao {
/**
* @see com.chinasofti.dao.UserDao#insertUser(com.chinasofti.model.User)
* @Function: insertUser
* @Description: 添加
*
* @param: 用户实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public User insertUser(User user) {
String sql = "INSERT INTO smms_user (role_id, name, sex, user_name, pass_word, phone, create_by, create_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
List<Object> paramList = new ArrayList<Object>();
paramList.add(user.getRoleId());
paramList.add(user.getName());
paramList.add(user.getSex());
paramList.add(user.getUserName());
paramList.add(user.getPassWord());
paramList.add(user.getPhone());
paramList.add(user.getCreateBy());
paramList.add(user.getCreateTime());
BigInteger primaryKey = insert(JdbcUtils.getConnection(), sql, BigInteger.class,paramList.toArray());
user.setId(primaryKey.longValue());
JdbcUtils.closeResource();
return user;
}
/**
* @see com.chinasofti.dao.UserDao#updateUser(com.chinasofti.model.User)
* @Function: updateStudent
* @Description: 修改
*
* @param: 用户实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void updateUser(User user) {
String updateBy = " update_by = ?,update_time = ?";
List<Object> paramList = new ArrayList<Object>();
paramList.add(user.getUserName());
paramList.add(LocalDateTime.now());
String update = "";
if (!StringUtils.isEmpty(user.getPassWord())) {
update += ",pass_word = ?";
paramList.add(user.getPassWord());
}
if (!StringUtils.isEmpty(user.getName())) {
update += ",name = ?";
paramList.add(user.getName());
}
if (!StringUtils.isEmpty(user.getSex())) {
update += ",sex = ?";
paramList.add(user.getSex());
}
if (!StringUtils.isEmpty(user.getUserName())) {
update += ",user_name = ?";
paramList.add(user.getUserName());
}
if (!StringUtils.isEmpty(user.getPhone())) {
update += ",phone = ?";
paramList.add(user.getPhone());
}
paramList.add(user.getId());
String sql = "update smms_user set"+updateBy+update+"where id = ?";
update(JdbcUtils.getConnection(), sql,paramList.toArray());
JdbcUtils.closeResource();
}
/**
* @see com.chinasofti.dao.UserDao#removeUser(long)
* @Function: removeStudent
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void removeUser(long id) {
String sql = "delete from smms_user where id = ?";
update(JdbcUtils.getConnection(), sql,id);
JdbcUtils.closeResource();
}
/**
* @see com.chinasofti.dao.UserDao#findUserById(long)
* @Function: findUser
* @Description: 查询单个用户
*
* @param: User
* @return用户实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public User findUser(User user){
List<Object> paramList = new ArrayList<Object>();
String where = "";
if (!StringUtils.isEmpty(user.getUserName())) {
where += " and user_name = ?";
paramList.add(user.getUserName());
}
if (!StringUtils.isEmpty(user.getPassWord())) {
where += " and pass_word = ?";
paramList.add(user.getPassWord());
}
if (null != user.getId() && user.getId() > 0) {
where += " and id = ?";
paramList.add(user.getId());
}
String sql = "select * from smms_user where 1=1" + where;
User resUser = getBean(JdbcUtils.getConnection(), sql, User.class,paramList.toArray());
JdbcUtils.closeResource();
return resUser;
}
/**
* @see com.chinasofti.dao.UserDao#findAll(com.chinasofti.model.User)
* @Function: findStudents
* @Description: 查询所有记录
*
* @param: 用户实体
* @return用户实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<User> findUsers(User user) {
String sql = "select * from smms_user where 1=1";
List<Object> paramList = new ArrayList<Object>();
if (null != user.getRoleId() && user.getRoleId() > 0) {
sql += " and role_id = ?";
paramList.add(user.getRoleId());
}
List<User> users = getListBean(JdbcUtils.getConnection(), sql, User.class,paramList.toArray());
JdbcUtils.closeResource();
return users;
}
}

View File

@@ -0,0 +1,50 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.enums
* @author: mrliy
* @date: 2025年5月16日 上午9:30:06
*/
package com.chinasofti.enums;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: CreditType.java
* @Description: 学分变动范围
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月16日 上午9:30:06
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月16日 李洪涛 v1.0.0 新建文件
*/
public enum CreditType {
THIS_WEEK("1","本周学分"),
THIS_DISCIPLINE("2","本科学分");
private final String type;
private final String info;
CreditType(String type, String info)
{
this.type = type;
this.info = info;
}
public String getType()
{
return type;
}
public String getInfo()
{
return info;
}
}

View File

@@ -0,0 +1,49 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.enums
* @author: 李洪涛
* @date: 2025年5月16日 上午10:44:12
*/
package com.chinasofti.enums;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: DeductPoints.java
* @Description: 扣分项
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月16日 上午10:44:12
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月16日 李洪涛 v1.0.0 新建文件
*/
public enum DeductCredit {
LEAVE(-2,"请假扣分");
private final int credit;
private final String info;
DeductCredit(int credit, String info)
{
this.credit = credit;
this.info = info;
}
public int getCredit()
{
return credit;
}
public String getInfo()
{
return info;
}
}

View File

@@ -0,0 +1,50 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.enums
* @author: 李洪涛
* @date: 2025年5月11日 下午8:26:37
*/
package com.chinasofti.enums;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: FileName.java
* @Description: 文件名称枚举
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月11日 下午8:26:37
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月11日 李洪涛 v1.0.0 新建文件
*/
public enum FileName {
STUDENT_TEMPLATE_NAME("学生导入模板.xls","学生导入模板名称"),
STUDENT_TEMPLATE_PATCH("D:\\eclipse-jee-2019-09-R-win32-x86_64\\workspace\\SMMS\\WebContent\\static\\file","学生导入模板存放路径");
private final String name;
private final String info;
FileName(String name, String info)
{
this.name = name;
this.info = info;
}
public String getName()
{
return name;
}
public String getInfo()
{
return info;
}
}

View File

@@ -0,0 +1,50 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.enums
* @author: 李洪涛
* @date: 2025年5月16日 下午5:53:30
*/
package com.chinasofti.enums;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: IsCounselor.java
* @Description: 是否是导员
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月16日 下午5:53:30
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月16日 李洪涛 v1.0.0 新建文件
*/
public enum IsCounselor {
YES("y",""),
NO("n","不是");
private final String is;
private final String info;
IsCounselor(String is, String info)
{
this.is = is;
this.info = info;
}
public String getIs()
{
return is;
}
public String getInfo()
{
return info;
}
}

View File

@@ -0,0 +1,51 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.enums
* @author: 李洪涛
* @date: 2025年5月11日 上午12:49:38
*/
package com.chinasofti.enums;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: LeaveStatus.java
* @Description: 该类的功能描述
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月11日 上午12:49:38
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月11日 李洪涛 v1.0.0 新建文件
*/
public enum LeaveStatus {
WAIT("0", "等待审核"),
PASS("1", "审核通过"),
REFUSE("2", "审核不通过");
private final String status;
private final String info;
LeaveStatus(String status, String info)
{
this.status = status;
this.info = info;
}
public String getstatus()
{
return status;
}
public String getInfo()
{
return info;
}
}

View File

@@ -0,0 +1,50 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.enums
* @author: 李洪涛
* @date: 2025年5月15日 下午5:14:48
*/
package com.chinasofti.enums;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: MathType.java
* @Description: 运算类型
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月15日 下午5:14:48
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月15日 李洪涛 v1.0.0 新建文件
*/
public enum MathType {
MINUS_SIGN("1","负号"),
POSITIVE_SIGN("2","正号");
private final String sign;
private final String info;
MathType(String sign, String info)
{
this.sign = sign;
this.info = info;
}
public String getSign()
{
return sign;
}
public String getInfo()
{
return info;
}
}

View File

@@ -0,0 +1,50 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.enums
* @author: 李洪涛
* @date: 2025年5月17日 下午4:15:49
*/
package com.chinasofti.enums;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: OperationResult.java
* @Description: 操作结果
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月17日 下午4:15:49
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月17日 李洪涛 v1.0.0 新建文件
*/
public enum OperationResult {
SUCCESS("success", "成功"),
ERROR("error", "失败");
private final String result;
private final String info;
OperationResult(String result, String info)
{
this.result = result;
this.info = info;
}
public String getResult()
{
return result;
}
public String getInfo()
{
return info;
}
}

View File

@@ -0,0 +1,47 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.enums
* @author: mrliy
* @date: 2025年5月16日 下午3:19:03
*/
package com.chinasofti.enums;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: PageScope.java
* @Description: 分页范围
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月16日 下午3:19:03
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月16日 李洪涛 v1.0.0 新建文件
*/
public enum PageScope {
CURRENT_PAGE(1,"起始"),PAGE_SIZE(99999,"结束");
private final int num;
private final String info;
PageScope(int num, String info)
{
this.num = num;
this.info = info;
}
public int getNum()
{
return num;
}
public String getInfo()
{
return info;
}
}

View File

@@ -0,0 +1,50 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.enums
* @author: 李洪涛
* @date: 2025年5月3日 下午3:06:28
*/
package com.chinasofti.enums;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: PassWord.java
* @Description: 默认密码枚举类
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月3日 下午3:06:28
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月3日 李洪涛 v1.0.0 修改原因
*/
public enum PassWord {
TEACHER("Teacher123456", "老师"),
STUDENT("111111", "学生");
private final String passWord;
private final String info;
PassWord(String passWord, String info)
{
this.passWord = passWord;
this.info = info;
}
public String getPassWord()
{
return passWord;
}
public String getInfo()
{
return info;
}
}

View File

@@ -0,0 +1,51 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.enums
* @author: 李洪涛
* @date: 2025年5月17日 上午10:42:33
*/
package com.chinasofti.enums;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: RoleCode.java
* @Description: 角色码值
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月8日 上午9:02:05
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月8日 李洪涛 v1.0.0 新建文件
*/
public enum RoleCode {
ADMIN("admin", "管理员"),
TEACHER("teacher", "老师"),
STUDENT("student", "学生");
private final String code;
private final String info;
RoleCode(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@@ -0,0 +1,51 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.enums
* @author: 李洪涛
* @date: 2025年4月8日 上午9:02:05
*/
package com.chinasofti.enums;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: RoleId.java
* @Description: 角色ID值
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月8日 上午9:02:05
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月8日 李洪涛 v1.0.0 新建文件
*/
public enum RoleId {
ADMIN(1l, "管理员"),
TEACHER(2l, "老师"),
STUDENT(3l, "学生");
private final long id;
private final String info;
RoleId(long id, String info)
{
this.id = id;
this.info = info;
}
public long getId()
{
return id;
}
public String getInfo()
{
return info;
}
}

View File

@@ -0,0 +1,49 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.enums
* @author: 李洪涛
* @date: 2025年5月11日 下午7:31:04
*/
package com.chinasofti.enums;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: ScoreNow.java
* @Description: 默认成绩
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月11日 下午7:31:04
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月11日 李洪涛 v1.0.0 新建文件
*/
public enum ScoreNow {
SCORE_WEEK(100,"默认每周学分100");
private final int score;
private final String info;
ScoreNow(int score, String info)
{
this.score = score;
this.info = info;
}
public int getScore()
{
return score;
}
public String getInfo()
{
return info;
}
}

View File

@@ -0,0 +1,50 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.enums
* @author: 李洪涛
* @date: 2025年5月11日 下午6:35:54
*/
package com.chinasofti.enums;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: Sex.java
* @Description: 性别
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月11日 下午6:35:54
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月11日 李洪涛 v1.0.0 新建文件
*/
public enum Sex {
MAN("0", ""),
WOMAN("1", "");
private final String sex;
private final String info;
Sex(String sex, String info)
{
this.sex = sex;
this.info = info;
}
public String getSex()
{
return sex;
}
public String getInfo()
{
return info;
}
}

View File

@@ -0,0 +1,101 @@
package com.chinasofti.filter;
import java.io.IOException;
import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: CharacterFilter.java
* @Description: 字符集过滤器
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 下午2:59:44
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建文件
*/
@WebFilter(
dispatcherTypes = {
DispatcherType.REQUEST,
DispatcherType.FORWARD,
DispatcherType.INCLUDE,
DispatcherType.ERROR
},
initParams = {
@WebInitParam(name = "character", value = "UTF-8")
},
urlPatterns = { "/*" }
)
public class CharacterFilter implements Filter {
private String character;
/**
*
* @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
* @Function: CharacterFilter.java
* @Description: 拦截
*
* @param: request
* @param: response
* @param: chain
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 下午3:01:31
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建方法
*/
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
req.setCharacterEncoding(character);
res.setContentType("text/html;charset=" + character);
chain.doFilter(request, response);
}
/**
*
* @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
* @Function: CharacterFilter.java
* @Description: 初始化方法
*
* @param:fConfig
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 下午3:02:48
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建方法
*/
public void init(FilterConfig fConfig) throws ServletException {
character=fConfig.getInitParameter("character");
}
}

View File

@@ -0,0 +1,39 @@
package com.chinasofti.filter;
import java.io.IOException;
import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
@WebFilter(dispatcherTypes = {
DispatcherType.REQUEST,
DispatcherType.FORWARD,
DispatcherType.INCLUDE,
DispatcherType.ERROR
}
, urlPatterns = { "/*" })
public class LoginFilter implements Filter {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
String uri = httpRequest.getRequestURI();
if (uri.contains("/index.jsp") || uri.contains("/login.jsp") || uri.contains("/LoginServlet") || uri.contains("/static")){
chain.doFilter(request, response);
}else {
Object user = httpRequest.getSession().getAttribute("user");
if (user!=null){
chain.doFilter(request, response);
}else {
httpRequest.setAttribute("msg","*您尚未登录,请登录");
request.getRequestDispatcher("/index.jsp").forward(httpRequest,response);
}
}
}
}

View File

@@ -0,0 +1,130 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.model
* @author: 李洪涛
* @date: 2025年4月8日 上午8:03:22
*/
package com.chinasofti.model;
import java.time.LocalDateTime;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: Clazz.java
* @Description: 班级实体
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月8日 上午8:03:22
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月8日 李洪涛 v1.0.0 新建文件
*/
public class Clazz {
private Long id;//主键
private Long userId;//责任人ID
private String clazzName;//班级名称
private String clazzCode;//班级编码
private String clazzs;//学级
private String clazzAds;//学届
private String createBy;//创建者
private LocalDateTime createTime;//创建时间
private String updateBy;//更新者
private LocalDateTime updateTime;//更新时间
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getClazzName() {
return clazzName;
}
public void setClazzName(String clazzName) {
this.clazzName = clazzName;
}
public String getClazzCode() {
return clazzCode;
}
public void setClazzCode(String clazzCode) {
this.clazzCode = clazzCode;
}
public String getClazzs() {
return clazzs;
}
public void setClazzs(String clazzs) {
this.clazzs = clazzs;
}
public String getClazzAds() {
return clazzAds;
}
public void setClazzAds(String clazzAds) {
this.clazzAds = clazzAds;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
}

View File

@@ -0,0 +1,140 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.model
* @author: 李洪涛
* @date: 2025年4月8日 上午8:03:22
*/
package com.chinasofti.model;
import java.time.LocalDateTime;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: Clazz.java
* @Description: 学分记录信息实体
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月8日 上午8:03:22
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月8日 李洪涛 v1.0.0 新建文件
*/
public class CreditRecords {
private Long id;//主键
private Integer credit;//增减学分
private String creditType;//学分增减范围1本周学分2本科学分
private String remark;//学分增减原因
private Long number;//学号
private String studentName;//学生姓名
private Long clazzId;//班级ID
private String clazzName;//班级名称
private String userName;//操作人姓名
private String createBy;//创建者
private LocalDateTime createTime;//创建时间
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getCredit() {
return credit;
}
public void setCredit(Integer credit) {
this.credit = credit;
}
public String getCreditType() {
return creditType;
}
public void setCreditType(String creditType) {
this.creditType = creditType;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Long getNumber() {
return number;
}
public void setNumber(Long number) {
this.number = number;
}
public Long getClazzId() {
return clazzId;
}
public void setClazzId(Long clazzId) {
this.clazzId = clazzId;
}
public String getStudentName() {
return studentName;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public String getClazzName() {
return clazzName;
}
public void setClazzName(String clazzName) {
this.clazzName = clazzName;
}
}

View File

@@ -0,0 +1,150 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.model
* @author: 李洪涛
* @date: 2025年5月9日 上午11:05:39
*/
package com.chinasofti.model;
import java.time.LocalDateTime;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: Leave.java
* @Description: 该类的功能描述
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月9日 上午11:05:39
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月9日 李洪涛 v1.0.0 新建文件
*/
public class Leave {
private Long id;//主键
private Long studentId;//学生Id
private Long teacherId;//审批教师Id
private String info;//请假申请信息
private String status;//审批状态,0:等待审核1审核通过2审核不通过
private String remark;//审批回复
private LocalDateTime applyTime;//申请时间
private LocalDateTime approveTime;//审批时间
private String createBy;//创建者
private LocalDateTime createTime;//创建时间
private String updateBy;//更新者
private LocalDateTime updateTime;//更新时间
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getStudentId() {
return studentId;
}
public void setStudentId(Long studentId) {
this.studentId = studentId;
}
public Long getTeacherId() {
return teacherId;
}
public void setTeacherId(Long teacherId) {
this.teacherId = teacherId;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public LocalDateTime getApplyTime() {
return applyTime;
}
public void setApplyTime(LocalDateTime applyTime) {
this.applyTime = applyTime;
}
public LocalDateTime getApproveTime() {
return approveTime;
}
public void setApproveTime(LocalDateTime approveTime) {
this.approveTime = approveTime;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
}

View File

@@ -0,0 +1,100 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.model
* @author: 李洪涛
* @date: 2025年4月8日 上午8:00:14
*/
package com.chinasofti.model;
import java.time.LocalDateTime;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: Role.java
* @Description: 角色实体
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月8日 上午8:00:14
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月8日 李洪涛 v1.0.0 新建文件
*/
public class Role {
private Long id;//主键
private String roleName;//角色名
private String roleCode;//角色编码
private String createBy;//创建者
private LocalDateTime createTime;//创建时间
private String updateBy;//更新者
private LocalDateTime updateTime;//更新时间
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public String getRoleCode() {
return roleCode;
}
public void setRoleCode(String roleCode) {
this.roleCode = roleCode;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
}

View File

@@ -0,0 +1,159 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.model
* @author: 李洪涛
* @date: 2025年3月27日 上午9:23:45
*/
package com.chinasofti.model;
import java.time.LocalDateTime;
import java.util.Date;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: Student.java
* @Description: 学生实体对象
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午9:23:45
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 文件新建
*/
public class Student {
private Long id;//主键
private Long clazzId;//班级ID
private Long userId;//用户ID
private Long number;//学号
private Date birthday;//出生日期
private String major;//专业
private String honor;//个人荣誉
private int scoreNow;//本周当前学分
private String createBy;//创建者
private LocalDateTime createTime;//创建时间
private String updateBy;//更新者
private LocalDateTime updateTime;//更新时间
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getClazzId() {
return clazzId;
}
public void setClazzId(Long clazzId) {
this.clazzId = clazzId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getNumber() {
return number;
}
public void setNumber(Long number) {
this.number = number;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getMajor() {
return major;
}
public void setMajor(String major) {
this.major = major;
}
public String getHonor() {
return honor;
}
public void setHonor(String honor) {
this.honor = honor;
}
public int getScoreNow() {
return scoreNow;
}
public void setScoreNow(int scoreNow) {
this.scoreNow = scoreNow;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "Student [id=" + id + ", clazzId=" + clazzId + ", userId=" + userId + ", number=" + number
+ ", birthday=" + birthday + ", major=" + major + ", honor=" + honor + ", scoreNow=" + scoreNow
+ ", createBy=" + createBy + ", createTime=" + createTime + ", updateBy=" + updateBy + ", updateTime="
+ updateTime + "]";
}
}

View File

@@ -0,0 +1,100 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.model
* @author: 李洪涛
* @date: 2025年5月4日 下午10:50:48
*/
package com.chinasofti.model;
import java.time.LocalDateTime;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: Teacher.java
* @Description: 教师实体
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月4日 下午10:50:48
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月4日 李洪涛 v1.0.0 新建文件
*/
public class Teacher {
private Long id;//主键
private Long userId;//用户ID
private String isCounselor;//是否是辅导员y:是n:不是
private String createBy;//创建者
private LocalDateTime createTime;//创建时间
private String updateBy;//更新者
private LocalDateTime updateTime;//更新时间
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
public String getIsCounselor() {
return isCounselor;
}
public void setIsCounselor(String isCounselor) {
this.isCounselor = isCounselor;
}
}

View File

@@ -0,0 +1,58 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.model
* @author: 李洪涛
* @date: 2025年5月5日 上午2:47:10
*/
package com.chinasofti.model;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: TeacherClazz.java
* @Description: 教师班级关系信息
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月5日 上午2:47:10
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月5日 李洪涛 v1.0.0 新建文件
*/
public class TeacherClazz {
private Long id;//主键
private Long clazzId;//班级ID
private Long teacherId;//教师ID
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getClazzId() {
return clazzId;
}
public void setClazzId(Long clazzId) {
this.clazzId = clazzId;
}
public Long getTeacherId() {
return teacherId;
}
public void setTeacherId(Long teacherId) {
this.teacherId = teacherId;
}
}

View File

@@ -0,0 +1,140 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.model
* @author: 李洪涛
* @date: 2025年3月27日 上午10:20:21
*/
package com.chinasofti.model;
import java.time.LocalDateTime;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: User.java
* @Description: 用户类
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午10:20:21
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 文件新建
*/
public class User {
private Long id;//主键
private Long roleId;//角色
private String name;//姓名
private String sex;//性别
private String userName;//用户名
private String passWord;//密码
private String phone;//联系方式
private String createBy;//创建者
private LocalDateTime createTime;//创建时间
private String updateBy;//更新者
private LocalDateTime updateTime;//更新时间
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
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 getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassWord() {
return passWord;
}
public void setPassWord(String passWord) {
this.passWord = passWord;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}

View File

@@ -0,0 +1,100 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.model.view
* @author: 李洪涛
* @date: 2025年5月11日 上午11:06:35
*/
package com.chinasofti.model.view;
import java.time.LocalDateTime;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: LeaveView.java
* @Description: 请假记录页面数据
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月11日 上午11:06:35
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月11日 李洪涛 v1.0.0 新建文件
*/
public class LeaveView {
private String studentName;//学生姓名
private String teacherName;//审批教师姓名
private String info;//请假申请信息
private String status;//审批状态,0:等待审核1审核通过2审核不通过
private String remark;//审批回复
private LocalDateTime applyTime;//申请时间
private LocalDateTime approveTime;//审批时间
public String getStudentName() {
return studentName;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
}
public String getTeacherName() {
return teacherName;
}
public void setTeacherName(String teacherName) {
this.teacherName = teacherName;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public LocalDateTime getApplyTime() {
return applyTime;
}
public void setApplyTime(LocalDateTime applyTime) {
this.applyTime = applyTime;
}
public LocalDateTime getApproveTime() {
return approveTime;
}
public void setApproveTime(LocalDateTime approveTime) {
this.approveTime = approveTime;
}
}

View File

@@ -0,0 +1,46 @@
package com.chinasofti.model.view;
/**
*
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: Page.java
* @Description: 分页类页码封装
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月3日 上午8:56:45
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月3日 李洪涛 v1.0.0 新建文件
*/
public class Page {
private int start;//起始页
private int currentPage;//当前页
private int pageSize;//每页显示数量
public Page(int currentPage,int pageSize){
this.start = (currentPage-1)*pageSize;
this.currentPage = currentPage;
this.pageSize = pageSize;
}
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
}

View File

@@ -0,0 +1,149 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.model.view
* @author: 李洪涛
* @date: 2025年5月3日 上午10:55:40
*/
package com.chinasofti.model.view;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: StudentView.java
* @Description: 学生类页面数据
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月3日 上午10:55:40
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月3日 李洪涛 v1.0.0 修改原因
*/
public class StudentView {
private Long userId;//用户主键
private Long studentId;//主键
private Long clazzId;//班级主键
private String name;//姓名
private String sex;//性别
private String userName;//用户名
private String phone;//联系方式
private Long number;//学号
private String birthday;//出生日期
private String major;//专业
private String honor;//个人荣誉
private int scoreNow;//当前学分
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getStudentId() {
return studentId;
}
public void setStudentId(Long studentId) {
this.studentId = studentId;
}
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 getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Long getNumber() {
return number;
}
public void setNumber(Long number) {
this.number = number;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getMajor() {
return major;
}
public void setMajor(String major) {
this.major = major;
}
public String getHonor() {
return honor;
}
public void setHonor(String honor) {
this.honor = honor;
}
public int getScoreNow() {
return scoreNow;
}
public void setScoreNow(int scoreNow) {
this.scoreNow = scoreNow;
}
public Long getClazzId() {
return clazzId;
}
public void setClazzId(Long clazzId) {
this.clazzId = clazzId;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}

View File

@@ -0,0 +1,108 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.model.view
* @author: 李洪涛
* @date: 2025年5月7日 下午1:07:09
*/
package com.chinasofti.model.view;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: TeacherView.java
* @Description: 该类的功能描述
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月7日 下午1:07:09
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月7日 李洪涛 v1.0.0 新建文件
*/
public class TeacherView {
private Long userId;//用户主键
private Long teacherId;//教师主键
private Long clazzId;//班级主键
private String name;//姓名
private String sex;//性别
private String userName;//用户名
private String phone;//联系方式
private String isCounselor;//是否是辅导员y:是n:不是
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getTeacherId() {
return teacherId;
}
public void setTeacherId(Long teacherId) {
this.teacherId = teacherId;
}
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 getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getIsCounselor() {
return isCounselor;
}
public void setIsCounselor(String isCounselor) {
this.isCounselor = isCounselor;
}
public Long getClazzId() {
return clazzId;
}
public void setClazzId(Long clazzId) {
this.clazzId = clazzId;
}
}

View File

@@ -0,0 +1,163 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.pool
* @author: 李洪涛
* @date: 2025年4月6日 上午10:45:18
*/
package com.chinasofti.pool;
import com.alibaba.druid.pool.DruidDataSourceFactory;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
/**
*
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: JdbcUtils.java
* @Description: 数据库连接池工具类
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午11:00:15
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建文件
*/
public class JdbcUtils {
//定义成员变量
private static DataSource dataSource;
private static ThreadLocal<Connection> threadLocal;
/**
* 静态代码块
*/
static {
try {
//加载连接池配置文件创建DataSource
Properties properties = new Properties();
properties.load(JdbcUtils.class.getClassLoader().getResourceAsStream("db.properties"));
dataSource = DruidDataSourceFactory.createDataSource(properties);
//初始化threadLocal对象
threadLocal = new ThreadLocal<>();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
*
* @Function: getConnection
* @Description: 获取数据库连接池连接
*
* @return数据库连接(关闭自动提交)
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:58:38
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public static Connection getAutoConnection() {
//1 ThreadLocal可以把线程和连接绑定在一起
//从ThreadLocal获取连接
Connection connection = threadLocal.get();
//如果获取不到dataSource取出来放到ThreadLocal里面
if(connection == null) {
try {
connection = dataSource.getConnection();
try {
connection.setAutoCommit(false);//关闭自动提交
} catch (SQLException e) {
e.printStackTrace();
}
threadLocal.set(connection);
} catch (SQLException e) {
e.printStackTrace();
}
}
try {
connection.setAutoCommit(false);
} catch (SQLException e) {
e.printStackTrace();
}
//如果获取到,直接返回
return connection;
}
/**
*
* @Function: getConnection
* @Description: 获取数据库连接池连接
*
* @return数据库连接
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:58:38
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public static Connection getConnection() {
//1 ThreadLocal可以把线程和连接绑定在一起
//从ThreadLocal获取连接
Connection connection = threadLocal.get();
//如果获取不到dataSource取出来放到ThreadLocal里面
if(connection == null) {
try {
connection = dataSource.getConnection();
threadLocal.set(connection);
} catch (SQLException e) {
e.printStackTrace();
}
}
//如果获取到,直接返回
return connection;
}
/**
*
* @Function: closeResource
* @Description: 释放资源
*
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:58:38
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public static void closeResource() {
Connection connection = threadLocal.get();
if(connection != null) {
try {
//close()
connection.close();
threadLocal.remove();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}

View File

@@ -0,0 +1,193 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service
* @author: 李洪涛
* @date: 2025年5月4日 上午8:00:11
*/
package com.chinasofti.service;
import java.util.List;
import com.chinasofti.model.Clazz;
import com.chinasofti.model.view.Page;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: ClazzService.java
* @Description: 班级业务处理
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月4日 上午8:00:11
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月4日 李洪涛 v1.0.0 修改原因
*/
public interface ClazzService {
/**
*
* @Function: findClazzPage
* @Description: 查询所有记录
*
* @param: 班级实体
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Clazz> findClazzPage(Clazz clazz,Page page);
/**
*
* @Function: findClazzsByClazzIds
* @Description: 根据班级查询班级实体
*
* @param: 班级实体
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Clazz> findClazzsByClazzIds(String clazzIds,Clazz clazz,Page page);
/**
*
* @Function: removeClazz
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void removeClazz(List<Long> ids);
/**
*
* @Function: insertClazz
* @Description: 添加
*
* @param: 班级实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public Clazz insertClazz(Clazz clazz);
/**
*
* @Function: updateClazz
* @Description: 修改
*
* @param: 班级实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void updateClazz(Clazz clazz);
/**
*
* @Function: findClazzsByTeacherId
* @Description: 根据教师Id查询班级实体
*
* @param: 教师Id
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Clazz> findClazzsByTeacherId(long teacherId);
/**
*
* @Function: findClazzByClazzName
* @Description: 根据班级名称查询
*
* @param: 班级名称
* @return班级实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public Clazz findClazzByClazzName(String clazzName);
/**
*
* @Function: findClazzsByUserIds
* @Description: 根据责任人查询班级实体
*
* @param: 班级实体
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Clazz> findClazzsByUserIds(String uderIds);
}

View File

@@ -0,0 +1,73 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service
* @author: 李洪涛
* @date: 2025年5月15日 下午1:37:53
*/
package com.chinasofti.service;
import java.util.List;
import com.chinasofti.model.CreditRecords;
import com.chinasofti.model.view.Page;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: CreditRecordsService.java
* @Description: 学分记录信息业务层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月15日 下午1:37:53
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月15日 李洪涛 v1.0.0 新建文件
*/
public interface CreditRecordsService {
/**
*
* @Function: insertCreditRecords
* @Description: 添加
*
* @param: 学分实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void insertCreditRecords(Long studentId,CreditRecords creditRecords);
/**
*
* @Function: findCreditRecordsPages
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<CreditRecords> findCreditRecordsPages(String startTime,String endTime,CreditRecords creditRecords,String clazzIds,Page page);
}

View File

@@ -0,0 +1,214 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service
* @author: 李洪涛
* @date: 2025年5月9日 下午1:11:21
*/
package com.chinasofti.service;
import java.util.List;
import com.chinasofti.model.Leave;
import com.chinasofti.model.view.LeaveView;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.TeacherView;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: LeaveService.java
* @Description: 请假记录业务处理层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月9日 下午1:11:21
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月9日 李洪涛 v1.0.0 新建文件
*/
public interface LeaveService {
/**
*
* @Function: findLeavePages
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Leave> findLeavePages(Leave leave,Page page);
/**
*
* @Function: insertLeave
* @Description: 添加
*
* @param: 角色实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void insertLeave(Leave leave);
/**
*
* @Function: updateLeave
* @Description: 修改
*
* @param: 角色实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void updateLeave(Leave leave);
/**
*
* @Function: findLeaveViews
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<LeaveView> findLeaveViews(Leave leave);
/**
*
* @Function: removeLeave
* @Description: 删除
*
* @param: Leave
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void removeLeave(Leave leave);
/**
*
* @Function: findLeaveByTeacherIdsAndStatus
* @Description: 根据教师id与状态查询
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Leave> findLeaveByTeacherIdsAndStatus(String teacherIds);
/**
*
* @Function: findLeavePagesByClazzIds
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Leave> findLeavePagesByClazzIds(Leave leave,Page page,String clazzIds);
/**
*
* @Function: findLeaveViewsByClazzIds
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<LeaveView> findLeaveViewsByClazzIds(Leave leave,String clazzIds);
/**
*
* @Function: findApproveTeacherViews
* @Description: 获取审批教师信息
*
* @param: 教师ID
* @return审批教师实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月17日 上午9:12:14
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月17日 李洪涛 v1.0.0 新建方法
*/
public List<TeacherView> findApproveTeacherViews(Long teacherId);
}

View File

@@ -0,0 +1,50 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service
* @author: 李洪涛
* @date: 2025年3月27日 上午10:42:35
*/
package com.chinasofti.service;
import com.chinasofti.model.User;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: LoginService.java
* @Description: 登录校验业务层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午10:42:35
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建文件
*/
public interface LoginService {
/**
*
* @Function: LoginService.java
* @Description: 登录校验
*
* @param:User
* @return校验结果
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午11:03:37
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建方法
*/
public User loginCheck(User user);
}

View File

@@ -0,0 +1,50 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service
* @author: 李洪涛
* @date: 2025年5月2日 下午9:50:01
*/
package com.chinasofti.service;
import com.chinasofti.model.Role;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: RoleService.java
* @Description: 角色业务处理层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月2日 下午9:50:01
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月2日 李洪涛 v1.0.0 新建文件
*/
public interface RoleService {
/**
*
* @Function: findRoleById
* @Description: 根据id查询
*
* @param: id值
* @return角色实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public Role findRoleById(long id);
}

View File

@@ -0,0 +1,176 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service
* @author: 李洪涛
* @date: 2025年4月2日 上午9:21:06
*/
package com.chinasofti.service;
import java.util.List;
import com.chinasofti.model.Student;
import com.chinasofti.model.User;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.StudentView;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: StudentService.java
* @Description: 该类的功能描述
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月2日 上午9:21:06
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月2日 李洪涛 v1.0.0 新建文件
*/
public interface StudentService {
/**
*
* @Function: insertStudent
* @Description: 添加
*
* @param: 学生实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public String insertStudent(Student student,User user);
/**
*
* @Function: removeStudents
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public String removeStudents(String studentIds,String userIds);
/**
*
* @Function: updateStudent
* @Description: 修改
*
* @param: 学生实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public String updateStudent(Student student,User user);
/**
*
* @Function: findStudentByUserId
* @Description: 根据id查询
*
* @param: userId值
* @returnStudentView
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public StudentView findStudentByUserId(StudentView studentView);
/**
*
* @Function: findStudentViews
* @Description: 查询所有记录
*
* @param: 学生实体
* @return学生实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<StudentView> findStudentViews(StudentView studentView,Page page);
/**
*
* @Function: findStudentViewsByClazzIds
* @Description: 根据班级查询学生实体
*
* @param: 学生实体
* @return学生实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<StudentView> findStudentViewsByClazzIds(StudentView studentView,String clazzIds,Page page);
/**
*
* @Function: updateStudentScoreNow
* @Description: 修改
*
* @param: 本周学分变动
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void updateStudentScoreNow(int score,Student student);
}

View File

@@ -0,0 +1,195 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service
* @author: 李洪涛
* @date: 2025年5月4日 下午11:17:06
*/
package com.chinasofti.service;
import java.util.List;
import com.chinasofti.model.Teacher;
import com.chinasofti.model.TeacherClazz;
import com.chinasofti.model.User;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.TeacherView;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: TeacherService.java
* @Description: 教师业务处理
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月4日 下午11:17:06
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月4日 李洪涛 v1.0.0 新建文件
*/
public interface TeacherService {
/**
*
* @Function: findTeacher
* @Description: 查询
*
* @param: 教师实体
* @return教师实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public Teacher findTeacher(Teacher teacher);
/**
*
* @Function: findClazzIdsByTeacherId
* @Description: 查询
*
* @param: teacherID
* @returnList<Long>
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<Long> findClazzIdsByTeacherId(Long teacherID);
/**
*
* @Function: findTeacherViews
* @Description: 查询所有记录
*
* @param: 教师实体
* @return教师实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<TeacherView> findTeacherViews(TeacherView teacherView,Page page);
/**
*
* @Function: insertTeacher
* @Description: 添加
*
* @param: 教师实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public String insertTeacher(Teacher teacher,User user,TeacherClazz teacherClazz,String [] clazzIds);
/**
*
* @Function: insertTeacherClazz
* @Description: 添加
*
* @param: 教师与班级关联关系实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public TeacherClazz insertTeacherClazz(TeacherClazz teacherClazz,String [] clazzIds);
/**
*
* @Function: updateTeacher
* @Description: 修改
*
* @param: 教师实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public String updateTeacher(Teacher teacher,String [] clazzIds,User user);
/**
*
* @Function: removeTeachers
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void removeTeachers(List<Long> ids);
/**
*
* @Function: findTeacherByStudentId
* @Description: 查询
*
* @param: 教师实体
* @return教师实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public Teacher findTeacherByStudentId(Long studentId);
}

View File

@@ -0,0 +1,112 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service
* @author: mrliy
* @date: 2025年5月2日 上午2:06:30
*/
package com.chinasofti.service;
import java.util.List;
import com.chinasofti.model.User;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: UserService.java
* @Description: 用户业务处理
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月2日 上午2:06:30
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月2日 李洪涛 v1.0.0 修改原因
*/
public interface UserService {
/**
*
* @Function: insertUser
* @Description: 添加
*
* @param: 用户实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public User insertUser(User user);
/**
*
* @Function: removeUser
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void removeUsers(List<Long> ids);
/**
*
* @Function: updateUser
* @Description: 修改
*
* @param: 用户实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public void updateUser(User user);
/**
*
* @Function: findUsers
* @Description: 查询所有记录
*
* @param: 用户实体
* @return用户实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
public List<User> findUsers(User user);
}

View File

@@ -0,0 +1,227 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service.impl
* @author: 李洪涛
* @date: 2025年5月4日 上午8:01:01
*/
package com.chinasofti.service.impl;
import java.util.List;
import com.chinasofti.dao.ClazzDao;
import com.chinasofti.dao.impl.ClazzDaoImpl;
import com.chinasofti.model.Clazz;
import com.chinasofti.model.view.Page;
import com.chinasofti.service.ClazzService;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: ClazzServiceImpl.java
* @Description: 该类的功能描述
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月4日 上午8:01:01
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月4日 李洪涛 v1.0.0 修改原因
*/
public class ClazzServiceImpl implements ClazzService {
private ClazzDao clazzDao = new ClazzDaoImpl();
/**
* @see com.chinasofti.service.ClazzService#findClazzPage(com.chinasofti.model.Clazz, com.chinasofti.model.view.Page)
* @Function: findClazzPage
* @Description: 查询所有记录
*
* @param: 班级实体
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Clazz> findClazzPage(Clazz clazz, Page page) {
return clazzDao.findClazzPage(clazz, page);
}
/**
* @see com.chinasofti.service.ClazzService#findClazzsByClazzIds(java.lang.String, com.chinasofti.model.view.Page)
* @Function: findClazzsByClazzIds
* @Description: 根据班级查询班级实体
*
* @param: 班级实体
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Clazz> findClazzsByClazzIds(String clazzIds, Clazz clazz, Page page) {
return clazzDao.findClazzsByClazzIds(clazzIds, clazz, page);
}
/**
* @see com.chinasofti.service.ClazzService#removeClazz(long)
* @Function: removeClazz
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void removeClazz(List<Long> ids) {
if (ids.size() > 0) {
for (Long id : ids) {
clazzDao.removeClazz(id);
clazzDao.removeTeacherClazzByClazzId(id);
}
}
}
/**
* @see com.chinasofti.service.ClazzService#insertClazz(com.chinasofti.model.Clazz)
* @Function: insertClazz
* @Description: 添加
*
* @param: 班级实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public Clazz insertClazz(Clazz clazz) {
return clazzDao.insertClazz(clazz);
}
/**
* @see com.chinasofti.service.ClazzService#updateClazz(com.chinasofti.model.Clazz)
* @Function: updateClazz
* @Description: 修改
*
* @param: 班级实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void updateClazz(Clazz clazz) {
clazzDao.updateClazz(clazz);
}
/**
* @see com.chinasofti.service.ClazzService#findClazzsByTeacherId(long)
* @Function: findClazzsByTeacherId
* @Description: 根据教师Id查询班级实体
*
* @param: 教师Id
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Clazz> findClazzsByTeacherId(long teacherId) {
return clazzDao.findClazzsByTeacherId(teacherId);
}
/**
* @see com.chinasofti.service.ClazzService#findClazzByClazzName(java.lang.String)
* @Function: findClazzByClazzName
* @Description: 根据班级名称查询
*
* @param: 班级名称
* @return班级实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public Clazz findClazzByClazzName(String clazzName) {
return clazzDao.findClazzByClazzName(clazzName);
}
/**
* @see com.chinasofti.service.ClazzService#findClazzsByUserIds(java.lang.String)
* @Function: findClazzsByUserIds
* @Description: 根据责任人查询班级实体
*
* @param: 班级实体
* @return班级实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Clazz> findClazzsByUserIds(String uderIds) {
return clazzDao.findClazzsByUserIds(uderIds);
}
}

View File

@@ -0,0 +1,84 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service
* @author: 李洪涛
* @date: 2025年5月15日 下午1:37:53
*/
package com.chinasofti.service.impl;
import java.util.List;
import com.chinasofti.dao.CreditRecordsDao;
import com.chinasofti.dao.impl.CreditRecordsDaoImpl;
import com.chinasofti.model.CreditRecords;
import com.chinasofti.model.view.Page;
import com.chinasofti.service.CreditRecordsService;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: CreditRecordsServiceImpl.java
* @Description: 学分记录信息业务层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月15日 下午1:37:53
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月15日 李洪涛 v1.0.0 新建文件
*/
public class CreditRecordsServiceImpl implements CreditRecordsService {
private CreditRecordsDao creditRecordsDao = new CreditRecordsDaoImpl();
/**
* @see com.chinasofti.service.CreditRecordsService#insertCreditRecords(com.chinasofti.model.CreditRecords)
* @Function: insertCreditRecords
* @Description: 添加
*
* @param: 学分实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void insertCreditRecords(Long studentId,CreditRecords creditRecords) {
creditRecordsDao.insertCreditRecords(studentId, creditRecords);
}
/**
* @see com.chinasofti.service.CreditRecordsService#findCreditRecordsPages(com.chinasofti.model.CreditRecords, com.chinasofti.model.view.Page)
* @Function: findCreditRecordsPages
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<CreditRecords> findCreditRecordsPages(String startTime,String endTime,CreditRecords creditRecords,String clazzIds, Page page) {
return creditRecordsDao.findCreditRecordsPages(startTime,endTime,creditRecords,clazzIds, page);
}
}

View File

@@ -0,0 +1,247 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service.impl
* @author: 李洪涛
* @date: 2025年5月9日 下午1:12:36
*/
package com.chinasofti.service.impl;
import java.util.List;
import com.chinasofti.dao.LeaveDao;
import com.chinasofti.dao.impl.LeaveDaoImpl;
import com.chinasofti.model.Leave;
import com.chinasofti.model.view.LeaveView;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.TeacherView;
import com.chinasofti.service.LeaveService;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: LeaveServiceImpl.java
* @Description: 请假记录业务处理层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月9日 下午1:11:21
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月9日 李洪涛 v1.0.0 新建文件
*/
public class LeaveServiceImpl implements LeaveService {
private LeaveDao leaveDao = new LeaveDaoImpl();
/**
* @see com.chinasofti.service.LeaveService#findfindLeavePages(com.chinasofti.model.Leave, com.chinasofti.model.view.Page)
* @Function: findfindLeavePages
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Leave> findLeavePages(Leave leave, Page page) {
return leaveDao.findLeavePages(leave, page);
}
/**
* @see com.chinasofti.service.LeaveService#insertLeave(com.chinasofti.model.Leave)
* @Function: insertLeave
* @Description: 添加
*
* @param: 角色实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void insertLeave(Leave leave) {
leaveDao.insertLeave(leave);
}
/**
* @see com.chinasofti.service.LeaveService#updateLeave(com.chinasofti.model.Leave)
* @Function: updateLeave
* @Description: 修改
*
* @param: 角色实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void updateLeave(Leave leave) {
leaveDao.updateLeave(leave);
}
/**
* @see com.chinasofti.service.LeaveService#findLeaveViews(com.chinasofti.model.Leave)
* @Function: findLeaveViews
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<LeaveView> findLeaveViews(Leave leave) {
return leaveDao.findLeaveViews(leave);
}
/**
* @see com.chinasofti.service.LeaveService#removeLeave(com.chinasofti.model.Leave)
* @Function: removeLeave
* @Description: 删除
*
* @param: Leave
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void removeLeave(Leave leave) {
leaveDao.removeLeave(leave);
}
/**
* @see com.chinasofti.service.LeaveService#findLeaveByTeacherIdsAndStatus(java.lang.String)
* @Function: findLeaveByTeacherIdsAndStatus
* @Description: 根据教师id与状态查询
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Leave> findLeaveByTeacherIdsAndStatus(String teacherIds) {
return leaveDao.findLeaveByTeacherIdsAndStatus(teacherIds);
}
/**
* @see com.chinasofti.service.LeaveService#findLeavePagesByClazzIds(com.chinasofti.model.Leave, com.chinasofti.model.view.Page, java.lang.String)
* @Function: findLeavePagesByClazzIds
* @Description: 查询所有记录
*
* @param: 请假记录实体
* @return请假记录实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Leave> findLeavePagesByClazzIds(Leave leave, Page page, String clazzIds) {
return leaveDao.findLeavePagesByClazzIds(leave, page, clazzIds);
}
/**
* @see com.chinasofti.service.LeaveService#findLeaveViewsByClazzIds(com.chinasofti.model.Leave, java.lang.String)
* @Function: LeaveServiceImpl.java
* @Description: 该函数的功能描述
*
* @param:描述1描述
* @return返回结果描述
* @throws异常描述
*
* @version: v1.0.0
* @author: mrliy
* @date: 2025年5月16日 下午8:23:34
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月16日 mrliy v1.0.0 修改原因
*/
@Override
public List<LeaveView> findLeaveViewsByClazzIds(Leave leave, String clazzIds) {
return leaveDao.findLeaveViewsByClazzIds(leave, clazzIds);
}
/**
* @see com.chinasofti.service.LeaveService#findApproveTeacherViews(java.lang.Long)
* @Function: findApproveTeacherViews
* @Description: 获取审批教师信息
*
* @param: 教师ID
* @return审批教师实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月17日 上午9:12:14
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月17日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<TeacherView> findApproveTeacherViews(Long teacherId) {
return leaveDao.findApproveTeacherViews(teacherId);
}
}

View File

@@ -0,0 +1,74 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service.impl
* @author: 李洪涛
* @date: 2025年3月27日 上午10:45:31
*/
package com.chinasofti.service.impl;
import com.alibaba.druid.util.StringUtils;
import com.chinasofti.dao.RoleDao;
import com.chinasofti.dao.UserDao;
import com.chinasofti.dao.impl.RoleDaoImpl;
import com.chinasofti.dao.impl.UserDaoImpl;
import com.chinasofti.model.Role;
import com.chinasofti.model.User;
import com.chinasofti.service.LoginService;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: LoginServiceImpl.java
* @Description: 登录校验业务处理层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午10:45:31
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建文件
*/
public class LoginServiceImpl implements LoginService {
private UserDao userDao = new UserDaoImpl();
private RoleDao roleDao = new RoleDaoImpl();
/**
* @see com.chinasofti.service.LoginService#loginCheck(com.chinasofti.model.User)
* @Function: LoginServiceImpl.java
* @Description: 登录校验
*
* @param:User
* @return校验结果
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午11:07:16
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建方法
*/
@Override
public User loginCheck(User user) {
User resUser = userDao.findUser(user);
User res = null;
if (null == resUser) {
return res;
}
user = resUser;
Role role = roleDao.findRoleById(user.getRoleId());
if (null != role && !StringUtils.isEmpty(role.getRoleCode()) ) {
res = user;
}
return res;
}
}

View File

@@ -0,0 +1,58 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service.impl
* @author: 李洪涛
* @date: 2025年5月2日 下午9:51:46
*/
package com.chinasofti.service.impl;
import com.chinasofti.dao.RoleDao;
import com.chinasofti.dao.impl.RoleDaoImpl;
import com.chinasofti.model.Role;
import com.chinasofti.service.RoleService;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: RoleService.java
* @Description: 角色业务处理层
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月2日 下午9:50:01
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月2日 李洪涛 v1.0.0 新建文件
*/
public class RoleServiceImpl implements RoleService {
private RoleDao roleDao = new RoleDaoImpl();
/**
* @see com.chinasofti.service.RoleService#findRoleById(long)
* @Function: findRoleById
* @Description: 根据id查询
*
* @param: id值
* @return角色实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public Role findRoleById(long id) {
return roleDao.findRoleById(id);
}
}

View File

@@ -0,0 +1,222 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service.impl
* @author: 李洪涛
* @date: 2025年4月2日 上午9:24:13
*/
package com.chinasofti.service.impl;
import java.util.List;
import com.chinasofti.dao.StudentDao;
import com.chinasofti.dao.UserDao;
import com.chinasofti.dao.impl.StudentDaoImpl;
import com.chinasofti.dao.impl.UserDaoImpl;
import com.chinasofti.model.Student;
import com.chinasofti.model.User;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.StudentView;
import com.chinasofti.service.StudentService;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: StudentServiceImpl.java
* @Description: 该类的功能描述
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月2日 上午9:24:13
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月2日 李洪涛 v1.0.0 新建文件
*/
public class StudentServiceImpl implements StudentService {
private StudentDao studentDao = new StudentDaoImpl();
private UserDao userDao = new UserDaoImpl();
/**
* @see com.chinasofti.service.StudentService#removeStudent(long)
* @Function: removeStudents
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public String removeStudents(String studentIds,String userIds) {
return studentDao.removeStudent(studentIds, userIds);
}
/**
* @see com.chinasofti.service.StudentService#updateStudent(com.chinasofti.model.Student)
/**
*
* @Function: updateStudent
* @Description: 修改
*
* @param: 学生实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public String updateStudent(Student student,User user) {
return studentDao.updateStudent(student,user);
}
/**
* @see com.chinasofti.service.StudentService#findStudentByUserId(long)
* @Function: findStudentByUserId
* @Description: 根据id查询
*
* @param: userId值
* @returnStudentView
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public StudentView findStudentByUserId(StudentView studentView) {
Student student = studentDao.findStudentByUserId(studentView.getUserId());
User user = new User();
user.setId(studentView.getUserId());
user = userDao.findUser(user);
studentView.setStudentId(student.getId());
studentView.setName(user.getName());
studentView.setSex(user.getSex());
studentView.setUserName(user.getUserName());
studentView.setPhone(user.getPhone());
studentView.setClazzId(student.getClazzId());
studentView.setNumber(student.getNumber());
studentView.setBirthday(student.getBirthday().toString());
studentView.setMajor(student.getMajor());
studentView.setHonor(student.getHonor());
studentView.setScoreNow(student.getScoreNow());
return studentView;
}
/**
* @see com.chinasofti.service.StudentService#findStudentViews(com.chinasofti.model.view.StudentView, com.chinasofti.model.view.Page)
* @Function: findStudentViews
* @Description: 查询所有记录
*
* @param: 学生实体
* @return学生实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<StudentView> findStudentViews(StudentView studentView, Page page) {
return studentDao.findStudentViews(studentView, page);
}
/**
* @see com.chinasofti.service.StudentService#insertStudent(com.chinasofti.model.Student)
* @Function: insertStudent
* @Description: 添加
*
* @param: 学生实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public String insertStudent(Student student,User user) {
return studentDao.insertStudent(student,user);
}
/**
* @see com.chinasofti.service.StudentService#findStudentViewsByClazzIds(java.lang.String, com.chinasofti.model.view.Page)
* @Function: findStudentViewsByClazzIds
* @Description: 根据班级查询学生实体
*
* @param: 学生实体
* @return学生实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<StudentView> findStudentViewsByClazzIds(StudentView studentView,String clazzIds, Page page) {
return studentDao.findStudentViewsByClazzIds(studentView,clazzIds, page);
}
/**
* @see com.chinasofti.service.StudentService#updateStudentScoreNow(int, com.chinasofti.model.Student)
* @Function: updateStudentScoreNow
* @Description: 修改
*
* @param: 本周学分变动
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void updateStudentScoreNow(int score, Student student) {
studentDao.updateStudentScoreNow(score, student);
}
}

View File

@@ -0,0 +1,234 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service.impl
* @author: 李洪涛
* @date: 2025年5月4日 下午11:18:00
*/
package com.chinasofti.service.impl;
import java.util.List;
import com.chinasofti.dao.TeacherDao;
import com.chinasofti.dao.impl.TeacherDaoImpl;
import com.chinasofti.model.Teacher;
import com.chinasofti.model.TeacherClazz;
import com.chinasofti.model.User;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.TeacherView;
import com.chinasofti.service.TeacherService;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: TeacherServiceImpl.java
* @Description: 教师业务处理
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月4日 下午11:18:00
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月4日 李洪涛 v1.0.0 新建文件
*/
public class TeacherServiceImpl implements TeacherService {
private TeacherDao teacherDao = new TeacherDaoImpl();
/**
* @see com.chinasofti.service.TeacherService#findTeacher(com.chinasofti.model.Teacher)
* @Function: findTeacher
* @Description: 查询
*
* @param: 教师实体
* @return教师实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public Teacher findTeacher(Teacher teacher) {
return teacherDao.findTeacher(teacher);
}
/**
* @see com.chinasofti.service.TeacherService#findClazzIdsByTeacherId(java.lang.Long)
* @Function: findClazzIdsByTeacherId
* @Description: 查询
*
* @param: teacherID
* @returnList<Long>
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<Long> findClazzIdsByTeacherId(Long teacherID) {
return teacherDao.findClazzIdsByTeacherId(teacherID);
}
/**
* @see com.chinasofti.service.TeacherService#findTeacherViews(com.chinasofti.model.view.TeacherView, com.chinasofti.model.view.Page)
* @Function: findTeacherViews
* @Description: 查询所有记录
*
* @param: 教师实体
* @return教师实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<TeacherView> findTeacherViews(TeacherView teacherView, Page page) {
return teacherDao.findTeacherViews(teacherView, page);
}
/**
* @see com.chinasofti.service.TeacherService#insertTeacher(com.chinasofti.model.Teacher)
* @Function: findTeacher
* @Description: 查询
*
* @param: 教师实体
* @return教师实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public String insertTeacher(Teacher teacher,User user,TeacherClazz teacherClazz,String [] clazzIds) {
return teacherDao.insertTeacher(teacher,user,teacherClazz,clazzIds);
}
/**
* @see com.chinasofti.service.TeacherService#insertTeacherClazz(com.chinasofti.model.TeacherClazz)
* @Function: insertTeacherClazz
* @Description: 添加
*
* @param: 教师与班级关联关系实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public TeacherClazz insertTeacherClazz(TeacherClazz teacherClazz,String [] clazzIds) {
for (String clazzId : clazzIds) {
teacherClazz.setClazzId(Long.parseLong(clazzId));
teacherDao.insertTeacherClazz(teacherClazz);
}
return teacherClazz;
}
/**
* @see com.chinasofti.service.TeacherService#updateTeacher(com.chinasofti.model.Teacher)
* @Function: updateTeacher
* @Description: 修改
*
* @param: 教师实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public String updateTeacher(Teacher teacher,String [] clazzIds,User user) {
return teacherDao.updateTeacher(teacher, clazzIds, user);
}
/**
* @see com.chinasofti.service.TeacherService#removeTeachers(java.util.List)
* @Function: removeTeachers
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void removeTeachers(List<Long> ids) {
if (ids.size() > 0) {
for (Long id : ids) {
teacherDao.removeTeacher(id);
teacherDao.removeTeacherClazz(id);
}
}
}
/**
* @see com.chinasofti.service.TeacherService#findTeacherByStudentId(java.lang.Long)
* @Function: findTeacherByStudentId
* @Description: 查询
*
* @param: 教师实体
* @return教师实体
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public Teacher findTeacherByStudentId(Long studentId) {
return teacherDao.findTeacherByStudentId(studentId);
}
}

View File

@@ -0,0 +1,133 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.service.impl
* @author: mrliy
* @date: 2025年5月2日 上午2:07:43
*/
package com.chinasofti.service.impl;
import java.util.List;
import com.chinasofti.dao.UserDao;
import com.chinasofti.dao.impl.UserDaoImpl;
import com.chinasofti.model.User;
import com.chinasofti.service.UserService;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: UserService.java
* @Description: 用户业务处理
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月2日 上午2:06:30
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月2日 李洪涛 v1.0.0 修改原因
*/
public class UserServiceImpl implements UserService{
private UserDao userDao = new UserDaoImpl();
/**
* @see com.chinasofti.service.UserService#updateUser(com.chinasofti.model.User)
* @Function: updateUser
* @Description: 修改
*
* @param: 用户实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void updateUser(User user) {
userDao.updateUser(user);
}
/**
* @see com.chinasofti.service.UserService#removeUser(long)
* @Function: removeUser
* @Description: 删除
*
* @param: id值
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public void removeUsers(List<Long> ids) {
if (null != ids && ids.size() > 0) {
for (Long id : ids) {
userDao.removeUser(id);
}
}
}
/**
*
* @Function: insertUser
* @Description: 添加
*
* @param: 用户实体
* @return
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public User insertUser(User user) {
return userDao.insertUser(user);
}
/**
* @see com.chinasofti.service.UserService#findUsers(com.chinasofti.model.User)
* @Function: findUsers
* @Description: 查询所有记录
*
* @param: 用户实体
* @return用户实体集合
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年4月6日 上午10:50:58
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年4月6日 李洪涛 v1.0.0 新建方法
*/
@Override
public List<User> findUsers(User user) {
return userDao.findUsers(user);
}
}

View File

@@ -0,0 +1,211 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.servlet
* @author: 李洪涛
* @date: 2025年3月27日 上午9:21:53
*/
package com.chinasofti.servlet;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.chinasofti.enums.OperationResult;
import com.chinasofti.enums.PageScope;
import com.chinasofti.enums.RoleCode;
import com.chinasofti.model.Clazz;
import com.chinasofti.model.User;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.StudentView;
import com.chinasofti.service.ClazzService;
import com.chinasofti.service.StudentService;
import com.chinasofti.service.impl.ClazzServiceImpl;
import com.chinasofti.service.impl.StudentServiceImpl;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
*
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: StudentServlet.java
* @Description: 学生接口
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午9:09:40
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建文件
*/
@WebServlet("/ClazzServlet")
public class ClazzServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private ClazzService clazzService = new ClazzServiceImpl();
private StudentService studentService = new StudentServiceImpl();
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException{
doPost(request, response);
}
public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException{
String method = request.getParameter("method");
if("toClazzListView".equals(method)){
clazzList(request,response);
} else if("getClazzList".equals(method)){
getClazzList(request, response);
} else if("DeleteClazz".equals(method)){
deleteClazz(request, response);
} else if("AddClazz".equals(method)){
addClazz(request, response);
} else if("EditClazz".equals(method)){
editClazz(request, response);
}
}
private void clazzList(HttpServletRequest request,HttpServletResponse response) {
try {
request.getRequestDispatcher("view/clazzList.jsp").forward(request, response);
} catch (ServletException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private void getClazzList(HttpServletRequest request,HttpServletResponse response){
Integer currentPage = request.getParameter("page") == null ? PageScope.CURRENT_PAGE.getNum() : Integer.parseInt(request.getParameter("page"));
Integer pageSize = request.getParameter("rows") == null ? PageScope.PAGE_SIZE.getNum() : Integer.parseInt(request.getParameter("rows"));
String clazzName = request.getParameter("clazzName");
Long userId = request.getParameter("userId") == null ? 0 : Long.parseLong(request.getParameter("userId"));
//获取当前登录用户类型
String roleCode = request.getSession().getAttribute("roleCode").toString();
User loginUser = (User)request.getSession().getAttribute("user");
Clazz clazz = new Clazz();
clazz.setClazzName(clazzName);
clazz.setUserId(userId);
List<Clazz> clazzList = null;
List<Clazz> clazzListTotal = null;
int total;
if(RoleCode.TEACHER.getCode().equals(roleCode)){
//如果是老师,只能查看关联或负责的班级信息
String clazzIdStr = request.getSession().getAttribute("clazzIdStr").toString();
clazzList = clazzService.findClazzsByClazzIds(clazzIdStr, clazz, new Page(currentPage, pageSize));
clazzListTotal = clazzService.findClazzsByClazzIds(clazzIdStr, clazz, new Page(PageScope.CURRENT_PAGE.getNum(), PageScope.PAGE_SIZE.getNum()));
} else if(RoleCode.STUDENT.getCode().equals(roleCode)){
StudentView studentView = new StudentView();
studentView.setUserId(loginUser.getId());
studentView = studentService.findStudentByUserId(studentView);
long clazzId = studentView.getClazzId();
clazzList = clazzService.findClazzsByClazzIds(clazzId + "", clazz, new Page(currentPage, pageSize));
clazzListTotal = clazzService.findClazzsByClazzIds(clazzId + "", clazz, new Page(PageScope.CURRENT_PAGE.getNum(), PageScope.PAGE_SIZE.getNum()));
} else {
clazzList = clazzService.findClazzPage(clazz, new Page(currentPage, pageSize));
clazzListTotal = clazzService.findClazzPage(clazz, new Page(PageScope.CURRENT_PAGE.getNum(), PageScope.PAGE_SIZE.getNum()));
}
total = clazzListTotal.size();
Map<String, Object> ret = new HashMap<String, Object>();
ret.put("total", total);
ret.put("rows", clazzList);
try {
String from = request.getParameter("from");
if("combox".equals(from)){
response.getWriter().write(JSONArray.fromObject(clazzList).toString());
}else{
response.getWriter().write(JSONObject.fromObject(ret).toString());
}
} catch (IOException e) {
e.printStackTrace();
}
}
private void deleteClazz(HttpServletRequest request,HttpServletResponse response) {
String[] clazzIdsRes = request.getParameterValues("clazzIds[]");
List<Long> clazzIds = new ArrayList<Long>();
for(String id : clazzIdsRes){
clazzIds.add(Long.parseLong(id));
}
String idStr = "";
for (Long clazzIdParams : clazzIds) {
idStr += clazzIdParams + ",";
}
idStr = idStr.substring(0, idStr.length()-1);
List<StudentView> sv = studentService.findStudentViewsByClazzIds(new StudentView(),idStr, new Page(1,999));
String res = OperationResult.SUCCESS.getResult();
if (null != sv && sv.size() > 0) {
res = "isHaveStudent";
} else {
clazzService.removeClazz(clazzIds);
}
try {
response.getWriter().write(res);
} catch (IOException e) {
e.printStackTrace();
}
}
private void addClazz(HttpServletRequest request,HttpServletResponse response) {
Long userId = Long.parseLong(request.getParameter("userId"));
String clazzName = request.getParameter("clazzName");
String clazzCode = request.getParameter("clazzCode");
String clazzs = request.getParameter("clazzs");
String clazzAds = request.getParameter("clazzAds");
Clazz clazz = new Clazz();
clazz.setUserId(userId);
clazz.setClazzName(clazzName);
clazz.setClazzCode(clazzCode);
clazz.setClazzs(clazzs);
clazz.setClazzAds(clazzAds);
User loginUser = (User)request.getSession().getAttribute("user");
clazz.setCreateBy(loginUser.getName());
clazz.setCreateTime(LocalDateTime.now());
clazzService.insertClazz(clazz);
try {
response.getWriter().write(OperationResult.SUCCESS.getResult());
} catch (IOException e) {
e.printStackTrace();
}
}
private void editClazz(HttpServletRequest request,HttpServletResponse response) {
User loginUser = (User)request.getSession().getAttribute("user");
Long id = Long.parseLong(request.getParameter("id"));
Long userId = Long.parseLong(request.getParameter("userId"));
String clazzName = request.getParameter("clazzName");
String clazzCode = request.getParameter("clazzCode");
String clazzs = request.getParameter("clazzs");
String clazzAds = request.getParameter("clazzAds");
Clazz clazz = new Clazz();
clazz.setId(id);
clazz.setUserId(userId);
clazz.setClazzName(clazzName);
clazz.setClazzCode(clazzCode);
clazz.setClazzs(clazzs);
clazz.setClazzAds(clazzAds);
clazz.setUpdateBy(loginUser.getName());
clazz.setUpdateTime(LocalDateTime.now());
clazzService.updateClazz(clazz);
try {
response.getWriter().write(OperationResult.SUCCESS.getResult());
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,240 @@
package com.chinasofti.servlet;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import com.alibaba.druid.util.StringUtils;
import com.chinasofti.enums.CreditType;
import com.chinasofti.enums.MathType;
import com.chinasofti.enums.OperationResult;
import com.chinasofti.enums.PageScope;
import com.chinasofti.enums.RoleCode;
import com.chinasofti.model.CreditRecords;
import com.chinasofti.model.Student;
import com.chinasofti.model.User;
import com.chinasofti.model.view.Page;
import com.chinasofti.service.CreditRecordsService;
import com.chinasofti.service.StudentService;
import com.chinasofti.service.impl.CreditRecordsServiceImpl;
import com.chinasofti.service.impl.StudentServiceImpl;
import com.chinasofti.utils.IsNumber;
import net.sf.json.JSONObject;
@WebServlet("/CreditRecordsServlet")
public class CreditRecordsServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private CreditRecordsService creditRecordsService = new CreditRecordsServiceImpl();
private StudentService studentService = new StudentServiceImpl();
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String method = request.getParameter("method");
if("toCreditRecordsServletListView".equals(method)){
recordsServletList(request, response);
} else if("CreditRecordsList".equals(method)){
getCreditRecordsList(request,response);
} else if("AddCreditRecords".equals(method)){
addCreditRecords(request,response);
} else if("ExportCreditRecordsList".equals(method)){
exportCreditRecords(request,response);
}
}
private void recordsServletList(HttpServletRequest request,HttpServletResponse response) {
try {
request.getRequestDispatcher("view/creditRecordsList.jsp").forward(request, response);
} catch (ServletException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private void getCreditRecordsList(HttpServletRequest request,HttpServletResponse response) {
Integer currentPage = request.getParameter("page") == null ? PageScope.CURRENT_PAGE.getNum() : Integer.parseInt(request.getParameter("page"));
Integer pageSize = request.getParameter("rows") == null ? PageScope.PAGE_SIZE.getNum() : Integer.parseInt(request.getParameter("rows"));
String studentName = request.getParameter("studentName");
long number = StringUtils.isEmpty(request.getParameter("number")) ? 0 : Long.parseLong(request.getParameter("number").toString());
String clazzName = request.getParameter("clazzName");
String creditType = request.getParameter("creditType");
String startTime = request.getParameter("startTime");
String endTime = request.getParameter("endTime");
//获取当前登录用户类型
String roleCode = request.getSession().getAttribute("roleCode").toString();
CreditRecords params = new CreditRecords();
params.setStudentName(studentName);
params.setNumber(number);
params.setClazzName(clazzName);
params.setCreditType(creditType);
String clazzIds = "";
List<CreditRecords> creditRecords = new ArrayList<CreditRecords>();
List<CreditRecords> creditRecordsTotal = new ArrayList<CreditRecords>();
int total;
if(RoleCode.TEACHER.getCode().equals(roleCode)){
clazzIds = request.getSession().getAttribute("clazzIdStr").toString();
}
creditRecords = creditRecordsService.findCreditRecordsPages(startTime,endTime,params, clazzIds, new Page(currentPage, pageSize));
creditRecordsTotal = creditRecordsService.findCreditRecordsPages(startTime,endTime,params, clazzIds, new Page(PageScope.CURRENT_PAGE.getNum(), PageScope.PAGE_SIZE.getNum()));
total = creditRecordsTotal.size();
Map<String, Object> ret = new HashMap<String, Object>();
ret.put("total", total);
ret.put("rows", creditRecords);
try {
response.getWriter().write(JSONObject.fromObject(ret).toString());
} catch (IOException e) {
e.printStackTrace();
}
}
private void addCreditRecords(HttpServletRequest request,HttpServletResponse response) {
String res = OperationResult.SUCCESS.getResult();
if (IsNumber.isNumber(request.getParameter("studentId").toString())) {
Long studentId = Long.parseLong(request.getParameter("studentId"));
String creditType = request.getParameter("creditType");
String mathType = request.getParameter("mathType");
Integer credit = Integer.parseInt(request.getParameter("credit"));
if (MathType.MINUS_SIGN.getSign().equals(mathType)) {
credit *= -1;
}
String remark = request.getParameter("remark");
User loginUser = (User)request.getSession().getAttribute("user");
String loginUserName = loginUser.getName();
LocalDateTime now = LocalDateTime.now();
CreditRecords creditRecords = new CreditRecords();
creditRecords.setCredit(credit);
creditRecords.setCreditType(creditType);
creditRecords.setRemark(remark);
creditRecords.setUserName(loginUserName);
creditRecords.setCreateBy(loginUserName);
creditRecords.setCreateTime(now);
//新增学分变动记录
creditRecordsService.insertCreditRecords(studentId, creditRecords);
if (CreditType.THIS_WEEK.getType().equals(creditType)) {
Student student = new Student();
student.setId(studentId);
student.setUpdateBy(loginUserName);
student.setUpdateTime(now);
//修改学生本周学分
studentService.updateStudentScoreNow(credit, student);
}
} else {
res = "error";
}
try {
response.getWriter().write(res);
} catch (IOException e) {
e.printStackTrace();
}
}
private void exportCreditRecords(HttpServletRequest request,HttpServletResponse response) {
Integer currentPage = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
Integer pageSize = request.getParameter("rows") == null ? 99999 : Integer.parseInt(request.getParameter("rows"));
String studentName = request.getParameter("studentName");
long number = StringUtils.isEmpty(request.getParameter("number")) ? 0 : Long.parseLong(request.getParameter("number").toString());
String clazzName = request.getParameter("clazzName");
String creditType = request.getParameter("creditType");
String startTime = request.getParameter("startTime");
String endTime = request.getParameter("endTime");
//获取当前登录用户类型
String roleCode = request.getSession().getAttribute("roleCode").toString();
CreditRecords params = new CreditRecords();
params.setStudentName(studentName);
params.setNumber(number);
params.setClazzName(clazzName);
params.setCreditType(creditType);
String clazzIds = "";
List<CreditRecords> creditRecords = new ArrayList<CreditRecords>();
if(RoleCode.TEACHER.getCode().equals(roleCode)){
clazzIds = request.getSession().getAttribute("clazzIdStr").toString();
}
creditRecords = creditRecordsService.findCreditRecordsPages(startTime,endTime,params, clazzIds, new Page(currentPage, pageSize));
try {
response.setHeader("Content-Disposition", "attachment;filename="+URLEncoder.encode("学分变动记录.xls", "UTF-8"));
response.setHeader("Connection", "close");
response.setHeader("Content-Type", "application/octet-stream");
ServletOutputStream outputStream = response.getOutputStream();
HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
HSSFSheet createSheet = hssfWorkbook.createSheet("学分变动列表");
HSSFRow createRow = createSheet.createRow(0);
createRow.createCell(0).setCellValue("学号");
createRow.createCell(1).setCellValue("学生");
createRow.createCell(2).setCellValue("班级");
createRow.createCell(3).setCellValue("变动分数");
createRow.createCell(4).setCellValue("变动范围");
createRow.createCell(5).setCellValue("操作人");
createRow.createCell(6).setCellValue("操作时间");
createRow.createCell(7).setCellValue("变动原因");
//实现将数据装入到excel文件中
int row = 1;
for(CreditRecords records:creditRecords){
createRow = createSheet.createRow(row++);
createRow.createCell(0).setCellValue(records.getNumber()+"");
createRow.createCell(1).setCellValue(records.getStudentName());
createRow.createCell(2).setCellValue(records.getClazzName());
int credit = records.getCredit();
if (credit > 0) {
createRow.createCell(3).setCellValue("+" + credit);
} else {
createRow.createCell(3).setCellValue("" + credit);
}
String type = records.getCreditType();
if (CreditType.THIS_WEEK.getType().equals(type)) {
createRow.createCell(4).setCellValue(CreditType.THIS_WEEK.getInfo());
} else {
createRow.createCell(4).setCellValue(CreditType.THIS_DISCIPLINE.getInfo());
}
createRow.createCell(5).setCellValue(records.getUserName());
createRow.createCell(6).setCellValue(records.getCreateTime().toString());
createRow.createCell(7).setCellValue(records.getRemark());
}
createSheet.setColumnWidth(0,20*256);
createSheet.setColumnWidth(2,20*256);
createSheet.setColumnWidth(6,10*256);
createSheet.setColumnWidth(7,200*256);
hssfWorkbook.write(outputStream);
outputStream.flush();
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,327 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.servlet
* @author: 李洪涛
* @date: 2025年3月27日 上午9:21:53
*/
package com.chinasofti.servlet;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import com.chinasofti.enums.CreditType;
import com.chinasofti.enums.DeductCredit;
import com.chinasofti.enums.LeaveStatus;
import com.chinasofti.enums.OperationResult;
import com.chinasofti.enums.PageScope;
import com.chinasofti.enums.RoleCode;
import com.chinasofti.model.CreditRecords;
import com.chinasofti.model.Leave;
import com.chinasofti.model.User;
import com.chinasofti.model.view.LeaveView;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.StudentView;
import com.chinasofti.model.view.TeacherView;
import com.chinasofti.service.CreditRecordsService;
import com.chinasofti.service.LeaveService;
import com.chinasofti.service.StudentService;
import com.chinasofti.service.TeacherService;
import com.chinasofti.service.impl.CreditRecordsServiceImpl;
import com.chinasofti.service.impl.LeaveServiceImpl;
import com.chinasofti.service.impl.StudentServiceImpl;
import com.chinasofti.service.impl.TeacherServiceImpl;
import com.chinasofti.utils.IsNumber;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
*
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: LeaveServlet.java
* @Description: 请假接口
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午9:09:40
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建文件
*/
@WebServlet("/LeaveServlet")
public class LeaveServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private LeaveService leaveService = new LeaveServiceImpl();
private StudentService studentService = new StudentServiceImpl();
private TeacherService teacherService = new TeacherServiceImpl();
private CreditRecordsService creditRecordsService = new CreditRecordsServiceImpl();
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String method = request.getParameter("method");
if("toLeaveServletListView".equals(method)){
leaveList(request, response);
} else if("LeaveList".equals(method)){
getLeaveList(request,response);
} else if("AddLeave".equals(method)){
addLeave(request,response);
} else if("CheckLeave".equals(method)){
checkLeave(request,response);
} else if("ExportLeaveList".equals(method)){
exportLeave(request,response);
} else if("ApproveTeacher".equals(method)){
approveTeacher(request,response);
}
}
private void leaveList(HttpServletRequest request,HttpServletResponse response) {
try {
request.getRequestDispatcher("view/leaveList.jsp").forward(request, response);
} catch (ServletException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private void getLeaveList(HttpServletRequest request,HttpServletResponse response) {
Integer currentPage = request.getParameter("page") == null ? PageScope.CURRENT_PAGE.getNum() : Integer.parseInt(request.getParameter("page"));
Integer pageSize = request.getParameter("rows") == null ? PageScope.PAGE_SIZE.getNum() : Integer.parseInt(request.getParameter("rows"));
long studentId = request.getParameter("studentId") == null || !IsNumber.isNumber(request.getParameter("studentId").toString()) ? 0 : Long.parseLong(request.getParameter("studentId").toString());
long teacherId = request.getParameter("teacherId") == null ? 0 : Long.parseLong(request.getParameter("teacherId").toString());
String status = request.getParameter("status");
//获取当前登录用户类型
String roleCode = request.getSession().getAttribute("roleCode").toString();
Leave leave = new Leave();
leave.setStudentId(studentId);
leave.setTeacherId(teacherId);
leave.setStatus(status);
List<Leave> leaves = null;
List<Leave> leavesTotal = null;
int total = 0;
if(RoleCode.STUDENT.getCode().equals(roleCode)){
User loginUser = (User)request.getSession().getAttribute("user");
StudentView studentView = new StudentView();
studentView.setUserId(loginUser.getId());
leave.setStudentId(studentService.findStudentByUserId(studentView).getStudentId());
leaves = leaveService.findLeavePages(leave, new Page(currentPage, pageSize));
leavesTotal = leaveService.findLeavePages(leave, new Page(PageScope.CURRENT_PAGE.getNum(), PageScope.PAGE_SIZE.getNum()));
} else if(RoleCode.TEACHER.getCode().equals(roleCode)){
String clazzIdStr = request.getSession().getAttribute("clazzIdStr").toString();
leaves = leaveService.findLeavePagesByClazzIds(leave, new Page(currentPage, pageSize),clazzIdStr);
leavesTotal = leaveService.findLeavePagesByClazzIds(leave, new Page(PageScope.CURRENT_PAGE.getNum(), PageScope.PAGE_SIZE.getNum()),clazzIdStr);
} else {
leaves = leaveService.findLeavePages(leave, new Page(currentPage, pageSize));
leavesTotal = leaveService.findLeavePages(leave, new Page(PageScope.CURRENT_PAGE.getNum(), PageScope.PAGE_SIZE.getNum()));
}
if (null != leavesTotal && leavesTotal.size() > 0) {
total = leavesTotal.size();
}
Map<String, Object> ret = new HashMap<String, Object>();
ret.put("total", total);
ret.put("rows", leaves);
try {
response.getWriter().write(JSONObject.fromObject(ret).toString());
} catch (IOException e) {
e.printStackTrace();
}
}
private void addLeave(HttpServletRequest request,HttpServletResponse response) {
String info = request.getParameter("info");
User loginUser = (User)request.getSession().getAttribute("user");
Leave leave = new Leave();
StudentView studentView = new StudentView();
studentView.setUserId(loginUser.getId());
Long studentId = studentService.findStudentByUserId(studentView).getStudentId();
Long teacherId = teacherService.findTeacherByStudentId(studentId).getId();
leave.setStudentId(studentId);
leave.setTeacherId(teacherId);
leave.setStatus(LeaveStatus.WAIT.getstatus());
leave.setInfo(info);
LocalDateTime now = LocalDateTime.now();
leave.setApplyTime(now);
leave.setCreateBy(loginUser.getName());
leave.setCreateTime(now);
leaveService.insertLeave(leave);
try {
response.getWriter().write(OperationResult.SUCCESS.getResult());
} catch (IOException e) {
e.printStackTrace();
}
}
private void checkLeave(HttpServletRequest request,HttpServletResponse response) {
Long id = Long.parseLong(request.getParameter("id"));
String status = request.getParameter("status");
String remark = request.getParameter("remark");
long studentId = Long.parseLong(request.getParameter("studentId").toString());
User loginUser = (User)request.getSession().getAttribute("user");
Leave leave = new Leave();
leave.setRemark(remark);
leave.setStatus(status);
leave.setId(id);
LocalDateTime now = LocalDateTime.now();
leave.setApproveTime(now);
leave.setUpdateBy(loginUser.getName());
leave.setCreateTime(now);
leaveService.updateLeave(leave);
if (LeaveStatus.PASS.getstatus().equals(status)) {
String creditType = CreditType.THIS_DISCIPLINE.getType();
Integer credit = DeductCredit.LEAVE.getCredit();
String creditRemark = DeductCredit.LEAVE.getInfo();
CreditRecords creditRecords = new CreditRecords();
creditRecords.setCredit(credit);
creditRecords.setCreditType(creditType);
creditRecords.setRemark(creditRemark);
creditRecords.setUserName(loginUser.getName());
creditRecords.setCreateBy(loginUser.getName());
creditRecords.setCreateTime(now);
creditRecordsService.insertCreditRecords(studentId, creditRecords);
}
try {
response.getWriter().write(OperationResult.SUCCESS.getResult());
} catch (IOException e) {
e.printStackTrace();
}
}
private void exportLeave(HttpServletRequest request,HttpServletResponse response) {
long studentId = request.getParameter("studentId") == null ? 0 : Long.parseLong(request.getParameter("studentId").toString());
long teacherId = request.getParameter("teacherId") == null ? 0 : Long.parseLong(request.getParameter("teacherId").toString());
String status = request.getParameter("status");
//获取当前登录用户类型
String roleCode = request.getSession().getAttribute("roleCode").toString();
Leave leave = new Leave();
leave.setStudentId(studentId);
leave.setTeacherId(teacherId);
leave.setStatus(status);
List<LeaveView> leaves = null;
if(RoleCode.STUDENT.getCode().equals(roleCode)){
User loginUser = (User)request.getSession().getAttribute("user");
StudentView studentView = new StudentView();
studentView.setUserId(loginUser.getId());
leave.setStudentId(studentService.findStudentByUserId(studentView).getStudentId());
leaves = leaveService.findLeaveViews(leave);
} else if(RoleCode.TEACHER.getCode().equals(roleCode)){
String clazzIdStr = request.getSession().getAttribute("clazzIdStr").toString();
leaves = leaveService.findLeaveViewsByClazzIds(leave,clazzIdStr);
} else {
leaves = leaveService.findLeaveViews(leave);
}
try {
response.setHeader("Content-Disposition", "attachment;filename="+URLEncoder.encode("请假记录.xls", "UTF-8"));
response.setHeader("Connection", "close");
response.setHeader("Content-Type", "application/octet-stream");
ServletOutputStream outputStream = response.getOutputStream();
HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
HSSFSheet createSheet = hssfWorkbook.createSheet("成绩列表");
HSSFRow createRow = createSheet.createRow(0);
createRow.createCell(0).setCellValue("学生");
createRow.createCell(1).setCellValue("审批教师");
createRow.createCell(2).setCellValue("申请信息");
createRow.createCell(3).setCellValue("审批状态");
createRow.createCell(4).setCellValue("审批回复");
createRow.createCell(5).setCellValue("申请时间");
createRow.createCell(6).setCellValue("审批时间");
//实现将数据装入到excel文件中
int row = 1;
for(LeaveView leaveView:leaves){
createRow = createSheet.createRow(row++);
createRow.createCell(0).setCellValue(leaveView.getStudentName());
createRow.createCell(1).setCellValue(leaveView.getTeacherName());
createRow.createCell(2).setCellValue(leaveView.getInfo());
createRow.createCell(3).setCellValue(leaveView.getStatus());
createRow.createCell(4).setCellValue(leaveView.getRemark());
createRow.createCell(5).setCellValue(leaveView.getApplyTime().toString());
String approveTime;
if (null == leaveView.getApproveTime()) {
approveTime = "";
} else {
approveTime = leaveView.getApproveTime().toString();
}
createRow.createCell(6).setCellValue(approveTime);
}
createSheet.setColumnWidth(0,10*256);
createSheet.setColumnWidth(1,10*256);
createSheet.setColumnWidth(2,50*256);
createSheet.setColumnWidth(4,50*256);
createSheet.setColumnWidth(5,20*256);
createSheet.setColumnWidth(6,20*256);
hssfWorkbook.write(outputStream);
outputStream.flush();
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private void approveTeacher(HttpServletRequest request,HttpServletResponse response) {
//获取当前登录用户的角色
String roleCode = request.getSession().getAttribute("roleCode").toString();
Long teacherId = null;
if (RoleCode.TEACHER.getCode().equals(roleCode)) {
//如果是老师,只能查看自己班级责任人的信息
teacherId = Long.parseLong(request.getSession().getAttribute("teacherId").toString());
}
if(RoleCode.STUDENT.getCode().equals(roleCode)){
//如果是学生,只能查看自己班级责任人的信息
User loginUser = (User)request.getSession().getAttribute("user");
StudentView studentView = new StudentView();
studentView.setUserId(loginUser.getId());
studentView = studentService.findStudentByUserId(studentView);
teacherId = teacherService.findTeacherByStudentId(studentView.getStudentId()).getId();
}
List<TeacherView> teacherViews = leaveService.findApproveTeacherViews(teacherId);
try {
response.getWriter().write(JSONArray.fromObject(teacherViews).toString());
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,166 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.servlet
* @author: 李洪涛
* @date: 2025年3月27日 上午9:21:53
*/
package com.chinasofti.servlet;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.chinasofti.enums.IsCounselor;
import com.chinasofti.enums.RoleId;
import com.chinasofti.model.Clazz;
import com.chinasofti.model.Role;
import com.chinasofti.model.Teacher;
import com.chinasofti.model.User;
import com.chinasofti.service.ClazzService;
import com.chinasofti.service.LoginService;
import com.chinasofti.service.RoleService;
import com.chinasofti.service.TeacherService;
import com.chinasofti.service.impl.ClazzServiceImpl;
import com.chinasofti.service.impl.LoginServiceImpl;
import com.chinasofti.service.impl.RoleServiceImpl;
import com.chinasofti.service.impl.TeacherServiceImpl;
import com.chinasofti.utils.SM3PasswordEncoder;
/**
*
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: LoginServlet.java
* @Description: 登录校验
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午9:09:40
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建文件
*/
@WebServlet("/LoginServlet")
public class LoginServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private LoginService loginService = new LoginServiceImpl();
private RoleService roleService = new RoleServiceImpl();
private ClazzService clazzService = new ClazzServiceImpl();
private TeacherService teacherService = new TeacherServiceImpl();
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException{
doPost(request, response);
}
/**
*
* @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
* @Function: doPost
* @Description: 登录校验,跳转页面
*
* @param: request
* @param: response
* @return void
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午9:12:20
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建方法
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String method = request.getParameter("method");
if("logout".equals(method)){
logout(request, response);
return;
}
String username = request.getParameter("username");
String password = request.getParameter("password");
User user = new User();
user.setUserName(username);
User res = loginService.loginCheck(user);
String loginStatus = "loginSuccess";
if (null != res && SM3PasswordEncoder.matches(password, res.getPassWord())) {
HttpSession session=request.getSession();
Role role = roleService.findRoleById(res.getRoleId());
session.setAttribute("user", res);
session.setAttribute("roleCode", role.getRoleCode());
if (RoleId.TEACHER.getId() == role.getId()) {
long userId = res.getId();
Teacher teacher = new Teacher();
teacher.setUserId(userId);
teacher = teacherService.findTeacher(teacher);
List<Clazz> clazzs = new ArrayList<Clazz>();
long teacherId = teacher.getId();
clazzs.addAll(clazzService.findClazzsByTeacherId(teacherId));
if (IsCounselor.YES.getIs().equals(teacher.getIsCounselor())) {
session.setAttribute("isCounselor", IsCounselor.YES.getIs());
clazzs.addAll(clazzService.findClazzsByUserIds(userId+""));
} else {
session.setAttribute("isCounselor", IsCounselor.NO.getIs());
}
String clazzIdStr = "";
if (clazzs.size() > 0) {
for (Clazz clazz : clazzs) {
clazzIdStr += clazz.getId() + ",";
}
clazzIdStr = clazzIdStr.substring(0, clazzIdStr.length()-1);
}
session.setAttribute("clazzIdStr", clazzIdStr);
session.setAttribute("teacherId", teacherId);
}
} else {
loginStatus = "loginError";
}
response.getWriter().write(loginStatus);
}
/**
*
* @Function: logout
* @Description: 退出登录
*
* @param: request
* @param: response
* @return void
* @throws
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午9:12:20
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建方法
*/
private void logout(HttpServletRequest request,HttpServletResponse response) throws IOException{
request.getSession().removeAttribute("user");
request.getSession().removeAttribute("userType");
response.sendRedirect("index.jsp");
}
}

View File

@@ -0,0 +1,497 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.servlet
* @author: 李洪涛
* @date: 2025年3月27日 上午9:21:53
*/
package com.chinasofti.servlet;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import com.alibaba.druid.util.StringUtils;
import com.chinasofti.enums.FileName;
import com.chinasofti.enums.OperationResult;
import com.chinasofti.enums.PageScope;
import com.chinasofti.enums.PassWord;
import com.chinasofti.enums.RoleCode;
import com.chinasofti.enums.RoleId;
import com.chinasofti.enums.ScoreNow;
import com.chinasofti.enums.Sex;
import com.chinasofti.model.Clazz;
import com.chinasofti.model.Student;
import com.chinasofti.model.User;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.StudentView;
import com.chinasofti.service.ClazzService;
import com.chinasofti.service.StudentService;
import com.chinasofti.service.impl.ClazzServiceImpl;
import com.chinasofti.service.impl.StudentServiceImpl;
import com.chinasofti.utils.ChineseToPinyin;
import com.chinasofti.utils.IsDate;
import com.chinasofti.utils.IsPhoneNumber;
import com.chinasofti.utils.SM3PasswordEncoder;
import com.lizhou.exception.FileFormatException;
import com.lizhou.exception.NullFileException;
import com.lizhou.exception.ProtocolException;
import com.lizhou.exception.SizeException;
import com.lizhou.fileload.FileUpload;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
*
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: StudentServlet.java
* @Description: 学生接口
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午9:09:40
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建文件
*/
@WebServlet("/StudentServlet")
public class StudentServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private StudentService studentService = new StudentServiceImpl();
private ClazzService clazzService = new ClazzServiceImpl();
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException{
doPost(request, response);
}
public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException{
String method = request.getParameter("method");
if("toStudentListView".equals(method)){
studentList(request,response);
}else if("AddStudent".equals(method)){
addStudent(request,response);
}else if("StudentList".equals(method)){
getStudentList(request,response);
}else if("EditStudent".equals(method)){
editStudent(request,response);
}else if("DeleteStudent".equals(method)){
deleteStudent(request,response);
}else if("ImportStudent".equals(method)){
importStudent(request,response);
}else if("DownLoad".equals(method)){
downLoad(request,response);
}
}
private void deleteStudent(HttpServletRequest request,HttpServletResponse response) {
String[] studentIdsRes = request.getParameterValues("studentIds[]");
String[] userIdsRes = request.getParameterValues("userIds[]");
String studentIdsStr = "";
for (String studentId : studentIdsRes) {
studentIdsStr += studentId + ",";
}
studentIdsStr = studentIdsStr.substring(0, studentIdsStr.length()-1);
String userIdsStr = "";
for (String userId : userIdsRes) {
userIdsStr += userId + ",";
}
userIdsStr = userIdsStr.substring(0, userIdsStr.length()-1);
try {
response.getWriter().write(studentService.removeStudents(studentIdsStr, userIdsStr));
} catch (IOException e) {
e.printStackTrace();
}
}
private void editStudent(HttpServletRequest request,HttpServletResponse response) {
long userId = Long.parseLong(request.getParameter("userId"));
String name = request.getParameter("name");
String sex = request.getParameter("sex");
String userName = request.getParameter("userName");
String phone = request.getParameter("phone");
long studentId = Long.parseLong(request.getParameter("studentId"));
long number = Long.parseLong(request.getParameter("number"));
String honor = request.getParameter("honor");
long clazzId = Long.parseLong(request.getParameter("clazzId"));
User loginUser = (User) request.getSession().getAttribute("user");
LocalDateTime now = LocalDateTime.now();
String updateBy = loginUser.getUserName();
User user = new User();
user.setId(userId);
user.setName(name);
user.setSex(sex);
user.setUserName(userName);
user.setPhone(phone);
user.setUpdateBy(updateBy);
user.setUpdateTime(now);
Student student = new Student();
student.setId(studentId);
student.setNumber(number);
student.setHonor(honor);
student.setClazzId(clazzId);
if (!StringUtils.isEmpty(request.getParameter("scoreNow"))) {
int scoreNow = Integer.parseInt(request.getParameter("scoreNow"));
student.setScoreNow(scoreNow);
}
student.setUpdateBy(updateBy);
student.setUpdateTime(now);
try {
response.getWriter().write(studentService.updateStudent(student,user));
} catch (IOException e) {
e.printStackTrace();
}
}
private void getStudentList(HttpServletRequest request,HttpServletResponse response) {
Integer currentPage = request.getParameter("page") == null ? PageScope.CURRENT_PAGE.getNum() : Integer.parseInt(request.getParameter("page"));
Integer pageSize = request.getParameter("rows") == null ? PageScope.PAGE_SIZE.getNum() : Integer.parseInt(request.getParameter("rows"));
//获取当前登录用户类型
String roleCode = request.getSession().getAttribute("roleCode").toString();
User loginUser = (User)request.getSession().getAttribute("user");
String name = request.getParameter("studentName");
Long clazzId = request.getParameter("clazzId") == null ? 0 : Long.parseLong(request.getParameter("clazzId"));
StudentView studentView = new StudentView();
studentView.setName(name);
studentView.setClazzId(clazzId);
List<StudentView> studentViews = null;
List<StudentView> studentViewsTotal = null;
int total;
if(RoleCode.STUDENT.getCode().equals(roleCode)){
//如果是学生,只能查看自己的信息
studentView.setUserId(loginUser.getId());
studentViews = new ArrayList<StudentView>();
studentViews.add(studentService.findStudentByUserId(studentView));
total = 1;
} else if(RoleCode.TEACHER.getCode().equals(roleCode)){
//如果是老师,只能查看关联或负责的班级内的学生信息
String clazzIdStr = request.getSession().getAttribute("clazzIdStr").toString();
studentViews = studentService.findStudentViewsByClazzIds(studentView, clazzIdStr, new Page(currentPage, pageSize));
studentViewsTotal = studentService.findStudentViewsByClazzIds(studentView, clazzIdStr, new Page(PageScope.CURRENT_PAGE.getNum(), PageScope.PAGE_SIZE.getNum()));
total = studentViewsTotal.size();
} else {
studentViews = studentService.findStudentViews(studentView, new Page(currentPage, pageSize));
studentViewsTotal = studentService.findStudentViews(studentView, new Page(PageScope.CURRENT_PAGE.getNum(), PageScope.PAGE_SIZE.getNum()));
total = studentViewsTotal.size();
}
Map<String, Object> res = new HashMap<String, Object>();
res.put("total", total);
res.put("rows", studentViews);
try {
String from = request.getParameter("from");
if("combox".equals(from)){
response.getWriter().write(JSONArray.fromObject(studentViews).toString());
}else{
response.getWriter().write(JSONObject.fromObject(res).toString());
}
} catch (IOException e) {
e.printStackTrace();
}
}
private void addStudent(HttpServletRequest request,HttpServletResponse response) {
String name = request.getParameter("name");
String sex = request.getParameter("sex");
String userName = request.getParameter("userName");
String phone = request.getParameter("phone");
long clazzId = Long.parseLong(request.getParameter("clazzId"));
long number = Long.parseLong(request.getParameter("number"));
Date birthday = null;
if (!StringUtils.isEmpty(request.getParameter("birthday"))) {
try {
birthday = new SimpleDateFormat("yyyy-MM-dd").parse(request.getParameter("birthday"));
} catch (ParseException e1) {
e1.printStackTrace();
}
}
String major = request.getParameter("major");
String honor = request.getParameter("honor");
int scoreNow = Integer.parseInt(request.getParameter("scoreNow"));
User loginUser = (User) request.getSession().getAttribute("user");
LocalDateTime now = LocalDateTime.now();
String createBy = loginUser.getUserName();
User user = new User();
user.setRoleId(RoleId.STUDENT.getId());
user.setName(name);
user.setSex(sex);
user.setUserName(userName);
user.setPhone(phone);
user.setPassWord(SM3PasswordEncoder.encode(PassWord.STUDENT.getPassWord()));
user.setCreateBy(createBy);
user.setCreateTime(now);
Student student = new Student();
student.setClazzId(clazzId);
student.setNumber(number);
student.setBirthday(birthday);
student.setMajor(major);
student.setHonor(honor);
student.setScoreNow(scoreNow);
student.setCreateBy(createBy);
student.setCreateTime(now);
try {
response.getWriter().write(studentService.insertStudent(student,user));
} catch (IOException e) {
e.printStackTrace();
}
}
private void studentList(HttpServletRequest request,HttpServletResponse response) throws IOException {
try {
request.getRequestDispatcher("view/studentList.jsp").forward(request, response);
} catch (ServletException e) {
e.printStackTrace();
}
}
private void importStudent(HttpServletRequest request,HttpServletResponse response) {
FileUpload fileUpload = new FileUpload(request);
fileUpload.setFileFormat("xls");
fileUpload.setFileFormat("xlsx");
fileUpload.setFileSize(2048);
response.setCharacterEncoding("UTF-8");
User loginUser = (User) request.getSession().getAttribute("user");
try {
InputStream uploadInputStream = fileUpload.getUploadInputStream();
HSSFWorkbook hssfWorkbook = new HSSFWorkbook(uploadInputStream);
HSSFSheet sheetAt = hssfWorkbook.getSheetAt(0);
int count = 0;
String errorMsg = "";
for(int rowNum = 1; rowNum <= sheetAt.getLastRowNum(); rowNum++){
HSSFRow row = sheetAt.getRow(rowNum);
HSSFCell cell = row.getCell(0);
//获取第0列学生姓名
if(cell == null){
errorMsg += "" + rowNum + "行学生姓名缺失!\n";
continue;
}
String name = cell.getStringCellValue();
String userName = ChineseToPinyin.convertToPinyin(name);
//获取第1列性别
cell = row.getCell(1);
if(cell == null){
errorMsg += "" + rowNum + "行学生性别缺失!\n";
continue;
}
String sexInfo = cell.getStringCellValue();
String sex;
if(sexInfo.equals(Sex.MAN.getInfo())){
sex = Sex.MAN.getSex();
} else if(sexInfo.equals(Sex.WOMAN.getInfo())) {
sex = Sex.WOMAN.getSex();
} else {
errorMsg += "" + rowNum + "行学生性别错误!\n";
continue;
}
//获取第2列联系方式
cell = row.getCell(2);
if(cell == null){
errorMsg += "" + rowNum + "行联系方式缺失!\n";
continue;
}
String phone = cell.getStringCellValue();
if(!IsPhoneNumber.isPhoneNumberValid(phone)){
errorMsg += "" + rowNum + "行联系方式不合法!\n";
continue;
}
//获取第3列学号
cell = row.getCell(3);
if(cell == null){
errorMsg += "" + rowNum + "行学号缺失!\n";
continue;
}
long number = Long.parseLong(cell.getStringCellValue());
//获取第4列班级
cell = row.getCell(4);
if(cell == null){
errorMsg += "" + rowNum + "行班级缺失!\n";
continue;
}
String clazzName = cell.getStringCellValue();
Clazz clazz = clazzService.findClazzByClazzName(clazzName);
if(clazz == null){
errorMsg += "" + rowNum + "行班级不存在!\n";
continue;
}
long clazzId = clazz.getId();
//获取第5列专业
cell = row.getCell(5);
if(cell == null){
errorMsg += "" + rowNum + "行专业缺失!\n";
continue;
}
String major = cell.getStringCellValue();
//获取第6列个人荣誉
cell = row.getCell(6);
String honor = cell.getStringCellValue();
//获取第7列生日
cell = row.getCell(7);
Date birthday = null;
String birthdayStr = cell.getStringCellValue();
if (!StringUtils.isEmpty(birthdayStr) && IsDate.validateDate(birthdayStr)) {
birthday = new SimpleDateFormat("yyyy-MM-dd").parse(birthdayStr);
}
User user = new User();
user.setRoleId(RoleId.STUDENT.getId());
user.setName(name);
user.setSex(sex);
user.setUserName(userName);
user.setPhone(phone);
user.setPassWord(SM3PasswordEncoder.encode(PassWord.STUDENT.getPassWord()));
user.setCreateBy(loginUser.getUserName());
user.setCreateTime(LocalDateTime.now());
Student student = new Student();
student.setClazzId(clazzId);
student.setNumber(number);
student.setBirthday(birthday);
student.setMajor(major);
student.setHonor(honor);
student.setScoreNow(ScoreNow.SCORE_WEEK.getScore());
student.setCreateBy(loginUser.getUserName());
student.setCreateTime(LocalDateTime.now());
String res = studentService.insertStudent(student,user);
if(OperationResult.SUCCESS.getResult().equals(res)){
count++;
}
}
errorMsg += "成功录入" + count + "条成绩信息!";
try {
response.getWriter().write("<div id='message'>"+errorMsg+"</div>");
} catch (IOException e1) {
e1.printStackTrace();
}
} catch (ProtocolException e) {
try {
response.getWriter().write("<div id='message'>上传协议错误!</div>");
} catch (IOException e1) {
e1.printStackTrace();
}
e.printStackTrace();
}catch (NullFileException e1) {
try {
response.getWriter().write("<div id='message'>上传的文件为空!</div>");
} catch (IOException e) {
e.printStackTrace();
}
e1.printStackTrace();
}catch (SizeException e2) {
try {
response.getWriter().write("<div id='message'>上传文件大小不能超过"+fileUpload.getFileSize()+"</div>");
} catch (IOException e) {
e.printStackTrace();
}
e2.printStackTrace();
}catch (IOException e3) {
try {
response.getWriter().write("<div id='message'>读取文件出错!</div>");
} catch (IOException e) {
e.printStackTrace();
}
e3.printStackTrace();
}catch (FileFormatException e4) {
try {
response.getWriter().write("<div id='message'>上传文件格式不正确,请上传 "+fileUpload.getFileFormat()+" 格式的文件!</div>");
} catch (IOException e) {
e.printStackTrace();
}
e4.printStackTrace();
}catch (FileUploadException e5) {
try {
response.getWriter().write("<div id='message'>上传文件失败!</div>");
} catch (IOException e) {
e.printStackTrace();
}
e5.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
}
//下载模板
public void downLoad(HttpServletRequest request, HttpServletResponse response) {
String name = FileName.STUDENT_TEMPLATE_NAME.getName();
String path = FileName.STUDENT_TEMPLATE_PATCH.getName();
// 指定要下载的文件路径
String filePath = path + "\\" + name;
// 获取文件名
String fileName = new File(filePath).getName();
String encodedFileName = null;
try {
encodedFileName = URLEncoder.encode(fileName, "UTF-8");
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
// 设置响应头信息
response.setHeader("Content-Disposition", "attachment; filename=\"" + encodedFileName + "\"");
response.setContentType("application/octet-stream");
// 读取文件并将其写入响应输出流
try (InputStream in = new FileInputStream(filePath);
OutputStream out = response.getOutputStream()) {
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = in.read(buffer)) != -1) {
out.write(buffer, 0, bytesRead);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,95 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.servlet
* @author: 李洪涛
* @date: 2025年3月27日 上午9:21:53
*/
package com.chinasofti.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.chinasofti.enums.OperationResult;
import com.chinasofti.model.User;
import com.chinasofti.service.UserService;
import com.chinasofti.service.impl.UserServiceImpl;
import com.chinasofti.utils.SM3PasswordEncoder;
/**
*
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: SystemServlet.java
* @Description: 系统登录后主界面
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午9:09:40
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建文件
*/
@WebServlet("/SystemServlet")
public class SystemServlet extends HttpServlet {
private static final long serialVersionUID = -7258264317769166483L;
UserService userService = new UserServiceImpl();
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException{
doPost(request, response);
}
public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException{
String method = request.getParameter("method");
if("toPersonalView".equals(method)){
personalView(request,response);
return;
}else if("EditPasswod".equals(method)){
editPassword(request,response);
return;
}
try {
request.getRequestDispatcher("view/system.jsp").forward(request, response);
} catch (ServletException e) {
e.printStackTrace();
}
}
private void editPassword(HttpServletRequest request,HttpServletResponse response) {
String password = request.getParameter("password");
String newPassword = request.getParameter("newpassword");
User user = (User)request.getSession().getAttribute("user");
if(!SM3PasswordEncoder.matches(password, user.getPassWord())){
try {
response.getWriter().write("原密码错误!");
return;
} catch (IOException e) {
e.printStackTrace();
}
}
user.setPassWord(SM3PasswordEncoder.encode(newPassword));
userService.updateUser(user);
try {
response.getWriter().write(OperationResult.SUCCESS.getResult());
} catch (IOException e) {
e.printStackTrace();
}
}
private void personalView(HttpServletRequest request,HttpServletResponse response) {
try {
request.getRequestDispatcher("view/personalView.jsp").forward(request, response);
} catch (ServletException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,281 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.servlet
* @author: 李洪涛
* @date: 2025年3月27日 上午9:21:53
*/
package com.chinasofti.servlet;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.chinasofti.enums.OperationResult;
import com.chinasofti.enums.PageScope;
import com.chinasofti.enums.PassWord;
import com.chinasofti.enums.RoleCode;
import com.chinasofti.enums.RoleId;
import com.chinasofti.model.Clazz;
import com.chinasofti.model.Leave;
import com.chinasofti.model.Teacher;
import com.chinasofti.model.TeacherClazz;
import com.chinasofti.model.User;
import com.chinasofti.model.view.Page;
import com.chinasofti.model.view.TeacherView;
import com.chinasofti.service.ClazzService;
import com.chinasofti.service.LeaveService;
import com.chinasofti.service.TeacherService;
import com.chinasofti.service.UserService;
import com.chinasofti.service.impl.ClazzServiceImpl;
import com.chinasofti.service.impl.LeaveServiceImpl;
import com.chinasofti.service.impl.TeacherServiceImpl;
import com.chinasofti.service.impl.UserServiceImpl;
import com.chinasofti.utils.SM3PasswordEncoder;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
*
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: TeacherServlet.java
* @Description: 教师接口
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年3月27日 上午9:09:40
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年3月27日 李洪涛 v1.0.0 新建文件
*/
@WebServlet("/TeacherServlet")
public class TeacherServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private TeacherService teacherService = new TeacherServiceImpl();
private UserService userService = new UserServiceImpl();
private ClazzService clazzService = new ClazzServiceImpl();
private LeaveService leaveService = new LeaveServiceImpl();
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String method = request.getParameter("method");
if("toTeacherListView".equals(method)){
teacherList(request,response);
} else if("TeacherList".equals(method)){
getTeacherList(request,response);
} else if("AddTeacher".equals(method)){
addTeacher(request,response);
} else if("GetTeacherClazz".equals(method)){
getTeacherClazz(request,response);
} else if("EditTeacher".equals(method)){
editTeacher(request,response);
} else if("DeleteTeacher".equals(method)){
deleteTeacher(request,response);
}
}
private void teacherList(HttpServletRequest request,HttpServletResponse response) {
try {
request.getRequestDispatcher("view/teacherList.jsp").forward(request, response);
} catch (ServletException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private void getTeacherList(HttpServletRequest request,HttpServletResponse response) {
Integer currentPage = request.getParameter("page") == null ? PageScope.CURRENT_PAGE.getNum() : Integer.parseInt(request.getParameter("page"));
Integer pageSize = request.getParameter("rows") == null ? PageScope.PAGE_SIZE.getNum() : Integer.parseInt(request.getParameter("rows"));
String name = request.getParameter("name");
Long clazzId = request.getParameter("clazzId") == null ? 0 : Long.parseLong(request.getParameter("clazzId"));
//获取当前登录用户的角色
String roleCode = request.getSession().getAttribute("roleCode").toString();
TeacherView params = new TeacherView();
if (RoleCode.TEACHER.getCode().equals(roleCode)) {
//如果是老师,只能查看自己的信息
User loginUser = (User)request.getSession().getAttribute("user");
long userId = loginUser.getId();
params.setUserId(userId);
} else {
params.setName(name);
params.setClazzId(clazzId);
}
List<TeacherView> teacherViews = teacherService.findTeacherViews(params, new Page(currentPage, pageSize));
List<TeacherView> teacherViewsTotal = teacherService.findTeacherViews(params, new Page(PageScope.CURRENT_PAGE.getNum(), PageScope.PAGE_SIZE.getNum()));
Map<String, Object> res = new HashMap<String, Object>();
res.put("total", teacherViewsTotal.size());
res.put("rows", teacherViews);
try {
String from = request.getParameter("from");
if("combox".equals(from)){
response.getWriter().write(JSONArray.fromObject(teacherViews).toString());
}else{
response.getWriter().write(JSONObject.fromObject(res).toString());
}
} catch (IOException e) {
e.printStackTrace();
}
}
private void addTeacher(HttpServletRequest request,HttpServletResponse response) {
String name = request.getParameter("name");
String sex = request.getParameter("sex");
String userName = request.getParameter("userName");
String phone = request.getParameter("phone");
String isCounselor = request.getParameter("isCounselor");
String [] clazzIds = request.getParameterValues("clazzIds");
User loginUser = (User) request.getSession().getAttribute("user");
LocalDateTime now = LocalDateTime.now();
String createBy = loginUser.getUserName();
User user = new User();
user.setRoleId(RoleId.TEACHER.getId());
user.setName(name);
user.setSex(sex);
user.setUserName(userName);
user.setPhone(phone);
user.setPassWord(SM3PasswordEncoder.encode(PassWord.TEACHER.getPassWord()));
user.setCreateBy(createBy);
user.setCreateTime(now);
Teacher teacher = new Teacher();
teacher.setUserId(user.getId());
teacher.setIsCounselor(isCounselor);
teacher.setCreateBy(createBy);
teacher.setCreateTime(now);
try {
response.getWriter().write(teacherService.insertTeacher(teacher,user,new TeacherClazz(), clazzIds));
} catch (IOException e) {
e.printStackTrace();
}
}
private void getTeacherClazz(HttpServletRequest request,HttpServletResponse response) {
long teacherId = Long.parseLong(request.getParameter("teacherId"));
List<Clazz> clazzList = clazzService.findClazzsByTeacherId(teacherId);
String res = "";
for (Clazz clazz : clazzList) {
res += clazz.getId() + ",";
}
res = res.substring(0, res.length()-1);
try {
response.getWriter().write(res);
} catch (IOException e) {
e.printStackTrace();
}
}
private void editTeacher(HttpServletRequest request,HttpServletResponse response) {
long userId = Long.parseLong(request.getParameter("userId"));
String name = request.getParameter("name");
String sex = request.getParameter("sex");
String userName = request.getParameter("userName");
String phone = request.getParameter("phone");
long teacherId = Long.parseLong(request.getParameter("teacherId"));
String isCounselor = request.getParameter("isCounselor");
String [] clazzIds = request.getParameterValues("clazzIds");
User loginUser = (User) request.getSession().getAttribute("user");
String updateBy = loginUser.getUserName();
LocalDateTime now = LocalDateTime.now();
User user = new User();
user.setId(userId);
user.setName(name);
user.setSex(sex);
user.setUserName(userName);
user.setPhone(phone);
user.setUpdateBy(updateBy);
user.setUpdateTime(now);
Teacher teacher = new Teacher();
teacher.setId(teacherId);
teacher.setIsCounselor(isCounselor);
teacher.setUpdateBy(updateBy);
teacher.setUpdateTime(now);
try {
response.getWriter().write(teacherService.updateTeacher(teacher,clazzIds,user));
} catch (IOException e) {
e.printStackTrace();
}
}
private void deleteTeacher(HttpServletRequest request,HttpServletResponse response) {
String[] userIdsRes = request.getParameterValues("userIds[]");
List<Long> userIds = new ArrayList<Long>();
for(String id : userIdsRes){
userIds.add(Long.parseLong(id));
}
String userIdStr = "";
for (Long userIdParams : userIds) {
userIdStr += userIdParams + ",";
}
userIdStr = userIdStr.substring(0, userIdStr.length()-1);
List<Clazz> clazzs = clazzService.findClazzsByUserIds(userIdStr);
String res = OperationResult.SUCCESS.getResult();
if (null != clazzs && clazzs.size() > 0) {
res = "isHaveClazz";
} else {
String[] teacherIdsRes = request.getParameterValues("teacherIds[]");
List<Long> teacherIds = new ArrayList<Long>();
for(String id : teacherIdsRes){
teacherIds.add(Long.parseLong(id));
}
String teacherIdStr = "";
for (Long teacherParams : teacherIds) {
teacherIdStr += teacherParams + ",";
}
teacherIdStr = teacherIdStr.substring(0, teacherIdStr.length()-1);
List<Leave> leaves = leaveService.findLeaveByTeacherIdsAndStatus(teacherIdStr);
if (null != leaves && leaves.size() > 0) {
res = "isHaveLeave";
} else {
teacherService.removeTeachers(teacherIds);
userService.removeUsers(userIds);
for (Long teacherId : teacherIds) {
Leave leave = new Leave();
leave.setTeacherId(teacherId);
leaveService.removeLeave(leave);
}
}
}
try {
response.getWriter().write(res);
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,47 @@
package com.chinasofti.servlet;
import java.io.IOException;
import java.util.List;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.chinasofti.enums.RoleId;
import com.chinasofti.model.User;
import com.chinasofti.service.UserService;
import com.chinasofti.service.impl.UserServiceImpl;
import net.sf.json.JSONArray;
@WebServlet("/UserServlet")
public class UserServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private UserService userService = new UserServiceImpl();
protected void doGet(HttpServletRequest request, HttpServletResponse response){
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response){
String method = request.getParameter("method");
if("GetUserForClazz".equals(method)){
getUserForClazz(request,response);
}
}
private void getUserForClazz(HttpServletRequest request,HttpServletResponse response){
User user = new User();
user.setRoleId(RoleId.TEACHER.getId());
List<User> users = userService.findUsers(user);
try {
response.getWriter().write(JSONArray.fromObject(users).toString());
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,43 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.utils
* @author: 李洪涛
* @date: 2025年5月11日 下午6:32:30
*/
package com.chinasofti.utils;
import net.sourceforge.pinyin4j.PinyinHelper;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: ChineseToPinyin.java
* @Description: 中文转汉语拼音
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月11日 下午6:32:30
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月11日 李洪涛 v1.0.0 新建文件
*/
public class ChineseToPinyin {
public static String convertToPinyin(String chinese) {
StringBuilder pinyin = new StringBuilder();
for (char c : chinese.toCharArray()) {
String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(c);
if (pinyinArray != null) {
pinyin.append(pinyinArray[0].substring(0, pinyinArray[0].length() - 1)); // 取第一个拼音
} else {
pinyin.append(c); // 非汉字字符直接追加
}
}
return pinyin.toString();
}
}

View File

@@ -0,0 +1,33 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.utils
* @author: 李洪涛
* @date: 2025年5月11日 下午7:25:50
*/
package com.chinasofti.utils;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: IsDate.java
* @Description: 是否日期
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月11日 下午7:25:50
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月11日 李洪涛 v1.0.0 新建文件
*/
public class IsDate {
public static boolean validateDate(String dateStr) {
String pattern = "\\d{4}-\\d{2}-\\d{2}"; // 正则表达式匹配YYYY-MM-DD格式的日期字符串
return dateStr.matches(pattern);
}
}

View File

@@ -0,0 +1,35 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.utils
* @author: 李洪涛
* @date: 2025年5月17日 上午10:32:42
*/
package com.chinasofti.utils;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: IsNumber.java
* @Description: 是否是数字
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月17日 上午10:32:42
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月17日 李洪涛 v1.0.0 新建文件
*/
public class IsNumber {
public static boolean isNumber(String str) {
if (str.matches("\\d+")) {
return true;
}
return false;
}
}

View File

@@ -0,0 +1,33 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.utils
* @author: 李洪涛
* @date: 2025年5月11日 下午6:48:31
*/
package com.chinasofti.utils;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: IsPhoneNumber.java
* @Description: 校验手机号
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月11日 下午6:48:31
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月11日 李洪涛 v1.0.0 新建文件
*/
public class IsPhoneNumber {
public static boolean isPhoneNumberValid(String phoneNumber) {
String regex = "1[3|4|5|7|8][0-9]{9}";
return phoneNumber.matches(regex);
}
}

View File

@@ -0,0 +1,85 @@
/**
* Copyright © 2025 eSunny Info. Tech Ltd. All rights reserved.
*
* 功能描述:
* @Package: com.chinasofti.util
* @author: 李洪涛
* @date: 2025年5月13日 上午11:01:55
*/
package com.chinasofti.utils;
import java.security.SecureRandom;
import org.bouncycastle.crypto.digests.SM3Digest;
import org.bouncycastle.util.encoders.Hex;
/**
* Copyright: Copyright (c) 2025 chiansofti
*
* @ClassName: SM3PasswordEncoder.java
* @Description: 登录密码加解密
*
* @version: v1.0.0
* @author: 李洪涛
* @date: 2025年5月13日 上午11:01:55
*
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2025年5月13日 李洪涛 v1.0.0 新建文件
*/
public class SM3PasswordEncoder {
private static final int SALT_LENGTH = 16; // 盐长度16字节
private static final int ITERATIONS = 10000; // 迭代次数
// 生成带盐的加密密码
public static String encode(String password) {
byte[] salt = generateSalt();
byte[] hash = calculateHash(password, salt);
return Hex.toHexString(salt) + ":" + Hex.toHexString(hash);
}
// 验证密码
public static boolean matches(String password, String encodedPassword) {
String[] parts = encodedPassword.split(":");
byte[] salt = Hex.decode(parts[0]);
byte[] storedHash = Hex.decode(parts[1]);
byte[] calculatedHash = calculateHash(password, salt);
return slowEquals(storedHash, calculatedHash);
}
// 生成随机盐
private static byte[] generateSalt() {
byte[] salt = new byte[SALT_LENGTH];
new SecureRandom().nextBytes(salt);
return salt;
}
// 计算哈希SM3+盐+迭代)
private static byte[] calculateHash(String password, byte[] salt) {
SM3Digest digest = new SM3Digest();
byte[] pwdBytes = password.getBytes();
byte[] combined = new byte[pwdBytes.length + salt.length];
System.arraycopy(pwdBytes, 0, combined, 0, pwdBytes.length);
System.arraycopy(salt, 0, combined, pwdBytes.length, salt.length);
byte[] hash = combined;
for (int i = 0; i < ITERATIONS; i++) {
digest.update(hash, 0, hash.length);
hash = new byte[digest.getDigestSize()];
digest.doFinal(hash, 0);
}
return hash;
}
// 防时序攻击的哈希比对
private static boolean slowEquals(byte[] a, byte[] b) {
int diff = a.length ^ b.length;
for (int i = 0; i < a.length && i < b.length; i++) {
diff |= a[i] ^ b[i];
}
return diff == 0;
}
}