Java项⽬:旅游景点门票管理系统(java+SSM+jsp+Mysql)jsp+ssm(spring+springMVC+mybatis)+MySQL实现的在线旅游景点信息管理系统,系统主要实现的功能有:⽤户浏览搜索景点游玩路线、⽤户注册登录、下单预定旅游产品等。后台管理员可对旅游产品进⾏管理、包括旅游的主题、产品、⽤户、定制、订单等。
⽤户控制层:
/**
* 控制器层
*
*/
@RestController
@CrossOrigin
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private HttpServletRequest request;
@Autowired
BCryptPasswordEncoder encoder;
/**
* 查询全部数据
*
* @return
*/
@RequestMapping(value = "userList",method = RequestMethod.GET)
public Result findAll() {
List<User> all = userService.findAll();
return new Result(true, StatusCode.OK, "查询成功",all,all.size());
}
/**
* 根据ID查询
*
* @param id ID
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public Result findById(@PathVariable Long id) {
return new Result(true, StatusCode.OK, "查询成功", userService.findById(id));
}
/**
* 分页+多条件查询
* @param searchMap 查询条件封装
* @param page 页码
* @param size 页⼤⼩
* @return 分页结果
*/
@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
Page<User> pageList = userService.findSearch(searchMap, page, size);
return  new Result(true,StatusCode.OK,"查询成功",  new PageResult<User>(TotalElements(), Content()) ); }
/**
* 根据条件查询
* @param searchMap
* @return
*/
@RequestMapping(value="/search",method = RequestMethod.POST)
public Result findSearch( @RequestBody Map searchMap){
return new Result(true,StatusCode.OK,"查询成功",userService.findSearch(searchMap));java valueof
}
/**
* 增加
* @param user
*/
@RequestMapping(method=RequestMethod.POST)
public Result add(@RequestBody User user  ){
userService.add(user);
return new Result(true,StatusCode.OK,"增加成功");
}
/**
* 修改
* @param user
*/
*/
@ResponseBody
@RequestMapping(value="/{id}",method= RequestMethod.PUT)
public Result update(User user, @PathVariable Long id ){
User oldUser=userService.findById(id);
user.setId(id);
user.Password());
userService.update(user);
return new Result(true,StatusCode.OK,"修改成功");
}
/
**
* 修改
* @param user
*/
@RequestMapping(value="/change",method= RequestMethod.POST,consumes = "application/json")
public Result update(@RequestBody User user, HttpSession session){
User us= (User) Attribute("user");
user.Id());
user.Password());
userService.update(user);
return new Result(true,StatusCode.OK,"修改成功");
}
/**
* 删除
* @param id
*/
@RequestMapping(value="/{id}",method= RequestMethod.DELETE)
public Result delete(@PathVariable String id ){
userService.deleteById(id);
return new Result(true,StatusCode.OK,"删除成功");
}
/**
* ⽤户注册
* @param code
* @param user
* @return
*/
@ResponseBody
@RequestMapping(value = "/register/",method = RequestMethod.POST)
public Result regist(@RequestParam(name = "code") String code,User user,HttpServletRequest request){  String sCode = (String) Session().getAttribute("user_register_email_code");
if(!sCode.equalsIgnoreCase(code)){
return new Result(false,StatusCode.ERROR,"验证码错误!");
}
userService.add(user);
return new Result(true,StatusCode.OK,"注册成功");
}
/**
*判断账号是否存在
* @param user
* @return
*/
@RequestMapping(value = "/checkPhone",method = RequestMethod.POST)
@ResponseBody
public Result checkPhone(User user){
String phone = Mobile();
if(!StringUtil.isMobile(phone)){
return new Result(false,StatusCode.ERROR,"请填写正确的⼿机号!");
}
User userphone= userService.findByMobile(phone);
if (userphone == null){
return new Result(true,StatusCode.OK,"该⼿机号可以注册");
}
return new Result(false,StatusCode.ERROR,"该⼿机号已经被注册");

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。