今天实现Service类
LogOnService
package com.example.service; import com.example.mapper.LogONMapper; import com.example.pojo.Department; import com.example.pojo.Staff; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.time.LocalDate; import java.util.List; @Service public class LogONService { @Autowired private LogONMapper logONMapper; public Staff getByUser(String username, String password) { return logONMapper.getByUser(username, password); } public List<Department> selectCount() { return logONMapper.selectCount(); } public int count() { return logONMapper.count(); } public void addStaff(Staff staff) { String jobID = staff.getJobID(); String name = staff.getName(); String sex = staff.getSex(); LocalDate birthday = staff.getBirthday(); String department = staff.getDepartment(); String role = staff.getRole(); String password = staff.getPassword(); logONMapper.addStaff(jobID, name, sex, birthday, department, role, password); } public void updateStaff(Staff staff) { String jobID = staff.getJobID(); String name = staff.getName(); String sex = staff.getSex(); LocalDate birthday = staff.getBirthday(); logONMapper.updateStaff(jobID, name, sex, birthday); } public List<Staff> getStaff() { String t = "2019"; return logONMapper.getStaff(t); } public void deleteStaff(String id) { logONMapper.deleteStaff(id); } public int aDep(String id) { return logONMapper.aDep(id); } public int bDep(String name) { return logONMapper.bDep(name); } public void addDep(Department department) { String departmentID = department.getDepartmentID(); String departmentName = department.getDepartmentName(); logONMapper.addDep(departmentID, departmentName); } public void updateDep(Department department) { String departmentID = department.getDepartmentID(); String departmentName = department.getDepartmentName(); logONMapper.updateDep(departmentID, departmentName); } public int cDep(String id) { return logONMapper.cDep(id); } public void deleteDep(String id) { logONMapper.deleteDep(id); } public int dDep() { String name = "经理"; return logONMapper.dDep(name); } public void updateRole(String id) { String name = "经理"; logONMapper.updateRole(id, name); } public Staff selectById(String id) { return logONMapper.selectById(id); } public void update(String id, String password) { logONMapper.update(id, password); } }
StaffService
package com.example.service; import com.example.mapper.StaffMapper; import com.example.pojo.Attendance; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class StaffService { @Autowired private StaffMapper staffMapper; public void addStaff(Attendance attendance) { int id = attendance.getId(); String attendanceTime = attendance.getAttendanceTime(); String jobID = attendance.getJobID(); String name = attendance.getName(); String sex = attendance.getSex(); String department = attendance.getDepartment(); int attendanceType = attendance.getAttendanceType(); String notes = attendance.getNotes(); String approvedType = attendance.getApprovedType(); staffMapper.addStaff(id, attendanceTime, jobID, name, sex, department, attendanceType, notes, approvedType); } public int count() { return staffMapper.count(); } public List<Attendance> low() { int i = 0; return staffMapper.low(i); } public void approve(String name, String type, String i) { staffMapper.approve(name, type, i); } }
标签:String,11.20,public,logONMapper,staff,id,name From: https://www.cnblogs.com/zzqq1314/p/17910883.html