——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7、Tomcat≥8
开发工具 eclipse/idea/myeclipse/sts等均可配置运行
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM员工管理系统员工考勤薪资管理(java+ssm+html+mysql)
登录: admin 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 @GetMapping(value = "getAdminById.action") @ResponseBody public Admin getAdminById (String id) { Admin admin = this .adminService.getAdminById(id); return admin; } } @RestController @RequestMapping(value = "/salary", produces = "application/json; charset=utf-8") @CrossOrigin public class SalaryController extends BaseController { @Autowired private SalaryService salaryService; @GetMapping(value = "createSalary.action") @ResponseBody public Map<String, Object> createSalary () { Map<String, Object> map = new HashMap<String, Object>(); map.put("sno" , "S" + VeDate.getStringDatex()); return map;
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 employ.setXueli(obj.getString("xueli" )); employ.setGraduate(obj.getString("graduate" )); employ.setWorkdate(obj.getString("workdate" )); employ.setMemo(obj.getString("memo" )); int num = this .employService.insertEmploy(employ); if (num > 0 ) { map.put("success" , true ); map.put("code" , num); map.put("message" , "保存成功" ); } else { map.put("success" , false ); map.put("code" , num); map.put("message" , "保存失败" ); } return map; } @GetMapping(value = "deleteEmploy.action") @ResponseBody public Map<String, Object> deleteEmploy (String id) { Map<String, Object> map = new HashMap<String, Object>(); int num = this .employService.deleteEmploy(id); if (num > 0 ) { map.put("success" , true ); map.put("code" , num); map.put("message" , "删除成功" ); } else { map.put("success" , false ); map.put("code" , num); map.put("message" , "删除失败" ); } return map; } @PostMapping(value = "deleteEmployByIds.action") @ResponseBody public Map<String, Object> deleteEmployByIds (@RequestBody String[] ids) { int num = 0 ; for (String employid : ids) { num += this .employService.deleteEmploy(employid); }
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 52 53 return new Font("Fixedsys" , Font.CENTER_BASELINE, 18 ); } private Color getRandColor (int fc, int bc) { if (fc > 255 ) fc = 255 ; if (bc > 255 ) bc = 255 ; int r = fc + random.nextInt(bc - fc - 16 ); int g = fc + random.nextInt(bc - fc - 14 ); int b = fc + random.nextInt(bc - fc - 18 ); return new Color(r, g, b); } public void getRandcode (HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR); Graphics g = image.getGraphics(); g.fillRect(0 , 0 , width, height); g.setFont(new Font("Times New Roman" , Font.ROMAN_BASELINE, 18 )); g.setColor(getRandColor(110 , 133 )); for (int i = 0 ; i <= lineSize; i++) { drowLine(g); } String randomString = "" ; for (int i = 1 ; i <= stringNum; i++) { randomString = drowString(g, randomString, i); } session.removeAttribute(RANDOMCODEKEY); session.setAttribute(RANDOMCODEKEY, randomString); g.dispose(); try { ImageIO.write(image, "JPEG" , response.getOutputStream()); } catch (Exception e) { e.printStackTrace(); } }
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 52 53 54 num += this .adminService.deleteAdmin(adminid); } Map<String, Object> map = new HashMap<String, Object>(); if (num > 0 ) { map.put("success" , true ); map.put("code" , num); map.put("message" , "删除成功" ); } else { map.put("success" , false ); map.put("code" , num); map.put("message" , "删除失败" ); } return map; } @PostMapping(value = "updateAdmin.action") @ResponseBody public Map<String, Object> updateAdmin (@RequestBody String jsonStr) { JSONObject obj = JSONObject.parseObject(jsonStr); Admin admin = this .adminService.getAdminById(obj.getString("adminid" )); admin.setUsername(obj.getString("username" )); admin.setRealname(obj.getString("realname" )); admin.setContact(obj.getString("contact" )); Map<String, Object> map = new HashMap<String, Object>(); int num = this .adminService.updateAdmin(admin); if (num > 0 ) { map.put("success" , true ); map.put("code" , num); map.put("message" , "修改成功" ); } else { map.put("success" , false ); map.put("code" , num); map.put("message" , "修改失败" ); } return map; } @GetMapping(value = "getAllAdmin.action") @ResponseBody public List<Admin> getAllAdmin () { return this .adminService.getAllAdmin(); } @GetMapping(value = "getAdminByPage.action") @ResponseBody public Map<String, Object> getAdminByPage (@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer limit) { Map<String, Object> map = new HashMap<String, Object>(); Page<Admin> pager = com.github.pagehelper.PageHelper.startPage(page, limit);
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 52 map.put("success" , true ); map.put("code" , num); map.put("message" , "删除成功" ); } else { map.put("success" , false ); map.put("code" , num); map.put("message" , "删除失败" ); } return map; } @PostMapping(value = "updateTrains.action") @ResponseBody public Map<String, Object> updateTrains (@RequestBody String jsonStr) { JSONObject obj = JSONObject.parseObject(jsonStr); Trains trains = this .trainsService.getTrainsById(obj.getString("trainsid" )); trains.setEmployid(obj.getString("employid" )); trains.setItemx(obj.getString("itemx" )); trains.setIswork(obj.getString("iswork" )); trains.setThestart(obj.getString("thestart" )); trains.setTheend(obj.getString("theend" )); trains.setMemo(obj.getString("memo" )); Map<String, Object> map = new HashMap<String, Object>(); int num = this .trainsService.updateTrains(trains); if (num > 0 ) { map.put("success" , true ); map.put("code" , num); map.put("message" , "修改成功" ); } else { map.put("success" , false ); map.put("code" , num); map.put("message" , "修改失败" ); } return map; } @GetMapping(value = "getAllTrains.action") @ResponseBody public List<Trains> getAllTrains () { return this .trainsService.getAllTrains(); } @GetMapping(value = "getTrainsByPage.action") @ResponseBody public Map<String, Object> getTrainsByPage (@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer limit) { Map<String, Object> map = new HashMap<String, Object>();
——————————PayStart——————————
项目链接: https://javayms.github.io?id=052223022309201fk https://javayms.pages.dev?id=052223022309201fk