职工工资管理系统后端文件

master
yjb 8 months ago
commit d62d1a1243

@ -0,0 +1,179 @@
package com.esms.controller;
import com.esms.po.Department;
import com.esms.service.DepartmentService;
import com.esms.vo.DepartmentPages;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* @Description
*/
@Controller
@RequestMapping("/department")
public class DepartmentController {
@Autowired
public DepartmentService departmentService = null;
/**
*
* @param pageNum
* @param limit
* @param d_name
* @return
* @throws Exception
*/
@RequestMapping("/findSelective.do")
@ResponseBody
public DepartmentPages findSelective(
@RequestParam(value="page", defaultValue="1")int pageNum,
@RequestParam(value="limit", defaultValue="5") int limit,
@RequestParam(value="d_name", defaultValue="") String d_name) throws Exception {
List<Department> list;
//模糊查询,有多少个条件就接收多少个字段
Department department = new Department();
department.setdName(d_name);
//pageNum:起始页面 pageSize:每页的大小
PageHelper.startPage(pageNum,limit);
//查找条件一定要紧跟在startPage后
list = departmentService.findSelective(department);
PageInfo pageResult = new PageInfo(list);
//设置前台需要的数据
DepartmentPages departmentPages = new DepartmentPages();
departmentPages.setCode(0);
departmentPages.setMsg("");
departmentPages.setCount((int) pageResult.getTotal());
departmentPages.setData(pageResult.getList());
return departmentPages;
}
/**
*
* @param d_name
* @param d_remark
* @return
* @throws Exception
*/
@RequestMapping("/add.do")
@ResponseBody
public int add(String d_name, String d_remark) throws Exception {
Department department = departmentService.findByDname(d_name);
//查找是否同名
if(department != null) {
return department.getdId();
} else {
Department d = new Department();
d.setdId(null);
d.setdName(d_name);
d.setdRemark(d_remark);
d.setdIsdel(1);
departmentService.insertSelective(d);
return 0;
}
}
/**
*
* @param id
* @return
* @throws Exception
*/
@RequestMapping("/findByPrimaryKey.do")
@ResponseBody
public Department findByPrimaryKey(int id) throws Exception {
Department department = departmentService.selectByPrimaryKey(id);
return department;
}
/**
*
* @param id
* @param d_name
* @param d_remark
* @throws Exception
*/
@RequestMapping("/updateByPrimaryKey.do")
@ResponseBody
public int updateByPrimaryKey(int id, String d_name, String d_remark) throws Exception {
Department department = departmentService.findByDname(d_name);
//有同名的且不是同一个
if(department != null && !department.getdId().equals(id) ) {
return department.getdId();
} else {
Department d = new Department();
d.setdId(id);
d.setdName(d_name);
d.setdRemark(d_remark);
d.setdIsdel(null);
departmentService.updateByPrimaryKeySelective(d);
return 0;
}
}
@RequestMapping("/findByDname.do")
@ResponseBody
public int findByDname(String d_name) {
Department department = departmentService.findByDname(d_name);
if(department != null) {
return department.getdId();
} else {
return 0;
}
}
/**
*
* @param id
*/
@RequestMapping("/deleteByPrimaryKey.do")
@ResponseBody
public int deleteByPrimaryKey(int id) throws Exception {
//删除部门调用更新操作将状态改为0
Department department = new Department();
department.setdId(id);
department.setdIsdel(0);
departmentService.updateByPrimaryKeySelective(department);
return 1;
}
/**
*
* @param ids
*/
@RequestMapping("/deleteByQuery.do")
public void deleteByQuery (@RequestParam(value = "arr")int[] ids) {
//批量删除实则修改状态为0
//如果有id才执行
if(ids.length > 0) {
departmentService.deleteByQuery(ids);
}
// var arr = [3,4,5];
// $.ajax({
// type:'post',
// url:'department/deleteByQuery.do',
// data: {"arr":arr},
// traditional: true,
// dataType:'json',
// });
}
}

@ -0,0 +1,28 @@
package com.esms.controller;
import com.esms.exception.CustomException;
import com.esms.service.IDownloadExcelService;
import com.esms.service.impl.DownloadExcelServiceImpl;
import jxl.read.biff.BiffException;
import jxl.write.WriteException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @Descriptionexcel
*/
@Controller
public class DownloadExcelController {
@Autowired
private IDownloadExcelService downloadExcelService;
@RequestMapping(value = "downloadExcel.do")
public void downloadExcel(HttpServletRequest request, HttpServletResponse response,String eAccount,Integer dId,String sTime) throws Exception{
downloadExcelService.getSalaryExcel(request,response,eAccount,dId,sTime) ;
}
}

@ -0,0 +1,175 @@
package com.esms.controller;
import com.esms.service.IEchartsService;
import com.esms.service.impl.EchartsServiceImpl;
import com.esms.vo.EchDepartmentSalary;
import com.esms.vo.EchEmployeeNums;
import com.esms.vo.EchMonthSalary;
import com.esms.vo.EchSalaryPercent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description:
**/
@Controller
public class EchartsController {
@Autowired
private IEchartsService echartsService;
@RequestMapping(value = "/showEmployeeNums.do")
@ResponseBody
public Map<String,List<EchEmployeeNums>> showEmployeeNums(){
/**
*
* json{"list":[{"department":"人事部","num":480},{"department":"行政部","num":380}]}
*/
/*
List<EchEmployeeNums> echEmployeeNumsList = new ArrayList();
Map<String,List<EchEmployeeNums>> map = new HashMap<String,List<EchEmployeeNums>>();
EchEmployeeNums e1 = new EchEmployeeNums();
e1.setDepartment("人事部");
e1.setNum(123);
EchEmployeeNums e2 = new EchEmployeeNums();
e2.setDepartment("行政部");
e2.setNum(123);
echEmployeeNumsList.add(e1);
echEmployeeNumsList.add(e2);
map.put("list",echEmployeeNumsList);*/
return echartsService.getEmployeeNums();
}
@RequestMapping(value = "/showDepartmentSalary.do")
@ResponseBody
public Map<String,List<EchDepartmentSalary>> showDepartmentSalary(String date){
/**
*
* json{"list":[{"year":"1","salary":[480,500,600,..]},{"year":"2","salary":[480,500,600...]}]}
*/
/*
List<EchDepartmentSalary> echDepartmentSalaryList = new ArrayList<EchDepartmentSalary>();
Map<String,List<EchDepartmentSalary>> stringListMap = new HashMap<String, List<EchDepartmentSalary>>();
EchDepartmentSalary e1 = new EchDepartmentSalary();
e1.setDepartment("人事部");
List<Double> salary1 = new ArrayList<Double>();
salary1.add(5000.00);
salary1.add(8000.00);
salary1.add(20000.00);
e1.setSalary(salary1);
EchDepartmentSalary e2 = new EchDepartmentSalary();
e2.setDepartment("科研部");
List<Double> salary2 = new ArrayList<Double>();
salary2.add(6000.00);
salary2.add(8500.00);
salary2.add(25000.00);
e2.setSalary(salary2);
EchDepartmentSalary e3 = new EchDepartmentSalary();
e3.setDepartment("策划部");
List<Double> salary3 = new ArrayList<Double>();
salary3.add(6000.00);
salary3.add(8800.00);
salary3.add(23000.00);
e3.setSalary(salary3);
echDepartmentSalaryList.add(e1);
echDepartmentSalaryList.add(e2);
echDepartmentSalaryList.add(e3);
stringListMap.put("list",echDepartmentSalaryList);
return stringListMap;*/
return echartsService.getDepartmentSalary(date);
}
@RequestMapping(value = "/showSalaryPercent.do")
@ResponseBody
public Map<String,List<EchSalaryPercent>> showSalaryPercent(String date,int state){
/*List<EchSalaryPercent> echSalaryPercentList = new ArrayList<EchSalaryPercent>();
Map<String,List<EchSalaryPercent>> map = new HashMap<String,List<EchSalaryPercent>>();
EchSalaryPercent s1 = new EchSalaryPercent();
EchSalaryPercent s2 = new EchSalaryPercent();
s1.setDepartment("人事部");
s1.setSalary(1010010.00);
s2.setDepartment("科研部");
s2.setSalary(1510010.00);
echSalaryPercentList.add(s1);
echSalaryPercentList.add(s2);
map.put("list",echSalaryPercentList);*/
return echartsService.getSalaryPercent(date,state);
}
@RequestMapping(value = "/showMonthSalary.do")
@ResponseBody
public Map<String,List<EchMonthSalary>> showMonthSalary(){
/*
List<EchMonthSalary> echMonthSalaryList = new ArrayList<EchMonthSalary>();
Map<String,List<EchMonthSalary>> stringListMap = new HashMap<String, List<EchMonthSalary>>();
EchMonthSalary e1 = new EchMonthSalary();
e1.setYear("2015年");
List<Double> salary1 = new ArrayList<Double>();
salary1.add(5000.00);
salary1.add(8000.00);
salary1.add(20000.00);
salary1.add(5000.00);
salary1.add(8000.00);
salary1.add(20000.00);
salary1.add(5000.00);
salary1.add(8000.00);
salary1.add(20000.00);
salary1.add(5000.00);
salary1.add(8000.00);
salary1.add(20000.00);
e1.setSalary(salary1);
EchMonthSalary e2 = new EchMonthSalary();
e2.setYear("2016年");
List<Double> salary2 = new ArrayList<Double>();
salary2.add(5800.00);
salary2.add(8080.00);
salary2.add(20800.00);
salary2.add(5080.00);
salary2.add(8800.00);
salary2.add(20800.00);
salary2.add(5080.00);
salary2.add(8080.00);
salary2.add(20800.00);
salary2.add(5080.00);
salary2.add(8080.00);
salary2.add(20080.00);
e2.setSalary(salary2);
EchMonthSalary e3 = new EchMonthSalary();
e3.setYear("2017年");
List<Double> salary3 = new ArrayList<Double>();
salary3.add(6000.00);
salary3.add(8800.00);
salary3.add(23000.00);
salary3.add(6000.00);
salary3.add(8800.00);
salary3.add(23000.00);
salary3.add(6000.00);
salary3.add(8800.00);
salary3.add(23000.00);
salary3.add(6000.00);
salary3.add(8800.00);
salary3.add(23000.00);
e3.setSalary(salary3);
echMonthSalaryList.add(e1);
echMonthSalaryList.add(e2);
echMonthSalaryList.add(e3);
stringListMap.put("list",echMonthSalaryList);
return stringListMap;*/
return echartsService.getMonthSalary();
}
}

@ -0,0 +1,228 @@
package com.esms.controller;
import com.esms.dao.EmployeeCustomVoMapper;
import com.esms.po.Employee;
import com.esms.service.EmployeeService;
import com.esms.utils.MD5Utils;
import com.esms.vo.EmployeeCustomVo;
import com.esms.vo.EmployeePages;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
* @Description
*/
@Controller
@RequestMapping("/employee")
public class EmployeeController {
@Autowired
private EmployeeService employeeService;
@Autowired
private EmployeeCustomVoMapper employeeCustomVoMapper = null;
@RequestMapping("/findSelective.do")
@ResponseBody
public EmployeePages findSelective(
@RequestParam(value="page", defaultValue="1")int pageNum,
@RequestParam(value="limit", defaultValue="5") int limit,
@RequestParam(value="e_account", defaultValue="") String e_account,
@RequestParam(value="e_name", defaultValue="") String e_name,
@RequestParam(value="d_id", defaultValue="0") int d_id) throws Exception {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("e_account",e_account);
map.put("e_name",e_name);
map.put("d_id",d_id);
//pageNum:起始页面 pageSize:每页的大小
PageHelper.startPage(pageNum,limit);
//查找条件一定要紧跟在startPage后
List<EmployeeCustomVo> list =
employeeCustomVoMapper.selectEmployeeSelective(map);
// System.out.println(list.get(0).getMonthlyAttendance().getAttendanceTime()+"========================");
PageInfo pageResult = new PageInfo(list);
//设置前台需要的数据
EmployeePages employeePages = new EmployeePages();
employeePages.setCode(0);
employeePages.setMsg("");
employeePages.setCount((int) pageResult.getTotal());
employeePages.setData(pageResult.getList());
return employeePages;
}
/**
*
* @param id
* @return
*/
@RequestMapping("/selectVoByPrimaryKey.do")
@ResponseBody
public EmployeeCustomVo selectVoByPrimaryKey(int id) {
EmployeeCustomVo monthlyAttendanceCustomVo = new EmployeeCustomVo();
monthlyAttendanceCustomVo = employeeCustomVoMapper.selectVoByPrimaryKey(id);
// System.out.println(monthlyAttendanceCustomVo+"=======================");
return monthlyAttendanceCustomVo;
}
@RequestMapping("/add.do")
@ResponseBody
public int add(String eAccount,
String eName,
String ePassword,
String eIdcard,
int rbId,
String eSex,
String eBirthday,
String eDagree,
int dId,
int pId,
String eEntryTime,
double eBasePay,
String ePhone,
String eEmail,
String eUrgentPerson,
String eUrgentPhone,
String eHometown,
String headPath) throws Exception {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
//检测工号是否相同
//查找是否同名
Employee e = employeeService.findByeAccount(eAccount);
if(e != null) {
return 0;
} else {
Employee employee = new Employee();
employee.seteAccount(eAccount);
employee.seteName(eName);
employee.setePassword(MD5Utils.encodeByMD5(ePassword));
employee.seteIdcard(eIdcard);
employee.seteRank(rbId);
employee.seteSex(eSex);
employee.seteBirthday(format.parse(eBirthday));
employee.seteDagree(eDagree);
employee.setdId(dId);
employee.setpId(pId);
employee.seteEntryTime(format.parse(eEntryTime));
employee.seteBasePay(eBasePay);
employee.setePhone(ePhone);
employee.seteEmail(eEmail);
employee.seteUrgentPerson(eUrgentPerson);
employee.seteUrgentPhone(eUrgentPhone);
employee.seteHometown(eHometown);
employee.seteHeadPath(headPath);
employee.seteIsdel(1);
employeeService.insert(employee);
return 1;
}
}
@RequestMapping("/updateByPrimaryKeySelective.do")
@ResponseBody
public int updateByPrimaryKeySelective(
int eId,
String eName,
String eIdcard,
int rbId,
String eSex,
String eBirthday,
String eDagree,
int dId,
int pId,
String eEntryTime,
double eBasePay,
String ePhone,
String eEmail,
String eUrgentPerson,
String eUrgentPhone,
String eHometown,
String headPath) throws Exception {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Employee employee = new Employee();
employee.seteId(eId);
employee.seteName(eName);
employee.seteIdcard(eIdcard);
employee.seteRank(rbId);
employee.seteSex(eSex);
employee.seteBirthday(format.parse(eBirthday));
employee.seteDagree(eDagree);
employee.setdId(dId);
employee.setpId(pId);
employee.seteEntryTime(format.parse(eEntryTime));
employee.seteBasePay(eBasePay);
employee.setePhone(ePhone);
employee.seteEmail(eEmail);
employee.seteUrgentPerson(eUrgentPerson);
employee.seteUrgentPhone(eUrgentPhone);
employee.seteHometown(eHometown);
employee.seteHeadPath(headPath);
employee.seteIsdel(1);
employeeService.updateByPrimaryKeySelective(employee);
return 1;
}
/**
*
* @param id
* @throws Exception
*/
@RequestMapping("/deleteByPrimaryKey.do")
@ResponseBody
public int deleteByPrimaryKey(int id) throws Exception {
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
// Date date = new Date();
// System.out.println(df.format(new Date()));// new Date()为获取当前系统时间
//假删除,设置离职时间
Employee employee = new Employee();
employee.seteId(id);
employee.seteLeaveTime(new Date());
employee.seteIsdel(0);
employeeService.updateByPrimaryKeySelective(employee);
return 1;
}
/**
*
* @param ids
*/
@RequestMapping("/deleteByQuery.do")
@ResponseBody
public int deleteByQuery (@RequestParam(value = "arr")int[] ids) {
// System.out.println(ids+"&"+ids.length);
// for (int i =0 ; i< ids.length;i++) {
// System.out.println(ids[i]);
// }
//假删除
//如果有id才执行
if(ids.length > 0) {
employeeService.deleteByQuery(ids);
}
return 1;
}
}

@ -0,0 +1,88 @@
package com.esms.controller;
import com.esms.service.IImportDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;
/**
* @Description:
**/
@Controller
public class ImportDataController {
@Autowired
private IImportDataService importDataService;
/**
* importAttendanceTeable.jsp
* @return
*/
@RequestMapping("toImportAttendance.do")
public String toImportAttendance(){
return "admin/importData/importAttendanceTable.jsp";
}
/**
* importReissueTable.jsp
* @return
*/
@RequestMapping("toImportReissue.do")
public String toImportReissue(){
return "admin/importData/importReissueTable.jsp";
}
/**
*
* @param excel
* @return
*/
@RequestMapping("/importAttendance.do")
@ResponseBody
public Map<String,String> importAttendanceTable(@RequestParam("file") MultipartFile excel) throws Exception{
Map<String,String> map = new HashMap<String, String>();
if (!excel.isEmpty()) {
String result = importDataService.insertMATable(excel);
map.put("result",result);
return map;
/*if (importDataService.insertMATable(excel)) {
//return "admin/importData/success.jsp";
map.put("result","导入成功");
return map;
}
else{
map.put("result","只能导入Microsoft Excel 97-2003 工作表 (.xls),请检查文件是否正确");
return map;
}*/
} else {
map.put("result","导入的文件不存在,请重新选择文件");
return map;
}
}
/**
*
* @param excel excel
* @return
*/
@RequestMapping("/importReissue.do")
@ResponseBody
public Map<String,String> importReissueTable(@RequestParam("file") MultipartFile excel) throws Exception{
Map<String,String> map = new HashMap<String, String>();
if (!excel.isEmpty()) {
String result = importDataService.insertReissueTable(excel);
map.put("result",result);
return map;
}
else {
map.put("result","导入的文件不存在,请重新选择文件");
return map;
}
}
}

@ -0,0 +1,127 @@
package com.esms.controller;
import com.esms.po.KeyValue;
import com.esms.service.impl.KeyValueServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class KeyValueController {
@Autowired
private KeyValueServiceImpl keyValueService = null;
// 测试
@RequestMapping("/getKeyValueById.do")
public @ResponseBody String getKeyValueById(Model model, Integer id_id)throws Exception{
return "error.jsp";
}
@RequestMapping("/changeWageItem.do")
@ResponseBody
public int changeWageItem(double late_buckle_pay,double early_buckle_pay,double missionallowance,double full_attendance_pay,double food_pay,double traffic_pay)throws Exception{
/*return late_buckle_pay;*/
int count=0;
KeyValue kv1=new KeyValue();
kv1.setKvKey("food_pay");
kv1.setKvId(1);
kv1.setKvValue(food_pay);
count+=keyValueService.updateByPrimaryKey(kv1);
KeyValue kv2=new KeyValue();
kv2.setKvId(2);
kv2.setKvKey("traffic_pay");
kv2.setKvValue(traffic_pay);
count+=keyValueService.updateByPrimaryKey(kv2);
KeyValue kv3=new KeyValue();
kv3.setKvId(3);
kv3.setKvKey("late_buckle_pay");
kv3.setKvValue(late_buckle_pay);
count+=keyValueService.updateByPrimaryKey(kv3);
KeyValue kv4=new KeyValue();
kv4.setKvId(4);
kv4.setKvKey("early_buckle_pay");
kv4.setKvValue(early_buckle_pay);
count+=keyValueService.updateByPrimaryKey(kv4);
KeyValue kv5=new KeyValue();
kv5.setKvId(5);
kv5.setKvKey("missionallowance");
kv5.setKvValue(missionallowance);
count+=keyValueService.updateByPrimaryKey(kv5);
KeyValue kv6=new KeyValue();
kv6.setKvId(6);
kv6.setKvKey("full_attendance_pay");
kv6.setKvValue(full_attendance_pay);
count+=keyValueService.updateByPrimaryKey(kv6);
return count;
}
@RequestMapping("/get_late_buckle_pay.do")
public @ResponseBody KeyValue get_late_buckle_pay(){
KeyValue keyValue=new KeyValue();
try {
keyValue=keyValueService.selectBykvKey("late_buckle_pay");
} catch (Exception e) {
e.printStackTrace();
}
return keyValue;
}
@RequestMapping("/get_food_pay.do")
public @ResponseBody KeyValue get_food_pay(){
KeyValue keyValue=new KeyValue();
try {
keyValue=keyValueService.selectBykvKey("food_pay");
} catch (Exception e) {
e.printStackTrace();
}
return keyValue;
}
@RequestMapping("/get_traffic_pay.do")
public @ResponseBody KeyValue get_traffic_pay(){
KeyValue keyValue=new KeyValue();
try {
keyValue=keyValueService.selectBykvKey("traffic_pay");
} catch (Exception e) {
e.printStackTrace();
}
return keyValue;
}
@RequestMapping("/get_early_buckle_pay.do")
public @ResponseBody KeyValue get_early_buckle_pay(){
KeyValue keyValue=new KeyValue();
try {
keyValue=keyValueService.selectBykvKey("early_buckle_pay");
} catch (Exception e) {
e.printStackTrace();
}
return keyValue;
}
@RequestMapping("/get_missionallowance.do")
public @ResponseBody KeyValue get_missionallowance(){
KeyValue keyValue=new KeyValue();
try {
keyValue=keyValueService.selectBykvKey("missionallowance");
} catch (Exception e) {
e.printStackTrace();
}
return keyValue;
}
@RequestMapping("/get_full_attendance_pay.do")
public @ResponseBody KeyValue get_full_attendance_pay(){
KeyValue keyValue=new KeyValue();
try {
keyValue=keyValueService.selectBykvKey("full_attendance_pay");
} catch (Exception e) {
e.printStackTrace();
}
return keyValue;
}
}

@ -0,0 +1,155 @@
package com.esms.controller;
import com.esms.exception.CustomException;
import com.esms.po.Employee;
import com.esms.po.SystemManager;
import com.esms.service.impl.LoginServiceImpl;
import com.esms.utils.CaptchaUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* @Description:
**/
@Controller
public class LoginController {
@Autowired
private LoginServiceImpl loginService = null;
/**
* @Author: admin
* @Description:
* @Param: [request, response]
* @Return: void
**/
//获取验证码
@RequestMapping(value = "/changeCode.do")
@ResponseBody
public void getIdentifyingCode(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
// 验证码存储在session的identifyingCode属性中
CaptchaUtil.outputCaptcha(request, response);
}
// 获取员工登陆界面
@RequestMapping("/")
public String getLoginPage(){
return "employee/login.html";
}
// 获取管理员登陆界面
@RequestMapping("/admin.do")
public String getAdminLoginPage(){
return "admin/adminLogin.html";
}
//员工登录判断
@RequestMapping(value = "/employeeLogin.do")
@ResponseBody
public Map<String,String> employeeLogin(Model model, HttpSession httpSession, String username,
String password, String identifyingcode)
{
String code = (String) httpSession.getAttribute("identifyingCode");
HashMap<String, String> map = new HashMap<String, String>();
if(identifyingcode.equalsIgnoreCase(code)){
Employee employee = null;
try {
employee = loginService.findEmployeeByIdAndPassword(username, password);
} catch (CustomException e) {
map.put("msg",e.getMessage());
map.put("status","500");
return map;
}
// 保存到session
httpSession.setAttribute("employeeId",employee.geteId());
map.put("url","/ssm_esms/loginSuccess.do");
map.put("msg","成功");
map.put("status","200");
return map;
}else{
map.put("msg","验证码错误");
map.put("status","0");
return map;
}
}
@RequestMapping(value = "/loginSuccess.do")
public String loginSucceses(Model model) throws Exception
{
return "employee/index.html";
}
//管理员登录判断
@RequestMapping(value = "/adminLogin.do")
@ResponseBody
public Map<String,String> adminLogin(Model model, HttpSession httpSession, String username,
String password, String identifyingcode)
{
String code = (String) httpSession.getAttribute("identifyingCode");
HashMap<String, String> map = new HashMap<String, String>();
if(identifyingcode.equalsIgnoreCase(code)){
SystemManager manager = null;
try {
manager = loginService.findSystemManagerByIdAndPassword(username, password);
} catch (CustomException e) {
map.put("msg",e.getMessage());
map.put("status","500");
return map;
}
// 保存到session
httpSession.setAttribute("admin",manager);
map.put("url","toPage.do?url=admin/index.html");
map.put("msg","成功");
map.put("status","200");
return map;
}else{
map.put("msg","验证码错误");
map.put("status","0");
return map;
}
}
@RequestMapping(value = "/getAdminAccount.do")
@ResponseBody
public String getAdminAccount(HttpSession httpSession){
SystemManager systemManager = (SystemManager) httpSession.getAttribute("admin");
// SystemManager manager = loginService.findSystemManagerById(id);
return systemManager.getSmAccount();
}
@RequestMapping(value = "/getEmployeeAccount.do")
@ResponseBody
public Map<String,String> getEmployeeAccount(HttpSession httpSession){
Integer id = (Integer) httpSession.getAttribute("employeeId");
Employee employee = loginService.findEmployeeById(id);
HashMap<String, String> map = new HashMap<String, String>();
map.put("account",employee.geteAccount());
map.put("name",employee.geteName());
return map;
}
@RequestMapping(value = "/logout.do")
public String logout(HttpSession httpSession){
httpSession.removeAttribute("employeeId");
return "redirect:/";
}
@RequestMapping(value = "/logoutAdmin.do")
public String logoutAdmin(HttpSession httpSession){
httpSession.removeAttribute("admin");
return "redirect:/admin.do";
}
}

@ -0,0 +1,207 @@
package com.esms.controller;
import com.esms.dao.MonthlyAttendanceCustomVoMapper;
import com.esms.dao.MonthlyAttendanceMapper;
import com.esms.po.MonthlyAttendance;
import com.esms.service.impl.MonthlyAttendanceServiceImpl;
import com.esms.vo.EmployeeMonthlyAttendancePages;
import com.esms.vo.MonthlyAttendanceCustomVo;
import com.esms.vo.MonthlyAttendancePages;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
/**
* @Description
*/
@Controller
@RequestMapping("/monthlyattendance")
public class MonthlyAttendanceController{
@Autowired
private MonthlyAttendanceServiceImpl monthlyAttendanceService;
@Autowired
private MonthlyAttendanceCustomVoMapper monthlyAttendanceCustomVoMapper = null;
@Autowired
private MonthlyAttendanceMapper monthlyAttendanceMapper = null;
@RequestMapping("test.do")
@ResponseBody
public List<MonthlyAttendanceCustomVo> test(){
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("e_account","4");
map.put("d_id",4);
map.put("attendance_time","2017-08");
List<MonthlyAttendanceCustomVo> monthlyAttendanceCustomVos =
monthlyAttendanceCustomVoMapper.selectMonthlyAttendanceCustomVoMapperByeAccountAnddIdAndTime(map);
return monthlyAttendanceCustomVos;
}
/**
*
* @param pageNum
* @param limit
* @param e_account
* @param d_id
* @param attendance_time
* @return
* @throws Exception
*/
@RequestMapping("/findSelective.do")
@ResponseBody
public MonthlyAttendancePages findSelective(
@RequestParam(value="page", defaultValue="1")int pageNum,
@RequestParam(value="limit", defaultValue="5") int limit,
@RequestParam(value="e_account", defaultValue="") String e_account,
@RequestParam(value="d_id", defaultValue="0") int d_id,
@RequestParam(value="attendance_time", defaultValue="") String attendance_time) throws Exception {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("e_account",e_account);
map.put("d_id",d_id);
map.put("attendance_time",attendance_time);
//pageNum:起始页面 pageSize:每页的大小
PageHelper.startPage(pageNum,limit);
//查找条件一定要紧跟在startPage后
List<MonthlyAttendanceCustomVo> list =
monthlyAttendanceCustomVoMapper.selectMonthlyAttendanceCustomVoMapperByeAccountAnddIdAndTime(map);
// System.out.println(list.get(0).getMonthlyAttendance().getAttendanceTime()+"========================");
PageInfo pageResult = new PageInfo(list);
//设置前台需要的数据
MonthlyAttendancePages monthlyAttendancePages = new MonthlyAttendancePages();
monthlyAttendancePages.setCode(0);
monthlyAttendancePages.setMsg("");
monthlyAttendancePages.setCount((int) pageResult.getTotal());
monthlyAttendancePages.setData(pageResult.getList());
return monthlyAttendancePages;
}
/**
*
* @param id
* @return
*/
@RequestMapping("/selectVoByPrimaryKey.do")
@ResponseBody
public MonthlyAttendanceCustomVo selectVoByPrimaryKey(int id) {
MonthlyAttendanceCustomVo monthlyAttendanceCustomVo = new MonthlyAttendanceCustomVo();
monthlyAttendanceCustomVo = monthlyAttendanceCustomVoMapper.selectVoByPrimaryKey(id);
// System.out.println(monthlyAttendanceCustomVo+"=======================");
return monthlyAttendanceCustomVo;
}
/**
*
* @param maId
* @param sickLeaveNum
* @param compassionateLeaveNum
* @param overtimeHour
* @param weekendHour
* @param holidayHour
* @param lateNum
* @param earlyNum
* @param absenceNum
* @param businessTravelNum
* @return
* @throws Exception
*/
@RequestMapping("/updateByPrimaryKeySelective.do")
@ResponseBody
public int updateByPrimaryKeySelective(int maId,
int sickLeaveNum,
int compassionateLeaveNum,
double overtimeHour,
double weekendHour,
double holidayHour,
int lateNum,
int earlyNum,
int absenceNum,
int businessTravelNum
) throws Exception {
MonthlyAttendance monthlyAttendance = new MonthlyAttendance();
monthlyAttendance.setMaId(maId);
monthlyAttendance.setSickLeaveNum(sickLeaveNum);
monthlyAttendance.setCompassionateLeaveNum(compassionateLeaveNum);
monthlyAttendance.setOvertimeHour(overtimeHour);
monthlyAttendance.setWeekendHour(weekendHour);
monthlyAttendance.setHolidayHour(holidayHour);
monthlyAttendance.setLateNum(lateNum);
monthlyAttendance.setEarlyNum(earlyNum);
monthlyAttendance.setAbsenceNum(absenceNum);
monthlyAttendance.setBusinessTravelNum(businessTravelNum);
// System.out.println(monthlyAttendance+"======================================================");
monthlyAttendanceService.updateByPrimaryKeySelective(monthlyAttendance);
return 1;
}
/**
*
* @param id
* @throws Exception
*/
@RequestMapping("/deleteByPrimaryKey.do")
@ResponseBody
public int deleteByPrimaryKey(int id) throws Exception {
//真删除
MonthlyAttendance monthlyAttendance = new MonthlyAttendance();
monthlyAttendance.setMaId(id);
monthlyAttendanceService.deleteByPrimaryKey(id);
return 1;
}
/**
*
* @param ids
*/
@RequestMapping("/deleteByQuery.do")
@ResponseBody
public int deleteByQuery (@RequestParam(value = "arr")int[] ids) {
// for (int i =0 ; i< ids.length;i++) {
// System.out.println(ids[i]);
// }
//真删除
//如果有id才执行
if(ids.length > 0) {
monthlyAttendanceService.deleteByQuery(ids);
}
return 1;
}
@RequestMapping("/findEmployeeAttendance.do")
@ResponseBody
public EmployeeMonthlyAttendancePages findEmployeeAttendance(
@RequestParam(value="page", defaultValue="1")int pageNum,
@RequestParam(value="limit", defaultValue="5") int limit,
@RequestParam(value="attendance_time", defaultValue="") String attendance_time,
HttpSession httpSession) throws Exception {
Integer id = (Integer) httpSession.getAttribute("employeeId");
//pageNum:起始页面 pageSize:每页的大小
PageHelper.startPage(pageNum,limit);
//查找条件一定要紧跟在startPage后
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("e_id",id);
map.put("attendance_time",attendance_time);
List<MonthlyAttendance> list = monthlyAttendanceMapper.selectMonthlyAttendanceMapperByeEidAndTime(map);
PageInfo pageResult = new PageInfo(list);
//设置前台需要的数据
EmployeeMonthlyAttendancePages employeeMonthlyAttendancePages = new EmployeeMonthlyAttendancePages();
employeeMonthlyAttendancePages.setCode(0);
employeeMonthlyAttendancePages.setMsg("");
employeeMonthlyAttendancePages.setCount((int) pageResult.getTotal());
employeeMonthlyAttendancePages.setData(pageResult.getList());
return employeeMonthlyAttendancePages;
}
}

@ -0,0 +1,183 @@
package com.esms.controller;
import com.esms.po.Position;
import com.esms.service.PositionService;
import com.esms.vo.PositionPages;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* @Description
*/
@Controller
@RequestMapping("/position")
public class PositionController {
@Autowired
public PositionService positionService = null;
/**
*
* @param pageNum
* @param limit
* @param p_name
* @return
* @throws Exception
*/
@RequestMapping("findSelective.do")
@ResponseBody
public PositionPages findSelective(
@RequestParam(value="page", defaultValue="1") int pageNum,
@RequestParam(value="limit", defaultValue="5") int limit,
@RequestParam(value="p_name", defaultValue="") String p_name) throws Exception {
List<Position> list;
//模糊查询,有多少个条件就接收多少个字段
Position position = new Position();
position.setpName(p_name);
//pageNum:起始页面 pageSize:每页的大小
PageHelper.startPage(pageNum,limit);
//查找条件一定要紧跟在startPage后
list = positionService.findSelective(position);
PageInfo pageResult = new PageInfo(list);
//设置前台需要的数据
PositionPages positionPages = new PositionPages();
positionPages.setCode(0);
positionPages.setMsg("");
positionPages.setCount((int)pageResult.getTotal());
positionPages.setData(pageResult.getList());
return positionPages;
}
/**
*
* @param p_name
* @param p_duty
* @param p_post_pay
* @return
* @throws Exception
*/
@RequestMapping("/add.do")
@ResponseBody
public int add(String p_name, String p_duty, Double p_post_pay) throws Exception {
Position position = positionService.findByDname(p_name);
//查找是否同名
if(position != null) {
return position.getpId();
} else {
Position p = new Position();
p.setpId(null);
p.setpName(p_name);
p.setpDuty(p_duty);
p.setpPostPay(p_post_pay);
p.setpIsdel(1);
positionService.insertSelective(p);
return 0;
}
}
/**
*
* @param id
* @return
* @throws Exception
*/
@RequestMapping("/findByPrimaryKey.do")
@ResponseBody
public Position findByPrimaryKey(int id) throws Exception {
Position position = positionService.findByPrimaryKey(id);
return position;
}
/**
*
* @param id
* @param p_name
* @param p_duty
* @param p_post_pay
* @throws Exception
*/
@RequestMapping("/updateByPrimaryKey.do")
@ResponseBody
public int updateByPrimaryKey(int id, String p_name, String p_duty, Double p_post_pay) throws Exception {
Position position = positionService.findByDname(p_name);
System.out.println(p_name);
System.out.println(position);
System.out.println(position != null && !position.getpName().equals(p_name));
//有同名的且不是同一个
if(position != null && !position.getpId().equals(id) ) {
return position.getpId();
} else {
Position p = new Position();
p.setpId(id);
p.setpName(p_name);
p.setpDuty(p_duty);
p.setpPostPay(p_post_pay);
p.setpIsdel(null);
positionService.updateByPrimaryKeySelective(p);
return 0;
}
}
/**
*
* @param p_name
* @return
*/
@RequestMapping("/findByDname.do")
@ResponseBody
public int findByDname(String p_name) {
Position position = positionService.findByDname(p_name);
if(position != null) {
return position.getpId();
} else {
return 0;
}
}
/**
*
* @param id
* @throws Exception
*/
@RequestMapping("/deleteByPrimaryKey.do")
@ResponseBody
public int deleteByPrimaryKey(int id) throws Exception {
//删除部门调用更新操作将状态改为0
Position position = new Position();
position.setpId(id);
positionService.deleteByPrimaryKey(id);
return 1;
}
/**
*
* @param ids
*/
@RequestMapping("/deleteByQuery.do")
public void deleteByQuery (@RequestParam(value = "arr")int[] ids) {
//批量删除实则修改状态为0
//如果有id才执行
if(ids.length > 0) {
positionService.deleteByQuery(ids);
}
}
}

@ -0,0 +1,137 @@
package com.esms.controller;
import com.esms.po.Department;
import com.esms.po.RankBonus;
import com.esms.service.IRankBonusService;
import com.esms.vo.DepartmentPages;
import com.esms.vo.RankBonusPages;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
/**
* @Description
*/
@Controller
public class RankBonusController {
@Autowired
private IRankBonusService service;
//@Qualifier("rankBonusService")
public void setiRankBonusService(IRankBonusService iRankBonusService) {
this.service = iRankBonusService;
}
//插入数据
@RequestMapping("/insertRankBonus.do")
@ResponseBody
public String doInsertRankBonus(int bonus,String name){
if(service.CountByName(name)>0){
return "exist";
}
if(!name.equals("")&& bonus>=0){
RankBonus rb= new RankBonus();
rb.setRankName(name);
rb.setRbBonus(bonus);
service.addRankBonus(rb);
return "ok";
}
else{
return "no";
}
}
//查询出所有记录
@RequestMapping("/findAll.do")
public String doFindAll(@RequestParam(value="pn",defaultValue = "1") Integer pn, Model model){
// 引入PageHelper分页插件
// 在查询之前只需要调用,传入页码,以及每页的大小
int pageSize = 10;
PageHelper.startPage(pn, pageSize);
// startPage后面紧跟的这个查询就是一个分页查询
List<RankBonus> rbs = service.findAll();
System.out.println(rbs+"=================================");
/*for (RankBonus rb:rbs) {
System.out.println(rb.getRankName());
}*/
// 使用pageInfo包装查询后的结果只需要将pageInfo交给页面就行了。
// 封装了详细的分页信息,包括有我们查询出来的数据,传入连续显示的页数
PageInfo page = new PageInfo(rbs, 5);
//ModelAndView modelAndView = new ModelAndView();
// modelAndView.setViewName("admin/rank-list.jsp");
// modelAndView.addObject("pageInfo",page);
model.addAttribute("pageInfo", page);
return "admin/rank-list.jsp";
}
@RequestMapping("/findRankBonusList.do")
@ResponseBody
public RankBonusPages findSelective(
@RequestParam(value="page", defaultValue="1")int pageNum,
@RequestParam(value="limit", defaultValue="10") int limit,
@RequestParam(value="rb_name", defaultValue="") String rb_name) throws Exception {
/*return rb_name;*/
List<RankBonus> list;
//模糊查询,有多少个条件就接收多少个字段
RankBonus rb = new RankBonus();
rb.setRankName(rb_name);
//pageNum:起始页面 pageSize:每页的大小
PageHelper.startPage(pageNum,limit);
//查找条件一定要紧跟在startPage后
list = service.findSelective(rb);
PageInfo pageResult = new PageInfo(list);
//设置前台需要的数据
RankBonusPages rankBonusPages = new RankBonusPages();
rankBonusPages.setCode(0);
rankBonusPages.setMsg("");
rankBonusPages.setCount((int) pageResult.getTotal());
rankBonusPages.setData(pageResult.getList());
return rankBonusPages;
}
//根据id删除数据
@RequestMapping("rankBonusDelete.do")
@ResponseBody
public String doDelete(int id){
if(service.CountByRbid(id)>0){
return "exist";
}
if(service.moveRankBonus(id)==true)
return "ok";
else{
return "no";}
}
//更新记录
@RequestMapping("/updateRankBonus.do")
@ResponseBody
public String doUpdate(int id,String rank,int bonus){
RankBonus rankBonus=service.findByName(rank);
if(rankBonus!=null&& !rankBonus.getRbId().equals(id)){
return "exist";
}
RankBonus rb=new RankBonus();
rb.setRbId(id);
rb.setRbBonus(bonus);
rb.setRankName(rank);
if(service.modifyRankName(rb)==true)
return "ok";
else
return "no";
}
}

@ -0,0 +1,104 @@
package com.esms.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.esms.exception.CustomException;
import com.esms.service.impl.SalaryServiceImpl;
import com.esms.vo.SalaryPages;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.Map;
/**
* @Description
*/
@Controller
public class SalaryController {
@Autowired
private SalaryServiceImpl salaryService = null;
@RequestMapping("salarySettlementByAcount.do")
@ResponseBody
public Map<String, String> salarySettlementByAcount(String eAccount, String date) {
Map<String, String> stringMap = new HashMap<String, String>();
try {
salaryService.insertSalaryByAcountAndDate(eAccount, date);
stringMap.put("msg", "工资结算完成");
return stringMap;
} catch (CustomException e) {
stringMap.put("msg", e.getMessage());
return stringMap;
}
}
@RequestMapping("salarySettlementAll.do")
@ResponseBody
public Map<String, String> salarySettlementAll(String date) {
Map<String, String> stringMap = new HashMap<String, String>();
try {
salaryService.insertSalaryAllByDate(date);
stringMap.put("msg", "工资结算完成");
return stringMap;
} catch (CustomException e) {
stringMap.put("msg", e.getMessage());
return stringMap;
}
}
// 删除工资项目
@RequestMapping("deleteSalaryByEid.do")
@ResponseBody
public int deleteSalaryByEid(@RequestParam(value = "arr")int[] ids) {
salaryService.deleteSalaryByEid(ids);
return 1;
}
// 发放工资项目
@RequestMapping("issueSalaryByEid.do")
@ResponseBody
public void issueSalaryByEid(@RequestParam(value = "arr")int[] ids) {
salaryService.updateSalaryBySid(ids);
}
@RequestMapping(value = "selectSalaryByEaccountDIdDate.do",
produces = "application/json;charset=utf-8")
@ResponseBody
public String selectSalaryByEaccountDIdDate(@RequestParam(value = "page", defaultValue = "1") int pageNum,
@RequestParam(value = "limit", defaultValue = "5") int limit,
String eAccount, Integer dId, String sTime) {
/**
* @Author:
* @Description:
* @Date: 12:37 2020/02/11
* @Param: [pageNum , limit, eAccount, dId, sTime]
* @Return: java.lang.String
**/
SalaryPages salaryPages = salaryService.selectSalaryByEaccountDIdDate(pageNum, limit, eAccount, dId, sTime);
//使用fastjson以字符串形式返回数据
JSON.DEFFAULT_DATE_FORMAT = "yyyy-MM";
return JSON.toJSONString(salaryPages, SerializerFeature.WriteDateUseDateFormat);
}
@RequestMapping(value = "selectSalaryByEaccountDIdDateState.do",
produces = "application/json;charset=utf-8")
@ResponseBody
public String selectSalaryByEaccountDIdDateState(@RequestParam(value = "page", defaultValue = "1") int pageNum,
@RequestParam(value = "limit", defaultValue = "5") int limit,
String eAccount, Integer dId, String sTime) {
SalaryPages salaryPages = salaryService.selectSalaryByEaccountDIdDateState(pageNum, limit, eAccount, dId, sTime);
//使用fastjson以字符串形式返回数据
JSON.DEFFAULT_DATE_FORMAT = "yyyy-MM";
return JSON.toJSONString(salaryPages, SerializerFeature.WriteDateUseDateFormat);
}
@RequestMapping(value = "updateSalaryByEidAndRissuePay.do")
@ResponseBody
public void updateSalaryByEidAndRissuePay(int sId, double rissuePay) {
salaryService.updateSalaryByEidAndRissuePay(sId, rissuePay);
}
}

@ -0,0 +1,75 @@
package com.esms.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @Description
*/
@Controller
public class UploadPhotoController {
@RequestMapping("uploadPhoto.do")
@ResponseBody
public Object updateHeadPhoto(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {
// 文件后缀
String prefix = "";
// 时间前缀
String dateStr = "";
//保存上传
OutputStream out = null;
InputStream fileInput = null;
// 随机数前缀
double index = 1000 * (Math.random());
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
try {
if (file != null) {
String originalName = file.getOriginalFilename();
prefix = originalName.substring(originalName.lastIndexOf(".") + 1);
dateStr = format.format(new Date());
String filepath = request.getServletContext().getRealPath("/img/head/") + dateStr + index + "." + prefix;
filepath = filepath.replace("\\", "/");
File files = new File(filepath);
//打印查看上传路径
System.out.println(filepath);
if (!files.getParentFile().exists()) {
files.getParentFile().mkdirs();
}
file.transferTo(files);
}
} catch (Exception e) {
} finally {
try {
if (out != null) {
out.close();
}
if (fileInput != null) {
fileInput.close();
}
} catch (IOException e) {
}
}
Map<String, Object> map2 = new HashMap<String, Object>();
Map<String, Object> map = new HashMap<String, Object>();
// 返回上传后的图片地址 img/head/……jpg
map2.put("src", "/ssm_esms/img/head/" + dateStr + index + "." + prefix);
map.put("code", 0);
map.put("msg", "");
map.put("data", map2);
return map;
}
}

@ -0,0 +1,144 @@
package com.esms.controller;
import com.esms.exception.CustomException;
import com.esms.po.Employee;
import com.esms.po.Salary;
import com.esms.po.SystemManager;
import com.esms.service.impl.UserInforServiceImpl;
import com.esms.utils.MD5Utils;
import com.esms.vo.EmployeeCustomVo;
import com.esms.vo.EmployeeSalaryVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
*/
@Controller
public class UserInforController {
@Autowired
private UserInforServiceImpl userInforService = null;
@RequestMapping("changePassword.do")
@ResponseBody
public Map<String, String> changePassword(String oldPassword, String newPassword1,
String newPassword2, HttpSession httpSession){
System.out.println(oldPassword+" "+newPassword1+" "+newPassword2);
HashMap<String, String> map = new HashMap<String, String>();
if (newPassword1.equals(newPassword2)){
SystemManager admin = (SystemManager) httpSession.getAttribute("admin");
String encodeByMD5 = MD5Utils.encodeByMD5(oldPassword);
if (encodeByMD5.equals(admin.getSmPassword())){
String newPassword = MD5Utils.encodeByMD5(newPassword1);
admin.setSmPassword(newPassword);
userInforService.updateSystemManagePassword(admin.getSmId(),admin);
map.put("status","1");
map.put("msg","密码修改成功");
return map;
}else{
map.put("status","2");
map.put("msg","原密码错误");
return map;
}
}else{
map.put("status","0");
map.put("msg","两次密码不一致");
return map;
}
}
@RequestMapping("changeEmployeePassword.do")
@ResponseBody
public Map<String, String> changeEmployeePassword(String oldPassword, String newPassword1,
String newPassword2, HttpSession httpSession){
System.out.println(oldPassword+" "+newPassword1+" "+newPassword2);
HashMap<String, String> map = new HashMap<String, String>();
if (newPassword1.equals(newPassword2)){
Integer eid = (Integer) httpSession.getAttribute("employeeId");
try {
userInforService.updateEmployeePassword(eid, oldPassword, newPassword1);
map.put("status","1");
map.put("msg","密码修改成功");
return map;
} catch (CustomException e) {
map.put("status","2");
map.put("msg","原密码错误");
return map;
}
}else{
map.put("status","0");
map.put("msg","两次密码不一致");
return map;
}
}
@RequestMapping("inforEmployee.do")
public @ResponseBody EmployeeCustomVo getInforEmployee(HttpSession httpSession){
Integer id = (Integer) httpSession.getAttribute("employeeId");
EmployeeCustomVo employeeCustomVo = userInforService.getInforEmployee(id);
return employeeCustomVo;
}
@RequestMapping("updateInforEmployee.do")
public @ResponseBody String updateInforEmployee(HttpSession httpSession, Employee employee){
Integer id = (Integer) httpSession.getAttribute("employeeId");
employee.seteId(id);
int i = userInforService.updateEmploueeById(id,employee);
if (i==1){
return "1";
}else {
return "0";
}
}
// @RequestMapping("employeeSalaryList.do")
// @ResponseBody
// public EmployeeSalaryVO employeeSalaryList(@RequestParam(name="year",defaultValue = "1") String year,
// HttpSession httpSession){
// Integer eId = (Integer) httpSession.getAttribute("employeeId");
// List<Salary> salaryList = userInforService.getEmployeeSalaryList(eId, year);
//
// EmployeeSalaryVO employeeSalaryVO = new EmployeeSalaryVO();
// employeeSalaryVO.setCode(0);
// employeeSalaryVO.setMsg("");
// employeeSalaryVO.setCount((int) salaryList.size());
// employeeSalaryVO.setData(salaryList);
// return employeeSalaryVO;
// }
@RequestMapping("employeeSalaryList.do")
@ResponseBody
public EmployeeSalaryVO findSelective(
@RequestParam(value="page", defaultValue="1")int pageNum,
@RequestParam(value="limit", defaultValue="10") int limit,
@RequestParam(value="year", defaultValue="1") String year,
HttpSession httpSession) throws Exception {
Integer eId = (Integer) httpSession.getAttribute("employeeId");
//pageNum:起始页面 pageSize:每页的大小
PageHelper.startPage(pageNum,limit);
//查找条件一定要紧跟在startPage后
List<Salary> salaryList = userInforService.getEmployeeSalaryList(eId, year);
PageInfo pageResult = new PageInfo(salaryList);
//设置前台需要的数据
EmployeeSalaryVO employeeSalaryVO = new EmployeeSalaryVO();
employeeSalaryVO.setCode(0);
employeeSalaryVO.setMsg("");
employeeSalaryVO.setCount((int) pageResult.getTotal());
employeeSalaryVO.setData(pageResult.getList());
return employeeSalaryVO;
}
}

@ -0,0 +1,131 @@
package com.esms.controller;
import com.esms.po.RankBonus;
import com.esms.po.WorkingYearsBonus;
import com.esms.service.IRankBonusService;
import com.esms.service.IWorkYearService;
import com.esms.vo.WokingYearsBonusPages;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* @Description
*/
@Controller
public class WorkYearController {
@Autowired
private IWorkYearService service;
/*查询所有数据*/
@RequestMapping("/findWorkingYearBonusList.do")
@ResponseBody
public WokingYearsBonusPages findAll(
@RequestParam(value="page", defaultValue="1")int pageNum,
@RequestParam(value="limit", defaultValue="5") int limit,
@RequestParam(value="year", defaultValue="0") int year) throws Exception {
List<WorkingYearsBonus> list;
//模糊查询,有多少个条件就接收多少个字段
WorkingYearsBonus wyb = new WorkingYearsBonus();
wyb.setWybYear(year);
//pageNum:起始页面 pageSize:每页的大小
PageHelper.startPage(pageNum,limit);
//查找条件一定要紧跟在startPage后
list = service.findSelective(wyb);
PageInfo pageResult = new PageInfo(list);
//设置前台需要的数据
WokingYearsBonusPages wybp = new WokingYearsBonusPages();
wybp.setCode(0);
wybp.setMsg("");
wybp.setCount((int) pageResult.getTotal());
wybp.setData(pageResult.getList());
return wybp;
}
//插入数据
@RequestMapping("/addWorkingYearsBonus.do")
@ResponseBody
public String doWorkYearBonus(int year,double bonus){
if(service.Count(year)>0)
{
return "exist";
}
if(year>=0 && bonus>=0){
WorkingYearsBonus wyb= new WorkingYearsBonus();
wyb.setWybYear(year);
wyb.setWybBonus(bonus);
service.addWorkYearBonus(wyb);
return "ok";
}
else{
return "no";
}
}
/*//查询出所有记录
@RequestMapping("/findList.do")
public String doFindList(@RequestParam(value="pn",defaultValue = "1") Integer pn, Model model){
// 引入PageHelper分页插件
// 在查询之前只需要调用,传入页码,以及每页的大小
int pageSize = 10;
PageHelper.startPage(pn, pageSize);
// startPage后面紧跟的这个查询就是一个分页查询
List<WorkingYearsBonus> wyb = service.findAll();
System.out.println(wyb+"=================================");
*//*for (RankBonus rb:rbs) {
System.out.println(rb.getRankName());
}*//*
// 使用pageInfo包装查询后的结果只需要将pageInfo交给页面就行了。
// 封装了详细的分页信息,包括有我们查询出来的数据,传入连续显示的页数
PageInfo page = new PageInfo(wyb, 5);
//ModelAndView modelAndView = new ModelAndView();
// modelAndView.setViewName("admin/rank-list.jsp");
// modelAndView.addObject("pageInfo",page);
model.addAttribute("pageInfo", page);
model.addAttribute("ttttt","tttttttttt********8");
return "admin/year-list.jsp";
}*/
//根据id删除数据
@RequestMapping("/deleteRecord.do")
@ResponseBody
public String doDelete(int id){
if (service.moveWorkYearBonus(id)==true) {
return "ok";
}
else{
return "no";
}
}
//更新记录
@RequestMapping("/updateRecord.do")
@ResponseBody
public String doUpdate(int id,int year,double bonus){
WorkingYearsBonus workingYearsBonus=service.findByYear(year);
if(workingYearsBonus!=null&&!workingYearsBonus.getWybId().equals(id))
{
return "exist";
}
WorkingYearsBonus wyb=new WorkingYearsBonus();
wyb.setWybId(id);
wyb.setWybYear(year);
wyb.setWybBonus(bonus);
if(service.modifyWorkYearBonus(wyb)==true)
return "ok";
else
return "no";
}
}

@ -0,0 +1,27 @@
package com.esms.dao;
import com.esms.po.Department;
import java.util.List;
public interface DepartmentMapper {
int deleteByPrimaryKey(Integer dId);
int insert(Department record);
int insertSelective(Department record);
Department selectByPrimaryKey(Integer dId);
List<Department> selectAll();
int updateByPrimaryKeySelective(Department record);
int updateByPrimaryKey(Department record);
List<Department> findSelective(Department department);
void deleteByQuery(int[] ids);
Department findByDname(String d_name);
}

@ -0,0 +1,14 @@
package com.esms.dao;
import com.esms.vo.EmployeeCustomVo;
import java.util.HashMap;
import java.util.List;
public interface EmployeeCustomVoMapper {
public EmployeeCustomVo selectEmployeeById(int eId);
List<EmployeeCustomVo> selectEmployeeSelective(HashMap<String, Object> map);
EmployeeCustomVo selectVoByPrimaryKey(int id);
}

@ -0,0 +1,37 @@
package com.esms.dao;
import com.esms.po.Employee;
import java.util.List;
public interface EmployeeMapper {
int deleteByPrimaryKey(Integer eId);
int insert(Employee record);
int insertSelective(Employee record);
Employee selectByPrimaryKey(Integer eId);
int updateByPrimaryKeySelective(Employee record);
int updateByPrimaryKey(Employee record);
Employee selectByAccountAndPassword(Employee employee);
int countByDid(Integer eId);
int countByRbid(Integer eRank);
Employee selectByAccount(String eAcount);
// void deleteByQuery(int[] ids);
Employee findByeAccount(String eAccount);
List<Employee> selectAll();
int isExistEmployee(String eAccount);
int selectEidByEaccount(String eAccount);
}

@ -0,0 +1,19 @@
package com.esms.dao;
import com.esms.po.KeyValue;
public interface KeyValueMapper {
int deleteByPrimaryKey(Integer kvId);
int insert(KeyValue record);
int insertSelective(KeyValue record);
KeyValue selectByPrimaryKey(Integer kvId);
int updateByPrimaryKeySelective(KeyValue record);
int updateByPrimaryKey(KeyValue record);
KeyValue selectBykvKey(String kvKey);
}

@ -0,0 +1,16 @@
package com.esms.dao;
import com.esms.vo.MonthlyAttendanceCustomVo;
import java.util.List;
import java.util.Map;
/**
* @Description
*/
public interface MonthlyAttendanceCustomVoMapper {
public List<MonthlyAttendanceCustomVo>
selectMonthlyAttendanceCustomVoMapperByeAccountAnddIdAndTime(Map<String,Object> map);
MonthlyAttendanceCustomVo selectVoByPrimaryKey(int id);
}

@ -0,0 +1,26 @@
package com.esms.dao;
import com.esms.po.MonthlyAttendance;
import java.util.List;
import java.util.Map;
public interface MonthlyAttendanceMapper {
int deleteByPrimaryKey(Integer maId);
int insert(MonthlyAttendance record);
int insertSelective(MonthlyAttendance record);
MonthlyAttendance selectByPrimaryKey(Integer maId);
int updateByPrimaryKeySelective(MonthlyAttendance record);
int updateByPrimaryKey(MonthlyAttendance record);
MonthlyAttendance selectByeIdAndDate(int eId, String date);
void deleteByQuery(int[] ids);
List<MonthlyAttendance> selectMonthlyAttendanceMapperByeEidAndTime (Map<String, Object> map);
}

@ -0,0 +1,25 @@
package com.esms.dao;
import com.esms.po.Position;
import java.util.List;
public interface PositionMapper {
int deleteByPrimaryKey(Integer pId);
int insert(Position record);
int insertSelective(Position record);
Position selectByPrimaryKey(Integer pId);
int updateByPrimaryKeySelective(Position record);
int updateByPrimaryKey(Position record);
List<Position> findSelective(Position position);
void deleteByQuery(int[] ids);
Position findByDname(String p_name);
}

@ -0,0 +1,28 @@
package com.esms.dao;
import com.esms.po.RankBonus;
import java.util.List;
public interface RankBonusMapper {
int deleteByPrimaryKey(Integer rbId);
int insert(RankBonus record);
int insertSelective(RankBonus record);
RankBonus selectByPrimaryKey(Integer rbId);
List<RankBonus> selectAll();
int updateByPrimaryKeySelective(RankBonus record);
int updateByPrimaryKey(RankBonus record);
int CountByRankName(String name);
List<RankBonus> findSelective(RankBonus record);
RankBonus findByname(String name);
}

@ -0,0 +1,43 @@
package com.esms.dao;
import com.esms.po.Salary;
import com.esms.vo.EchSalary;
import java.util.List;
import java.util.Map;
public interface SalaryMapper {
int deleteByPrimaryKey(Integer sId);
int insert(Salary record);
int insertSelective(Salary record);
Salary selectByPrimaryKey(Integer sId);
int updateByPrimaryKeySelective(Salary record);
int updateByPrimaryKey(Salary record);
Salary selectByEidAndTime(Integer eId, String time);
Double selectMaxSalaryByDepartment(Integer dId,String date);
//查每个最低,平均,最高工资
EchSalary selectSalaryByDepartment(Integer dId, String date);
//查每个工资总数,时间年月
Double selectAllSalaryByDepartment(Integer dId,String date);
//查每个工资总数,时间年
Double selectAllSalaryByDepAndYear(Integer dId,String date);
// 查找员工个人的某年工资记录
List<Salary> selectEmployeeSalaryList(Integer eId, String data);
List<Salary> selectByeId(Integer eId);
//根据年月时间查工资总数
Double selectAllSalaryByDate(String date);
List<Salary> test(String eAccount);
List<Salary> selectByEaccountDIdDate(Map<String,Object> map);
List<Salary> selectByeTimeAndStatus(String date, int status);
Salary selectByEidAndTimeAndStatus(Integer eId, String time, int status);
List<Salary> selectByEaccountDIdDateState(Map<String,Object> map);
}

@ -0,0 +1,19 @@
package com.esms.dao;
import com.esms.po.SystemManager;
public interface SystemManagerMapper {
int deleteByPrimaryKey(Integer smId);
int insert(SystemManager record);
int insertSelective(SystemManager record);
SystemManager selectByPrimaryKey(Integer smId);
int updateByPrimaryKeySelective(SystemManager record);
int updateByPrimaryKey(SystemManager record);
SystemManager selectByAccountAndPassword(SystemManager systemManager);
}

@ -0,0 +1,27 @@
package com.esms.dao;
import com.esms.po.WorkingYearsBonus;
import java.util.List;
public interface WorkingYearsBonusMapper {
int deleteByPrimaryKey(Integer wybId);
int insert(WorkingYearsBonus record);
int insertSelective(WorkingYearsBonus record);
WorkingYearsBonus selectByPrimaryKey(Integer wybId);
int updateByPrimaryKeySelective(WorkingYearsBonus record);
int updateByPrimaryKey(WorkingYearsBonus record);
List<WorkingYearsBonus> selectAll();
int countByYear(Integer year);
List<WorkingYearsBonus> findSelective(WorkingYearsBonus record);
WorkingYearsBonus findByYear(int year);
}

@ -0,0 +1,19 @@
package com.esms.exception;
public class CustomException extends Exception{
private String message;
public CustomException(String message) {
super(message);
this.message = message;
}
@Override
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}

@ -0,0 +1,25 @@
package com.esms.exception;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class CustomExceptionResolver implements HandlerExceptionResolver {
public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) {
CustomException customException = null;
if (e instanceof CustomException) {
customException = (CustomException) e;
}else{
customException = new CustomException("系统出现未知错误!");
}
String message = customException.getMessage();
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("message",message);
modelAndView.setViewName("error/error.jsp");
return modelAndView;
}
}

@ -0,0 +1,56 @@
package com.esms.interceptor;
import com.esms.po.SystemManager;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @Description
*/
public class LoginInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse, Object o) throws Exception {
// String requestUri = httpServletRequest.getRequestURI();
// String contextPath = httpServletRequest.getContextPath();
// String url = requestUri.substring(contextPath.length());
// System.out.println(url);
// System.out.println(requestUri);
// if ("/".equals(url)){
// return true;
// }
// if ("/employeeLogin.do".equals(url)){
// return true;
// }else{
String string = (String) httpServletRequest.getSession().getAttribute("employeeId");
SystemManager systemManager = (SystemManager) httpServletRequest.getSession().getAttribute("admin");
if (string != null) {
return true;
} else if (string == null){
httpServletResponse.sendRedirect("/");
return false;
} else if (systemManager != null) {
return true;
} else {
httpServletResponse.sendRedirect("/admin.do");
return false;
}
}
@Override
public void postHandle(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse,
Object o, ModelAndView modelAndView) throws Exception {
}
@Override
public void afterCompletion(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse,
Object o, Exception e) throws Exception {
}
}

@ -0,0 +1,34 @@
package com.esms.interceptor;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @Description
*/
public class PermissionInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
// if (httpServletRequest.getSession().getAttribute("admin") != null){
// return true;
// }else{
//// httpServletRequest.getRequestDispatcher("/login.do").forward(httpServletRequest, httpServletResponse);
// httpServletResponse.sendRedirect("/admin.do");
// return false;
// }
return true;
}
@Override
public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
}
@Override
public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
}
}

@ -0,0 +1,53 @@
package com.esms.po;
public class Department {
private Integer dId;
private String dName;
private String dRemark;
private Integer dIsdel;
public Integer getdId() {
return dId;
}
public void setdId(Integer dId) {
this.dId = dId;
}
public String getdName() {
return dName;
}
public void setdName(String dName) {
this.dName = dName == null ? null : dName.trim();
}
public String getdRemark() {
return dRemark;
}
public void setdRemark(String dRemark) {
this.dRemark = dRemark == null ? null : dRemark.trim();
}
public Integer getdIsdel() {
return dIsdel;
}
public void setdIsdel(Integer dIsdel) {
this.dIsdel = dIsdel;
}
@Override
public String toString() {
return "Department{" +
"dId=" + dId +
", dName='" + dName + '\'' +
", dRemark='" + dRemark + '\'' +
", dIsdel=" + dIsdel +
'}';
}
}

@ -0,0 +1,273 @@
package com.esms.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class Employee {
private Integer eId;
private String eAccount;
private String ePassword;
private String eName;
private String eIdcard;
private String eSex;
private String eDagree;
private Date eBirthday;
private String eEmail;
private String ePhone;
private String eHometown;
private Integer eRank;
// private RankBonus rankBonus;
private String eHeadPath;
private String eUrgentPerson;
private String eUrgentPhone;
private Integer pId;
// private Position position;
private Integer dId;
// private Department department;
private Double eBasePay;
private Integer eIsdel;
private Date eEntryTime;
private Date eLeaveTime;
public Integer geteId() {
return eId;
}
public void seteId(Integer eId) {
this.eId = eId;
}
public String geteAccount() {
return eAccount;
}
public void seteAccount(String eAccount) {
this.eAccount = eAccount == null ? null : eAccount.trim();
}
public String getePassword() {
return ePassword;
}
public void setePassword(String ePassword) {
this.ePassword = ePassword == null ? null : ePassword.trim();
}
public String geteName() {
return eName;
}
public void seteName(String eName) {
this.eName = eName == null ? null : eName.trim();
}
public String geteIdcard() {
return eIdcard;
}
public void seteIdcard(String eIdcard) {
this.eIdcard = eIdcard == null ? null : eIdcard.trim();
}
public String geteSex() {
return eSex;
}
public void seteSex(String eSex) {
this.eSex = eSex;
}
public String geteDagree() {
return eDagree;
}
public void seteDagree(String eDagree) {
this.eDagree = eDagree == null ? null : eDagree.trim();
}
@JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
public Date geteBirthday() {
return eBirthday;
}
public void seteBirthday(Date eBirthday) {
this.eBirthday = eBirthday;
}
public String geteEmail() {
return eEmail;
}
public void seteEmail(String eEmail) {
this.eEmail = eEmail == null ? null : eEmail.trim();
}
public String getePhone() {
return ePhone;
}
public void setePhone(String ePhone) {
this.ePhone = ePhone == null ? null : ePhone.trim();
}
public String geteHometown() {
return eHometown;
}
public void seteHometown(String eHometown) {
this.eHometown = eHometown == null ? null : eHometown.trim();
}
public Integer geteRank() {
return eRank;
}
public void seteRank(Integer eRank) {
this.eRank = eRank;
}
public String geteHeadPath() {
return eHeadPath;
}
public void seteHeadPath(String eHeadPath) {
this.eHeadPath = eHeadPath == null ? null : eHeadPath.trim();
}
public String geteUrgentPerson() {
return eUrgentPerson;
}
public void seteUrgentPerson(String eUrgentPerson) {
this.eUrgentPerson = eUrgentPerson == null ? null : eUrgentPerson.trim();
}
public String geteUrgentPhone() {
return eUrgentPhone;
}
public void seteUrgentPhone(String eUrgentPhone) {
this.eUrgentPhone = eUrgentPhone == null ? null : eUrgentPhone.trim();
}
public Integer getpId() {
return pId;
}
public void setpId(Integer pId) {
this.pId = pId;
}
public Integer getdId() {
return dId;
}
public void setdId(Integer dId) {
this.dId = dId;
}
// public RankBonus getRankBonus() {
// return rankBonus;
// }
//
// public void setRankBonus(RankBonus rankBonus) {
// this.rankBonus = rankBonus;
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Department getDepartment() {
// return department;
// }
//
// public void setDepartment(Department department) {
// this.department = department;
// }
public Double geteBasePay() {
return eBasePay;
}
public void seteBasePay(Double eBasePay) {
this.eBasePay = eBasePay;
}
public Integer geteIsdel() {
return eIsdel;
}
public void seteIsdel(Integer eIsdel) {
this.eIsdel = eIsdel;
}
@JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
public Date geteEntryTime() {
return eEntryTime;
}
public void seteEntryTime(Date eEntryTime) {
this.eEntryTime = eEntryTime;
}
public Date geteLeaveTime() {
return eLeaveTime;
}
public void seteLeaveTime(Date eLeaveTime) {
this.eLeaveTime = eLeaveTime;
}
@Override
public String toString() {
return "Employee{" +
"eId=" + eId +
", eAccount='" + eAccount + '\'' +
", ePassword='" + ePassword + '\'' +
", eName='" + eName + '\'' +
", eIdcard='" + eIdcard + '\'' +
", eSex=" + eSex +
", eDagree='" + eDagree + '\'' +
", eBirthday=" + eBirthday +
", eEmail='" + eEmail + '\'' +
", ePhone='" + ePhone + '\'' +
", eHometown='" + eHometown + '\'' +
", eRank=" + eRank +
", eHeadPath='" + eHeadPath + '\'' +
", eUrgentPerson='" + eUrgentPerson + '\'' +
", eUrgentPhone='" + eUrgentPhone + '\'' +
", pId=" + pId +
", dId=" + dId +
", eBasePay=" + eBasePay +
", eIsdel=" + eIsdel +
", eEntryTime=" + eEntryTime +
", eLeaveTime=" + eLeaveTime +
'}';
}
}

@ -0,0 +1,42 @@
package com.esms.po;
public class KeyValue {
private Integer kvId;
private String kvKey;
private double kvValue;
public Integer getKvId() {
return kvId;
}
public void setKvId(Integer kvId) {
this.kvId = kvId;
}
public String getKvKey() {
return kvKey;
}
public void setKvKey(String kvKey) {
this.kvKey = kvKey == null ? null : kvKey.trim();
}
public double getKvValue() {
return kvValue;
}
public void setKvValue(double kvValue) {
this.kvValue = kvValue;
}
@Override
public String toString() {
return "KeyValue{" +
"kvId=" + kvId +
", kvKey='" + kvKey + '\'' +
", kvValue='" + kvValue + '\'' +
'}';
}
}

@ -0,0 +1,156 @@
package com.esms.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class MonthlyAttendance {
private Integer maId;
private Integer eId;
private Employee employee;
private Date attendanceTime;
private Integer sickLeaveNum;
private Double overtimeHour;
private Double weekendHour;
private Double holidayHour;
private Integer lateNum;
private Integer earlyNum;
private Integer absenceNum;
private Integer businessTravelNum;
private Integer compassionateLeaveNum;
public Integer getMaId() {
return maId;
}
public void setMaId(Integer maId) {
this.maId = maId;
}
public Integer geteId() {
return eId;
}
public void seteId(Integer eId) {
this.eId = eId;
}
public Employee getEmployee() {
return employee;
}
public void setEmployee(Employee employee) {
this.employee = employee;
}
@JsonFormat(pattern="yyyy-MM",timezone = "GMT+8")
public Date getAttendanceTime() {
return attendanceTime;
}
public void setAttendanceTime(Date attendanceTime) {
this.attendanceTime = attendanceTime;
}
public Integer getSickLeaveNum() {
return sickLeaveNum;
}
public void setSickLeaveNum(Integer sickLeaveNum) {
this.sickLeaveNum = sickLeaveNum;
}
public Double getOvertimeHour() {
return overtimeHour;
}
public void setOvertimeHour(Double overtimeHour) {
this.overtimeHour = overtimeHour;
}
public Double getWeekendHour() {
return weekendHour;
}
public void setWeekendHour(Double weekendHour) {
this.weekendHour = weekendHour;
}
public Double getHolidayHour() {
return holidayHour;
}
public void setHolidayHour(Double holidayHour) {
this.holidayHour = holidayHour;
}
public Integer getLateNum() {
return lateNum;
}
public void setLateNum(Integer lateNum) {
this.lateNum = lateNum;
}
public Integer getEarlyNum() {
return earlyNum;
}
public void setEarlyNum(Integer earlyNum) {
this.earlyNum = earlyNum;
}
public Integer getAbsenceNum() {
return absenceNum;
}
public void setAbsenceNum(Integer absenceNum) {
this.absenceNum = absenceNum;
}
public Integer getBusinessTravelNum() {
return businessTravelNum;
}
public void setBusinessTravelNum(Integer businessTravelNum) {
this.businessTravelNum = businessTravelNum;
}
public Integer getCompassionateLeaveNum() {
return compassionateLeaveNum;
}
public void setCompassionateLeaveNum(Integer compassionateLeaveNum) {
this.compassionateLeaveNum = compassionateLeaveNum;
}
@Override
public String toString() {
return "MonthlyAttendance{" +
"maId=" + maId +
", eId=" + eId +
", employee=" + employee +
", attendanceTime=" + attendanceTime +
", sickLeaveNum=" + sickLeaveNum +
", overtimeHour=" + overtimeHour +
", weekendHour=" + weekendHour +
", holidayHour=" + holidayHour +
", lateNum=" + lateNum +
", earlyNum=" + earlyNum +
", absenceNum=" + absenceNum +
", businessTravelNum=" + businessTravelNum +
", compassionateLeaveNum=" + compassionateLeaveNum +
'}';
}
}

@ -0,0 +1,64 @@
package com.esms.po;
public class Position {
private Integer pId;
private String pName;
private String pDuty;
private Double pPostPay;
private Integer pIsdel;
public Integer getpId() {
return pId;
}
public void setpId(Integer pId) {
this.pId = pId;
}
public String getpName() {
return pName;
}
public void setpName(String pName) {
this.pName = pName == null ? null : pName.trim();
}
public String getpDuty() {
return pDuty;
}
public void setpDuty(String pDuty) {
this.pDuty = pDuty == null ? null : pDuty.trim();
}
public Double getpPostPay() {
return pPostPay;
}
public void setpPostPay(Double pPostPay) {
this.pPostPay = pPostPay;
}
public Integer getpIsdel() {
return pIsdel;
}
public void setpIsdel(Integer pIsdel) {
this.pIsdel = pIsdel;
}
@Override
public String toString() {
return "Position{" +
"pId=" + pId +
", pName='" + pName + '\'' +
", pDuty='" + pDuty + '\'' +
", pPostPay=" + pPostPay +
", pIsdel=" + pIsdel +
'}';
}
}

@ -0,0 +1,42 @@
package com.esms.po;
public class RankBonus {
private Integer rbId;
private String rankName;
private Integer rbBonus;
public Integer getRbId() {
return rbId;
}
public void setRbId(Integer rbId) {
this.rbId = rbId;
}
public String getRankName() {
return rankName;
}
public void setRankName(String rankName) {
this.rankName = rankName == null ? null : rankName.trim();
}
public Integer getRbBonus() {
return rbBonus;
}
public void setRbBonus(Integer rbBonus) {
this.rbBonus = rbBonus;
}
@Override
public String toString() {
return "RankBonus{" +
"rbId=" + rbId +
", rankName='" + rankName + '\'' +
", rbBonus=" + rbBonus +
'}';
}
}

@ -0,0 +1,342 @@
package com.esms.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class Salary {
private Integer sId;
private Integer eId;
private Employee employee;
private Integer dId;
private Department department;
private Date sTime;
private Integer sState;
private Double basePay;
private Double foodPay;
private Double postPay;
private Double workingYearPay;
private Double rankPay;
private Double trafficPay;
private Double persionPay;
private Double medicalPay;
private Double unemploymentPay;
private Double injuryPay;
private Double birthPay;
private Double housingPay;
private Double latePay;
private Double earlyPay;
private Double overtimePay;
private Double sickPay;
private Double thingPay;
private Double businessTravelPay;
private Double fullAttendancePay;
private Double rissuePay;
private Double individualIncomeTax;
private Double shouldPay;
private Double actualPay;
public Integer getsId() {
return sId;
}
public void setsId(Integer sId) {
this.sId = sId;
}
public Integer geteId() {
return eId;
}
public void seteId(Integer eId) {
this.eId = eId;
}
public Integer getdId() {
return dId;
}
public void setdId(Integer dId) {
this.dId = dId;
}
public Department getDepartment() {
return department;
}
public void setDepartment(Department department) {
this.department = department;
}
public Employee getEmployee() {
return employee;
}
public void setEmployee(Employee employee) {
this.employee = employee;
}
@JsonFormat(pattern="yyyy-MM",timezone = "GMT+8")
public Date getsTime() {
return sTime;
}
public void setsTime(Date sTime) {
this.sTime = sTime;
}
public Integer getsState() {
return sState;
}
public void setsState(Integer sState) {
this.sState = sState;
}
public Double getBasePay() {
return basePay;
}
public void setBasePay(Double basePay) {
this.basePay = basePay;
}
public Double getFoodPay() {
return foodPay;
}
public void setFoodPay(Double foodPay) {
this.foodPay = foodPay;
}
public Double getPostPay() {
return postPay;
}
public void setPostPay(Double postPay) {
this.postPay = postPay;
}
public Double getWorkingYearPay() {
return workingYearPay;
}
public void setWorkingYearPay(Double workingYearPay) {
this.workingYearPay = workingYearPay;
}
public Double getRankPay() {
return rankPay;
}
public void setRankPay(Double rankPay) {
this.rankPay = rankPay;
}
public Double getTrafficPay() {
return trafficPay;
}
public void setTrafficPay(Double trafficPay) {
this.trafficPay = trafficPay;
}
public Double getPersionPay() {
return persionPay;
}
public void setPersionPay(Double persionPay) {
this.persionPay = persionPay;
}
public Double getMedicalPay() {
return medicalPay;
}
public void setMedicalPay(Double medicalPay) {
this.medicalPay = medicalPay;
}
public Double getUnemploymentPay() {
return unemploymentPay;
}
public void setUnemploymentPay(Double unemploymentPay) {
this.unemploymentPay = unemploymentPay;
}
public Double getInjuryPay() {
return injuryPay;
}
public void setInjuryPay(Double injuryPay) {
this.injuryPay = injuryPay;
}
public Double getBirthPay() {
return birthPay;
}
public void setBirthPay(Double birthPay) {
this.birthPay = birthPay;
}
public Double getHousingPay() {
return housingPay;
}
public void setHousingPay(Double housingPay) {
this.housingPay = housingPay;
}
public Double getLatePay() {
return latePay;
}
public void setLatePay(Double latePay) {
this.latePay = latePay;
}
public Double getEarlyPay() {
return earlyPay;
}
public void setEarlyPay(Double earlyPay) {
this.earlyPay = earlyPay;
}
public Double getOvertimePay() {
return overtimePay;
}
public void setOvertimePay(Double overtimePay) {
this.overtimePay = overtimePay;
}
public Double getSickPay() {
return sickPay;
}
public void setSickPay(Double sickPay) {
this.sickPay = sickPay;
}
public Double getThingPay() {
return thingPay;
}
public void setThingPay(Double thingPay) {
this.thingPay = thingPay;
}
public Double getBusinessTravelPay() {
return businessTravelPay;
}
public void setBusinessTravelPay(Double businessTravelPay) {
this.businessTravelPay = businessTravelPay;
}
public Double getFullAttendancePay() {
return fullAttendancePay;
}
public void setFullAttendancePay(Double fullAttendancePay) {
this.fullAttendancePay = fullAttendancePay;
}
public Double getRissuePay() {
return rissuePay;
}
public void setRissuePay(Double rissuePay) {
this.rissuePay = rissuePay;
}
public Double getIndividualIncomeTax() {
return individualIncomeTax;
}
public void setIndividualIncomeTax(Double individualIncomeTax) {
this.individualIncomeTax = individualIncomeTax;
}
public Double getShouldPay() {
return shouldPay;
}
public void setShouldPay(Double shouldPay) {
this.shouldPay = shouldPay;
}
public Double getActualPay() {
return actualPay;
}
public void setActualPay(Double actualPay) {
this.actualPay = actualPay;
}
@Override
public String toString() {
return "Salary{" +
"sId=" + sId +
", eId=" + eId +
", employee=" + employee +
", dId=" + dId +
", department=" + department +
", sTime=" + sTime +
", sState=" + sState +
", basePay=" + basePay +
", foodPay=" + foodPay +
", postPay=" + postPay +
", workingYearPay=" + workingYearPay +
", rankPay=" + rankPay +
", trafficPay=" + trafficPay +
", persionPay=" + persionPay +
", medicalPay=" + medicalPay +
", unemploymentPay=" + unemploymentPay +
", injuryPay=" + injuryPay +
", birthPay=" + birthPay +
", housingPay=" + housingPay +
", latePay=" + latePay +
", earlyPay=" + earlyPay +
", overtimePay=" + overtimePay +
", sickPay=" + sickPay +
", thingPay=" + thingPay +
", businessTravelPay=" + businessTravelPay +
", fullAttendancePay=" + fullAttendancePay +
", rissuePay=" + rissuePay +
", individualIncomeTax=" + individualIncomeTax +
", shouldPay=" + shouldPay +
", actualPay=" + actualPay +
'}';
}
}

@ -0,0 +1,43 @@
package com.esms.po;
public class SystemManager {
private Integer smId;
private String smAccount;
private String smPassword;
public Integer getSmId() {
return smId;
}
public void setSmId(Integer smId) {
this.smId = smId;
}
public String getSmAccount() {
return smAccount;
}
public void setSmAccount(String smAccount) {
this.smAccount = smAccount == null ? null : smAccount.trim();
}
public String getSmPassword() {
return smPassword;
}
public void setSmPassword(String smPassword) {
this.smPassword = smPassword == null ? null : smPassword.trim();
}
@Override
public String toString() {
return "SystemManager{" +
"smId=" + smId +
", smAccount='" + smAccount + '\'' +
", smPassword='" + smPassword + '\'' +
'}';
}
}

@ -0,0 +1,43 @@
package com.esms.po;
public class WorkingYearsBonus {
private Integer wybId;
private Integer wybYear;
private Double wybBonus;
public Integer getWybId() {
return wybId;
}
public void setWybId(Integer wybId) {
this.wybId = wybId;
}
public Integer getWybYear() {
return wybYear;
}
public void setWybYear(Integer wybYear) {
this.wybYear = wybYear;
}
public Double getWybBonus() {
return wybBonus;
}
public void setWybBonus(Double wybBonus) {
this.wybBonus = wybBonus;
}
@Override
public String toString() {
return "WorkingYearsBonus{" +
"wybId=" + wybId +
", wybYear=" + wybYear +
", wybBonus=" + wybBonus +
'}';
}
}

@ -0,0 +1,22 @@
package com.esms.service;
import com.esms.po.Department;
import java.util.List;
public interface DepartmentService {
public Department selectByPrimaryKey(int id) throws Exception;
int insertSelective(Department department) throws Exception;
void updateByPrimaryKeySelective(Department department) throws Exception;
void deleteByPrimaryKey(int id) throws Exception;
List<Department> findSelective(Department department) throws Exception;
void deleteByQuery(int[] ids);
Department findByDname(String d_name);
}

@ -0,0 +1,18 @@
package com.esms.service;
import com.esms.po.Employee; /**
*
* 2020/02/10 15:20
*/
public interface EmployeeService {
void deleteByPrimaryKey(int id);
void deleteByQuery(int[] ids);
void insert(Employee employee);
Employee findByeAccount(String eAccount);
void updateByPrimaryKeySelective(Employee employee);
}

@ -0,0 +1,12 @@
package com.esms.service;
import com.esms.exception.CustomException;
import jxl.write.WriteException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public interface IDownloadExcelService {
void getSalaryExcel(HttpServletRequest request, HttpServletResponse response,String eAccount,Integer dId,String sTime) throws Exception;
}

@ -0,0 +1,17 @@
package com.esms.service;
import com.esms.po.Department;
import com.esms.vo.EchDepartmentSalary;
import com.esms.vo.EchEmployeeNums;
import com.esms.vo.EchMonthSalary;
import com.esms.vo.EchSalaryPercent;
import java.util.List;
import java.util.Map;
public interface IEchartsService {
Map<String,List<EchEmployeeNums>> getEmployeeNums();
Map<String,List<EchDepartmentSalary>> getDepartmentSalary(String date);
Map<String,List<EchSalaryPercent>> getSalaryPercent(String date,int state);
Map<String,List<EchMonthSalary>> getMonthSalary();
}

@ -0,0 +1,8 @@
package com.esms.service;
import org.springframework.web.multipart.MultipartFile;
public interface IImportDataService {
String insertMATable(MultipartFile excel) throws Exception;
String insertReissueTable(MultipartFile excel) throws Exception;
}

@ -0,0 +1,9 @@
package com.esms.service;
import com.esms.po.KeyValue;
public interface IKeyValueService {
public KeyValue getKeyValueById(int id) throws Exception;
public KeyValue selectBykvKey(String key)throws Exception;
public int updateByPrimaryKey(KeyValue kv)throws Exception;
}

@ -0,0 +1,15 @@
package com.esms.service;
import com.esms.exception.CustomException;
import com.esms.po.Employee;
import com.esms.po.SystemManager;
/**
* @Description
*/
public interface ILoginService {
public Employee findEmployeeByIdAndPassword(String account, String password) throws CustomException;
public SystemManager findSystemManagerByIdAndPassword(String account, String password) throws CustomException;
public Employee findEmployeeById(int id);
public SystemManager findSystemManagerById(int id);
}

@ -0,0 +1,17 @@
package com.esms.service;
import com.esms.po.MonthlyAttendance;
import org.springframework.stereotype.Service;
/**
* @Description
*/
public interface IMonthlyAttendanceService {
void deleteByPrimaryKey(int id);
void deleteByQuery(int[] ids);
MonthlyAttendance selectByPrimaryKey(int id);
void updateByPrimaryKeySelective(MonthlyAttendance monthlyAttendance);
}

@ -0,0 +1,35 @@
package com.esms.service;
import com.esms.po.RankBonus;
import java.util.List;
/**
* @Description
*/
public interface IRankBonusService {
//添加职称奖金记录
boolean addRankBonus(RankBonus rb);
//删除
boolean moveRankBonus(int rbId);
//修改
boolean modifyRankName(RankBonus rb);
//查询所有
List<RankBonus> findAll();
//根据id查询
RankBonus findById(int rbId);
//根据名字查询
RankBonus findByName(String rankName);
//
int CountByRbid(Integer rbid);
//
int CountByName(String name);
List<RankBonus> findSelective(RankBonus rb) throws Exception;
}

@ -0,0 +1,19 @@
package com.esms.service;
import com.esms.exception.CustomException;
import com.esms.vo.SalaryPages;
/**
* @Description
*/
public interface ISalaryService {
public void insertSalaryByAcountAndDate(String eAccount, String date) throws CustomException;
public void insertSalaryAllByDate(String date) throws CustomException;
public SalaryPages selectSalaryByEaccountDIdDate(Integer pageNum,Integer limit,String eAccount,Integer dId,String sTime);
public void deleteSalaryByEid(int[] ids);
public void updateSalaryBySid(int[] ids);
public SalaryPages selectSalaryByEaccountDIdDateState(int pageNum, int limit, String eAccount, Integer dId, String sTime);
void updateSalaryByEidAndRissuePay(int sId, double rissuePay);
}

@ -0,0 +1,21 @@
package com.esms.service;
import com.esms.exception.CustomException;
import com.esms.po.Employee;
import com.esms.vo.EmployeeCustomVo;
import com.esms.po.Salary;
import com.esms.po.SystemManager;
import java.util.List;
/**
* @Description
*/
public interface IUserInforService {
public void updateSystemManagePassword(int id, SystemManager systemManager);
public void updateEmployeePassword(int id, String oldPassword, String newPassword) throws CustomException;
public EmployeeCustomVo getInforEmployee(int id);
public int updateEmploueeById(int id, Employee employee);
// 查找员工个人的某年工资记录
public List<Salary> getEmployeeSalaryList(int eId, String year);
}

@ -0,0 +1,36 @@
package com.esms.service;
import com.esms.po.RankBonus;
import com.esms.po.WorkingYearsBonus;
import java.util.List;
/**
* @Description
*/
public interface IWorkYearService {
//添加工龄奖金记录
boolean addWorkYearBonus(WorkingYearsBonus wyb);
//删除
boolean moveWorkYearBonus(int wybId);
//修改奖金
boolean modifyWorkYearBonus(WorkingYearsBonus wyb);
//查询所有
List<WorkingYearsBonus> findAll();
//根据id查询
WorkingYearsBonus findById(int wybId);
//统计是否存在该工龄
int Count(int wybYear);
List<WorkingYearsBonus> findSelective(WorkingYearsBonus record);
WorkingYearsBonus findByYear(int year);
}

@ -0,0 +1,24 @@
package com.esms.service;
import com.esms.po.Position;
import java.util.List;
/**
* @Description
*/
public interface PositionService {
List<Position> findSelective(Position position);
int insertSelective(Position position);
Position findByPrimaryKey(int id);
void updateByPrimaryKeySelective(Position position);
void deleteByPrimaryKey(int id);
void deleteByQuery(int[] ids);
Position findByDname(String p_name);
}

@ -0,0 +1,48 @@
package com.esms.service.impl;
import com.esms.dao.DepartmentMapper;
import com.esms.po.Department;
import com.esms.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class DepartmentServiceImpl implements DepartmentService {
@Autowired
public DepartmentMapper departmentMapper = null;
public Department selectByPrimaryKey(int id) {
return departmentMapper.selectByPrimaryKey(id);
}
public int insertSelective(Department department) {
return departmentMapper.insertSelective(department);
}
@Override
public void updateByPrimaryKeySelective(Department department) {
departmentMapper.updateByPrimaryKeySelective(department);
}
@Override
public void deleteByPrimaryKey(int id) {
departmentMapper.deleteByPrimaryKey(id);
}
@Override
public List<Department> findSelective(Department department) {
return departmentMapper.findSelective(department);
}
@Override
public void deleteByQuery(int[] ids) {
departmentMapper.deleteByQuery(ids);
}
@Override
public Department findByDname(String d_name) {
return departmentMapper.findByDname(d_name);
}
}

@ -0,0 +1,56 @@
package com.esms.service.impl;
import com.esms.dao.SalaryMapper;
import com.esms.exception.CustomException;
import com.esms.po.Salary;
import com.esms.service.IDownloadExcelService;
import com.esms.utils.JXLUtils;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
*/
@Service
public class DownloadExcelServiceImpl implements IDownloadExcelService{
@Autowired
private SalaryMapper salaryMapper;
@Override
public void getSalaryExcel(HttpServletRequest request, HttpServletResponse response,String eAccount,Integer dId,String sTime) throws Exception{
// response.setCharacterEncoding("utf-8");
//response.setHeader("Content-Disposition", "text/html; charset=utf-8;attachment; filename=salary.xls");
String excelName = "工资表.xls";
//WritableWorkbook writableWorkbook = ExcelUtils.createTemplate(response.getOutputStream());
WritableWorkbook writableWorkbook = null;
Map map = new HashMap<String,Object>();
map.put("eAccount",eAccount);
map.put("dId",dId);
map.put("sTime",sTime);
List<Salary> salaries = salaryMapper.selectByEaccountDIdDate(map);
try {
response.setHeader("Content-Disposition", "attachment;filename=" + new String(excelName.getBytes("gbk"),"ISO-8859-1"));
writableWorkbook = JXLUtils.createSalaryExcel(response.getOutputStream(),salaries);
writableWorkbook.write();
writableWorkbook.close();
} catch (IOException e) {
e.printStackTrace();
throw new CustomException("下载失败");
} catch (WriteException e) {
e.printStackTrace();
throw new CustomException("下载失败");
}
}
}

@ -0,0 +1,156 @@
package com.esms.service.impl;
import com.esms.dao.DepartmentMapper;
import com.esms.dao.EmployeeMapper;
import com.esms.dao.SalaryMapper;
import com.esms.po.Department;
import com.esms.po.Employee;
import com.esms.service.IEchartsService;
import com.esms.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @Description
**/
@Service
public class EchartsServiceImpl implements IEchartsService {
@Autowired
private DepartmentMapper departmentMapper;
@Autowired
private EmployeeMapper employeeMapper;
@Autowired
private SalaryMapper salaryMapper;
@Override
public Map<String, List<EchEmployeeNums>> getEmployeeNums() {
/**
* @Author:
* @Description:
* @Date: 8:11 2020/02/7
* @Param: []
* @Return: java.util.Map<java.lang.String,java.util.List<com.esms.vo.EchEmployeeNums>>
**/
List<EchEmployeeNums> echEmployeeNumsList = new ArrayList();
Map<String,List<EchEmployeeNums>> map = new HashMap<String,List<EchEmployeeNums>>();
List<Department> departmentList = (List<Department>) departmentMapper.selectAll();
int nums = 0;
for (Department department:departmentList){
//统计部门员工人数
nums = employeeMapper.countByDid(department.getdId());
EchEmployeeNums echEmployeeNums = new EchEmployeeNums();
//填入部门名
echEmployeeNums.setDepartment(department.getdName());
//填入部门员工人数
echEmployeeNums.setNum(nums);
echEmployeeNumsList.add(echEmployeeNums);
nums = 0; //清零
}
map.put("list",echEmployeeNumsList);
return map;
}
@Override
public Map<String, List<EchDepartmentSalary>> getDepartmentSalary(String date) {
/**
* @Author:
* @Description:线
* @Date: 14:36 2020/02/7
* @Param: []
* @Return: java.util.Map<java.lang.String,java.util.List<com.esms.vo.EchDepartmentSalary>>
**/
List<EchDepartmentSalary> echDepartmentSalaryList = new ArrayList<EchDepartmentSalary>();
Map<String,List<EchDepartmentSalary>> stringListMap = new HashMap<String, List<EchDepartmentSalary>>();
List<Department> departmentList = (List<Department>) departmentMapper.selectAll();
//遍历所有部门
for (Department department:departmentList){
EchDepartmentSalary echDepartmentSalary = new EchDepartmentSalary();
//填入部门名称
echDepartmentSalary.setDepartment(department.getdName());
//查找每个部门最高,平均,最低工资,并用vo类echSalary接收
EchSalary echSalary = salaryMapper.selectSalaryByDepartment(department.getdId(),date);
//查找不到数据则赋值为0
if(echSalary==null){
echSalary = new EchSalary(0.00,0.00,0.00);
}
//填入每个部门最高,平均,最低工资
List<Double> salary = new ArrayList<Double>();
salary.add(echSalary.getMinSalary());
salary.add(echSalary.getAvgSalary());
salary.add(echSalary.getMaxSalary());
echDepartmentSalary.setSalary(salary);
//填入一条数据department,salary[10,20,30]到VO
echDepartmentSalaryList.add(echDepartmentSalary);
}
stringListMap.put("list",echDepartmentSalaryList);
return stringListMap;
}
@Override
public Map<String, List<EchSalaryPercent>> getSalaryPercent(String date,int state) {
List<EchSalaryPercent> echSalaryPercentList = new ArrayList<EchSalaryPercent>();
Map<String,List<EchSalaryPercent>> map = new HashMap<String,List<EchSalaryPercent>>();
List<Department> departmentList = (List<Department>) departmentMapper.selectAll();
//遍历所有部门
for (Department department:departmentList){
EchSalaryPercent echSalaryPercent = new EchSalaryPercent();
//填入部门名称
echSalaryPercent.setDepartment(department.getdName());
//查找每个部门工资总数,并用vo类echSalaryDepartment接收
//时间为年月
Double allSalary = 0.00;
if(state == 0){
allSalary = salaryMapper.selectAllSalaryByDepartment(department.getdId(),date);
}else {
allSalary = salaryMapper.selectAllSalaryByDepAndYear(department.getdId(),date);
}
//查找不到数据则赋值为0
if(allSalary==null){
allSalary = 0.00;
}
//填入每个部门工资总数
echSalaryPercent.setSalary(allSalary);
//填入一条数据到VO
echSalaryPercentList.add(echSalaryPercent);
}
map.put("list",echSalaryPercentList);
return map;
}
@Override
public Map<String, List<EchMonthSalary>> getMonthSalary() {
List<EchMonthSalary> echMonthSalaryList = new ArrayList<EchMonthSalary>();
Map<String,List<EchMonthSalary>> stringListMap = new HashMap<String, List<EchMonthSalary>>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
Integer year = Integer.parseInt(sdf.format(new Date())); //当前年
String date = null;
//近三年(不包括本年)
for(int i = year-2;i<=year;i++){
EchMonthSalary echMonthSalary = new EchMonthSalary();
echMonthSalary.setYear(i+"年");
List<Double> salary = new ArrayList<Double>();
for(int month = 1; month<=12;month++) {
if(month<10){
date = i + "-0"+month;
}
else {
date = i + "-"+month;
}
Double ymSalary = salaryMapper.selectAllSalaryByDate(date); //查找某年某一月的总工资
if (ymSalary == null) {
ymSalary = 0.00;
}
salary.add(ymSalary);
}
echMonthSalary.setSalary(salary);
echMonthSalaryList.add(echMonthSalary);
}
stringListMap.put("list",echMonthSalaryList);
return stringListMap;
}
}

@ -0,0 +1,49 @@
package com.esms.service.impl;
import com.esms.dao.EmployeeMapper;
import com.esms.po.Employee;
import com.esms.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* @Description
*/
@Service
public class EmployeeServiceImpl implements EmployeeService{
@Autowired
private EmployeeMapper employeeMapper;
@Override
public void deleteByPrimaryKey(int id) {
employeeMapper.deleteByPrimaryKey(id);
}
@Override
public void deleteByQuery(int[] ids) {
for (int i:ids){
Employee employee = new Employee();
employee.seteId(i);
employee.seteLeaveTime(new Date());
employee.seteIsdel(0);
employeeMapper.updateByPrimaryKeySelective(employee);
}
}
@Override
public void insert(Employee employee) {
employeeMapper.insert(employee);
}
@Override
public Employee findByeAccount(String eAccount) {
return employeeMapper.findByeAccount(eAccount);
}
@Override
public void updateByPrimaryKeySelective(Employee employee) {
employeeMapper.updateByPrimaryKeySelective(employee);
}
}

@ -0,0 +1,194 @@
package com.esms.service.impl;
import com.esms.dao.EmployeeMapper;
import com.esms.dao.MonthlyAttendanceMapper;
import com.esms.dao.SalaryMapper;
import com.esms.po.MonthlyAttendance;
import com.esms.po.Salary;
import com.esms.service.IImportDataService;
import com.esms.utils.JXLUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.List;
@Service
public class ImportDataServiceImpl implements IImportDataService {
@Autowired
private MonthlyAttendanceMapper monthlyAttendanceMapper;
@Autowired
private SalaryMapper salaryMapper;
@Autowired
private EmployeeMapper employeeMapper;
public String insertMATable(MultipartFile excel) throws Exception {
String fileName = excel.getOriginalFilename();
//限制上传文件的类型
if (fileName.endsWith(".xls")) {
String path = "D://ESMSexcel/monthly_attendance_table/";
File fileDirectory = new File(path);
if (!fileDirectory.exists())
fileDirectory.mkdirs();
File file = new File(path, fileName);
//完成上传
try {
excel.transferTo(file);
} catch (IOException e) {
e.printStackTrace();
}
List<MonthlyAttendance> monthlyAttendanceList = JXLUtils.readMonthlyAttendanceTable(file);
//校验是否存在员工工号
for (MonthlyAttendance temp : monthlyAttendanceList) {
Integer count = employeeMapper.isExistEmployee(temp.getEmployee().geteAccount());
//如果不存在此员工
if (count == 0)
return "不存在员工工号为" + temp.getEmployee().geteAccount() + "请检查导入的excel文件";
}
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
//添加数据到数据库
for (MonthlyAttendance temp : monthlyAttendanceList) {
int eId = employeeMapper.selectEidByEaccount(temp.getEmployee().geteAccount());
temp.getEmployee().seteId(eId);
MonthlyAttendance mon = new MonthlyAttendance();
mon = monthlyAttendanceMapper.selectByeIdAndDate(temp.getEmployee().geteId(),dateFormat.format(temp.getAttendanceTime()));
if(mon ==null) {
monthlyAttendanceMapper.insert(temp);
}
else{
temp.setMaId(mon.getMaId());
monthlyAttendanceMapper.updateByPrimaryKeySelective(temp);
}
}
return "导入成功";
} else {
return "只能导入Microsoft Excel 97-2003 工作表 (.xls),请检查文件是否正确";
}
}
public String insertReissueTable(MultipartFile excel) throws Exception {
String fileName = excel.getOriginalFilename();
//限制上传文件的类型
if (fileName.endsWith(".xls")) {
String path = "D://ESMSexcel/monthly_reissue_table/";
File fileDirectory = new File(path);
if (!fileDirectory.exists())
fileDirectory.mkdirs();
File file = new File(path, fileName);
//完成上传
try {
excel.transferTo(file);
} catch (IOException e) {
e.printStackTrace();
}
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
List<Salary> salaryList = JXLUtils.readReissueTable(file);
//校验是否存在此员工工号
for (Salary salary : salaryList) {
Integer count = employeeMapper.isExistEmployee(salary.getEmployee().geteAccount());
//如果不存在此员工
if (count == 0) {
return "不存在员工工号为" + salary.getEmployee().geteAccount() + "请检查导入的excel文件";
}
}
for (Salary salary : salaryList) {
int eId = employeeMapper.selectEidByEaccount(salary.getEmployee().geteAccount());
salary.getEmployee().seteId(eId);
Salary temp = salaryMapper.selectByEidAndTimeAndStatus(salary.getEmployee().geteId(), dateFormat.format(salary.getsTime()),0);
//如果数据库表salay不存在此记录直接插入
if (temp == null) {
salary.setBasePay(0.00);
salary.setFoodPay(0.00);
salary.setPostPay(0.00);
salary.setWorkingYearPay(0.00);
salary.setRankPay(0.00);
salary.setTrafficPay(0.00);
salary.setOvertimePay(0.00);
salary.setBusinessTravelPay(0.00);
salary.setFullAttendancePay(0.00);
// salary.setRissuePay(0.00); 表格有
salary.setPersionPay(0.00);
salary.setMedicalPay(0.00);
salary.setUnemploymentPay(0.00);
salary.setInjuryPay(0.00);
salary.setBirthPay(0.00);
salary.setHousingPay(0.00);
salary.setLatePay(0.00) ;
salary.setEarlyPay(0.00);
salary.setSickPay(0.00);
salary.setThingPay(0.00);
salary.setIndividualIncomeTax(0.00); // 修改个人所得税
salary.setShouldPay(0.00); // 修改应发工资
salary.setActualPay(0.00); // 修改实发工资
salary.setsState(0);
salaryMapper.insertSelective(salary);
} else {
//如果数据库表salay已存在此记录修改补发金额数据
salary.setsId(temp.getsId());
// shouldPay 应发金额 10项
double shouldPay = temp.getBasePay()
+ temp.getFoodPay()
+ temp.getPostPay()
+ temp.getWorkingYearPay()
+ temp.getRankPay()
+ temp.getTrafficPay()
+ temp.getOvertimePay()
+ temp.getBusinessTravelPay()
+ temp.getFullAttendancePay()
+ salary.getRissuePay();
// 五险一金扣费 6项
double insurances = temp.getPersionPay()
+ temp.getMedicalPay()
+ temp.getUnemploymentPay()
+ temp.getInjuryPay()
+ temp.getBirthPay()
+ temp.getHousingPay();
// 考勤扣费 4项
double attendance = temp.getLatePay()
+ temp.getEarlyPay()
+ temp.getSickPay()
+ temp.getThingPay();
double incomeTax = 0;
double taxable = shouldPay + insurances + attendance - temp.getBusinessTravelPay() - 3500; // 纳税超额部分
if (0<taxable && taxable <= 1500) {
incomeTax = taxable * 0.03;
} else if (1500 < taxable && taxable <= 4500) {
incomeTax = taxable * 0.1 - 105;
} else if (4500 < taxable && taxable <= 9000) {
incomeTax = taxable * 0.2 - 555;
} else if (9000 < taxable && taxable <= 35000) {
incomeTax = taxable * 0.25 - 1005;
} else if (35000 < taxable && taxable <= 55000) {
incomeTax = taxable * 0.3 - 2755;
} else if (55000 < taxable && taxable <= 80000) {
incomeTax = taxable * 0.35 - 5505;
} else if (80000 < taxable) {
incomeTax = taxable * 0.45 - 13505;
}
salary.setIndividualIncomeTax(-incomeTax); // 修改个人所得税
salary.setShouldPay(shouldPay); // 修改应发工资
salary.setActualPay(shouldPay + insurances + attendance - incomeTax); // 修改实发工资
salaryMapper.updateByPrimaryKeySelective(salary);
}
}
return "导入成功";
}
else
return"只能导入Microsoft Excel 97-2003 工作表 (.xls),请检查文件是否正确";
}
}

@ -0,0 +1,27 @@
package com.esms.service.impl;
import com.esms.dao.KeyValueMapper;
import com.esms.po.KeyValue;
import com.esms.service.IKeyValueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class KeyValueServiceImpl implements IKeyValueService {
@Autowired
private KeyValueMapper keyValueMapper = null;
public KeyValue getKeyValueById(int id) throws Exception{
return keyValueMapper.selectByPrimaryKey(id);
}
@Override
public KeyValue selectBykvKey(String key) throws Exception {
return keyValueMapper.selectBykvKey(key);
}
@Override
public int updateByPrimaryKey(KeyValue kv) throws Exception {
return keyValueMapper.updateByPrimaryKey(kv);
}
}

@ -0,0 +1,61 @@
package com.esms.service.impl;
import com.esms.dao.EmployeeMapper;
import com.esms.dao.SystemManagerMapper;
import com.esms.exception.CustomException;
import com.esms.po.Employee;
import com.esms.po.SystemManager;
import com.esms.service.ILoginService;
import com.esms.utils.MD5Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Description
*/
@Service
public class LoginServiceImpl implements ILoginService {
@Autowired
private EmployeeMapper employeeMapper = null;
@Autowired
private SystemManagerMapper systemManagerMapper = null;
public Employee findEmployeeByIdAndPassword(String account, String password) throws CustomException {
String encode = MD5Utils.encodeByMD5(password);
// System.out.println(encode);
Employee employee = new Employee();
employee.seteAccount(account);
employee.setePassword(encode);
// employee.setePassword(password);
employee.seteIsdel(1);
Employee employee1 = employeeMapper.selectByAccountAndPassword(employee);
if(employee1 == null){
throw new CustomException("工号或密码错误");
}
return employee1;
}
@Override
public SystemManager findSystemManagerByIdAndPassword(String account, String password) throws CustomException {
String encode = MD5Utils.encodeByMD5(password);
SystemManager systemManager = new SystemManager();
systemManager.setSmAccount(account);
systemManager.setSmPassword(encode);
// systemManager.setSmPassword(password);
SystemManager systemManager1 = systemManagerMapper.selectByAccountAndPassword(systemManager);
if(systemManager1 == null){
throw new CustomException("管理员账号或密码错误");
}
return systemManager1;
}
@Override
public Employee findEmployeeById(int id) {
return employeeMapper.selectByPrimaryKey(id);
}
@Override
public SystemManager findSystemManagerById(int id) {
return systemManagerMapper.selectByPrimaryKey(id);
}
}

@ -0,0 +1,41 @@
package com.esms.service.impl;
import com.esms.dao.MonthlyAttendanceMapper;
import com.esms.po.MonthlyAttendance;
import com.esms.service.IMonthlyAttendanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description
*/
@Service
public class MonthlyAttendanceServiceImpl implements IMonthlyAttendanceService {
@Autowired
private MonthlyAttendanceMapper monthlyAttendanceMapper;
public MonthlyAttendance t(int id) {
return monthlyAttendanceMapper.selectByPrimaryKey(id);
}
@Override
public void deleteByPrimaryKey(int id) {
monthlyAttendanceMapper.deleteByPrimaryKey(id);
}
@Override
public void deleteByQuery(int[] ids) {
monthlyAttendanceMapper.deleteByQuery(ids);
}
@Override
public MonthlyAttendance selectByPrimaryKey(int id) {
return monthlyAttendanceMapper.selectByPrimaryKey(id);
}
@Override
public void updateByPrimaryKeySelective(MonthlyAttendance monthlyAttendance) {
monthlyAttendanceMapper.updateByPrimaryKeySelective(monthlyAttendance);
}
}

@ -0,0 +1,55 @@
package com.esms.service.impl;
import com.esms.dao.PositionMapper;
import com.esms.po.Position;
import com.esms.service.PositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description
*/
@Service
public class PositionServiceImpl implements PositionService{
@Autowired
public PositionMapper positionMapper = null;
@Override
public List<Position> findSelective(Position position) {
return positionMapper.findSelective(position);
}
@Override
public int insertSelective(Position position) {
return positionMapper.insertSelective(position);
}
@Override
public Position findByPrimaryKey(int id) {
return positionMapper.selectByPrimaryKey(id);
}
@Override
public void updateByPrimaryKeySelective(Position position) {
positionMapper.updateByPrimaryKeySelective(position);
}
@Override
public void deleteByPrimaryKey(int id) {
positionMapper.deleteByPrimaryKey(id);
}
@Override
public void deleteByQuery(int[] ids) {
positionMapper.deleteByQuery(ids);
}
@Override
public Position findByDname(String p_name) {
return positionMapper.findByDname(p_name);
}
}

@ -0,0 +1,109 @@
package com.esms.service.impl;
import com.esms.dao.EmployeeMapper;
import com.esms.dao.RankBonusMapper;
import com.esms.dao.WorkingYearsBonusMapper;
import com.esms.po.RankBonus;
import com.esms.service.IRankBonusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description
*/
@Service("rankBonusService")
public class RankBonusServiceImpl implements IRankBonusService {
@Autowired
private RankBonusMapper rankBonusMapper;
@Autowired
private EmployeeMapper employeeMapper;
public void setRankBonusMapper(RankBonusMapper rankBonusMapper) {
this.rankBonusMapper = rankBonusMapper;
}
@Override
public boolean moveRankBonus(int rbId) {
int n=rankBonusMapper.deleteByPrimaryKey(rbId);
if(n>0){
return true;
}
else{
return false;
}
}
//修改职称名
@Override
public boolean modifyRankName(RankBonus rb) {
int n=rankBonusMapper.updateByPrimaryKey(rb);
if(n>0)
return true;
else
return false;
}
@Override
public List<RankBonus> findAll() {
List<RankBonus> rb = rankBonusMapper.selectAll();
if(rb.size()>0){
return rb;
}
else{
return null;
}
}
@Override
public RankBonus findById(int rbId) {
return null;
}
@Override
public RankBonus findByName(String rankName) {
return rankBonusMapper.findByname(rankName);
}
//插入新的职称
@Override
public boolean addRankBonus(RankBonus rb) {
int count = rankBonusMapper.insert(rb);
if (count > 0) {
return true;
}
return false;
}
@Override
public int CountByRbid(Integer rbid) {
int n=employeeMapper.countByRbid(rbid);
if(n>0) return n;
else return 0;
}
// public int CountByRbid(int rbId){
// int count =employeeMapper.countByRbid(rbId);
// if(count>0){ return count; }
// else{ return 0; }
// }
@Override
public int CountByName(String name) {
int count=rankBonusMapper.CountByRankName(name);
if(count>0) return count;
else return 0;
}
@Override
public List<RankBonus> findSelective(RankBonus rb) {
return rankBonusMapper.findSelective(rb);
}
}

@ -0,0 +1,344 @@
package com.esms.service.impl;
import com.esms.dao.*;
import com.esms.exception.CustomException;
import com.esms.po.Employee;
import com.esms.po.MonthlyAttendance;
import com.esms.po.Salary;
import com.esms.service.ISalaryService;
import com.esms.vo.SalaryPages;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
*/
@Service
public class SalaryServiceImpl implements ISalaryService {
@Autowired
private SalaryMapper salaryMapper = null;
@Autowired
private MonthlyAttendanceMapper monthlyAttendanceMapper = null;
@Autowired
private EmployeeMapper employeeMapper = null;
@Autowired
private RankBonusMapper rankBonusMapper = null;
@Autowired
private PositionMapper positionMapper = null;
@Autowired
private WorkingYearsBonusMapper workingYearsBonusMapper = null;
@Autowired
private KeyValueMapper keyValueMapper = null;
@Autowired
private DepartmentMapper departmentMapper = null;
public void insertSalaryByAcountAndDate(String eAccount, String date) throws CustomException {
Employee employee = null;
employee = employeeMapper.selectByAccount(eAccount);
if (employee == null) {
throw new CustomException("此工号不存在");
} else {
if (salaryMapper.selectByEidAndTimeAndStatus(employee.geteId(), date, 1) != null) {
throw new CustomException("本工号的此月工资已发放,不能在结算");
} else {
insertSalay(employee, date);
}
}
}
@Override
public void insertSalaryAllByDate(String date) throws CustomException {
List<Salary> salaryList = salaryMapper.selectByeTimeAndStatus(date, 1);
if (salaryList.size() >= 1) {
throw new CustomException("此月工资已发放,不能在进行工资结算");
} else {
List<Employee> employeeList = null;
employeeList = employeeMapper.selectAll();
for (Employee employee : employeeList) {
insertSalay(employee, date);
}
}
}
/**
* @Author: admin
* @Description:
* @Date: 1:00 2020/02/12
* @Param: [employee, date]
* @Return: int
**/
private void insertSalay(Employee employee, String date) {
// 按照年月和工号查出这个员工的考勤记录,
// 1.考勤存在就计算考勤
// 2.考勤不存在即为0
MonthlyAttendance monthlyAttendance = monthlyAttendanceMapper.selectByeIdAndDate(employee.geteId(), date);
// 判断数据库是否存在
Salary salarySelect = salaryMapper.selectByEidAndTimeAndStatus(employee.geteId(), date, 0);
Salary salary = new Salary();
DateFormat format1 = new SimpleDateFormat("yyyy-MM");
Date dateNew = null;
// 4
// salary.seteId(employee.geteId()); // 员工号
salary.setEmployee(employee);
// salary.setdId(employee.getdId()); // 部门号
salary.setDepartment(departmentMapper.selectByPrimaryKey(employee.getdId()));
try {
dateNew = format1.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
salary.setsTime(dateNew); // 工资日期
Double basePay = employee.geteBasePay();
salary.setBasePay(basePay); // 基本工资
// 7
if (monthlyAttendance != null) {
// 计算考勤
double late_buckle_pay = keyValueMapper.selectBykvKey("late_buckle_pay").getKvValue(); // 迟到
double early_buckle_pay = keyValueMapper.selectBykvKey("early_buckle_pay").getKvValue(); // 早退
double missionallowance = keyValueMapper.selectBykvKey("missionallowance").getKvValue(); //出差不补贴
double full_attendance_pay = keyValueMapper.selectBykvKey("full_attendance_pay").getKvValue(); // 全勤奖
salary.setLatePay(monthlyAttendance.getLateNum() * late_buckle_pay); // 迟到罚金
salary.setEarlyPay(monthlyAttendance.getEarlyNum() * early_buckle_pay); // 早退罚金
double x = basePay / 21.75 / 8;
double overTimePay = x * monthlyAttendance.getOvertimeHour() * 1.5
+ x * monthlyAttendance.getWeekendHour() * 2
+ x * monthlyAttendance.getHolidayHour() * 3;
salary.setOvertimePay(overTimePay); // 加班补贴
if (monthlyAttendance.getSickLeaveNum() > 3) { // 大于3天扣钱
salary.setSickPay((monthlyAttendance.getSickLeaveNum() - 3) * (-30.00)); // 病假扣钱
} else {
salary.setSickPay(0.00);
}
if (monthlyAttendance.getSickLeaveNum() > 2) { // 大于3天扣钱
salary.setThingPay((monthlyAttendance.getCompassionateLeaveNum() - 2) * (-50.00)); // 事假扣钱
} else {
salary.setThingPay(0.00);
}
salary.setBusinessTravelPay(monthlyAttendance.getCompassionateLeaveNum() * missionallowance); // 出差补贴
if (monthlyAttendance.getAbsenceNum() < 1){
salary.setFullAttendancePay(full_attendance_pay); // 全勤奖励
}else {
salary.setFullAttendancePay(0.00); // 全勤奖励
}
} else {
// 不用计算考勤
salary.setLatePay(0.00); // 迟到罚金
salary.setEarlyPay(0.00); // 早退罚金
salary.setOvertimePay(0.00); // 加班补贴
salary.setSickPay(0.00); // 病假扣钱
salary.setThingPay(0.00); // 事假扣钱
salary.setBusinessTravelPay(0.00); // 出差补贴
salary.setFullAttendancePay(0.00); // 全勤奖励
}
// 16
double food_pay = keyValueMapper.selectBykvKey("food_pay").getKvValue(); // 餐饮补贴
double traffic_pay = keyValueMapper.selectBykvKey("traffic_pay").getKvValue(); // 交通补贴
salary.setFoodPay(food_pay); // 餐饮补贴
salary.setTrafficPay(traffic_pay); // 交通补贴
salary.setPostPay(positionMapper.selectByPrimaryKey(employee.getpId()).getpPostPay()); // 岗位补贴
salary.setRankPay((double) (rankBonusMapper.selectByPrimaryKey(employee.geteRank()).getRbBonus())); // 职称补贴
long datesum = (dateNew.getTime() - employee.geteEntryTime().getTime());
int years = (int) (datesum / 31536000 / 1000);
try {
salary.setWorkingYearPay(workingYearsBonusMapper.findByYear(years).getWybBonus()); // 工龄补贴
}catch (Exception e){
salary.setWorkingYearPay(0.00);
}
salary.setPersionPay(-(basePay * 0.08)); // 养老保险
salary.setMedicalPay(-(basePay * 0.02 + 10)); // 医疗保险
salary.setUnemploymentPay(-(basePay * 0.01)); // 失业保险
salary.setInjuryPay(0.00); // 工伤保险
salary.setBirthPay(0.00); // 生育保险
salary.setHousingPay(-(basePay * 0.08)); // 住房公积金
if (salarySelect != null){
salary.setRissuePay(salarySelect.getRissuePay()); //补发金额
}else {
salary.setRissuePay(0.00); //补发金额
}
// shouldPay 应发金额 10项
double shouldPay = salary.getBasePay()
+ salary.getFoodPay()
+ salary.getPostPay()
+ salary.getWorkingYearPay()
+ salary.getRankPay()
+ salary.getTrafficPay()
+ salary.getOvertimePay()
+ salary.getBusinessTravelPay()
+ salary.getFullAttendancePay()
+ salary.getRissuePay();
// 五险一金扣费 6项
double insurances = salary.getPersionPay()
+ salary.getMedicalPay()
+ salary.getUnemploymentPay()
+ salary.getInjuryPay()
+ salary.getBirthPay()
+ salary.getHousingPay();
// 考勤扣费 4项
double attendance = salary.getLatePay()
+ salary.getEarlyPay()
+ salary.getSickPay()
+ salary.getThingPay();
double incomeTax = 0;
double taxable = shouldPay + insurances + attendance - salary.getBusinessTravelPay() - 3500; // 纳税超额部分
if (0<taxable && taxable <= 1500) {
incomeTax = taxable * 0.03;
} else if (1500 < taxable && taxable <= 4500) {
incomeTax = taxable * 0.1 - 105;
} else if (4500 < taxable && taxable <= 9000) {
incomeTax = taxable * 0.2 - 555;
} else if (9000 < taxable && taxable <= 35000) {
incomeTax = taxable * 0.25 - 1005;
} else if (35000 < taxable && taxable <= 55000) {
incomeTax = taxable * 0.3 - 2755;
} else if (55000 < taxable && taxable <= 80000) {
incomeTax = taxable * 0.35 - 5505;
} else if (80000 < taxable) {
incomeTax = taxable * 0.45 - 13505;
}
salary.setIndividualIncomeTax(-incomeTax); //个人所得税
salary.setShouldPay(shouldPay); // 应发工资
salary.setActualPay(shouldPay + insurances + attendance - incomeTax); // 实发工资
salary.setsState(0); // 工资转态未发
// System.out.println(salary.toString());
if (salarySelect != null) {
salary.setsId(salarySelect.getsId());
salaryMapper.updateByPrimaryKeySelective(salary);
} else {
salaryMapper.insertSelective(salary);
}
}
@Override
public SalaryPages selectSalaryByEaccountDIdDate(Integer pageNum, Integer limit, String eAccount, Integer dId, String sTime) {
/**
* @Author:
* @Description:
* @Date: 12:38 2020/02/11
* @Param: [pageNum, limit, eAccount, dId, sTime]
* @Return: com.esms.vo.SalaryPages
**/
Map<String, Object> map = new HashMap<String, Object>();
map.put("eAccount", eAccount);
map.put("dId", dId);
map.put("sTime", sTime);
//pageNum:起始页面 pageSize:每页的大小
PageHelper.startPage(pageNum, limit);
//查找条件一定要紧跟在startPage后
List<Salary> salaries = salaryMapper.selectByEaccountDIdDate(map); //获取满足条件的数据
PageInfo pageResult = new PageInfo(salaries);
//返回layui表格要求的格式数据
return new SalaryPages(0, "", (int) pageResult.getTotal(), pageResult.getList());
}
@Override
public void deleteSalaryByEid(int[] ids) {
for (int i : ids) {
salaryMapper.deleteByPrimaryKey(i);
}
}
@Override
public void updateSalaryBySid(int[] ids) {
Salary salary = new Salary();
for (int i : ids) {
salary.setsId(i);
salary.setsState(1);
salaryMapper.updateByPrimaryKeySelective(salary);
}
}
@Override
public SalaryPages selectSalaryByEaccountDIdDateState(int pageNum, int limit, String eAccount, Integer dId, String sTime) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("eAccount", eAccount);
map.put("dId", dId);
map.put("sTime", sTime);
//pageNum:起始页面 pageSize:每页的大小
PageHelper.startPage(pageNum, limit);
//查找条件一定要紧跟在startPage后
List<Salary> salaries = salaryMapper.selectByEaccountDIdDateState(map); //获取满足条件的数据
PageInfo pageResult = new PageInfo(salaries);
//返回layui表格要求的格式数据
return new SalaryPages(0, "", (int) pageResult.getTotal(), pageResult.getList());
}
@Override
public void updateSalaryByEidAndRissuePay(int sId, double rissuePay) {
Salary salary = salaryMapper.selectByPrimaryKey(sId);
salary.setRissuePay(rissuePay);
// shouldPay 应发金额 10项
double shouldPay = salary.getBasePay()
+ salary.getFoodPay()
+ salary.getPostPay()
+ salary.getWorkingYearPay()
+ salary.getRankPay()
+ salary.getTrafficPay()
+ salary.getOvertimePay()
+ salary.getBusinessTravelPay()
+ salary.getFullAttendancePay()
+ salary.getRissuePay();
// 五险一金扣费 6项
double insurances = salary.getPersionPay()
+ salary.getMedicalPay()
+ salary.getUnemploymentPay()
+ salary.getInjuryPay()
+ salary.getBirthPay()
+ salary.getHousingPay();
// 考勤扣费 4项
double attendance = salary.getLatePay()
+ salary.getEarlyPay()
+ salary.getSickPay()
+ salary.getThingPay();
double incomeTax = 0;
double taxable = shouldPay + insurances + attendance - salary.getBusinessTravelPay() - 3500; // 纳税超额部分
if (0<taxable && taxable <= 1500) {
incomeTax = taxable * 0.03;
} else if (1500 < taxable && taxable <= 4500) {
incomeTax = taxable * 0.1 - 105;
} else if (4500 < taxable && taxable <= 9000) {
incomeTax = taxable * 0.2 - 555;
} else if (9000 < taxable && taxable <= 35000) {
incomeTax = taxable * 0.25 - 1005;
} else if (35000 < taxable && taxable <= 55000) {
incomeTax = taxable * 0.3 - 2755;
} else if (55000 < taxable && taxable <= 80000) {
incomeTax = taxable * 0.35 - 5505;
} else if (80000 < taxable) {
incomeTax = taxable * 0.45 - 13505;
}
salary.setIndividualIncomeTax(-incomeTax); // 修改个人所得税
salary.setShouldPay(shouldPay); // 修改应发工资
salary.setActualPay(shouldPay + insurances + attendance - incomeTax); // 修改实发工资
salaryMapper.updateByPrimaryKeySelective(salary);
}
}

@ -0,0 +1,84 @@
package com.esms.service.impl;
import com.esms.dao.*;
import com.esms.exception.CustomException;
import com.esms.po.*;
import com.esms.service.IUserInforService;
import com.esms.utils.MD5Utils;
import com.esms.vo.EmployeeCustomVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description
*/
@Service
public class UserInforServiceImpl implements IUserInforService {
@Autowired
private SystemManagerMapper systemManagerMapper = null;
@Autowired
private EmployeeMapper employeeMapper = null;
@Autowired
private RankBonusMapper rankBonusMapper = null;
@Autowired
private PositionMapper positionMapper = null;
@Autowired
private DepartmentMapper departmentMapper = null;
@Autowired
private EmployeeCustomVoMapper employeeCustomVoMapper = null;
@Autowired
private SalaryMapper salaryMapper = null;
@Override
public void updateSystemManagePassword(int id, SystemManager systemManager) {
systemManagerMapper.updateByPrimaryKey(systemManager);
}
@Override
public void updateEmployeePassword(int id, String oldPassword, String newPassword) throws CustomException {
Employee employee = employeeMapper.selectByPrimaryKey(id);
String encodeOld = MD5Utils.encodeByMD5(oldPassword);
if (encodeOld.equals(employee.getePassword())) {
String encodeNew = MD5Utils.encodeByMD5(newPassword);
employee.setePassword(encodeNew);
employeeMapper.updateByPrimaryKeySelective(employee);
} else {
throw new CustomException("原密码错误");
}
}
@Override
public EmployeeCustomVo getInforEmployee(int id) {
// EmployeeCustomVo employeeCustomVo = new EmployeeCustomVo();
// Employee employee = employeeMapper.selectByPrimaryKey(id);
// Department department = departmentMapper.selectByPrimaryKey(employee.getdId());
// Position position = positionMapper.selectByPrimaryKey(employee.getpId());
// RankBonus rankBonus = rankBonusMapper.selectByPrimaryKey(employee.geteRank());
// employeeCustomVo.setEmployee(employee);
// employeeCustomVo.setDepartment(department);
// employeeCustomVo.setPosition(position);
// employeeCustomVo.setRankBonus(rankBonus);
return employeeCustomVoMapper.selectEmployeeById(id);
}
@Override
public int updateEmploueeById(int id, Employee employee) {
int i = employeeMapper.updateByPrimaryKeySelective(employee);
if (i == 1) {
return 1;
} else {
return 0;
}
}
@Override
public List<Salary> getEmployeeSalaryList(int eId, String year) {
if ("1".equals(year)){
return salaryMapper.selectByeId(eId);
}else {
return salaryMapper.selectEmployeeSalaryList(eId,year);
}
}
}

@ -0,0 +1,78 @@
package com.esms.service.impl;
import com.esms.dao.WorkingYearsBonusMapper;
import com.esms.po.WorkingYearsBonus;
import com.esms.service.IWorkYearService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description
*/
@Service
public class WorkYearServiceImpl implements IWorkYearService {
@Autowired
private WorkingYearsBonusMapper workingYearsBonusMapper;
@Override
public boolean addWorkYearBonus(WorkingYearsBonus wyb) {
int count = workingYearsBonusMapper.insert(wyb);
if (count > 0) {
return true;
}
return false;
}
@Override
public boolean moveWorkYearBonus(int wybId) {
int n=workingYearsBonusMapper.deleteByPrimaryKey(wybId);
if(n>0){
return true;
}
else{
return false;
}
}
@Override
public boolean modifyWorkYearBonus(WorkingYearsBonus wyb) {
int n=workingYearsBonusMapper.updateByPrimaryKey(wyb); //n代表影响的行数
if(n>0)
return true;
else
return false;
}
@Override
public List<WorkingYearsBonus> findAll() {
List<WorkingYearsBonus> wyb = workingYearsBonusMapper.selectAll();
if(wyb.size()>0){
return wyb;
}
else{
return null;
}
}
@Override
public WorkingYearsBonus findById(int wybId) {
return null;
}
@Override
public int Count(int wybYear) {
int n=workingYearsBonusMapper.countByYear(wybYear);
if(n>0) return n;
else return 0;
}
@Override
public List<WorkingYearsBonus> findSelective(WorkingYearsBonus record) {
return workingYearsBonusMapper.findSelective(record);
}
@Override
public WorkingYearsBonus findByYear(int year) {
return workingYearsBonusMapper.findByYear(year);
}
}

@ -0,0 +1,92 @@
package com.esms.utils;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;
public final class CaptchaUtil
{
private CaptchaUtil(){}
/*
*
*/
private static final char[] CHARS = { '2', '3', '4', '5', '6', '7', '8',
'9' };
/*
*
*/
private static Random random = new Random();
/*
* 4
*/
private static String getRandomString()
{
StringBuffer buffer = new StringBuffer();
for(int i = 0; i < 4; i++)
{
buffer.append(CHARS[random.nextInt(CHARS.length)]);
}
return buffer.toString();
}
/*
*
*/
private static Color getRandomColor()
{
return new Color(random.nextInt(255),random.nextInt(255),
random.nextInt(255));
}
/*
*
*/
private static Color getReverseColor(Color c)
{
return new Color(255 - c.getRed(), 255 - c.getGreen(),255 - c.getBlue());
}
public static void outputCaptcha(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("image/jpeg");
// 获取验证码字符串
String identifyingCode = getRandomString();
request.getSession(true).setAttribute("identifyingCode", identifyingCode);
int width = 100;
int height = 30;
Color color = getRandomColor();
Color reverse = getReverseColor(color);
BufferedImage bi = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
Graphics2D g = bi.createGraphics();
g.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 16));
g.setColor(color);
g.fillRect(0, 0, width, height);
g.setColor(reverse);
g.drawString(identifyingCode, 18, 20);
for (int i = 0, n = random.nextInt(100); i < n; i++)
{
g.drawRect(random.nextInt(width), random.nextInt(height), 1, 1);
}
// 转成JPEG格式
ServletOutputStream out = response.getOutputStream();
// JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
// encoder.encode(bi);
ImageIO.write(bi, "jpeg", out);
out.flush();
}
}

@ -0,0 +1,319 @@
package com.esms.utils;
import com.esms.po.Employee;
import com.esms.po.MonthlyAttendance;
import com.esms.po.Salary;
import jxl.*;
import jxl.format.CellFormat;
import jxl.read.biff.BiffException;
import jxl.write.*;
import jxl.write.Boolean;
import jxl.write.Number;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
public class JXLUtils {
public static List<MonthlyAttendance> readMonthlyAttendanceTable(File file) throws Exception{
/* 1:创建workbook */
Workbook workbook = null;
try {
workbook = Workbook.getWorkbook(file);
} catch (IOException e) {
e.printStackTrace();
} catch (BiffException e) {
e.printStackTrace();
}
//2:获取第一个工作表sheet
Sheet sheet = workbook.getSheet(0);
//3:获取数据
/*System.out.println("行:" + sheet.getRows());
System.out.println("列:" + sheet.getColumns());*/
List<MonthlyAttendance> monthlyAttendanceList = new ArrayList<MonthlyAttendance>();
for (int i = 1; i < sheet.getRows(); i++) {
MonthlyAttendance monthlyAttendance = new MonthlyAttendance();
for (int j = 1; j < sheet.getColumns(); j++) {
Cell cell = sheet.getCell(j, i);
//System.out.print(cell.getContents() + " ");
switch (j) {
case 1:
Employee employee = new Employee();
employee.seteAccount(cell.getContents());
monthlyAttendance.setEmployee(employee);
break;
case 2:
monthlyAttendance.setSickLeaveNum(Integer.parseInt(cell.getContents()));
break;
case 3:
monthlyAttendance.setOvertimeHour(Double.parseDouble(cell.getContents()));
break;
case 4:
monthlyAttendance.setWeekendHour(Double.parseDouble(cell.getContents()));
break;
case 5:
monthlyAttendance.setHolidayHour(Double.parseDouble(cell.getContents()));
break;
case 6:
try {
monthlyAttendance.setLateNum(Integer.parseInt(cell.getContents().replace(" ", "")));
} catch (Exception e) {
e.printStackTrace();
monthlyAttendance.setLateNum(0);
}
break;
case 7:
try {
monthlyAttendance.setEarlyNum(Integer.parseInt(cell.getContents().replace(" ", "")));
} catch (Exception e) {
e.printStackTrace();
monthlyAttendance.setEarlyNum(0);
}
break;
case 8:
try {
monthlyAttendance.setAbsenceNum(Integer.parseInt(cell.getContents().replace(" ", "")));
} catch (Exception e) {
e.printStackTrace();
monthlyAttendance.setAbsenceNum(0);
}
break;
case 9:
try {
monthlyAttendance.setCompassionateLeaveNum(Integer.parseInt(cell.getContents().replace(" ", "")));
} catch (Exception e) {
e.printStackTrace();
monthlyAttendance.setCompassionateLeaveNum(0);
}
break;
case 10:
try {
monthlyAttendance.setBusinessTravelNum(Integer.parseInt(cell.getContents().replace(" ", "")));
} catch (Exception e) {
e.printStackTrace();
monthlyAttendance.setBusinessTravelNum(0);
}
break;
case 11:
DateCell dc = (DateCell) cell;
Date date = dc.getDate(); //获取单元格的date类型
monthlyAttendance.setAttendanceTime(date);
break;
}
}
//System.out.println(monthlyAttendance);
monthlyAttendanceList.add(monthlyAttendance);
}
//最后一步:关闭资源
workbook.close();
return monthlyAttendanceList;
}
public static List<Salary> readReissueTable(File file) {
/* 1:创建workbook */
Workbook workbook = null;
try {
workbook = Workbook.getWorkbook(file);
} catch (IOException e) {
e.printStackTrace();
} catch (BiffException e) {
e.printStackTrace();
}
//2:获取第一个工作表sheet
Sheet sheet = workbook.getSheet(0);
//3:获取数据
System.out.println("行:" + sheet.getRows());
System.out.println("列:" + sheet.getColumns());
List<Salary> salaryList = new ArrayList<Salary>();
for (int i = 1; i < sheet.getRows(); i++) {
Salary salary = new Salary();
for (int j = 1; j < sheet.getColumns(); j++) {
Cell cell = sheet.getCell(j, i);
System.out.print(cell.getContents() + " ");
switch (j) {
case 1:
Employee employee = new Employee();
employee.seteAccount(cell.getContents());
salary.setEmployee(employee);
break;
case 2:
salary.setRissuePay(Double.parseDouble(cell.getContents()));
break;
case 3:
DateCell dc = (DateCell) cell;
Date date = dc.getDate(); //获取单元格的date类型
salary.setsTime(date);
break;
}
}
System.out.println(salary);
salaryList.add(salary);
}
//最后一步:关闭资源
workbook.close();
return salaryList;
}
//创建excel工资表格
public static WritableWorkbook createSalaryExcel(OutputStream output,List<Salary> salaries) throws IOException, WriteException {
WritableWorkbook writableWorkbook= Workbook.createWorkbook(output);
WritableSheet sheet = writableWorkbook.createSheet("工资表", 0);
CellFormat cf = writableWorkbook.getSheet(0).getCell(1, 0).getCellFormat();
WritableCellFormat wc = new WritableCellFormat();
// 设置水平居中
wc.setAlignment(Alignment.CENTRE);
//设置垂直居中
wc.setVerticalAlignment(VerticalAlignment.CENTRE);
// 设置边框线
wc.setBorder(Border.ALL, BorderLineStyle.THIN);
wc.setBackground(jxl.format.Colour.WHITE);
//合并单元格,第一个参数:要合并的单元格最左上角的列号,第二个参数:要合并的单元格最左上角的行号,
//第三个参数:要合并的单元格最右角的列号,第四个参数:要合并的单元格最右下角的行号,
//前4个
for(int i = 0;i< 5;i++){
sheet.mergeCells(i, 0, i, 1);
}
sheet.mergeCells(5, 0, 8, 0); //合并补贴单元格
sheet.mergeCells(9, 0, 12, 0); //合并奖金单元格
sheet.mergeCells(13, 0, 18, 0); //合并五险一金单元格
sheet.mergeCells(19, 0, 23, 0); //合并工资扣额单元格
/*// 后4个
for(int i = 23,j = 0;i< 25;i++,j++ ){
sheet.mergeCells(i, 0, j, 1);
}*/
//sheet.mergeCells(23, 0, 23, 1); //合并工资扣额单元格
//sheet.mergeCells(1, 0, 1, 1);
/*Label nc0 = new Label(0, 0, "标题1",wc);//Label(x,y,z)其中x代表单元格的第x+1列第y+1行, 单元格的内容是z
Label nc1 = new Label(1, 0, "标题2",wc);
Label nc2 = new Label(2, 0, "标题3",wc);
Label nc3 = new Label(0, 1, "dddd");
Label nc4 = new Label(1, 1, "ffff");
wsheet.addCell(nc0);
wsheet.addCell(nc1);
wsheet.addCell(nc2);
wsheet.addCell(nc3);
wsheet.addCell(nc4);*/
//创建要显示的具体内容
Label eAccount = new Label(0,0,"员工工号",wc);
sheet.addCell(eAccount);
Label eName = new Label(1,0,"员工姓名",wc);
sheet.addCell(eName);
Label department = new Label(2,0,"所属部门",wc);
sheet.addCell(department);
Label date = new Label(3,0,"日期",wc);
sheet.addCell(date);
Label basePay = new Label(4,0,"基本工资",wc);
sheet.addCell(basePay);
Label subsidy = new Label(5,0,"补贴",wc);
sheet.addCell(subsidy);
Label foodPay = new Label(5,1,"餐饮补贴",wc);
sheet.addCell(foodPay);
Label postPay = new Label(6,1,"岗位补贴",wc);
sheet.addCell(postPay);
Label trafficPay = new Label(7,1,"交通补贴",wc);
sheet.addCell(trafficPay);
Label businessTravePay = new Label(8,1,"出差补贴",wc);
sheet.addCell(businessTravePay);
Label bonus = new Label(9,0,"奖金",wc);
sheet.addCell(bonus);
Label wokingYearsPay = new Label(9,1,"工龄奖金",wc);
sheet.addCell(wokingYearsPay);
Label rankPay = new Label(10,1,"职称奖金",wc);
sheet.addCell(rankPay);
Label overtimePay = new Label(11,1,"加班奖金",wc);
sheet.addCell(overtimePay);
Label fullAttendancePay = new Label(12,1,"全勤奖金",wc);
sheet.addCell(fullAttendancePay);
Label risks = new Label(13,0,"五险一金",wc);
sheet.addCell( risks);
Label persionPay = new Label(13,1,"养老保险",wc);
sheet.addCell(persionPay);
Label medicalPay = new Label(14,1,"医疗保险",wc);
sheet.addCell(medicalPay);
Label unemploymentPay = new Label(15,1,"失业保险",wc);
sheet.addCell(unemploymentPay);
Label injuryPay = new Label(16,1,"工伤保险",wc);
sheet.addCell(injuryPay);
Label birthPay = new Label(17,1,"生育保险",wc);
sheet.addCell(birthPay);
Label housingPay = new Label(18,1,"住房公积金",wc);
sheet.addCell(housingPay);
Label deduction = new Label(19,0,"工资扣额",wc);
sheet.addCell(deduction);
Label latePay = new Label(19,1,"迟到扣额",wc);
sheet.addCell(latePay);
Label earlyPay = new Label(20,1,"早退扣额",wc);
sheet.addCell(earlyPay);
Label sickPay = new Label(21,1,"病假扣额",wc);
sheet.addCell(sickPay);
Label thingPay = new Label(22,1,"事假扣额",wc);
sheet.addCell(thingPay);
Label individualIncomeTax = new Label(23,1,"个人所得税",wc);
sheet.addCell(individualIncomeTax);
Label rissuePay = new Label(24,0,"补发工资",wc);
sheet.addCell(rissuePay);
sheet.mergeCells(24, 0, 24, 1); //合并上下单元格
Label shouldPay = new Label(25,0,"应发工资",wc);
sheet.addCell(shouldPay);
sheet.mergeCells(25, 0, 25, 1); //合并上下单元格
Label actualPay = new Label(26,0,"实发工资",wc);
sheet.addCell(actualPay);
sheet.mergeCells(26, 0, 26, 1); //合并上下单元格
Label sState = new Label(27,0,"状态",wc);
sheet.mergeCells(27, 0, 27, 1); //合并上下单元格
sheet.addCell(sState);
WritableCellFormat cf1 = new WritableCellFormat(DateFormats.FORMAT1);
int row = 1;
for (Salary salary:salaries){
row++;
sheet.addCell(new Label(0,row,salary.getEmployee().geteAccount()));
sheet.addCell(new Label(1,row,salary.getEmployee().geteName()));
sheet.addCell(new Label(2,row,salary.getDepartment().getdName()));
sheet.addCell(new DateTime(3,row,salary.getsTime(),cf1));
sheet.addCell(new Number(4,row,salary.getBasePay()));
sheet.addCell(new Number(5,row,salary.getFoodPay()));
sheet.addCell(new Number(6,row,salary.getPostPay()));
sheet.addCell(new Number(7,row,salary.getTrafficPay()));
sheet.addCell(new Number(8,row,salary.getBusinessTravelPay()));
sheet.addCell(new Number(9,row,salary.getWorkingYearPay()));
sheet.addCell(new Number(10,row,salary.getRankPay()));
sheet.addCell(new Number(11,row,salary.getOvertimePay()));
sheet.addCell(new Number(12,row,salary.getFullAttendancePay()));
sheet.addCell(new Number(13,row,salary.getPersionPay()));
sheet.addCell(new Number(14,row,salary.getMedicalPay()));
sheet.addCell(new Number(15,row,salary.getUnemploymentPay()));
sheet.addCell(new Number(16,row,salary.getInjuryPay()));
sheet.addCell(new Number(17,row,salary.getBirthPay()));
sheet.addCell(new Number(18,row,salary.getHousingPay()));
sheet.addCell(new Number(19,row,salary.getLatePay()));
sheet.addCell(new Number(20,row,salary.getEarlyPay()));
sheet.addCell(new Number(21,row,salary.getSickPay()));
sheet.addCell(new Number(22,row,salary.getThingPay()));
sheet.addCell(new Number(23,row,salary.getIndividualIncomeTax()));
sheet.addCell(new Number(24,row,salary.getRissuePay()));
sheet.addCell(new Number(25,row,salary.getShouldPay()));
sheet.addCell(new Number(26,row,salary.getActualPay()));
if(salary.getsState()==0) {
sheet.addCell(new Label(27, row, "未发"));
}
else{
sheet.addCell(new Label(27,row,"已发"));
}
}
//output.close();
return writableWorkbook;
}
}

@ -0,0 +1,67 @@
package com.esms.utils;
import java.security.MessageDigest;
public class MD5Utils {
/** 十六进制下数字到字符的映射数组 */
private final static String[] hexDigits = { "0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
/**
* MD5
* @param originString
* @return
*/
public static String encodeByMD5(String originString) {
if (originString != null){
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(originString);
//BookSharingPlatform MD5加密后的32位数字作为秘钥
stringBuffer.append("esms");
//加入秘钥后的字符串在进行MD5加密
originString = String.valueOf(stringBuffer);
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] results = md.digest(originString .getBytes());
String resultString = byteArrayToHexString(results);
return resultString.toUpperCase();
} catch (Exception ex) {
ex.printStackTrace();
}
}
return null;
}
/**
* 16
*
* @param b
* @return
*/
private static String byteArrayToHexString(byte[] b) {
StringBuffer resultSb = new StringBuffer();
for (int i = 0; i < b.length; i++) {
resultSb.append(byteToHexString(b[i]));
}
return resultSb.toString();
}
/**
* 16
* @param b
* @return
*/
private static String byteToHexString(byte b) {
int n = b;
if (n < 0)
n = 256 + n;
int d1 = n / 16;
int d2 = n % 16;
return hexDigits[d1] + hexDigits[d2];
}
public static void main(String[] args) {
System.out.println(encodeByMD5("admin"));
}
}

@ -0,0 +1,13 @@
package com.esms.utils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class PageUtils {
@RequestMapping("/toPage.do")
public String toPage(String url) {
return url;
}
}

@ -0,0 +1,56 @@
package com.esms.vo;
import com.esms.po.Department;
import java.util.List;
public class DepartmentPages {
Integer code;
String msg;
Integer count;
List<Department> data;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public List<Department> getData() {
return data;
}
public void setData(List<Department> data) {
this.data = data;
}
@Override
public String toString() {
return "DepartmentPages{" +
"code=" + code +
", msg='" + msg + '\'' +
", count=" + count +
", data=" + data +
'}';
}
}

@ -0,0 +1,30 @@
package com.esms.vo;
import java.util.List;
/**
* @Description
*/
public class EchDepartmentSalary {
//部门名称
private String department;
//工资列表:最低工资,平均工资,最高工资
private List<Double> salary;
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public List<Double> getSalary() {
return salary;
}
public void setSalary(List<Double> salary) {
this.salary = salary;
}
}

@ -0,0 +1,25 @@
package com.esms.vo;
/**
* @Description
*/
public class EchEmployeeNums {
private String department;
private Integer num;
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
}

@ -0,0 +1,33 @@
package com.esms.vo;
import java.util.List;
/**
* @Description
*/
public class EchMonthSalary {
private String year;
private List<Double> salary;
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public List<Double> getSalary() {
return salary;
}
public void setSalary(List<Double> salary) {
this.salary = salary;
}
public EchMonthSalary(){}
public EchMonthSalary(String year, List<Double> salary) {
this.year = year;
this.salary = salary;
}
}

@ -0,0 +1,44 @@
package com.esms.vo;
/**
* @DescriptionsalaryMap.selectSalaryByDepartment()
*/
public class EchSalary {
private Double minSalary= 0.00;
private Double avgSalary = 0.00;
private Double maxSalary = 0.00;
public Double getMinSalary() {
return minSalary;
}
public void setMinSalary(Double minSalary) {
this.minSalary = minSalary;
}
public Double getAvgSalary() {
return avgSalary;
}
public void setAvgSalary(Double avgSalary) {
this.avgSalary = avgSalary;
}
public Double getMaxSalary() {
return maxSalary;
}
public void setMaxSalary(Double maxSalary) {
this.maxSalary = maxSalary;
}
public EchSalary() { }
public EchSalary(Double minSalary, Double avgSalary, Double maxSalary) {
this.minSalary = minSalary;
this.avgSalary = avgSalary;
this.maxSalary = maxSalary;
}
}

@ -0,0 +1,32 @@
package com.esms.vo;
/**
* @Description
*/
public class EchSalaryPercent {
private String Department = null;
private Double Salary = 0.00;
public String getDepartment() {
return Department;
}
public void setDepartment(String department) {
Department = department;
}
public Double getSalary() {
return Salary;
}
public void setSalary(Double salary) {
Salary = salary;
}
public EchSalaryPercent(){}
public EchSalaryPercent(String department, Double salary) {
Department = department;
Salary = salary;
}
}

@ -0,0 +1,58 @@
package com.esms.vo;
import com.esms.po.Department;
import com.esms.po.Employee;
import com.esms.po.Position;
import com.esms.po.RankBonus;
/**
* @Description
*/
public class EmployeeCustomVo {
private Employee employee;
private RankBonus rankBonus;
private Position position;
private Department department;
public Employee getEmployee() {
return employee;
}
public void setEmployee(Employee employee) {
this.employee = employee;
}
public RankBonus getRankBonus() {
return rankBonus;
}
public void setRankBonus(RankBonus rankBonus) {
this.rankBonus = rankBonus;
}
public Position getPosition() {
return position;
}
public void setPosition(Position position) {
this.position = position;
}
public Department getDepartment() {
return department;
}
public void setDepartment(Department department) {
this.department = department;
}
@Override
public String toString() {
return "EmployeeCustomVo{" +
"employee=" + employee +
", rankBonus=" + rankBonus +
", position=" + position +
", department=" + department +
'}';
}
}

@ -0,0 +1,57 @@
package com.esms.vo;
import com.esms.po.MonthlyAttendance;
import java.util.List;
/**
* @Description
*/
public class EmployeeMonthlyAttendancePages {
Integer code;
String msg;
Integer count;
List<MonthlyAttendance> data;
@Override
public String toString() {
return "EmployeeMonthlyAttendancePages{" +
"code=" + code +
", msg='" + msg + '\'' +
", count=" + count +
", data=" + data +
'}';
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public List<MonthlyAttendance> getData() {
return data;
}
public void setData(List<MonthlyAttendance> data) {
this.data = data;
}
}

@ -0,0 +1,55 @@
package com.esms.vo;
import java.util.List;
/**
* @Description
*/
public class EmployeePages {
Integer code;
String msg;
Integer count;
List<EmployeeCustomVo> data;
@Override
public String toString() {
return "EmployeePages{" +
"code=" + code +
", msg='" + msg + '\'' +
", count=" + count +
", data=" + data +
'}';
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public List<EmployeeCustomVo> getData() {
return data;
}
public void setData(List<EmployeeCustomVo> data) {
this.data = data;
}
}

@ -0,0 +1,57 @@
package com.esms.vo;
import com.esms.po.Salary;
import java.util.List;
/**
* @Description
*/
public class EmployeeSalaryVO {
Integer code;
String msg;
Integer count;
List<Salary> data;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public List<Salary> getData() {
return data;
}
public void setData(List<Salary> data) {
this.data = data;
}
@Override
public String toString() {
return "EmployeeSalaryVO{" +
"code=" + code +
", msg='" + msg + '\'' +
", count=" + count +
", data=" + data +
'}';
}
}

@ -0,0 +1,47 @@
package com.esms.vo;
import com.esms.po.Department;
import com.esms.po.Employee;
import com.esms.po.MonthlyAttendance;
/**
* @Description
*/
public class MonthlyAttendanceCustomVo {
private MonthlyAttendance monthlyAttendance = null;
private Employee employee = null;
private Department department = null;
@Override
public String toString() {
return "MonthlyAttendanceCustomVo{" +
"monthlyAttendance=" + monthlyAttendance +
", employee=" + employee +
", department=" + department +
'}';
}
public MonthlyAttendance getMonthlyAttendance() {
return monthlyAttendance;
}
public void setMonthlyAttendance(MonthlyAttendance monthlyAttendance) {
this.monthlyAttendance = monthlyAttendance;
}
public Employee getEmployee() {
return employee;
}
public void setEmployee(Employee employee) {
this.employee = employee;
}
public Department getDepartment() {
return department;
}
public void setDepartment(Department department) {
this.department = department;
}
}

@ -0,0 +1,56 @@
package com.esms.vo;
import java.util.List;
/**
*
* @Description
*/
public class MonthlyAttendancePages {
Integer code;
String msg;
Integer count;
List<MonthlyAttendanceCustomVo> data;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public List<MonthlyAttendanceCustomVo> getData() {
return data;
}
public void setData(List<MonthlyAttendanceCustomVo> data) {
this.data = data;
}
@Override
public String toString() {
return "MonthlyAttendancePages{" +
"code=" + code +
", msg='" + msg + '\'' +
", count=" + count +
", data=" + data +
'}';
}
}

@ -0,0 +1,57 @@
package com.esms.vo;
import com.esms.po.Position;
import java.util.List;
/**
* @Description
*/
public class PositionPages {
Integer code;
String msg;
Integer count;
List<Position> data;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public List<Position> getData() {
return data;
}
public void setData(List<Position> data) {
this.data = data;
}
@Override
public String toString() {
return "PositionPages{" +
"code=" + code +
", msg='" + msg + '\'' +
", count=" + count +
", data=" + data +
'}';
}
}

@ -0,0 +1,58 @@
package com.esms.vo;
import com.esms.po.Department;
import com.esms.po.RankBonus;
import java.util.List;
/**
* @Description
*/
public class RankBonusPages {
Integer code;
String msg;
Integer count;
List<RankBonus> data;
@Override
public String toString() {
return "RankBonusPages{" +
"code=" + code +
", msg='" + msg + '\'' +
", count=" + count +
", data=" + data +
'}';
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public List<RankBonus> getData() {
return data;
}
public void setData(List<RankBonus> data) {
this.data = data;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
}

@ -0,0 +1,55 @@
package com.esms.vo;
import com.esms.po.Salary;
import java.util.List;
/**
* @Description
*/
public class SalaryPages {
Integer code;
String msg;
Integer count;
List<Salary> data;
public SalaryPages(){}
public SalaryPages(Integer code, String msg, Integer count, List<Salary> data) {
this.code = code;
this.msg = msg;
this.count = count;
this.data = data;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public List<Salary> getData() {
return data;
}
public void setData(List<Salary> data) {
this.data = data;
}
}

@ -0,0 +1,57 @@
package com.esms.vo;
import com.esms.po.RankBonus;
import java.util.List;
/**
* @Description
*/
public class WokingYearsBonusPages {
Integer code;
String msg;
Integer count;
List<WokingYearsBonusPages> data;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public List<WokingYearsBonusPages> getData() {
return data;
}
public void setData(List<WokingYearsBonusPages> data) {
this.data = data;
}
@Override
public String toString() {
return "WokingYearsBonusPages{" +
"code=" + code +
", msg='" + msg + '\'' +
", count=" + count +
", data=" + data +
'}';
}
}

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd">
<!-- 对基本包进行注解扫描,开启注解 -->
<context:component-scan base-package="com.esms">
<!-- 只对controller进行扫描 -->
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan>
<!-- Spring的配置文件这里主要配置和业务逻辑有关的 -->
<!--=================== 数据源事务控制xxx ================ -->
<!-- 加载数据库配置文件dbconfig.properties -->
<context:property-placeholder location="classpath:dbconfig.properties" />
<!-- 加载数据库 -->
<bean id="pooledDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property>
<property name="driverClass" value="${jdbc.driverClass}"></property>
<property name="user" value="${jdbc.user}"></property>
<property name="password" value="${jdbc.password}"></property>
</bean>
<!--================== 配置和MyBatis的整合=============== -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- 指定mybatis全局配置文件的位置 -->
<property name="configLocation" value="classpath:mybatis-config.xml"></property>
<property name="dataSource" ref="pooledDataSource"></property>
<!-- 指定mybatismapper文件的位置 -->
<property name="mapperLocations" value="classpath:mappers/*.xml"></property>
</bean>
<!-- 配置扫描器将mybatis接口的实现加入到ioc容器中 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!-- 扫描所有dao接口的实现加入到ioc容器中 -->
<property name="basePackage" value="com.esms.dao"></property>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
<!-- 配置一个可以执行批量的sqlSession -->
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg name="sqlSessionFactory" ref="sqlSessionFactory"></constructor-arg>
<constructor-arg name="executorType" value="BATCH"></constructor-arg>
</bean>
<!-- ===============事务控制的配置 ================ -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<!--控制住数据源 -->
<property name="dataSource" ref="pooledDataSource"></property>
</bean>
<!--配置事务增强,事务如何切入 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true" propagation="SUPPORTS"/>
<tx:method name="list*" read-only="true" propagation="SUPPORTS"/>
<tx:method name="find*" read-only="true" propagation="SUPPORTS"/>
<tx:method name="query*" read-only="true" propagation="SUPPORTS"/>
<tx:method name="count*" read-only="true" propagation="SUPPORTS"/>
<tx:method name="update*" read-only="false" propagation="REQUIRED"/>
<tx:method name="insert*" read-only="false" propagation="REQUIRED"/>
<tx:method name="save*" read-only="false" propagation="REQUIRED"/>
<tx:method name="delete*" read-only="false" propagation="REQUIRED"/>
<tx:method name="remove*" read-only="false" propagation="REQUIRED"/>
<tx:method name="*" read-only="true" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<aop:aspectj-autoproxy proxy-target-class="true"/>
<!--开启基于注解的事务使用xml配置形式的事务必要主要的都是使用配置式 -->
<aop:config>
<!-- 切入点表达式 --> <!-- 需要修改包的扫描 -->
<aop:pointcut expression="execution(* com.esms.service.impl.*.*(..))" id="txPoint" />
<!-- 配置事务增强 -->
<aop:advisor advice-ref="txAdvice" pointcut-ref="txPoint" />
</aop:config>
<bean class="com.esms.exception.CustomExceptionResolver"/>
</beans>

@ -0,0 +1,4 @@
jdbc.jdbcUrl=jdbc:mysql://127.0.0.1:3306/ssm_esms?useSSL=false&useUnicode=true&characterEncoding=utf8&serverTimezone=UTC
jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.user=root
jdbc.password=123456

@ -0,0 +1,14 @@
#1.\u539F\u7248\uFF08\u8BE6\u7EC6\uFF09
#log4j.rootLogger=DEBUG,myConsole
#log4j.appender.myConsole=org.apache.log4j.ConsoleAppender
#log4j.appender.myConsole.ImmediateFlush=true
#log4j.appender.myConsole.Target=System.out
#log4j.appender.myConsole.layout=org.apache.log4j.PatternLayout
#log4j.appender.myConsole.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n
#
#log4j.logger.com.mchange.v2=ERROR
#2.\u7B80\u7565\u7248
log4j.rootLogger=DEBUG, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.esms.dao.DepartmentMapper">
<resultMap id="BaseResultMap" type="com.esms.po.Department">
<id column="d_id" jdbcType="INTEGER" property="dId" />
<result column="d_name" jdbcType="VARCHAR" property="dName" />
<result column="d_remark" jdbcType="VARCHAR" property="dRemark" />
<result column="d_isdel" jdbcType="INTEGER" property="dIsdel" />
</resultMap>
<sql id="Base_Column_List">
d_id, d_name, d_remark, d_isdel
</sql>
<select id="findSelective" parameterType="com.esms.po.Department" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from department
<where>
<if test="dName != '' and dName != null">
and d_name like concat('%',#{dName,jdbcType=VARCHAR},'%')
</if>
<if test="true">
and d_isdel = 1
</if>
</where>
order by d_id DESC
</select>
<select id="findByDname" parameterType="String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from department where d_name = #{dName,jdbcType=VARCHAR} and d_isdel = 1
</select>
<update id="deleteByQuery" parameterType="java.util.ArrayList">
update department set d_isdel = 0 where d_id in
<foreach collection="array" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from department
where d_id = #{dId,jdbcType=INTEGER}
</select>
<select id="selectAll" resultType="com.esms.po.Department">
select
<include refid="Base_Column_List" />
from department
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from department
where d_id = #{dId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.esms.po.Department">
<selectKey keyProperty="dId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into department (d_name, d_remark, d_isdel
)
values (#{dName,jdbcType=VARCHAR}, #{dRemark,jdbcType=VARCHAR}, #{dIsdel,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.esms.po.Department">
<selectKey keyProperty="dId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into department
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dName != null">
d_name,
</if>
<if test="dRemark != null">
d_remark,
</if>
<if test="dIsdel != null">
d_isdel,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dName != null">
#{dName,jdbcType=VARCHAR},
</if>
<if test="dRemark != null">
#{dRemark,jdbcType=VARCHAR},
</if>
<if test="dIsdel != null">
#{dIsdel,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.esms.po.Department">
update department
<set>
<if test="dName != null">
d_name = #{dName,jdbcType=VARCHAR},
</if>
<if test="dRemark != null">
d_remark = #{dRemark,jdbcType=VARCHAR},
</if>
<if test="dIsdel != null">
d_isdel = #{dIsdel,jdbcType=INTEGER},
</if>
</set>
where d_id = #{dId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.esms.po.Department">
update department
set d_name = #{dName,jdbcType=VARCHAR},
d_remark = #{dRemark,jdbcType=VARCHAR},
d_isdel = #{dIsdel,jdbcType=INTEGER}
where d_id = #{dId,jdbcType=INTEGER}
</update>
</mapper>

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.esms.dao.EmployeeCustomVoMapper">
<resultMap id="BaseResultMap" type="com.esms.vo.EmployeeCustomVo">
<result column="e_id" jdbcType="INTEGER" property="employee.eId"/>
<result column="e_account" jdbcType="VARCHAR" property="employee.eAccount"/>
<result column="e_password" jdbcType="VARCHAR" property="employee.ePassword"/>
<result column="e_name" jdbcType="VARCHAR" property="employee.eName"/>
<result column="e_idcard" jdbcType="VARCHAR" property="employee.eIdcard"/>
<result column="e_sex" jdbcType="VARCHAR" property="employee.eSex"/>
<result column="e_dagree" jdbcType="VARCHAR" property="employee.eDagree"/>
<result column="e_birthday" jdbcType="DATE" property="employee.eBirthday"/>
<result column="e_email" jdbcType="VARCHAR" property="employee.eEmail"/>
<result column="e_phone" jdbcType="VARCHAR" property="employee.ePhone"/>
<result column="e_hometown" jdbcType="VARCHAR" property="employee.eHometown"/>
<result column="e_rank" jdbcType="INTEGER" property="employee.eRank"/>
<result column="e_head_path" jdbcType="VARCHAR" property="employee.eHeadPath"/>
<result column="e_urgent_person" jdbcType="VARCHAR" property="employee.eUrgentPerson"/>
<result column="e_urgent_phone" jdbcType="VARCHAR" property="employee.eUrgentPhone"/>
<result column="p_id" jdbcType="INTEGER" property="employee.pId"/>
<result column="d_id" jdbcType="INTEGER" property="employee.dId"/>
<result column="e_base_pay" jdbcType="DOUBLE" property="employee.eBasePay"/>
<result column="e_isdel" jdbcType="INTEGER" property="employee.eIsdel"/>
<result column="e_entry_time" jdbcType="DATE" property="employee.eEntryTime"/>
<result column="e_leave_time" jdbcType="DATE" property="employee.eLeaveTime"/>
<result column="p_id" jdbcType="INTEGER" property="position.pId"/>
<result column="p_name" jdbcType="VARCHAR" property="position.pName"/>
<result column="p_duty" jdbcType="VARCHAR" property="position.pDuty"/>
<result column="p_post_pay" jdbcType="DOUBLE" property="position.pPostPay"/>
<result column="p_isdel" jdbcType="INTEGER" property="position.pIsdel"/>
<result column="rb_id" jdbcType="INTEGER" property="rankBonus.rbId"/>
<result column="rank_name" jdbcType="VARCHAR" property="rankBonus.rankName"/>
<result column="rb_bonus" jdbcType="INTEGER" property="rankBonus.rbBonus"/>
<result column="d_id" jdbcType="INTEGER" property="department.dId"/>
<result column="d_name" jdbcType="VARCHAR" property="department.dName"/>
<result column="d_remark" jdbcType="VARCHAR" property="department.dRemark"/>
<result column="d_isdel" jdbcType="INTEGER" property="department.dIsdel"/>
</resultMap>
<select id="selectEmployeeById" resultMap="BaseResultMap">
select * from employee e, department d,position p,rank_bonus rb
where e.e_id = #{arg0} and d.d_id = e.d_id and p.p_id = e.p_id and e_rank = rb_id
</select>
<!--条件查找 工号 员工姓名 部门id By xjx-->
<select id="selectEmployeeSelective" parameterType="map" resultMap="BaseResultMap" >
select *
from
employee e
left join department d on e.d_id = d.d_id
left join position p on e.p_id = p.p_id
left join rank_bonus rb on e.e_rank = rb.rb_id
<where>
<if test="e_account != ''">
and e_account like concat('%',#{e_account},'%')
</if>
<if test="e_name != ''">
and e_name like concat('%',#{e_name},'%')
</if>
<if test="d_id != 0">
and d.d_id = #{d_id}
</if>
<if test="true">
and e.e_isdel = 1
</if>
</where>
ORDER BY e.e_id DESC
</select>
<!-- 查找一个 By xjx-->
<select id="selectVoByPrimaryKey" parameterType="int" resultMap="BaseResultMap" >
select *
from
employee e
left join department d on e.d_id = d.d_id
left join position p on e.p_id = p.p_id
left join rank_bonus rb on e.e_rank = rb.rb_id
where e_id = #{id, jdbcType=INTEGER} and e_isdel = 1
</select>
</mapper>

@ -0,0 +1,348 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.esms.dao.EmployeeMapper">
<resultMap id="BaseResultMap" type="com.esms.po.Employee">
<id column="e_id" jdbcType="INTEGER" property="eId" />
<result column="e_account" jdbcType="VARCHAR" property="eAccount" />
<result column="e_password" jdbcType="VARCHAR" property="ePassword" />
<result column="e_name" jdbcType="VARCHAR" property="eName" />
<result column="e_idcard" jdbcType="VARCHAR" property="eIdcard" />
<result column="e_sex" jdbcType="VARCHAR" property="eSex" />
<result column="e_dagree" jdbcType="VARCHAR" property="eDagree" />
<result column="e_birthday" jdbcType="DATE" property="eBirthday" />
<result column="e_email" jdbcType="VARCHAR" property="eEmail" />
<result column="e_phone" jdbcType="VARCHAR" property="ePhone" />
<result column="e_hometown" jdbcType="VARCHAR" property="eHometown" />
<result column="e_rank" jdbcType="INTEGER" property="eRank" />
<result column="e_head_path" jdbcType="VARCHAR" property="eHeadPath" />
<result column="e_urgent_person" jdbcType="VARCHAR" property="eUrgentPerson" />
<result column="e_urgent_phone" jdbcType="VARCHAR" property="eUrgentPhone" />
<result column="p_id" jdbcType="INTEGER" property="pId" />
<result column="d_id" jdbcType="INTEGER" property="dId" />
<result column="e_base_pay" jdbcType="DOUBLE" property="eBasePay" />
<result column="e_isdel" jdbcType="INTEGER" property="eIsdel" />
<result column="e_entry_time" jdbcType="DATE" property="eEntryTime" />
<result column="e_leave_time" jdbcType="DATE" property="eLeaveTime" />
<!--<association property="rankBonus" javaType="com.esms.po.RankBonus"-->
<!--select="com.esms.dao.RankBonusMapper.selectByPrimaryKey" column="e_rank">-->
<!--</association>-->
<!--<association property="position" javaType="com.esms.po.Position"-->
<!--select="com.esms.dao.PositionMapper.selectByPrimaryKey" column="p_id">-->
<!--</association>-->
<!--<association property="department" javaType="com.esms.po.Department"-->
<!--select="com.esms.dao.DepartmentMapper.selectByPrimaryKey" column="d_id">-->
<!--</association>-->
</resultMap>
<sql id="Base_Column_List">
e_id, e_account, e_password, e_name, e_idcard, e_sex, e_dagree, e_birthday, e_email,
e_phone, e_hometown, e_rank, e_head_path, e_urgent_person, e_urgent_phone, p_id,
d_id, e_base_pay, e_isdel, e_entry_time, e_leave_time
</sql>
<!--删除与批量删除 添加 By xjx -->
<update id="deleteByPrimaryKey" parameterType="java.lang.Integer">
update employee set e_isdel = 0 where e_id = #{eId,jdbcType=INTEGER}
</update>
<!--<update id="deleteByQuery" parameterType="java.util.ArrayList">-->
<!--update employee set e_isdel = 0 where e_id in-->
<!--<foreach collection="array" item="id" separator="," open="(" close=")">-->
<!--#{id}-->
<!--</foreach>-->
<!--</update>-->
<select id="findByeAccount" parameterType="String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from employee where e_account = #{eAccount,jdbcType=VARCHAR} and e_isdel = 1
</select>
<select id="selectByAccount" resultType="com.esms.po.Employee">
select * from employee where e_account = #{arg0} and e_isdel = 1
</select>
<select id="selectByAccountAndPassword" parameterType="com.esms.po.Employee" resultType="com.esms.po.Employee">
select * from employee where e_account = #{eAccount} and e_password = #{ePassword} and e_isdel = #{eIsdel}
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from employee
where e_id = #{eId,jdbcType=INTEGER}
</select>
<!--统计部门拥有员工数 by 方宏泰-->
<select id="countByDid" parameterType="java.lang.Integer" resultType="java.lang.Integer">
select count(*)
from employee
where d_id = #{dId}
</select>
<!--<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">-->
<!--delete from employee-->
<!--where e_id = #{eId,jdbcType=INTEGER}-->
<!--</delete>-->
<insert id="insert" parameterType="com.esms.po.Employee">
<selectKey keyProperty="eId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into employee (e_account, e_password, e_name,
e_idcard, e_sex, e_dagree,
e_birthday, e_email, e_phone,
e_hometown, e_rank, e_head_path,
e_urgent_person, e_urgent_phone, p_id,
d_id, e_base_pay, e_isdel,
e_entry_time, e_leave_time)
values (#{eAccount,jdbcType=VARCHAR}, #{ePassword,jdbcType=VARCHAR}, #{eName,jdbcType=VARCHAR},
#{eIdcard,jdbcType=VARCHAR}, #{eSex,jdbcType=VARCHAR}, #{eDagree,jdbcType=VARCHAR},
#{eBirthday,jdbcType=DATE}, #{eEmail,jdbcType=VARCHAR}, #{ePhone,jdbcType=VARCHAR},
#{eHometown,jdbcType=VARCHAR}, #{eRank,jdbcType=INTEGER}, #{eHeadPath,jdbcType=VARCHAR},
#{eUrgentPerson,jdbcType=VARCHAR}, #{eUrgentPhone,jdbcType=VARCHAR}, #{pId,jdbcType=INTEGER},
#{dId,jdbcType=INTEGER}, #{eBasePay,jdbcType=DOUBLE}, #{eIsdel,jdbcType=INTEGER},
#{eEntryTime,jdbcType=DATE}, #{eLeaveTime,jdbcType=DATE})
</insert>
<insert id="insertSelective" parameterType="com.esms.po.Employee">
<selectKey keyProperty="eId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into employee
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="eAccount != null">
e_account,
</if>
<if test="ePassword != null">
e_password,
</if>
<if test="eName != null">
e_name,
</if>
<if test="eIdcard != null">
e_idcard,
</if>
<if test="eSex != null">
e_sex,
</if>
<if test="eDagree != null">
e_dagree,
</if>
<if test="eBirthday != null">
e_birthday,
</if>
<if test="eEmail != null">
e_email,
</if>
<if test="ePhone != null">
e_phone,
</if>
<if test="eHometown != null">
e_hometown,
</if>
<if test="eRank != null">
e_rank,
</if>
<if test="eHeadPath != null">
e_head_path,
</if>
<if test="eUrgentPerson != null">
e_urgent_person,
</if>
<if test="eUrgentPhone != null">
e_urgent_phone,
</if>
<if test="pId != null">
p_id,
</if>
<if test="dId != null">
d_id,
</if>
<if test="eBasePay != null">
e_base_pay,
</if>
<if test="eIsdel != null">
e_isdel,
</if>
<if test="eEntryTime != null">
e_entry_time,
</if>
<if test="eLeaveTime != null">
e_leave_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="eAccount != null">
#{eAccount,jdbcType=VARCHAR},
</if>
<if test="ePassword != null">
#{ePassword,jdbcType=VARCHAR},
</if>
<if test="eName != null">
#{eName,jdbcType=VARCHAR},
</if>
<if test="eIdcard != null">
#{eIdcard,jdbcType=VARCHAR},
</if>
<if test="eSex != null">
#{eSex,jdbcType=INTEGER},
</if>
<if test="eDagree != null">
#{eDagree,jdbcType=VARCHAR},
</if>
<if test="eBirthday != null">
#{eBirthday,jdbcType=DATE},
</if>
<if test="eEmail != null">
#{eEmail,jdbcType=VARCHAR},
</if>
<if test="ePhone != null">
#{ePhone,jdbcType=VARCHAR},
</if>
<if test="eHometown != null">
#{eHometown,jdbcType=VARCHAR},
</if>
<if test="eRank != null">
#{eRank,jdbcType=INTEGER},
</if>
<if test="eHeadPath != null">
#{eHeadPath,jdbcType=VARCHAR},
</if>
<if test="eUrgentPerson != null">
#{eUrgentPerson,jdbcType=VARCHAR},
</if>
<if test="eUrgentPhone != null">
#{eUrgentPhone,jdbcType=VARCHAR},
</if>
<if test="pId != null">
#{pId,jdbcType=INTEGER},
</if>
<if test="dId != null">
#{dId,jdbcType=INTEGER},
</if>
<if test="eBasePay != null">
#{eBasePay,jdbcType=DOUBLE},
</if>
<if test="eIsdel != null">
#{eIsdel,jdbcType=INTEGER},
</if>
<if test="eEntryTime != null">
#{eEntryTime,jdbcType=DATE},
</if>
<if test="eLeaveTime != null">
#{eLeaveTime,jdbcType=DATE},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.esms.po.Employee">
update employee
<set>
<if test="eAccount != null">
e_account = #{eAccount,jdbcType=VARCHAR},
</if>
<if test="ePassword != null">
e_password = #{ePassword,jdbcType=VARCHAR},
</if>
<if test="eName != null">
e_name = #{eName,jdbcType=VARCHAR},
</if>
<if test="eIdcard != null">
e_idcard = #{eIdcard,jdbcType=VARCHAR},
</if>
<if test="eSex != null">
e_sex = #{eSex,jdbcType=VARCHAR},
</if>
<if test="eDagree != null">
e_dagree = #{eDagree,jdbcType=VARCHAR},
</if>
<if test="eBirthday != null">
e_birthday = #{eBirthday,jdbcType=DATE},
</if>
<if test="eEmail != null">
e_email = #{eEmail,jdbcType=VARCHAR},
</if>
<if test="ePhone != null">
e_phone = #{ePhone,jdbcType=VARCHAR},
</if>
<if test="eHometown != null">
e_hometown = #{eHometown,jdbcType=VARCHAR},
</if>
<if test="eRank != null">
e_rank = #{eRank,jdbcType=INTEGER},
</if>
<if test="eHeadPath != null">
e_head_path = #{eHeadPath,jdbcType=VARCHAR},
</if>
<if test="eUrgentPerson != null">
e_urgent_person = #{eUrgentPerson,jdbcType=VARCHAR},
</if>
<if test="eUrgentPhone != null">
e_urgent_phone = #{eUrgentPhone,jdbcType=VARCHAR},
</if>
<if test="pId != null">
p_id = #{pId,jdbcType=INTEGER},
</if>
<if test="dId != null">
d_id = #{dId,jdbcType=INTEGER},
</if>
<if test="eBasePay != null">
e_base_pay = #{eBasePay,jdbcType=DOUBLE},
</if>
<if test="eIsdel != null">
e_isdel = #{eIsdel,jdbcType=INTEGER},
</if>
<if test="eEntryTime != null">
e_entry_time = #{eEntryTime,jdbcType=DATE},
</if>
<if test="eLeaveTime != null">
e_leave_time = #{eLeaveTime,jdbcType=DATE},
</if>
</set>
where e_id = #{eId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.esms.po.Employee">
update employee
set e_account = #{eAccount,jdbcType=VARCHAR},
e_password = #{ePassword,jdbcType=VARCHAR},
e_name = #{eName,jdbcType=VARCHAR},
e_idcard = #{eIdcard,jdbcType=VARCHAR},
e_sex = #{eSex,jdbcType=VARCHAR},
e_dagree = #{eDagree,jdbcType=VARCHAR},
e_birthday = #{eBirthday,jdbcType=DATE},
e_email = #{eEmail,jdbcType=VARCHAR},
e_phone = #{ePhone,jdbcType=VARCHAR},
e_hometown = #{eHometown,jdbcType=VARCHAR},
e_rank = #{eRank,jdbcType=INTEGER},
e_head_path = #{eHeadPath,jdbcType=VARCHAR},
e_urgent_person = #{eUrgentPerson,jdbcType=VARCHAR},
e_urgent_phone = #{eUrgentPhone,jdbcType=VARCHAR},
p_id = #{pId,jdbcType=INTEGER},
d_id = #{dId,jdbcType=INTEGER},
e_base_pay = #{eBasePay,jdbcType=DOUBLE},
e_isdel = #{eIsdel,jdbcType=INTEGER},
e_entry_time = #{eEntryTime,jdbcType=DATE},
e_leave_time = #{eLeaveTime,jdbcType=DATE}
where e_id = #{eId,jdbcType=INTEGER}
</update>
<!--根据rank_bonus表的rb_id统计是否有员工依赖-->
<select id="countByRbid" parameterType="java.lang.Integer" resultType="java.lang.Integer">
select count(*)
from employee
where e_rank = #{eRank}
</select>
<!--根据rank_bonus表的rb_id统计是否有员工依赖-->
<select id="selectAll" resultType="com.esms.po.Employee">
select *
from employee
where e_isdel = 1
</select>
<!--根据员工号检查是否存在此员工 by方宏泰-->
<select id="isExistEmployee" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT count(*)
from employee
where e_account = #{e_account}
</select>
<!--根据员工工号查找员工ID by方宏泰-->
<select id="selectEidByEaccount" parameterType="java.lang.String" resultType="java.lang.Integer">
select e_id
from employee
where e_account = #{e_account}
</select>
</mapper>

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.esms.dao.KeyValueMapper">
<resultMap id="BaseResultMap" type="com.esms.po.KeyValue">
<id column="kv_id" jdbcType="INTEGER" property="kvId" />
<result column="kv_key" jdbcType="VARCHAR" property="kvKey" />
<result column="kv_value" jdbcType="DOUBLE" property="kvValue" />
</resultMap>
<sql id="Base_Column_List">
kv_id, kv_key, kv_value
</sql>
<select id="selectBykvKey" resultMap="BaseResultMap">
select *
from key_value
where kv_key = #{arg0}
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from key_value
where kv_id = #{kvId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from key_value
where kv_id = #{kvId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.esms.po.KeyValue">
<selectKey keyProperty="kvId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into key_value (kv_key, kv_value)
values (#{kvKey,jdbcType=VARCHAR}, #{kvValue,jdbcType=DOUBLE})
</insert>
<insert id="insertSelective" parameterType="com.esms.po.KeyValue">
<selectKey keyProperty="kvId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into key_value
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="kvKey != null">
kv_key,
</if>
<if test="kvValue != null">
kv_value,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="kvKey != null">
#{kvKey,jdbcType=VARCHAR},
</if>
<if test="kvValue != null">
#{kvValue,jdbcType=DOUBLE},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.esms.po.KeyValue">
update key_value
<set>
<if test="kvKey != null">
kv_key = #{kvKey,jdbcType=VARCHAR},
</if>
<if test="kvValue != null">
kv_value = #{kvValue,jdbcType=DOUBLE},
</if>
</set>
where kv_id = #{kvId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.esms.po.KeyValue">
update key_value
set kv_key = #{kvKey,jdbcType=VARCHAR},
kv_value = #{kvValue,jdbcType=DOUBLE}
where kv_id = #{kvId,jdbcType=INTEGER}
</update>
</mapper>

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.esms.dao.MonthlyAttendanceCustomVoMapper">
<resultMap id="BaseResultMap" type="com.esms.vo.MonthlyAttendanceCustomVo">
<result column="ma_id" jdbcType="INTEGER" property="monthlyAttendance.maId"/>
<result column="e_id" jdbcType="INTEGER" property="monthlyAttendance.eId" />
<result column="attendance_time" jdbcType="DATE" property="monthlyAttendance.attendanceTime"/>
<result column="sick_leave_num" jdbcType="INTEGER" property="monthlyAttendance.sickLeaveNum"/>
<result column="overtime_hour" jdbcType="DOUBLE" property="monthlyAttendance.overtimeHour"/>
<result column="weekend_hour" jdbcType="DOUBLE" property="monthlyAttendance.weekendHour"/>
<result column="holiday_hour" jdbcType="DOUBLE" property="monthlyAttendance.holidayHour"/>
<result column="late_num" jdbcType="INTEGER" property="monthlyAttendance.lateNum"/>
<result column="early_num" jdbcType="INTEGER" property="monthlyAttendance.earlyNum"/>
<result column="absence_num" jdbcType="INTEGER" property="monthlyAttendance.absenceNum"/>
<result column="business_travel_num" jdbcType="INTEGER" property="monthlyAttendance.businessTravelNum"/>
<result column="compassionate_leave_num" jdbcType="INTEGER" property="monthlyAttendance.compassionateLeaveNum"/>
<result column="e_id" jdbcType="INTEGER" property="employee.eId"/>
<result column="e_account" jdbcType="VARCHAR" property="employee.eAccount"/>
<result column="e_password" jdbcType="VARCHAR" property="employee.ePassword"/>
<result column="e_name" jdbcType="VARCHAR" property="employee.eName"/>
<result column="e_idcard" jdbcType="VARCHAR" property="employee.eIdcard"/>
<result column="e_sex" jdbcType="VARCHAR" property="employee.eSex"/>
<result column="e_dagree" jdbcType="VARCHAR" property="employee.eDagree"/>
<result column="e_birthday" jdbcType="DATE" property="employee.eBirthday"/>
<result column="e_email" jdbcType="VARCHAR" property="employee.eEmail"/>
<result column="e_phone" jdbcType="VARCHAR" property="employee.ePhone"/>
<result column="e_hometown" jdbcType="VARCHAR" property="employee.eHometown"/>
<result column="e_rank" jdbcType="INTEGER" property="employee.eRank"/>
<result column="e_head_path" jdbcType="VARCHAR" property="employee.eHeadPath"/>
<result column="e_urgent_person" jdbcType="VARCHAR" property="employee.eUrgentPerson"/>
<result column="e_urgent_phone" jdbcType="VARCHAR" property="employee.eUrgentPhone"/>
<result column="p_id" jdbcType="INTEGER" property="employee.pId"/>
<result column="d_id" jdbcType="INTEGER" property="employee.dId"/>
<result column="e_base_pay" jdbcType="DOUBLE" property="employee.eBasePay"/>
<result column="e_isdel" jdbcType="INTEGER" property="employee.eIsdel"/>
<result column="e_entry_time" jdbcType="DATE" property="employee.eEntryTime"/>
<result column="e_leave_time" jdbcType="DATE" property="employee.eLeaveTime"/>
<result column="d_id" jdbcType="INTEGER" property="department.dId"/>
<result column="d_name" jdbcType="VARCHAR" property="department.dName"/>
<result column="d_remark" jdbcType="VARCHAR" property="department.dRemark"/>
<result column="d_isdel" jdbcType="INTEGER" property="department.dIsdel"/>
</resultMap>
<select id="selectMonthlyAttendanceCustomVoMapperByeAccountAnddIdAndTime" parameterType="map" resultMap="BaseResultMap" >
select *
-- ma.ma_id, ma.attendance_time, ma.sick_leave_num, ma.overtime_hour, ma.weekend_hour, ma.holiday_hour, ma.late_num, ma.early_num, ma.absence_num, ma.business_travel_num, ma.compassionate_leave_num,
-- e.e_id, e.e_account, e.e_password, e.e_name, e.e_idcard, e_sex, e.e_dagree, e.e_birthday, e.e_email, e.e_phone, e.e_hometown, e.e_rank, e.e_head_path, e.e_urgent_person, e.e_urgent_phone, e.p_id, e.e_base_pay, e.e_isdel, e.e_entry_time, e.e_leave_time,
-- d.d_id, d.d_name, d.d_remark, d.d_isdel
from
monthly_attendance ma
left join employee e on e.e_id = ma.e_id
left join department d on d.d_id = e.d_id
<where>
<if test="e_account != ''">
and e_account like concat('%',#{e_account},'%')
</if>
<if test="d_id != 0">
and d.d_id = #{d_id}
</if>
<if test="attendance_time != ''">
and attendance_time like concat('%',#{attendance_time},'%')
</if>
</where>
ORDER BY attendance_time DESC
</select>
<select id="selectVoByPrimaryKey" parameterType="int" resultMap="BaseResultMap" >
select *
from
monthly_attendance ma
left join employee e on e.e_id = ma.e_id
left join department d on d.d_id = e.e_id
where ma_id = #{id, jdbcType=INTEGER}
</select>
</mapper>

@ -0,0 +1,207 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.esms.dao.MonthlyAttendanceMapper">
<resultMap id="BaseResultMap" type="com.esms.po.MonthlyAttendance">
<id column="ma_id" jdbcType="INTEGER" property="maId" />
<result column="e_id" jdbcType="INTEGER" property="eId" />
<result column="attendance_time" jdbcType="DATE" property="attendanceTime" />
<result column="sick_leave_num" jdbcType="INTEGER" property="sickLeaveNum" />
<result column="overtime_hour" jdbcType="DOUBLE" property="overtimeHour" />
<result column="weekend_hour" jdbcType="DOUBLE" property="weekendHour" />
<result column="holiday_hour" jdbcType="DOUBLE" property="holidayHour" />
<result column="late_num" jdbcType="INTEGER" property="lateNum" />
<result column="early_num" jdbcType="INTEGER" property="earlyNum" />
<result column="absence_num" jdbcType="INTEGER" property="absenceNum" />
<result column="business_travel_num" jdbcType="INTEGER" property="businessTravelNum" />
<result column="compassionate_leave_num" jdbcType="INTEGER" property="compassionateLeaveNum" />
<association property="employee" javaType="com.esms.po.Employee"
select="com.esms.dao.EmployeeMapper.selectByPrimaryKey" column="e_id">
</association>
</resultMap>
<delete id="deleteByQuery" parameterType="java.util.ArrayList">
delete from monthly_attendance where ma_id in
<foreach collection="array" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</delete>
<sql id="Base_Column_List">
ma_id, e_id, attendance_time, sick_leave_num, overtime_hour, weekend_hour, holiday_hour,
late_num, early_num, absence_num, business_travel_num, compassionate_leave_num
</sql>
<select id="selectByeIdAndDate" resultMap="BaseResultMap">
select *
from monthly_attendance
where e_id = #{arg0} and strcmp(date_format(attendance_time,'%Y-%m'),#{arg1}) = 0
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from monthly_attendance
where ma_id = #{maId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from monthly_attendance
where ma_id = #{maId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.esms.po.MonthlyAttendance">
<selectKey keyProperty="maId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into monthly_attendance (e_id, attendance_time, sick_leave_num,
overtime_hour, weekend_hour, holiday_hour,
late_num, early_num, absence_num,
business_travel_num, compassionate_leave_num
)
values (#{employee.eId,jdbcType=INTEGER}, #{attendanceTime,jdbcType=DATE}, #{sickLeaveNum,jdbcType=INTEGER},
#{overtimeHour,jdbcType=DOUBLE}, #{weekendHour,jdbcType=DOUBLE}, #{holidayHour,jdbcType=DOUBLE},
#{lateNum,jdbcType=INTEGER}, #{earlyNum,jdbcType=INTEGER}, #{absenceNum,jdbcType=INTEGER},
#{businessTravelNum,jdbcType=INTEGER}, #{compassionateLeaveNum,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.esms.po.MonthlyAttendance">
<selectKey keyProperty="maId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into monthly_attendance
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="employee != null">
e_id,
</if>
<if test="attendanceTime != null">
attendance_time,
</if>
<if test="sickLeaveNum != null">
sick_leave_num,
</if>
<if test="overtimeHour != null">
overtime_hour,
</if>
<if test="weekendHour != null">
weekend_hour,
</if>
<if test="holidayHour != null">
holiday_hour,
</if>
<if test="lateNum != null">
late_num,
</if>
<if test="earlyNum != null">
early_num,
</if>
<if test="absenceNum != null">
absence_num,
</if>
<if test="businessTravelNum != null">
business_travel_num,
</if>
<if test="compassionateLeaveNum != null">
compassionate_leave_num,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="employee != null">
#{employee.eId,jdbcType=INTEGER},
</if>
<if test="attendanceTime != null">
#{attendanceTime,jdbcType=DATE},
</if>
<if test="sickLeaveNum != null">
#{sickLeaveNum,jdbcType=INTEGER},
</if>
<if test="overtimeHour != null">
#{overtimeHour,jdbcType=DOUBLE},
</if>
<if test="weekendHour != null">
#{weekendHour,jdbcType=DOUBLE},
</if>
<if test="holidayHour != null">
#{holidayHour,jdbcType=DOUBLE},
</if>
<if test="lateNum != null">
#{lateNum,jdbcType=INTEGER},
</if>
<if test="earlyNum != null">
#{earlyNum,jdbcType=INTEGER},
</if>
<if test="absenceNum != null">
#{absenceNum,jdbcType=INTEGER},
</if>
<if test="businessTravelNum != null">
#{businessTravelNum,jdbcType=INTEGER},
</if>
<if test="compassionateLeaveNum != null">
#{compassionateLeaveNum,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.esms.po.MonthlyAttendance">
update monthly_attendance
<set>
<if test="employee != null">
e_id = #{employee.eId,jdbcType=INTEGER},
</if>
<if test="attendanceTime != null">
attendance_time = #{attendanceTime,jdbcType=DATE},
</if>
<if test="sickLeaveNum != null">
sick_leave_num = #{sickLeaveNum,jdbcType=INTEGER},
</if>
<if test="overtimeHour != null">
overtime_hour = #{overtimeHour,jdbcType=DOUBLE},
</if>
<if test="weekendHour != null">
weekend_hour = #{weekendHour,jdbcType=DOUBLE},
</if>
<if test="holidayHour != null">
holiday_hour = #{holidayHour,jdbcType=DOUBLE},
</if>
<if test="lateNum != null">
late_num = #{lateNum,jdbcType=INTEGER},
</if>
<if test="earlyNum != null">
early_num = #{earlyNum,jdbcType=INTEGER},
</if>
<if test="absenceNum != null">
absence_num = #{absenceNum,jdbcType=INTEGER},
</if>
<if test="businessTravelNum != null">
business_travel_num = #{businessTravelNum,jdbcType=INTEGER},
</if>
<if test="compassionateLeaveNum != null">
compassionate_leave_num = #{compassionateLeaveNum,jdbcType=INTEGER},
</if>
</set>
where ma_id = #{maId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.esms.po.MonthlyAttendance">
update monthly_attendance
set e_id = #{employee.eId,jdbcType=INTEGER},
attendance_time = #{attendanceTime,jdbcType=DATE},
sick_leave_num = #{sickLeaveNum,jdbcType=INTEGER},
overtime_hour = #{overtimeHour,jdbcType=DOUBLE},
weekend_hour = #{weekendHour,jdbcType=DOUBLE},
holiday_hour = #{holidayHour,jdbcType=DOUBLE},
late_num = #{lateNum,jdbcType=INTEGER},
early_num = #{earlyNum,jdbcType=INTEGER},
absence_num = #{absenceNum,jdbcType=INTEGER},
business_travel_num = #{businessTravelNum,jdbcType=INTEGER},
compassionate_leave_num = #{compassionateLeaveNum,jdbcType=INTEGER}
where ma_id = #{maId,jdbcType=INTEGER}
</update>
<!--by admin 按员工id和年份查询考勤-->
<select id="selectMonthlyAttendanceMapperByeEidAndTime" parameterType="map" resultType="com.esms.po.MonthlyAttendance">
select *
from
monthly_attendance ma
<where>
ma.e_id = #{e_id}
<if test="attendanceTime!=''">
and attendance_time like concat('%',#{attendance_time},'%')
</if>
</where>
ORDER BY attendance_time DESC
</select>
</mapper>

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.esms.dao.PositionMapper">
<resultMap id="BaseResultMap" type="com.esms.po.Position">
<id column="p_id" jdbcType="INTEGER" property="pId" />
<result column="p_name" jdbcType="VARCHAR" property="pName" />
<result column="p_duty" jdbcType="VARCHAR" property="pDuty" />
<result column="p_post_pay" jdbcType="DOUBLE" property="pPostPay" />
<result column="p_isdel" jdbcType="INTEGER" property="pIsdel" />
</resultMap>
<sql id="Base_Column_List">
p_id, p_name, p_duty, p_post_pay, p_isdel
</sql>
<select id="findSelective" parameterType="com.esms.po.Position" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from position
<where>
<if test="pName != '' and pName != null">
and p_name like concat('%',#{pName,jdbcType=VARCHAR},'%')
</if>
<if test="true">
and p_isdel = 1
</if>
</where>
order by p_id DESC
</select>
<select id="findByDname" parameterType="String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from position where p_name = #{pName,jdbcType=VARCHAR} and p_isdel = 1
</select>
<update id="deleteByPrimaryKey" parameterType="java.lang.Integer">
update position set p_isdel = 0 where p_id = #{pId,jdbcType=INTEGER}
</update>
<update id="deleteByQuery" parameterType="java.util.ArrayList">
update position set p_isdel = 0 where p_id in
<foreach collection="array" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from position
where p_id = #{pId,jdbcType=INTEGER}
</select>
<insert id="insert" parameterType="com.esms.po.Position">
<selectKey keyProperty="pId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into position (p_name, p_duty, p_post_pay,
p_isdel)
values (#{pName,jdbcType=VARCHAR}, #{pDuty,jdbcType=VARCHAR}, #{pPostPay,jdbcType=DOUBLE},
#{pIsdel,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.esms.po.Position">
<selectKey keyProperty="pId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into position
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="pName != null">
p_name,
</if>
<if test="pDuty != null">
p_duty,
</if>
<if test="pPostPay != null">
p_post_pay,
</if>
<if test="pIsdel != null">
p_isdel,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="pName != null">
#{pName,jdbcType=VARCHAR},
</if>
<if test="pDuty != null">
#{pDuty,jdbcType=VARCHAR},
</if>
<if test="pPostPay != null">
#{pPostPay,jdbcType=DOUBLE},
</if>
<if test="pIsdel != null">
#{pIsdel,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.esms.po.Position">
update position
<set>
<if test="pName != null">
p_name = #{pName,jdbcType=VARCHAR},
</if>
<if test="pDuty != null">
p_duty = #{pDuty,jdbcType=VARCHAR},
</if>
<if test="pPostPay != null">
p_post_pay = #{pPostPay,jdbcType=DOUBLE},
</if>
<if test="pIsdel != null">
p_isdel = #{pIsdel,jdbcType=INTEGER},
</if>
</set>
where p_id = #{pId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.esms.po.Position">
update position
set p_name = #{pName,jdbcType=VARCHAR},
p_duty = #{pDuty,jdbcType=VARCHAR},
p_post_pay = #{pPostPay,jdbcType=DOUBLE},
p_isdel = #{pIsdel,jdbcType=INTEGER}
where p_id = #{pId,jdbcType=INTEGER}
</update>
</mapper>

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.esms.dao.RankBonusMapper">
<resultMap id="BaseResultMap" type="com.esms.po.RankBonus">
<id column="rb_id" jdbcType="INTEGER" property="rbId" />
<result column="rank_name" jdbcType="VARCHAR" property="rankName" />
<result column="rb_bonus" jdbcType="INTEGER" property="rbBonus" />
</resultMap>
<sql id="Base_Column_List">
rb_id, rank_name, rb_bonus
</sql>
<select id="findSelective" parameterType="com.esms.po.RankBonus" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from rank_bonus
<where>
<if test="rankName != '' and rankName != null">
and rank_name like concat('%',#{rankName,jdbcType=VARCHAR},'%')
</if>
</where>
order by rb_id DESC
</select>
<select id="selectAll" resultType="com.esms.po.RankBonus">
select * from rank_bonus order by rb_id DESC
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from rank_bonus
where rb_id = #{rbId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from rank_bonus
where rb_id = #{rbId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.esms.po.RankBonus">
<selectKey keyProperty="rbId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into rank_bonus (rank_name, rb_bonus)
values (#{rankName,jdbcType=VARCHAR}, #{rbBonus,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.esms.po.RankBonus">
<selectKey keyProperty="rbId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into rank_bonus
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="rankName != null">
rank_name,
</if>
<if test="rbBonus != null">
rb_bonus,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="rankName != null">
#{rankName,jdbcType=VARCHAR},
</if>
<if test="rbBonus != null">
#{rbBonus,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.esms.po.RankBonus">
update rank_bonus
<set>
<if test="rankName != null">
rank_name = #{rankName,jdbcType=VARCHAR},
</if>
<if test="rbBonus != null">
rb_bonus = #{rbBonus,jdbcType=INTEGER},
</if>
</set>
where rb_id = #{rbId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.esms.po.RankBonus">
update rank_bonus
set rank_name = #{rankName,jdbcType=VARCHAR},
rb_bonus = #{rbBonus,jdbcType=INTEGER}
where rb_id = #{rbId,jdbcType=INTEGER}
</update>
<select id="CountByRankName" parameterType="java.lang.String" resultType="java.lang.Integer">
select count(*) from rank_bonus
where rank_name=#{ooo}
</select>
<select id="findByname" parameterType="String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from rank_bonus where rank_name = #{rankName,jdbcType=VARCHAR}
</select>
</mapper>

@ -0,0 +1,476 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.esms.dao.SalaryMapper">
<resultMap id="BaseResultMap" type="com.esms.po.Salary">
<id column="s_id" jdbcType="INTEGER" property="sId" />
<result column="e_id" jdbcType="INTEGER" property="eId" />
<result column="d_id" jdbcType="INTEGER" property="dId" />
<result column="s_time" jdbcType="DATE" property="sTime" />
<result column="s_state" jdbcType="INTEGER" property="sState" />
<result column="base_pay" jdbcType="DOUBLE" property="basePay" />
<result column="food_pay" jdbcType="DOUBLE" property="foodPay" />
<result column="post_pay" jdbcType="DOUBLE" property="postPay" />
<result column="working_year_pay" jdbcType="DOUBLE" property="workingYearPay" />
<result column="rank_pay" jdbcType="DOUBLE" property="rankPay" />
<result column="traffic_pay" jdbcType="DOUBLE" property="trafficPay" />
<result column="persion_pay" jdbcType="DOUBLE" property="persionPay" />
<result column="medical_pay" jdbcType="DOUBLE" property="medicalPay" />
<result column="unemployment_pay" jdbcType="DOUBLE" property="unemploymentPay" />
<result column="injury_pay" jdbcType="DOUBLE" property="injuryPay" />
<result column="birth_pay" jdbcType="DOUBLE" property="birthPay" />
<result column="housing_pay" jdbcType="DOUBLE" property="housingPay" />
<result column="late_pay" jdbcType="DOUBLE" property="latePay" />
<result column="early_pay" jdbcType="DOUBLE" property="earlyPay" />
<result column="overtime_pay" jdbcType="DOUBLE" property="overtimePay" />
<result column="sick_pay" jdbcType="DOUBLE" property="sickPay" />
<result column="thing_pay" jdbcType="DOUBLE" property="thingPay" />
<result column="business_travel_pay" jdbcType="DOUBLE" property="businessTravelPay" />
<result column="full_attendance_pay" jdbcType="DOUBLE" property="fullAttendancePay" />
<result column="rissue_pay" jdbcType="DOUBLE" property="rissuePay" />
<result column="individual_income_tax" jdbcType="DOUBLE" property="individualIncomeTax" />
<result column="should_pay" jdbcType="DOUBLE" property="shouldPay" />
<result column="actual_pay" jdbcType="DOUBLE" property="actualPay" />
<association property="employee" javaType="com.esms.po.Employee"
select="com.esms.dao.EmployeeMapper.selectByPrimaryKey" column="e_id">
</association>
<association property="department" javaType="com.esms.po.Department"
select="com.esms.dao.DepartmentMapper.selectByPrimaryKey" column="d_id">
</association>
</resultMap>
<sql id="Base_Column_List">
s_id, e_id, d_id, s_time, s_state, base_pay, food_pay, post_pay, working_year_pay,
rank_pay, traffic_pay, persion_pay, medical_pay, unemployment_pay, injury_pay, birth_pay,
housing_pay, late_pay, early_pay, overtime_pay, sick_pay, thing_pay, business_travel_pay,
full_attendance_pay, rissue_pay, individual_income_tax, should_pay, actual_pay
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from salary
where s_id = #{sId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from salary
where s_id = #{sId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.esms.po.Salary">
<selectKey keyProperty="sId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into salary (e_id, d_id, s_time,
s_state, base_pay, food_pay,
post_pay, working_year_pay, rank_pay,
traffic_pay, persion_pay, medical_pay,
unemployment_pay, injury_pay, birth_pay,
housing_pay, late_pay, early_pay,
overtime_pay, sick_pay, thing_pay,
business_travel_pay, full_attendance_pay, rissue_pay,
individual_income_tax, should_pay, actual_pay
)
values (#{employee.eId,jdbcType=INTEGER}, #{department.dId,jdbcType=INTEGER}, #{sTime,jdbcType=DATE},
#{sState,jdbcType=INTEGER}, #{basePay,jdbcType=DOUBLE}, #{foodPay,jdbcType=DOUBLE},
#{postPay,jdbcType=DOUBLE}, #{workingYearPay,jdbcType=DOUBLE}, #{rankPay,jdbcType=DOUBLE},
#{trafficPay,jdbcType=DOUBLE}, #{persionPay,jdbcType=DOUBLE}, #{medicalPay,jdbcType=DOUBLE},
#{unemploymentPay,jdbcType=DOUBLE}, #{injuryPay,jdbcType=DOUBLE}, #{birthPay,jdbcType=DOUBLE},
#{housingPay,jdbcType=DOUBLE}, #{latePay,jdbcType=DOUBLE}, #{earlyPay,jdbcType=DOUBLE},
#{overtimePay,jdbcType=DOUBLE}, #{sickPay,jdbcType=DOUBLE}, #{thingPay,jdbcType=DOUBLE},
#{businessTravelPay,jdbcType=DOUBLE}, #{fullAttendancePay,jdbcType=DOUBLE}, #{rissuePay,jdbcType=DOUBLE},
#{individualIncomeTax,jdbcType=DOUBLE}, #{shouldPay,jdbcType=DOUBLE}, #{actualPay,jdbcType=DOUBLE}
)
</insert>
<insert id="insertSelective" parameterType="com.esms.po.Salary">
<selectKey keyProperty="sId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into salary
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="employee != null">
e_id,
</if>
<if test="department != null">
d_id,
</if>
<if test="sTime != null">
s_time,
</if>
<if test="sState != null">
s_state,
</if>
<if test="basePay != null">
base_pay,
</if>
<if test="foodPay != null">
food_pay,
</if>
<if test="postPay != null">
post_pay,
</if>
<if test="workingYearPay != null">
working_year_pay,
</if>
<if test="rankPay != null">
rank_pay,
</if>
<if test="trafficPay != null">
traffic_pay,
</if>
<if test="persionPay != null">
persion_pay,
</if>
<if test="medicalPay != null">
medical_pay,
</if>
<if test="unemploymentPay != null">
unemployment_pay,
</if>
<if test="injuryPay != null">
injury_pay,
</if>
<if test="birthPay != null">
birth_pay,
</if>
<if test="housingPay != null">
housing_pay,
</if>
<if test="latePay != null">
late_pay,
</if>
<if test="earlyPay != null">
early_pay,
</if>
<if test="overtimePay != null">
overtime_pay,
</if>
<if test="sickPay != null">
sick_pay,
</if>
<if test="thingPay != null">
thing_pay,
</if>
<if test="businessTravelPay != null">
business_travel_pay,
</if>
<if test="fullAttendancePay != null">
full_attendance_pay,
</if>
<if test="rissuePay != null">
rissue_pay,
</if>
<if test="individualIncomeTax != null">
individual_income_tax,
</if>
<if test="shouldPay != null">
should_pay,
</if>
<if test="actualPay != null">
actual_pay,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="employee != null">
#{employee.eId,jdbcType=INTEGER},
</if>
<if test="department != null">
#{department.dId,jdbcType=INTEGER},
</if>
<if test="sTime != null">
#{sTime,jdbcType=DATE},
</if>
<if test="sState != null">
#{sState,jdbcType=INTEGER},
</if>
<if test="basePay != null">
#{basePay,jdbcType=DOUBLE},
</if>
<if test="foodPay != null">
#{foodPay,jdbcType=DOUBLE},
</if>
<if test="postPay != null">
#{postPay,jdbcType=DOUBLE},
</if>
<if test="workingYearPay != null">
#{workingYearPay,jdbcType=DOUBLE},
</if>
<if test="rankPay != null">
#{rankPay,jdbcType=DOUBLE},
</if>
<if test="trafficPay != null">
#{trafficPay,jdbcType=DOUBLE},
</if>
<if test="persionPay != null">
#{persionPay,jdbcType=DOUBLE},
</if>
<if test="medicalPay != null">
#{medicalPay,jdbcType=DOUBLE},
</if>
<if test="unemploymentPay != null">
#{unemploymentPay,jdbcType=DOUBLE},
</if>
<if test="injuryPay != null">
#{injuryPay,jdbcType=DOUBLE},
</if>
<if test="birthPay != null">
#{birthPay,jdbcType=DOUBLE},
</if>
<if test="housingPay != null">
#{housingPay,jdbcType=DOUBLE},
</if>
<if test="latePay != null">
#{latePay,jdbcType=DOUBLE},
</if>
<if test="earlyPay != null">
#{earlyPay,jdbcType=DOUBLE},
</if>
<if test="overtimePay != null">
#{overtimePay,jdbcType=DOUBLE},
</if>
<if test="sickPay != null">
#{sickPay,jdbcType=DOUBLE},
</if>
<if test="thingPay != null">
#{thingPay,jdbcType=DOUBLE},
</if>
<if test="businessTravelPay != null">
#{businessTravelPay,jdbcType=DOUBLE},
</if>
<if test="fullAttendancePay != null">
#{fullAttendancePay,jdbcType=DOUBLE},
</if>
<if test="rissuePay != null">
#{rissuePay,jdbcType=DOUBLE},
</if>
<if test="individualIncomeTax != null">
#{individualIncomeTax,jdbcType=DOUBLE},
</if>
<if test="shouldPay != null">
#{shouldPay,jdbcType=DOUBLE},
</if>
<if test="actualPay != null">
#{actualPay,jdbcType=DOUBLE},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.esms.po.Salary">
update salary
<set>
<if test="employee != null">
e_id = #{employee.eId,jdbcType=INTEGER},
</if>
<if test="department != null">
d_id = #{department.dId,jdbcType=INTEGER},
</if>
<if test="sTime != null">
s_time = #{sTime,jdbcType=DATE},
</if>
<if test="sState != null">
s_state = #{sState,jdbcType=INTEGER},
</if>
<if test="basePay != null">
base_pay = #{basePay,jdbcType=DOUBLE},
</if>
<if test="foodPay != null">
food_pay = #{foodPay,jdbcType=DOUBLE},
</if>
<if test="postPay != null">
post_pay = #{postPay,jdbcType=DOUBLE},
</if>
<if test="workingYearPay != null">
working_year_pay = #{workingYearPay,jdbcType=DOUBLE},
</if>
<if test="rankPay != null">
rank_pay = #{rankPay,jdbcType=DOUBLE},
</if>
<if test="trafficPay != null">
traffic_pay = #{trafficPay,jdbcType=DOUBLE},
</if>
<if test="persionPay != null">
persion_pay = #{persionPay,jdbcType=DOUBLE},
</if>
<if test="medicalPay != null">
medical_pay = #{medicalPay,jdbcType=DOUBLE},
</if>
<if test="unemploymentPay != null">
unemployment_pay = #{unemploymentPay,jdbcType=DOUBLE},
</if>
<if test="injuryPay != null">
injury_pay = #{injuryPay,jdbcType=DOUBLE},
</if>
<if test="birthPay != null">
birth_pay = #{birthPay,jdbcType=DOUBLE},
</if>
<if test="housingPay != null">
housing_pay = #{housingPay,jdbcType=DOUBLE},
</if>
<if test="latePay != null">
late_pay = #{latePay,jdbcType=DOUBLE},
</if>
<if test="earlyPay != null">
early_pay = #{earlyPay,jdbcType=DOUBLE},
</if>
<if test="overtimePay != null">
overtime_pay = #{overtimePay,jdbcType=DOUBLE},
</if>
<if test="sickPay != null">
sick_pay = #{sickPay,jdbcType=DOUBLE},
</if>
<if test="thingPay != null">
thing_pay = #{thingPay,jdbcType=DOUBLE},
</if>
<if test="businessTravelPay != null">
business_travel_pay = #{businessTravelPay,jdbcType=DOUBLE},
</if>
<if test="fullAttendancePay != null">
full_attendance_pay = #{fullAttendancePay,jdbcType=DOUBLE},
</if>
<if test="rissuePay != null">
rissue_pay = #{rissuePay,jdbcType=DOUBLE},
</if>
<if test="individualIncomeTax != null">
individual_income_tax = #{individualIncomeTax,jdbcType=DOUBLE},
</if>
<if test="shouldPay != null">
should_pay = #{shouldPay,jdbcType=DOUBLE},
</if>
<if test="actualPay != null">
actual_pay = #{actualPay,jdbcType=DOUBLE},
</if>
</set>
where s_id = #{sId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.esms.po.Salary">
update salary
set e_id = #{employee.eId,jdbcType=INTEGER},
d_id = #{department.dId,jdbcType=INTEGER},
s_time = #{sTime,jdbcType=DATE},
s_state = #{sState,jdbcType=INTEGER},
base_pay = #{basePay,jdbcType=DOUBLE},
food_pay = #{foodPay,jdbcType=DOUBLE},
post_pay = #{postPay,jdbcType=DOUBLE},
working_year_pay = #{workingYearPay,jdbcType=DOUBLE},
rank_pay = #{rankPay,jdbcType=DOUBLE},
traffic_pay = #{trafficPay,jdbcType=DOUBLE},
persion_pay = #{persionPay,jdbcType=DOUBLE},
medical_pay = #{medicalPay,jdbcType=DOUBLE},
unemployment_pay = #{unemploymentPay,jdbcType=DOUBLE},
injury_pay = #{injuryPay,jdbcType=DOUBLE},
birth_pay = #{birthPay,jdbcType=DOUBLE},
housing_pay = #{housingPay,jdbcType=DOUBLE},
late_pay = #{latePay,jdbcType=DOUBLE},
early_pay = #{earlyPay,jdbcType=DOUBLE},
overtime_pay = #{overtimePay,jdbcType=DOUBLE},
sick_pay = #{sickPay,jdbcType=DOUBLE},
thing_pay = #{thingPay,jdbcType=DOUBLE},
business_travel_pay = #{businessTravelPay,jdbcType=DOUBLE},
full_attendance_pay = #{fullAttendancePay,jdbcType=DOUBLE},
rissue_pay = #{rissuePay,jdbcType=DOUBLE},
individual_income_tax = #{individualIncomeTax,jdbcType=DOUBLE},
should_pay = #{shouldPay,jdbcType=DOUBLE},
actual_pay = #{actualPay,jdbcType=DOUBLE}
where s_id = #{sId,jdbcType=INTEGER}
</update>
<!--根据员工编号和时间查找工资记录 by方宏泰-->
<select id="selectByEidAndTime" resultMap="BaseResultMap">
SELECT *
from salary
where e_id = #{arg0,jdbcType=INTEGER} and
s_time = #{arg1,jdbcType=VARCHAR}
</select>
<!--根据部门编号和时间查最低工资,平均工资,最高工资 by方宏泰-->
<select id="selectSalaryByDepartment" resultType="com.esms.vo.EchSalary">
SELECT MIN(actual_pay) as minSalary,AVG(actual_pay) as avgSalary,MAX(actual_pay) as maxSalary
from salary
where d_id=#{arg0} and strcmp(date_format(s_time,'%Y-%m'),#{arg1}) = 0
</select>
<!--根据部门编号和年月时间查工资总数 by方宏泰-->
<select id="selectAllSalaryByDepartment" resultType="java.lang.Double">
SELECT SUM(actual_pay)
from salary
where d_id=#{arg0} and strcmp(date_format(s_time,'%Y-%m'),#{arg1}) = 0
</select>
<!--根据部门编号和年时间查工资总数 by方宏泰-->
<select id="selectAllSalaryByDepAndYear" resultType="java.lang.Double">
SELECT SUM(actual_pay)
from salary
where d_id=#{arg0} and strcmp(date_format(s_time,'%Y'),#{arg1}) = 0
</select>
<!--根据年月时间查工资总数 by方宏泰-->
<select id="selectAllSalaryByDate" resultType="java.lang.Double">
SELECT SUM(actual_pay)
from salary
where strcmp(date_format(s_time,'%Y-%m'),#{date}) = 0
</select>
<!--多条件查询员工工号部门ID时间年月by方宏泰-->
<!--and e.e_account =#{eAccount}-->
<select id="selectByEaccountDIdDate" parameterType="map" resultMap="BaseResultMap">
select
s_id, s.e_id , s.d_id , s_time, s_state, base_pay, food_pay, post_pay, working_year_pay,
rank_pay, traffic_pay, persion_pay, medical_pay, unemployment_pay, injury_pay, birth_pay,
housing_pay, late_pay, early_pay, overtime_pay, sick_pay, thing_pay, business_travel_pay,
full_attendance_pay, rissue_pay, individual_income_tax, should_pay, actual_pay
from employee e,department d,salary s
<where>
e.e_id = s.e_id and d.d_id = s.d_id
<if test="eAccount!=null and eAccount!=''">
and e.e_account like concat('%',#{eAccount},'%')
</if>
<if test="dId!=null">
and d.d_id = #{dId}
</if>
<if test="sTime!=null and sTime!=''">
and strcmp(date_format(s_time,'%Y-%m'),#{sTime}) = 0
</if>
</where>
ORDER BY s_time DESC
</select>
<!--根据员工id和年时间查工资总记录 byadmin-->
<select id="selectEmployeeSalaryList" resultType="com.esms.po.Salary">
SELECT *
from salary
where e_id=#{arg0} and strcmp(date_format(s_time,'%Y'),#{arg1}) = 0 ORDER BY s_time DESC
</select>
<select id="selectByeId" parameterType="java.lang.Integer" resultType="com.esms.po.Salary">
select *
from salary
where e_id = #{eId,jdbcType=INTEGER} ORDER BY s_time DESC
</select>
<!--// 通过date 和 转态为 1-->
<select id="selectByeTimeAndStatus" resultType="com.esms.po.Salary">
select *
from salary
where strcmp(date_format(s_time,'%Y-%m'),#{arg0}) = 0 and s_state = #{arg1}
</select>
<!--// 通过date 和 eid 和转态为 1-->
<select id="selectByEidAndTimeAndStatus" resultType="com.esms.po.Salary">
select *
from salary
where e_id=#{arg0} and strcmp(date_format(s_time,'%Y-%m'),#{arg1}) = 0 and s_state = #{arg2}
</select>
<!--多条件查询员工工号部门ID时间年月转态byadmin-->
<select id="selectByEaccountDIdDateState" parameterType="map" resultMap="BaseResultMap">
select
s_id, s.e_id , s.d_id , s_time, s_state, base_pay, food_pay, post_pay, working_year_pay,
rank_pay, traffic_pay, persion_pay, medical_pay, unemployment_pay, injury_pay, birth_pay,
housing_pay, late_pay, early_pay, overtime_pay, sick_pay, thing_pay, business_travel_pay,
full_attendance_pay, rissue_pay, individual_income_tax, should_pay, actual_pay
from employee e,department d,salary s
<where>
e.e_id = s.e_id and d.d_id = s.d_id
<if test="eAccount!=null and eAccount!=''">
and e.e_account like concat('%',#{eAccount},'%')
</if>
<if test="dId!=null">
and d.d_id = #{dId}
</if>
<if test="sTime!=null and sTime!=''">
and strcmp(date_format(s_time,'%Y-%m'),#{sTime}) = 0
</if>
and s_state = 0
</where>
ORDER BY s_time DESC
</select>
</mapper>

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.esms.dao.SystemManagerMapper">
<resultMap id="BaseResultMap" type="com.esms.po.SystemManager">
<id column="sm_id" jdbcType="INTEGER" property="smId" />
<result column="sm_account" jdbcType="VARCHAR" property="smAccount" />
<result column="sm_password" jdbcType="VARCHAR" property="smPassword" />
</resultMap>
<sql id="Base_Column_List">
sm_id, sm_account, sm_password
</sql>
<select id="selectByAccountAndPassword" parameterType="com.esms.po.SystemManager" resultType="com.esms.po.SystemManager">
select * from system_manager where sm_account = #{smAccount} and sm_password = #{smPassword}
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from system_manager
where sm_id = #{smId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from system_manager
where sm_id = #{smId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.esms.po.SystemManager">
<selectKey keyProperty="smId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into system_manager (sm_account, sm_password)
values (#{smAccount,jdbcType=VARCHAR}, #{smPassword,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.esms.po.SystemManager">
<selectKey keyProperty="smId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into system_manager
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="smAccount != null">
sm_account,
</if>
<if test="smPassword != null">
sm_password,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="smAccount != null">
#{smAccount,jdbcType=VARCHAR},
</if>
<if test="smPassword != null">
#{smPassword,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.esms.po.SystemManager">
update system_manager
<set>
<if test="smAccount != null">
sm_account = #{smAccount,jdbcType=VARCHAR},
</if>
<if test="smPassword != null">
sm_password = #{smPassword,jdbcType=VARCHAR},
</if>
</set>
where sm_id = #{smId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.esms.po.SystemManager">
update system_manager
set sm_account = #{smAccount,jdbcType=VARCHAR},
sm_password = #{smPassword,jdbcType=VARCHAR}
where sm_id = #{smId,jdbcType=INTEGER}
</update>
</mapper>

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.esms.dao.WorkingYearsBonusMapper">
<resultMap id="BaseResultMap" type="com.esms.po.WorkingYearsBonus">
<id column="wyb_id" jdbcType="INTEGER" property="wybId" />
<result column="wyb_year" jdbcType="INTEGER" property="wybYear" />
<result column="wyb_bonus" jdbcType="DOUBLE" property="wybBonus" />
</resultMap>
<sql id="Base_Column_List">
wyb_id, wyb_year, wyb_bonus
</sql>
<select id="findSelective" parameterType="com.esms.po.WorkingYearsBonus" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from working_years_bonus
<where>
<if test="wybYear >0">
and wyb_year =#{wybYear,jdbcType=INTEGER}
</if>
</where>
order by wyb_id DESC
</select>
<select id="selectAll" resultType="com.esms.po.WorkingYearsBonus">
select * from working_years_bonus order by wyb_id DESC
</select>
<select id="countByYear" resultType="java.lang.Integer">
select count(*)from working_years_bonus
where wyb_year=#{ooo}
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from working_years_bonus
where wyb_id = #{wybId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from working_years_bonus
where wyb_id = #{wybId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.esms.po.WorkingYearsBonus">
<selectKey keyProperty="wybId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into working_years_bonus (wyb_year, wyb_bonus)
values (#{wybYear,jdbcType=INTEGER}, #{wybBonus,jdbcType=DOUBLE})
</insert>
<insert id="insertSelective" parameterType="com.esms.po.WorkingYearsBonus">
<selectKey keyProperty="wybId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into working_years_bonus
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="wybYear != null">
wyb_year,
</if>
<if test="wybBonus != null">
wyb_bonus,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="wybYear != null">
#{wybYear,jdbcType=INTEGER},
</if>
<if test="wybBonus != null">
#{wybBonus,jdbcType=DOUBLE},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.esms.po.WorkingYearsBonus">
update working_years_bonus
<set>
<if test="wybYear != null">
wyb_year = #{wybYear,jdbcType=INTEGER},
</if>
<if test="wybBonus != null">
wyb_bonus = #{wybBonus,jdbcType=DOUBLE},
</if>
</set>
where wyb_id = #{wybId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.esms.po.WorkingYearsBonus">
update working_years_bonus
set wyb_year = #{wybYear,jdbcType=INTEGER},
wyb_bonus = #{wybBonus,jdbcType=DOUBLE}
where wyb_id = #{wybId,jdbcType=INTEGER}
</update>
<select id="findByYear" parameterType="int" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from working_years_bonus where wyb_year = #{wybYear,jdbcType=INTEGER}
</select>
</mapper>

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<!-- 是否开启自动驼峰命名规则 -->
<settings>
<setting name="mapUnderscoreToCamelCase" value="true"/>
<!--开启懒加载-->
<setting name="lazyLoadingEnabled" value="true"/>
<!--关闭积极加载-->
<setting name="aggressiveLazyLoading" value="false"/>
</settings>
<!-- 定义别名 -->
<typeAliases>
<package name="com.esms.po"/>
</typeAliases>
<!-- 引入分页插件 pagehelper -->
<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<!--分页参数合理化 防止出现-1页或者超出最大页数-->
<property name="reasonable" value="true"/>
</plugin>
</plugins>
</configuration>

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd">
<!--SpringMVC的配置文件包含网站跳转逻辑的控制配置 -->
<!--base-package:xxx(xxx.po,xxx.controller)基础包 -->
<context:component-scan base-package="com.esms">
<!--只扫描控制器。 -->
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<!--<context:component-scan base-package="com.esms.controller"></context:component-scan>-->
<!-- 视图解析器解析jsp解析默认使用jstl标签classpath下的得有jstl的包-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 配置页面路径的前缀 -->
<property name="prefix" value="/WEB-INF/page/"/>
<!-- 配置jsp路径的后缀 -->
<!--<property name="suffix" value=".html"/>-->
</bean>
<!--注解适配器和注解映射器-->
<mvc:annotation-driven></mvc:annotation-driven>
<!-- 防止静态资源被拦截 -->
<mvc:default-servlet-handler/>
<!--注册multipart解析器-->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="defaultEncoding" value="utf-8"/>
<property name="maxUploadSize" value="1048576"/>
</bean>
<!--配置拦截器-->
<!--<mvc:interceptors>-->
<!--<mvc:interceptor>-->
<!--<mvc:mapping path="/department/**"/>-->
<!--<mvc:mapping path="/employee/**"/>-->
<!--<mvc:mapping path="/monthlyattendance/**"/>-->
<!--<mvc:exclude-mapping path="/"/>-->
<!--<bean class="com.esms.interceptor.LoginInterceptor"></bean>-->
<!--</mvc:interceptor>-->
<!--</mvc:interceptors>-->
</beans>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save