当前位置:   article > 正文

HRS人力资源系统_hrs name

hrs name

项目结构:

 

 

  1. application.properties
    1. server.port=8080
    2. # jsp view
    3. spring.mvc.view.prefix=/views/jsp/
    4. spring.mvc.view.suffix=.jsp
    5. #UTF-8encoding
    6. spring.http.encoding.force=true
    7. spring.http.encoding.charset=UTF-8
    8. spring.http.encoding.enabled=true
    9. server.tomcat.uri-encoding=UTF-8
    10. #mysql datasource
    11. spring.datasource.driverClassName = com.mysql.jdbc.Driver
    12. spring.datasource.url = jdbc:mysql://localhost:3306/hrs?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    13. spring.datasource.username = root
    14. spring.datasource.password = root
    15. #spring data jpa & mysql
    16. spring.jpa.database = MYSQL
    17. spring.jpa.show-sql = true
    18. spring.jpa.hibernate.ddl-auto = update
    19. spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
    20. spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

     

  2. pom.xml

    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    4. <modelVersion>4.0.0</modelVersion>
    5. <parent>
    6. <groupId>org.springframework.boot</groupId>
    7. <artifactId>spring-boot-starter-parent</artifactId>
    8. <version>2.1.1.RELEASE</version>
    9. <relativePath/> <!-- lookup parent from repository -->
    10. </parent>
    11. <groupId>com.hrs</groupId>
    12. <artifactId>hrs</artifactId>
    13. <version>0.0.1-SNAPSHOT</version>
    14. <packaging>war</packaging>
    15. <name>hrs</name>
    16. <description>Demo project for Spring Boot</description>
    17. <properties>
    18. <java.version>1.8</java.version>
    19. <mysql-connector-version>5.1.47</mysql-connector-version>
    20. </properties>
    21. <dependencies>
    22. <dependency>
    23. <groupId>org.springframework.boot</groupId>
    24. <artifactId>spring-boot-starter-data-jpa</artifactId>
    25. </dependency>
    26. <dependency>
    27. <groupId>org.springframework.boot</groupId>
    28. <artifactId>spring-boot-starter-web</artifactId>
    29. </dependency>
    30. <dependency>
    31. <groupId>org.apache.commons</groupId>
    32. <artifactId>commons-lang3</artifactId>
    33. </dependency>
    34. <dependency>
    35. <groupId>org.springframework.boot</groupId>
    36. <artifactId>spring-boot-devtools</artifactId>
    37. <scope>runtime</scope>
    38. </dependency>
    39. <dependency>
    40. <groupId>mysql</groupId>
    41. <artifactId>mysql-connector-java</artifactId>
    42. <version>${mysql-connector-version}</version>
    43. <scope>runtime</scope>
    44. </dependency>
    45. <dependency>
    46. <groupId>org.springframework.boot</groupId>
    47. <artifactId>spring-boot-starter-tomcat</artifactId>
    48. <scope>provided</scope>
    49. </dependency>
    50. <dependency>
    51. <groupId>org.apache.commons</groupId>
    52. <artifactId>commons-lang3</artifactId>
    53. </dependency>
    54. <dependency>
    55. <groupId>org.springframework.boot</groupId>
    56. <artifactId>spring-boot-starter-test</artifactId>
    57. <scope>test</scope>
    58. </dependency>
    59. </dependencies>
    60. <build>
    61. <plugins>
    62. <plugin>
    63. <groupId>org.springframework.boot</groupId>
    64. <artifactId>spring-boot-maven-plugin</artifactId>
    65. </plugin>
    66. </plugins>
    67. </build>
    68. </project>

     

  3. dao

    1. package com.hrs.youzhenjie.employee.dao;
    2. import java.util.List;
    3. import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
    4. import org.springframework.data.repository.PagingAndSortingRepository;
    5. import org.springframework.stereotype.Repository;
    6. import com.hrs.youzhenjie.employee.domain.Employee;
    7. @Repository
    8. public interface IEmployeeDao extends PagingAndSortingRepository<Employee, Long>, JpaSpecificationExecutor<Employee> {
    9. //JPA 高级查询
    10. public Employee findByEmployeeId(String name);
    11. public Employee findByEmployeeName(String employeeName);
    12. }

     

  4. domain

    1. package com.hrs.youzhenjie.employee.domain;
    2. import java.util.Date;
    3. import javax.persistence.CascadeType;
    4. import javax.persistence.Column;
    5. import javax.persistence.Entity;
    6. import javax.persistence.FetchType;
    7. import javax.persistence.GeneratedValue;
    8. import javax.persistence.GenerationType;
    9. import javax.persistence.Id;
    10. import javax.persistence.JoinColumn;
    11. import javax.persistence.OneToOne;
    12. import javax.persistence.Table;
    13. import javax.persistence.Temporal;
    14. import javax.persistence.TemporalType;
    15. import javax.validation.constraints.NotNull;
    16. import org.springframework.format.annotation.DateTimeFormat;
    17. import org.springframework.lang.NonNull;
    18. import com.fasterxml.jackson.annotation.JsonFormat;
    19. import com.hrs.common.BaseDomain;
    20. import com.hrs.youzhenjie.contract.domain.Contract;
    21. import jdk.nashorn.internal.ir.annotations.Reference;
    22. @Entity
    23. @Table(name = "t_employee")
    24. public class Employee extends BaseDomain<Long> {
    25. private String employeeId;// 工号
    26. private String employeeName;// 姓名
    27. private String employeeSex;// 性别
    28. private String employeeDepartment;// 部门
    29. private String employeePosition;// 职位
    30. private String employeeTel;// 电话
    31. private String employeeState;// 在职状态
    32. private Date employeeEntryTime;// 入职日期
    33. private Date employeeLeaveTime;// 离职日期
    34. //private Contract contract;
    35. // @OneToOne(cascade=CascadeType.ALL)
    36. //@JoinColumn(name="referenceId")
    37. //
    38. //@OneToOne(fetch=FetchType.EAGER,mappedBy="employee")
    39. // public Contract getContract() {
    40. // return contract;
    41. // }
    42. @Column(unique = true, nullable = false)
    43. @NotNull
    44. public String getEmployeeId() {
    45. return employeeId;
    46. }
    47. public String getEmployeeName() {
    48. return employeeName;
    49. }
    50. public String getEmployeeSex() {
    51. return employeeSex;
    52. }
    53. public String getEmployeeDepartment() {
    54. return employeeDepartment;
    55. }
    56. public String getEmployeePosition() {
    57. return employeePosition;
    58. }
    59. public String getEmployeeTel() {
    60. return employeeTel;
    61. }
    62. @Column(length = 1)
    63. public String getEmployeeState() {
    64. return employeeState;
    65. }
    66. @Temporal(TemporalType.DATE)
    67. // @DateTimeFormat(pattern="yyyy/MM/dd")
    68. @JsonFormat(pattern = "yyyy/MM/dd", timezone = "GMT+8")
    69. public Date getEmployeeEntryTime() {
    70. return employeeEntryTime;
    71. }
    72. @Temporal(TemporalType.DATE)
    73. // @DateTimeFormat(pattern="yyyy/MM/dd")
    74. @JsonFormat(pattern = "yyyy/MM/dd", timezone = "GMT+8")
    75. public Date getEmployeeLeaveTime() {
    76. return employeeLeaveTime;
    77. }
    78. public void setEmployeeId(String employeeId) {
    79. this.employeeId = employeeId;
    80. }
    81. public void setEmployeeName(String employeeName) {
    82. this.employeeName = employeeName;
    83. }
    84. public void setEmployeeSex(String employeeSex) {
    85. this.employeeSex = employeeSex;
    86. }
    87. public void setEmployeeDepartment(String employeeDepartment) {
    88. this.employeeDepartment = employeeDepartment;
    89. }
    90. public void setEmployeePosition(String employeePosition) {
    91. this.employeePosition = employeePosition;
    92. }
    93. public void setEmployeeTel(String employeeTel) {
    94. this.employeeTel = employeeTel;
    95. }
    96. public void setEmployeeState(String employeeState) {
    97. this.employeeState = employeeState;
    98. }
    99. public void setEmployeeEntryTime(Date employeeEntryTime) {
    100. this.employeeEntryTime = employeeEntryTime;
    101. }
    102. public void setEmployeeLeaveTime(Date employeeLeaveTime) {
    103. this.employeeLeaveTime = employeeLeaveTime;
    104. }
    105. // public void setContract(Contract contract) {
    106. // this.contract = contract;
    107. // }
    108. }

     

  5. Dto

    1. package com.hrs.youzhenjie.employee.domain;
    2. import java.util.ArrayList;
    3. import java.util.Date;
    4. import java.util.List;
    5. import javax.persistence.criteria.CriteriaBuilder;
    6. import javax.persistence.criteria.CriteriaQuery;
    7. import javax.persistence.criteria.Predicate;
    8. import javax.persistence.criteria.Root;
    9. import org.apache.commons.lang3.StringUtils;
    10. import org.springframework.data.jpa.domain.Specification;
    11. import org.springframework.format.annotation.DateTimeFormat;
    12. import com.fasterxml.jackson.annotation.JsonFormat;
    13. public class EmployeeQueryDTO {
    14. // 查询的参数
    15. private String employeeId;// 工号
    16. @JsonFormat(pattern = "yyyy/MM/dd")
    17. @DateTimeFormat(pattern="yyyy/MM/dd")
    18. private Date employeeEntryTime;// 入职日期
    19. @JsonFormat(pattern = "yyyy/MM/dd")
    20. @DateTimeFormat(pattern="yyyy/MM/dd")
    21. private Date employeeLeaveTime;// 离职日期
    22. private String employeeDepartment;// 部门
    23. private String employeePosition;// 职位
    24. @SuppressWarnings({ "serial" })
    25. public static Specification<Employee> getWhereClause(final EmployeeQueryDTO employeeQueryDTO) {
    26. return new Specification<Employee>() {
    27. @Override
    28. public Predicate toPredicate(Root<Employee> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
    29. List<Predicate> predicate = new ArrayList<>();
    30. if (StringUtils.isNotBlank(employeeQueryDTO.getEmployeeId())) {
    31. predicate.add(criteriaBuilder.like(root.get("employeeId").as(String.class),
    32. "%" + employeeQueryDTO.getEmployeeId() + "%"));
    33. }
    34. if (null != employeeQueryDTO.getEmployeeEntryTime()) {
    35. predicate.add(criteriaBuilder.greaterThanOrEqualTo(root.get("employeeEntryTime").as(Date.class),
    36. employeeQueryDTO.getEmployeeEntryTime()));
    37. }
    38. if (null != employeeQueryDTO.getEmployeeLeaveTime()) {
    39. predicate.add(criteriaBuilder.lessThanOrEqualTo(root.get("employeeLeaveTime").as(Date.class),
    40. employeeQueryDTO.getEmployeeLeaveTime()));
    41. }
    42. if (null != employeeQueryDTO.getEmployeeDepartment()) {
    43. predicate.add(criteriaBuilder.like(root.get("employeeDepartment").as(String.class),
    44. "%" + employeeQueryDTO.getEmployeeDepartment() + "%"));
    45. }
    46. if (null != employeeQueryDTO.getEmployeePosition()) {
    47. predicate.add(criteriaBuilder.like(root.get("employeePosition").as(String.class),
    48. "%" + employeeQueryDTO.getEmployeePosition() + "%"));
    49. }
    50. Predicate[] pre = new Predicate[predicate.size()];
    51. return query.where(predicate.toArray(pre)).getRestriction();
    52. }
    53. };
    54. }
    55. public String getEmployeeId() {
    56. return employeeId;
    57. }
    58. public void setEmployeeId(String employeeId) {
    59. this.employeeId = employeeId;
    60. }
    61. public Date getEmployeeEntryTime() {
    62. return employeeEntryTime;
    63. }
    64. public void setEmployeeEntryTime(Date employeeEntryTime) {
    65. this.employeeEntryTime = employeeEntryTime;
    66. }
    67. public Date getEmployeeLeaveTime() {
    68. return employeeLeaveTime;
    69. }
    70. public void setEmployeeLeaveTime(Date employeeLeaveTime) {
    71. this.employeeLeaveTime = employeeLeaveTime;
    72. }
    73. public String getEmployeeDepartment() {
    74. return employeeDepartment;
    75. }
    76. public void setEmployeeDepartment(String employeeDepartment) {
    77. this.employeeDepartment = employeeDepartment;
    78. }
    79. public String getEmployeePosition() {
    80. return employeePosition;
    81. }
    82. public void setEmployeePosition(String employeePosition) {
    83. this.employeePosition = employeePosition;
    84. }
    85. }

     

  6. service

    1. package com.hrs.youzhenjie.employee.service;
    2. import java.util.ArrayList;
    3. import java.util.List;
    4. import java.util.Optional;
    5. import org.springframework.beans.factory.annotation.Autowired;
    6. import org.springframework.data.domain.Page;
    7. import org.springframework.data.domain.Pageable;
    8. import org.springframework.data.jpa.domain.Specification;
    9. import org.springframework.stereotype.Service;
    10. import org.springframework.transaction.annotation.Transactional;
    11. import com.hrs.youzhenjie.employee.dao.IEmployeeDao;
    12. import com.hrs.youzhenjie.employee.domain.Employee;
    13. @Service
    14. @Transactional
    15. public class EmployeeService implements IEmployeeService {
    16. @Autowired
    17. private IEmployeeDao employeeDao;
    18. @Override
    19. public Employee saveOrUpdate(Employee employee) {
    20. System.out.println(employee.getEmployeeId());
    21. return employeeDao.save(employee);
    22. }
    23. @Override
    24. public Optional<Employee> searchById(Long id) {
    25. // TODO Auto-generated method stub
    26. return employeeDao.findById(id);
    27. }
    28. @Override
    29. @Transactional(readOnly = true)
    30. public List<Employee> searchAll() {
    31. // TODO Auto-generated method stub
    32. return (List<Employee>) employeeDao.findAll();
    33. }
    34. @Override
    35. public Page<Employee> searchAllByPage(Specification<Employee> sepc, Pageable pageable) {
    36. // TODO Auto-generated method stub
    37. return employeeDao.findAll(sepc, pageable);
    38. }
    39. @Override
    40. public Employee findByEmployeeId(String empid) {
    41. // TODO Auto-generated method stub
    42. return employeeDao.findByEmployeeId(empid);
    43. }
    44. @Override
    45. public void deleteById(Long id) {
    46. // TODO Auto-generated method stub
    47. if (employeeDao.findById(id) != null) {
    48. employeeDao.deleteById(id);
    49. }
    50. }
    51. @Override
    52. @Transactional(readOnly = true)
    53. public long count() {
    54. // TODO Auto-generated method stub
    55. return employeeDao.count();
    56. }
    57. @Override
    58. @Transactional(readOnly = true)
    59. public boolean existsById(Long id) {
    60. // TODO Auto-generated method stub
    61. return employeeDao.existsById(id);
    62. }
    63. @Override
    64. public void deleteAll(Long[] ids) {
    65. List<Long> empIdLists = new ArrayList<Long>();
    66. for (int i = 0; i < ids.length; i++) {
    67. empIdLists.add(ids[i]);
    68. }
    69. List<Employee> employees = (List<Employee>) employeeDao.findAllById(empIdLists);
    70. if (employees != null) {
    71. employeeDao.deleteAll(employees);
    72. }
    73. }
    74. @Override
    75. public Employee findByEmployeeName(String employeeName) {
    76. return employeeDao.findByEmployeeName(employeeName);
    77. }
    78. }

     

  7. serviceimpl

    1. package com.hrs.youzhenjie.employee.service;
    2. import java.util.List;
    3. import java.util.Optional;
    4. import org.springframework.data.domain.Page;
    5. import org.springframework.data.domain.Pageable;
    6. import org.springframework.data.jpa.domain.Specification;
    7. import com.hrs.youzhenjie.employee.domain.Employee;
    8. public interface IEmployeeService {
    9. /*
    10. *
    11. */
    12. //通过ID查询
    13. public Optional<Employee> searchById(Long id);
    14. //查询所有(没有分页)
    15. public List<Employee> searchAll();
    16. //查询所有(分页)
    17. public Page<Employee> searchAllByPage(Specification<Employee> sepc,Pageable pageable);
    18. //通过名字查询
    19. public Employee findByEmployeeId(String name);
    20. //通过employeeName查询
    21. public Employee findByEmployeeName(String employeeName);
    22. /*
    23. *&&&&
    24. * 软删除:
    25. * 删除员工相当于update员工的在职状态为0
    26. */
    27. public Employee saveOrUpdate(Employee employee);
    28. //预留删除接口:
    29. public void deleteById(Long id);
    30. public void deleteAll(Long[] ids);
    31. //统计
    32. public long count();
    33. //是否存在
    34. public boolean existsById(Long id);
    35. }

     

  8. controller

    1. package com.hrs.youzhenjie.employee.web;
    2. import java.text.ParseException;
    3. import java.text.SimpleDateFormat;
    4. import java.util.Date;
    5. import java.util.HashMap;
    6. import java.util.Map;
    7. import javax.servlet.http.HttpServletRequest;
    8. import javax.servlet.http.HttpSession;
    9. import org.springframework.beans.factory.annotation.Autowired;
    10. import org.springframework.data.domain.Page;
    11. import org.springframework.http.MediaType;
    12. import org.springframework.web.bind.annotation.DeleteMapping;
    13. import org.springframework.web.bind.annotation.GetMapping;
    14. import org.springframework.web.bind.annotation.PathVariable;
    15. import org.springframework.web.bind.annotation.PostMapping;
    16. import org.springframework.web.bind.annotation.PutMapping;
    17. import org.springframework.web.bind.annotation.RequestBody;
    18. import org.springframework.web.bind.annotation.RequestMapping;
    19. import org.springframework.web.bind.annotation.RequestParam;
    20. import org.springframework.web.bind.annotation.ResponseBody;
    21. import org.springframework.web.bind.annotation.RestController;
    22. import org.springframework.web.context.request.RequestContextHolder;
    23. import org.springframework.web.context.request.ServletRequestAttributes;
    24. import com.hrs.common.beans.BeanUtils;
    25. import com.hrs.common.beans.SessionUtil;
    26. import com.hrs.common.web.ExtAjaxResponse;
    27. import com.hrs.common.web.ExtjsPageRequest;
    28. import com.hrs.huangwenkang.entry.service.IEntryService;
    29. import com.hrs.youzhenjie.employee.domain.Employee;
    30. import com.hrs.youzhenjie.employee.domain.EmployeeQueryDTO;
    31. import com.hrs.youzhenjie.employee.service.IEmployeeService;
    32. import com.hrs.zhanshiyang.log.domain.Log;
    33. import com.hrs.zhanshiyang.log.domain.LogDTO;
    34. import com.hrs.zhanshiyang.log.service.ILogService;
    35. import com.hrs.zhanshiyang.record.domain.RecordDTO;
    36. import com.hrs.zhanshiyang.record.service.IRecordService;
    37. @RestController
    38. @RequestMapping(value = "employee")
    39. public class EmployeeController {
    40. @Autowired
    41. private IEmployeeService employeeService;
    42. @Autowired
    43. private ILogService logService;
    44. @Autowired
    45. private IEntryService entryService;
    46. @Autowired
    47. private IRecordService recordService;
    48. // 花名册的主页 分页+显示所有信息
    49. /*
    50. * 查询所有
    51. */
    52. @GetMapping
    53. public Page<Employee> findAll(EmployeeQueryDTO dto, ExtjsPageRequest pageRequest) {
    54. return employeeService.searchAllByPage(dto.getWhereClause(dto), pageRequest.getPageable());
    55. }
    56. /*
    57. * 查询一个
    58. */
    59. @GetMapping(value = "{id}")
    60. public Employee findOne(@PathVariable Long id) {
    61. System.out.println(id);
    62. return employeeService.searchById(id).get();
    63. }
    64. /*
    65. * 添加数据
    66. */
    67. @PostMapping("/save")
    68. public ExtAjaxResponse save(@RequestParam(value = "id") String id,
    69. @RequestParam(value = "resumeId") String resumeId,
    70. @RequestParam(value = "entryName") String entryName,
    71. @RequestParam(value = "entrySex") String entrySex,
    72. @RequestParam(value = "entrybranch") String entrybranch,
    73. @RequestParam(value = "entryposition") String entryposition,
    74. @RequestParam(value = "entryTel") String entryTel,
    75. @RequestParam(value = "entryConfirmedEntryDate") String entryConfirmedEntryDate) throws ParseException{
    76. //String类型转换为Long
    77. Long i=Long.valueOf(id);
    78. int resume=Integer.valueOf(resumeId);
    79. Employee domain=new Employee();
    80. Date date=new Date(entryConfirmedEntryDate);
    81. //String类型转换为Date
    82. SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
    83. Date dateSql = sdf.parse(entryConfirmedEntryDate);
    84. domain.setEmployeeName(entryName);//姓名
    85. domain.setEmployeeSex(entrySex);//性别
    86. domain.setEmployeeDepartment(entrybranch);//部门
    87. domain.setEmployeePosition(entryposition);//职位
    88. domain.setEmployeeTel(entryTel);//电话
    89. domain.setEmployeeState("1");//状态
    90. domain.setEmployeeEntryTime(dateSql);//入职时间
    91. //Log表
    92. LogDTO log=new LogDTO();
    93. String partId;
    94. if(resume<10) {
    95. //工号自定义
    96. partId=new SimpleDateFormat("yyMMdd").format(date)+"0"+resumeId;
    97. domain.setEmployeeId(partId);
    98. System.out.println("Loging start");
    99. log.setEmployeeId(partId);
    100. System.out.println("Loging end");
    101. }else {
    102. partId=new SimpleDateFormat("yyMMdd").format(date)+resumeId;
    103. domain.setEmployeeId(partId);
    104. log.setEmployeeId(partId);
    105. log.setEmployeeName(entryName);
    106. log.setLogPermission("9");
    107. }
    108. try {
    109. //写入employee表
    110. employeeService.saveOrUpdate(domain);
    111. //更新状态
    112. entryService.updateEntryRes(i);
    113. //写入log登录表
    114. logService.save(log);
    115. //日志
    116. writeLog("修改待入职表状态并添加");
    117. return new ExtAjaxResponse(true,"保存成功!");
    118. }catch(Exception e) {
    119. return new ExtAjaxResponse(true,"保存失败!");
    120. }
    121. }
    122. /*
    123. * 更新update
    124. */
    125. @PutMapping(value = "{id}")
    126. public ExtAjaxResponse update(@PathVariable("id") Long id, @RequestBody Employee employeedto) {
    127. System.out.println("update-------------------------" + id);
    128. try {
    129. Employee emp = employeeService.searchById(id).get();
    130. if (emp != null) {
    131. BeanUtils.copyProperties(employeedto, emp);// 使用自定义的BeanUtils
    132. employeeService.saveOrUpdate(emp);
    133. //日志
    134. writeLog("修改");
    135. }
    136. return new ExtAjaxResponse(true, "更新成功!");
    137. } catch (Exception e) {
    138. return new ExtAjaxResponse(false, "更新失败!");
    139. }
    140. }
    141. /*
    142. * 更新状态
    143. */
    144. /*
    145. * 删除 设置state为0
    146. */
    147. // 删除
    148. @DeleteMapping(value = "{id}")
    149. public ExtAjaxResponse delete(@PathVariable("id") Long id) {
    150. System.out.println("单个删除-- -------------------------------------------id:" + id);
    151. try {
    152. if (id != null) {
    153. employeeService.deleteById(id);
    154. //日志
    155. writeLog("删除");
    156. }
    157. return new ExtAjaxResponse(true, "删除成功!");
    158. } catch (Exception e) {
    159. return new ExtAjaxResponse(false, "删除失败!");
    160. }
    161. }
    162. @PostMapping("/deletes")
    163. public ExtAjaxResponse deleteRows(@RequestParam(name = "ids") Long[] ids) {
    164. System.out.println("批量删除-----------------");
    165. for (int i = 0; i < ids.length; i++) {
    166. System.out.println(ids[i]);
    167. writeLog("批量删除:删除");
    168. }
    169. try {
    170. if (ids != null) {
    171. employeeService.deleteAll(ids);
    172. }
    173. return new ExtAjaxResponse(true, "批量删除成功!");
    174. } catch (Exception e) {
    175. return new ExtAjaxResponse(false, "批量删除失败!");
    176. }
    177. }
    178. @RequestMapping(value = "/findByEmployeeId")
    179. public @ResponseBody ExtAjaxResponse findByEmployeeId(@RequestParam("employeeId") String employeeId) {
    180. System.out.println(employeeId);
    181. Employee emp=employeeService.findByEmployeeId(employeeId);
    182. if(emp!=null) {
    183. Map<String,String> map=new HashMap<String, String>();
    184. map.put("employeeName", emp.getEmployeeName());
    185. System.out.println("123"+emp.getEmployeeName());
    186. map.put("msg", "获取成功!");
    187. return new ExtAjaxResponse(true,map);
    188. } else {
    189. return new ExtAjaxResponse(false,"获取失败");
    190. }
    191. }
    192. //日志方法
    193. public void writeLog(String operation){
    194. HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
    195. HttpSession session=request.getSession();
    196. String employeeId=SessionUtil.getEmployeeId(session);
    197. RecordDTO recordDTO = new RecordDTO();
    198. recordDTO.setEmployeeId(employeeId);
    199. recordDTO.setRecordContent(operation+" 员工信息成功");
    200. recordDTO.setRecordTime(new Date());
    201. recordService.save(recordDTO);
    202. }
    203. }

     

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/417628
推荐阅读
相关标签
  

闽ICP备14008679号