@ResponseBody @RequestMapping("getUserById") public String getUserById(int id) { User user = (User) userService.getById("User", id); return JsonUtil.getJsonFormatDateFromObject(user); }
@ResponseBody @RequestMapping("getAllUserJson") public String getAllUserJson() { List<User> list = userService.getAllUser(); return JsonUtil.getJsonFromArray(list); }
/** * //搜索系统 * * @param table --实体类名 * @param searchType --搜索类型(实体类中) * @param searchKeyWord --关键字 * @return */ @ResponseBody @RequestMapping("searchsystem") public String searchsystem(String table, String searchType, String searchKeyWord) { List list = userService.searchSystem(table, searchType, searchKeyWord); return JsonUtil.getJsonFromArray(list); }
/** * 查看用户的账户名有木有 * * @param passport * @return */ @ResponseBody @RequestMapping("testPassport") public boolean testPassport(String passport) { boolean flag = userService.testUser(passport); return flag; }
@RequestMapping("outExcelForUser") public void outExcelForUser(HttpServletResponse response) { String c[] = { "数据库ID", "账号", "密码", "称呼", "姓", "名", "性别", "生日", "国籍", "护照号", "将要就读的学校", "学校ID", "年级", "全日制", "专业", "以前的学校", "知道我们通过", "联系地址", "省/州", "市/县", "邮编", "现状", "国家", "信用卡类型", "手机", "用户邮箱", "亲属全名", "亲属与用户关系", "联系地址", "省/州", "市/县", "邮编", "国家", "亲属座机", "手机", "用户邮箱", "附件1", "附件2", "附件3", "附件4", "用户头像", "个人爱好", "渠道编码", "个人备注", "个人详细介绍", "用户账号状态", "注册时间", "登陆时间", "登陆IP" }; List<User> list = userService.getAllUser(); try { excelService.outExcel(response, c, list, 1, null); } catch (Exception e) { e.printStackTrace(); } }
@RequestMapping("saveUser") public String saveUser( String ctime_as, String utime_as, String btime_as, String etime_as, String logtime_as, String birthday_as, User user, HttpServletRequest request) { user.setCtime(DateUtil.getDateFromStr(ctime_as, "yyyy-MM-dd hh:mm:ss")); user.setUtime(DateUtil.getDateFromStr(utime_as, "yyyy-MM-dd hh:mm:ss")); user.setBtime(new Date()); user.setEtime(new Date()); user.setLogtime(DateUtil.getDateFromStr(logtime_as, "yyyy-MM-dd hh:mm:ss")); user.setBirthday(DateUtil.getDateFromStr(birthday_as, "yyyy-MM-dd")); if (user.getSsid() == null || user.getSsid() == 0) user.setSsid(userService.getMaxSsid("User") + 1); baseService.save(user); return "redirect:user.html"; }
@ResponseBody @RequestMapping("getUserList") public String getUserList(int page, int rows) { HashMap hm = userService.getPageList(page, rows); return JsonUtil.getJson(hm); }
@ResponseBody @RequestMapping("delUserById") public int delUserById(int id) { return userService.delete("User", id); }