——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Node.js≥14
开发工具
后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可
❗没学过node.js的不要搞前后端分离项目
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明












基于javaweb的SpringBoot人力资源管理系统企业人事(java+springboot+maven+vue+element-ui)
后端启动类:StartApplication
前端启动命令:npm run serve
登录:
管理员:
admin 123456
普通员工:
staff_2 123456
staff_3 123456
staff_4 123456
staff_5 123456
staff_6 123456
staff_7 123456
staff_8 123456
staff_9 123456
staff_10 123456
staff_11 123456
staff_12 123456
staff_13 123456
staff_14 123456
staff_15 123456
staff_16 123456
staff_17 123456
staff_18 123456
staff_19 123456
staff_20 123456
staff_21 123456
staff_22 123456
staff_23 123456
staff_24 123456
staff_25 123456
staff_26 123456
staff_27 123456
staff_28 123456
staff_29 123456
staff_30 123456
staff_31 123456
staff_32 123456
staff_33 123456
staff_34 123456
staff_35 123456
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| * 服务类 * </p> * */
@Service public class StaffService extends ServiceImpl<StaffMapper, Staff> {
@Resource private DeptService deptService;
@Resource private StaffMapper staffMapper;
/** * 新增 * * @param staff * @return ResponseDTO */ public ResponseDTO add(Staff staff) { if (save(staff)) { // 设置默认密码、工号、头像 staff.setPassword(MD5Util.MD55("123456")).setCode("staff_" + staff.getId()).setAvatar("avatar.png"); updateById(staff); return Response.success(); } return Response.error(); }
/** * 逻辑删除 * * @param id * @return */ public ResponseDTO deleteById(Integer id) { if (removeById(id)) { return Response.success(); } return Response.error(); }
/** * 编辑 * * @param staff * @return */
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
public class HutoolExcelUtil {
public static <T> void writeExcel(HttpServletResponse response, List<T> list, String filename, Class<T> clazz) throws IOException { Integer columnNum = 0; ExcelWriter writer = ExcelUtil.getWriter(true); boolean isSerializable = false; Field[] fields = clazz.getDeclaredFields(); for (Field field : fields) { field.setAccessible(true);
|
1 2 3 4 5 6 7 8 9 10 11 12
| }
@Service public class DocsService extends ServiceImpl<DocsMapper, Docs> {
private String fileUploadPath=System.getProperty("user.dir")+"\\src\\main\\resources\\static\\file\\";
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| }
@ApiOperation("查询") @GetMapping("/{id}") public ResponseDTO findById(@PathVariable Integer id) { return this.staffLeaveService.findById(id); }
@ApiOperation("分页条件查询") @GetMapping public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String name) { return this.staffLeaveService.list(current, size, name); }
@ApiOperation("数据导出接口") @GetMapping("/export") public ResponseDTO export(HttpServletResponse response) throws IOException { return this.staffLeaveService.export(response); }
@ApiOperation("数据导入接口") @PostMapping("/import") public ResponseDTO imp(MultipartFile file) throws IOException { return this.staffLeaveService.imp(file); }
@ApiOperation("分页") @GetMapping("/staff") public ResponseDTO findByStaffId(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, Integer id) { return this.staffLeaveService.findByStaffId(current, size, id); }
@ApiOperation("查询未被审核的请假") @GetMapping("/staff/{id}") public ResponseDTO findUnauditedByStaffId(@PathVariable Integer id) { return this.staffLeaveService.findUnauditedByStaffId(id); }
}
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| public ResponseDTO list(Integer current, Integer size, String name) { IPage<StaffLeaveVO> config = new Page<>(current, size); if (name == null) { name = ""; } IPage<StaffLeaveVO> page = this.staffLeaveMapper.listStaffLeaveVO(config, name); Map map = new HashMap(); map.put("pages", page.getPages()); map.put("total", page.getTotal()); map.put("list", page.getRecords()); return Response.success(map); }
public ResponseDTO export(HttpServletResponse response) throws IOException { List<StaffLeave> list = list(); HutoolExcelUtil.writeExcel(response, list, "员工请假记录表", StaffLeave.class); return Response.success(); }
@Transactional(rollbackFor = Exception.class) public ResponseDTO imp(MultipartFile file) throws IOException { InputStream inputStream = file.getInputStream(); List<StaffLeave> list = HutoolExcelUtil.readExcel(inputStream, 1, StaffLeave.class); if (saveBatch(list)) { return Response.success(); } return Response.error();
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| public ResponseDTO setInsurance(Insurance insurance) { QueryWrapper<Insurance> queryWrapper = new QueryWrapper(); queryWrapper.eq("staff_id", insurance.getStaffId()); if (saveOrUpdate(insurance, queryWrapper)) { return Response.success(BusinessStatusEnum.SUCCESS); } throw new ServiceException(BusinessStatusEnum.ERROR); }
public ResponseDTO findByStaffId(Integer id) { QueryWrapper<Insurance> queryWrapper = new QueryWrapper(); queryWrapper.eq("staff_id", id); Insurance insurance = getOne(queryWrapper); if (insurance == null) { return Response.error(); } return Response.success(insurance); } }
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=152024300804201lo
https://javayms.pages.dev?id=152024300804201lo