From 33ffcfec6625c110cef64e00dca16150d820f988 Mon Sep 17 00:00:00 2001 From: 20918 <2091823062@qq.com> Date: Tue, 16 Apr 2024 16:58:19 +0800 Subject: [PATCH] userleave --- .../system/SysUserExamineController.java | 1 - .../controller/system/TdLeaveController.java | 127 +++++++++++ .../resources/templates/system/leave/add.html | 105 +++++++++ .../templates/system/leave/edit.html | 106 +++++++++ .../templates/system/leave/leave.html | 162 ++++++++++++++ ruoyi-system/pom.xml | 5 + .../java/com/ruoyi/system/domain/TdLeave.java | 201 ++++++++++++++++++ .../ruoyi/system/mapper/TdLeaveMapper.java | 63 ++++++ .../ruoyi/system/service/ISysRoleService.java | 5 +- .../ruoyi/system/service/ITdLeaveService.java | 61 ++++++ .../service/impl/SysRoleServiceImpl.java | 10 +- .../service/impl/TdLeaveServiceImpl.java | 94 ++++++++ .../resources/mapper/system/TdLeaveMapper.xml | 107 ++++++++++ 13 files changed, 1040 insertions(+), 7 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TdLeaveController.java create mode 100644 ruoyi-admin/src/main/resources/templates/system/leave/add.html create mode 100644 ruoyi-admin/src/main/resources/templates/system/leave/edit.html create mode 100644 ruoyi-admin/src/main/resources/templates/system/leave/leave.html create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/TdLeave.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/TdLeaveMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/ITdLeaveService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TdLeaveServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/mapper/system/TdLeaveMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserExamineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserExamineController.java index c7a7f05..069cb8b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserExamineController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserExamineController.java @@ -98,7 +98,6 @@ public class SysUserExamineController extends BaseController { @GetMapping("/examineprint/{userId}") public String paint(@PathVariable("userId") Long userId,ModelMap mmap) { - List roles = roleService.selectRolesByUserId(userId); mmap.put("user",userService.selectUserById(userId)); mmap.put("roles", roleService.selectRolesByUserIds(userId)); mmap.put("posts", postService.selectPostsByUserIds(userId)); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TdLeaveController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TdLeaveController.java new file mode 100644 index 0000000..2c28879 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TdLeaveController.java @@ -0,0 +1,127 @@ +package com.ruoyi.web.controller.system; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.TdLeave; +import com.ruoyi.system.service.ITdLeaveService; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 人员离职Controller + * + * @author ruoyi + * @date 2024-04-16 + */ +@Controller +@RequestMapping("/system/leave") +public class TdLeaveController extends BaseController +{ + private String prefix = "system/leave"; + + @Autowired + private ITdLeaveService tdLeaveService; + + @RequiresPermissions("system:leave:view") + @GetMapping() + public String leave() + { + return prefix + "/leave"; + } + + /** + * 查询人员离职列表 + */ + @RequiresPermissions("system:leave:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(TdLeave tdLeave) + { + startPage(); + List list = tdLeaveService.selectTdLeaveList(tdLeave); + return getDataTable(list); + } + + /** + * 导出人员离职列表 + */ + @RequiresPermissions("system:leave:export") + @Log(title = "人员离职", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(TdLeave tdLeave) + { + List list = tdLeaveService.selectTdLeaveList(tdLeave); + ExcelUtil util = new ExcelUtil(TdLeave.class); + return util.exportExcel(list, "人员离职数据"); + } + + /** + * 新增人员离职 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存人员离职 + */ + @RequiresPermissions("system:leave:add") + @Log(title = "人员离职", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(TdLeave tdLeave) + { + return toAjax(tdLeaveService.insertTdLeave(tdLeave)); + } + + /** + * 修改人员离职 + */ + @RequiresPermissions("system:leave:edit") + @GetMapping("/edit/{id}") + public String edit(@PathVariable("id") Long id, ModelMap mmap) + { + TdLeave tdLeave = tdLeaveService.selectTdLeaveById(id); + mmap.put("tdLeave", tdLeave); + return prefix + "/edit"; + } + + /** + * 修改保存人员离职 + */ + @RequiresPermissions("system:leave:edit") + @Log(title = "人员离职", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(TdLeave tdLeave) + { + return toAjax(tdLeaveService.updateTdLeave(tdLeave)); + } + + /** + * 删除人员离职 + */ + @RequiresPermissions("system:leave:remove") + @Log(title = "人员离职", businessType = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(tdLeaveService.deleteTdLeaveByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/resources/templates/system/leave/add.html b/ruoyi-admin/src/main/resources/templates/system/leave/add.html new file mode 100644 index 0000000..a5e5a35 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/leave/add.html @@ -0,0 +1,105 @@ + + + + + + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+ +
+
+
+
+ + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/leave/edit.html b/ruoyi-admin/src/main/resources/templates/system/leave/edit.html new file mode 100644 index 0000000..0cbcd02 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/leave/edit.html @@ -0,0 +1,106 @@ + + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+ +
+
+
+
+ + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/leave/leave.html b/ruoyi-admin/src/main/resources/templates/system/leave/leave.html new file mode 100644 index 0000000..60b8dcc --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/leave/leave.html @@ -0,0 +1,162 @@ + + + + + + +
+
+
+
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • +  搜索 +  重置 +
  • +
+
+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-system/pom.xml b/ruoyi-system/pom.xml index c2691ac..9ea09b9 100644 --- a/ruoyi-system/pom.xml +++ b/ruoyi-system/pom.xml @@ -29,6 +29,11 @@ mybatis-plus-boot-starter 3.5.2 + + org.projectlombok + lombok + provided + diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/TdLeave.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TdLeave.java new file mode 100644 index 0000000..e25fa06 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TdLeave.java @@ -0,0 +1,201 @@ +package com.ruoyi.system.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 人员离职对象 td_leave + * + * @author ruoyi + * @date 2024-04-16 + */ +@Data +@Getter +@Setter +public class TdLeave extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long id; + + /** 提交人 */ + @Excel(name = "提交人") + private String username; + + /** 城市 */ + @Excel(name = "城市") + private String country; + + /** 地区 */ + @Excel(name = "地区") + private String areaname; + + /** 离职原因 */ + @Excel(name = "离职原因") + private String leavereason; + + /** 单位 */ + @Excel(name = "单位") + private String depart; + + /** 离职时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "离职时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date leavedate; + + /** 工作交接 */ + @Excel(name = "工作交接") + private String workstate; + + /** 离职状态(0:未离职,1:已离职) */ + @Excel(name = "离职状态", readConverterExp = "0=:未离职,1:已离职") + private String leavestate; + + /** 审核人 */ + @Excel(name = "审核人") + private String examinename; + + /** 审核日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "审核日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date examinedate; + + /** 审核意见(0:通过,1:不通过,2:审核中) */ + @Excel(name = "审核意见", readConverterExp = "0=:通过,1:不通过,2:审核中") + private String examinestate; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setUsername(String username) + { + this.username = username; + } + + public String getUsername() + { + return username; + } + public void setCountry(String country) + { + this.country = country; + } + + public String getCountry() + { + return country; + } + public void setAreaname(String areaname) + { + this.areaname = areaname; + } + + public String getAreaname() + { + return areaname; + } + public void setLeavereason(String leavereason) + { + this.leavereason = leavereason; + } + + public String getLeavereason() + { + return leavereason; + } + public void setDepart(String depart) + { + this.depart = depart; + } + + public String getDepart() + { + return depart; + } + public void setLeavedate(Date leavedate) + { + this.leavedate = leavedate; + } + + public Date getLeavedate() + { + return leavedate; + } + public void setWorkstate(String workstate) + { + this.workstate = workstate; + } + + public String getWorkstate() + { + return workstate; + } + public void setLeavestate(String leavestate) + { + this.leavestate = leavestate; + } + + public String getLeavestate() + { + return leavestate; + } + public void setExaminename(String examinename) + { + this.examinename = examinename; + } + + public String getExaminename() + { + return examinename; + } + public void setExaminedate(Date examinedate) + { + this.examinedate = examinedate; + } + + public Date getExaminedate() + { + return examinedate; + } + public void setExaminestate(String examinestate) + { + this.examinestate = examinestate; + } + + public String getExaminestate() + { + return examinestate; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("username", getUsername()) + .append("country", getCountry()) + .append("areaname", getAreaname()) + .append("leavereason", getLeavereason()) + .append("depart", getDepart()) + .append("leavedate", getLeavedate()) + .append("workstate", getWorkstate()) + .append("leavestate", getLeavestate()) + .append("examinename", getExaminename()) + .append("examinedate", getExaminedate()) + .append("examinestate", getExaminestate()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TdLeaveMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TdLeaveMapper.java new file mode 100644 index 0000000..83e48cd --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TdLeaveMapper.java @@ -0,0 +1,63 @@ +package com.ruoyi.system.mapper; + +import java.util.List; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.system.domain.TdLeave; + +/** + * 人员离职Mapper接口 + * + * @author ruoyi + * @date 2024-04-16 + */ +public interface TdLeaveMapper extends BaseMapper +{ + /** + * 查询人员离职 + * + * @param id 人员离职主键 + * @return 人员离职 + */ + public TdLeave selectTdLeaveById(Long id); + + /** + * 查询人员离职列表 + * + * @param tdLeave 人员离职 + * @return 人员离职集合 + */ + public List selectTdLeaveList(TdLeave tdLeave); + + /** + * 新增人员离职 + * + * @param tdLeave 人员离职 + * @return 结果 + */ + public int insertTdLeave(TdLeave tdLeave); + + /** + * 修改人员离职 + * + * @param tdLeave 人员离职 + * @return 结果 + */ + public int updateTdLeave(TdLeave tdLeave); + + /** + * 删除人员离职 + * + * @param id 人员离职主键 + * @return 结果 + */ + public int deleteTdLeaveById(Long id); + + /** + * 批量删除人员离职 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteTdLeaveByIds(String[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java index a97ed35..9e30265 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java @@ -2,15 +2,18 @@ package com.ruoyi.system.service; import java.util.List; import java.util.Set; + +import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.system.domain.SysUserRole; +import com.ruoyi.system.domain.TdLeave; /** * 角色业务层 * * @author ruoyi */ -public interface ISysRoleService +public interface ISysRoleService extends IService { /** * 根据条件分页查询角色数据 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITdLeaveService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITdLeaveService.java new file mode 100644 index 0000000..652a17f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITdLeaveService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.TdLeave; + +/** + * 人员离职Service接口 + * + * @author ruoyi + * @date 2024-04-16 + */ +public interface ITdLeaveService +{ + /** + * 查询人员离职 + * + * @param id 人员离职主键 + * @return 人员离职 + */ + public TdLeave selectTdLeaveById(Long id); + + /** + * 查询人员离职列表 + * + * @param tdLeave 人员离职 + * @return 人员离职集合 + */ + public List selectTdLeaveList(TdLeave tdLeave); + + /** + * 新增人员离职 + * + * @param tdLeave 人员离职 + * @return 结果 + */ + public int insertTdLeave(TdLeave tdLeave); + + /** + * 修改人员离职 + * + * @param tdLeave 人员离职 + * @return 结果 + */ + public int updateTdLeave(TdLeave tdLeave); + + /** + * 批量删除人员离职 + * + * @param ids 需要删除的人员离职主键集合 + * @return 结果 + */ + public int deleteTdLeaveByIds(String ids); + + /** + * 删除人员离职信息 + * + * @param id 人员离职主键 + * @return 结果 + */ + public int deleteTdLeaveById(Long id); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index ef5fc15..25c1e1d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -5,6 +5,10 @@ import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.system.domain.TdLeave; +import com.ruoyi.system.mapper.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -20,10 +24,6 @@ import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.system.domain.SysRoleDept; import com.ruoyi.system.domain.SysRoleMenu; import com.ruoyi.system.domain.SysUserRole; -import com.ruoyi.system.mapper.SysRoleDeptMapper; -import com.ruoyi.system.mapper.SysRoleMapper; -import com.ruoyi.system.mapper.SysRoleMenuMapper; -import com.ruoyi.system.mapper.SysUserRoleMapper; import com.ruoyi.system.service.ISysRoleService; /** @@ -32,7 +32,7 @@ import com.ruoyi.system.service.ISysRoleService; * @author ruoyi */ @Service -public class SysRoleServiceImpl implements ISysRoleService +public class SysRoleServiceImpl extends ServiceImpl implements ISysRoleService { @Autowired private SysRoleMapper roleMapper; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TdLeaveServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TdLeaveServiceImpl.java new file mode 100644 index 0000000..7e057e6 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TdLeaveServiceImpl.java @@ -0,0 +1,94 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.TdLeaveMapper; +import com.ruoyi.system.domain.TdLeave; +import com.ruoyi.system.service.ITdLeaveService; +import com.ruoyi.common.core.text.Convert; + +/** + * 人员离职Service业务层处理 + * + * @author ruoyi + * @date 2024-04-16 + */ +@Service +public class TdLeaveServiceImpl implements ITdLeaveService +{ + @Autowired + private TdLeaveMapper tdLeaveMapper; + + /** + * 查询人员离职 + * + * @param id 人员离职主键 + * @return 人员离职 + */ + @Override + public TdLeave selectTdLeaveById(Long id) + { + return tdLeaveMapper.selectTdLeaveById(id); + } + + /** + * 查询人员离职列表 + * + * @param tdLeave 人员离职 + * @return 人员离职 + */ + @Override + public List selectTdLeaveList(TdLeave tdLeave) + { + return tdLeaveMapper.selectTdLeaveList(tdLeave); + } + + /** + * 新增人员离职 + * + * @param tdLeave 人员离职 + * @return 结果 + */ + @Override + public int insertTdLeave(TdLeave tdLeave) + { + return tdLeaveMapper.insertTdLeave(tdLeave); + } + + /** + * 修改人员离职 + * + * @param tdLeave 人员离职 + * @return 结果 + */ + @Override + public int updateTdLeave(TdLeave tdLeave) + { + return tdLeaveMapper.updateTdLeave(tdLeave); + } + + /** + * 批量删除人员离职 + * + * @param ids 需要删除的人员离职主键 + * @return 结果 + */ + @Override + public int deleteTdLeaveByIds(String ids) + { + return tdLeaveMapper.deleteTdLeaveByIds(Convert.toStrArray(ids)); + } + + /** + * 删除人员离职信息 + * + * @param id 人员离职主键 + * @return 结果 + */ + @Override + public int deleteTdLeaveById(Long id) + { + return tdLeaveMapper.deleteTdLeaveById(id); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/TdLeaveMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TdLeaveMapper.xml new file mode 100644 index 0000000..10d038b --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/TdLeaveMapper.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + select id, username, country, areaname, leavereason, depart, leavedate, workstate, leavestate, examinename, examinedate, examinestate from td_leave + + + + + + + + insert into td_leave + + username, + country, + areaname, + leavereason, + depart, + leavedate, + workstate, + leavestate, + examinename, + examinedate, + examinestate, + + + #{username}, + #{country}, + #{areaname}, + #{leavereason}, + #{depart}, + #{leavedate}, + #{workstate}, + #{leavestate}, + #{examinename}, + #{examinedate}, + #{examinestate}, + + + + + update td_leave + + username = #{username}, + country = #{country}, + areaname = #{areaname}, + leavereason = #{leavereason}, + depart = #{depart}, + leavedate = #{leavedate}, + workstate = #{workstate}, + leavestate = #{leavestate}, + examinename = #{examinename}, + examinedate = #{examinedate}, + examinestate = #{examinestate}, + + where id = #{id} + + + + delete from td_leave where id = #{id} + + + + delete from td_leave where id in + + #{id} + + + + \ No newline at end of file