package com.ncvt.tourism.controller;
import com.ncvt.tourism.mapper.*;
import com.ncvt.tourism.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
@RestController
@RequestMapping("/api")
public class TourismController {
private static final String TIPS = "TIPS"; //提示
private static final String RESULT = "RESULT"; //返回结果
private static final String ONE_DATA = "ONE_DETAIL"; //返回数据1
private static final String TWO_DATA = "TWO_DETAIL"; //返回数据2
private static final String THREE_DATA = "THREE_DATA"; //返回数据3
private static final String FOUR_DATA = "FOUR_DATA"; //返回数据4
@Autowired
private UserMapper userMapper;
@Autowired
private AmountRechargeMapper amountRechargeMapper;
@Autowired
private CommonAddrMapper commonAddrMapper;
@Autowired
private MemberMapper memberMapper;
@Autowired
private MemberPowerMapper memberPowerMapper;
@Autowired
private UserCollectionMapper collectionMapper;
@Autowired
private ScenicRegionMapper scenicRegionMapper;
@Autowired
private ScenicSpotMapper scenicSpotMapper;
@Autowired
private ScenicDetailsMapper scenicDetailsMapper;
@Autowired
private ScenicPicMapper scenicPicMapper;
@Autowired
private ExhibitionAreaMapper exhibitionAreaMapper;
@Autowired
private ExhibitsMapper exhibitsMapper;
@Autowired
private ExhibitsPicMapper exhibitsPicMapper;
@Autowired
private ExhibitsCommentMapper exhibitsCommentMapper;
@Autowired
private FabulousDetailsMapper fabulousDetailsMapper;
@Autowired
private ExhibitsCommentMapper ecmMapper;
@Autowired
private OrderMapper orderMapper;
@Autowired
private OrderDetailsMapper orderDetailsMapper;
@Autowired
private ContactsMapper contactsMapper;
@Autowired
private PassengerMapper passengerMapper;
@Autowired
private TripMapper tripMapper;
/**
* 用户进行登录
* @param user 用户信息
* @return 返回结果
*/
@RequestMapping("/login")
public Map<String, Object> login(@RequestBody User user) {
Map<String, Object> map = new HashMap<>();
UserExample example = new UserExample();
example.createCriteria().andUserAccountNameEqualTo(user.getUserAccountName());
List<User> userList = userMapper.selectByExample(example);
if (userList.size() > 0) {
//校验密码输入是否正确
if (!user.getPassword().equals(userList.get(0).getPassword())) {
map.put(RESULT, "F");
map.put(TIPS, "密码输入错误");
return map;
}
map.put(RESULT, "S");
map.put(TIPS, "登录成功!");
map.put(ONE_DATA,userList.get(0));
return map;
} else {
map.put(RESULT, "F");
map.put(TIPS, "该用户不存在");
return map;
}
}
/**
* 用户注册
* @param user
* @return 返回的结果
*/
@RequestMapping("/register")
public Map<String, String> register(@RequestBody User user) {
Map<String, String> map = new HashMap<>();
TimeZone.setDefault(TimeZone.getTimeZone("GMT+8"));
Calendar calendar = Calendar.getInstance();
Date date = calendar.getTime();
try {
user.setUserMoney((double) 1000000);
user.setUserTime(date);
userMapper.insertSelective(user);
userMapper.updateByPrimaryKeySelective(user);
} catch (Exception e) {
map.put(RESULT, "F");
map.put(TIPS, "注册失败!");
return map;
}
map.put(RESULT, "S");
map.put(TIPS, "注册成功!");
return map;
}
/**
* 检测账户名是否已存在
* @param user
* @return 返回的结果
*/
@RequestMapping("/qeuryUserAccountName")
public Map<String, String> qeuryUserAccountName(@RequestBody User user) {
Map<String, String> map = new HashMap<>();
UserExample example = new UserExample();
example.createCriteria().andUserAccountNameEqualTo(user.getUserAccountName());
List<User> userList = userMapper.selectByExample(example);
if (userList.size() > 0) {
map.put(RESULT, "F");
map.put(TIPS, "该用户名已被使用!");
return map;
} else {
map.put(RESULT, "S");
map.put(TIPS, "可以创建");
return map;
}
}
/**
* 查询用户信息
* @param userId 用户编号
* @return 返回的结果
*/
@RequestMapping("/queryByUserInformation")
public Map<String, Object> queryByUserInformation(int userId) {
//向上造型
Map<String, Object> map = new HashMap<>();
User user = userMapper.selectByPrimaryKey(userId);
if (user == null) {
map.put(RESULT, "F");
map.put(TIPS, "没有该用户!");
return map;
}
map.put(RESULT, "S");
map.put(ONE_DATA, userMapper.selectByPrimaryKey(userId));
return map;
}
/**
* 更新用户信息
* @param user
* @return 返回的结果
*/
@RequestMapping("/updateUserInformation")
public Map<String, String> updateUserInformation(@RequestBody User user) {
Map<String, String> map = new HashMap<>();
if (userMapper.selectByPrimaryKey(user.getUserId()) == null) {
map.put(RESULT, "F");
map.put(TIPS, "没有该用户!");
return map;
}
try {
userMapper.updateByPrimaryKeySelective(user);
} catch (Exception e) {
map.put(RESULT, "F");
map.put(TIPS, "修改失败!");
return map;
}
map.put(RESULT, "S");
map.put(TIPS, "修改成功!");
return map;
}
/**
* 添加常用地址内容信息
* @param commonAddr
* @return 返回结果
*/
@RequestMapping("/addedCommonAddress")
public Map<String, String> addedCommonAddress(@RequestBody CommonAddr commonAddr) {
Map<String, String> map = new HashMap<>();
try {
commonAddrMapper.insertSelective(commonAddr);
commonAddrMapper.updateByPrimaryKeySelective(commonAddr);
} catch (Exception e) {
map.put(RESULT, "F");
map.put(TIPS, "添加失败!");
return map;
}
map.put(RESULT, "S");
map.put(TIPS, "添加成功!");
return map;
}
/**
* 修改常用地址内容信息
* @param commonAddr
* @return 返回结果
*/
@RequestMapping("/updateCommonAddress")
public Map<String, String> updateCommonAddress(@RequestBody CommonAddr commonAddr) {
Map<String, String> map = new HashMap<>();
if (commonAddrMapper.selectByPrimaryKey(commonAddr.getCommonAddrId()) == null) {
map.put(RESULT, "F");
map.put(TIPS, "请先添加您的常用地址!");
return map;
}
try {
commonAddrMapper.updateByPrimaryKeySelective(commonAddr);
} catch (Exception e) {
map.put(RESULT, "F");
map.put(TIPS, "更新失败!");
return map;
}
map.put(RESULT, "S");
map.put(TIPS, "更新成功!");
return map;
}
/**
* 查询所有常用地址内容信息
* @param commonAddr
* @return 返回结果
*/
@RequestMapping("/queryAllCommonAddress")
public Map<String, Object> queryAllCommonAddress(@RequestBody CommonAddr commonAddr, int userId) {
没有合适的资源?快使用搜索试试~ 我知道了~
基于SSM开发框架开发的旅游服务管理系统.zip
共1202个文件
jpg:672个
class:306个
xml:92个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 72 浏览量
2023-11-12
10:53:33
上传
评论
收藏 165.71MB ZIP 举报
温馨提示
1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 -------- 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。
资源推荐
资源详情
资源评论
收起资源包目录
基于SSM开发框架开发的旅游服务管理系统.zip (1202个子文件)
TourismController.class 46KB
TourismController.class 46KB
ScenicSpotExample$GeneratedCriteria.class 34KB
ScenicSpotExample$GeneratedCriteria.class 34KB
UserExample$GeneratedCriteria.class 28KB
UserExample$GeneratedCriteria.class 28KB
OrderExample$GeneratedCriteria.class 28KB
OrderExample$GeneratedCriteria.class 28KB
ScenicDetailsExample$GeneratedCriteria.class 24KB
ScenicDetailsExample$GeneratedCriteria.class 24KB
AmountRechargeExample$GeneratedCriteria.class 24KB
AmountRechargeExample$GeneratedCriteria.class 24KB
UserPayExample$GeneratedCriteria.class 23KB
UserPayExample$GeneratedCriteria.class 23KB
ScenicSpotExample$Criteria.class 23KB
ScenicSpotExample$Criteria.class 23KB
ExhibitsExample$GeneratedCriteria.class 20KB
ExhibitsExample$GeneratedCriteria.class 20KB
UserExample$Criteria.class 19KB
UserExample$Criteria.class 19KB
OrderExample$Criteria.class 19KB
OrderExample$Criteria.class 19KB
EvaluatetionExample$GeneratedCriteria.class 18KB
EvaluatetionExample$GeneratedCriteria.class 18KB
ContactsExample$GeneratedCriteria.class 17KB
ContactsExample$GeneratedCriteria.class 17KB
ScenicDetailsExample$Criteria.class 16KB
ScenicDetailsExample$Criteria.class 16KB
AmountRechargeExample$Criteria.class 16KB
AmountRechargeExample$Criteria.class 16KB
CommonAddrExample$GeneratedCriteria.class 15KB
CommonAddrExample$GeneratedCriteria.class 15KB
UserPayExample$Criteria.class 15KB
UserPayExample$Criteria.class 15KB
TripExample$GeneratedCriteria.class 15KB
TripExample$GeneratedCriteria.class 15KB
PassengerExample$GeneratedCriteria.class 14KB
PassengerExample$GeneratedCriteria.class 14KB
MemberExample$GeneratedCriteria.class 13KB
MemberExample$GeneratedCriteria.class 13KB
ExhibitsExample$Criteria.class 13KB
ExhibitsExample$Criteria.class 13KB
ExhibitsCommentExample$GeneratedCriteria.class 12KB
ExhibitsCommentExample$GeneratedCriteria.class 12KB
UserFeedbackExample$GeneratedCriteria.class 12KB
UserFeedbackExample$GeneratedCriteria.class 12KB
NewsPublishExample$GeneratedCriteria.class 12KB
NewsPublishExample$GeneratedCriteria.class 12KB
OrderDetailsExample$GeneratedCriteria.class 12KB
OrderDetailsExample$GeneratedCriteria.class 12KB
EvaluatetionExample$Criteria.class 12KB
EvaluatetionExample$Criteria.class 12KB
ExhibitionAreaExample$GeneratedCriteria.class 11KB
ExhibitionAreaExample$GeneratedCriteria.class 11KB
ContactsExample$Criteria.class 11KB
ContactsExample$Criteria.class 11KB
FabulousDetailsExample$GeneratedCriteria.class 11KB
FabulousDetailsExample$GeneratedCriteria.class 11KB
ScenicRegionExample$GeneratedCriteria.class 10KB
ScenicRegionExample$GeneratedCriteria.class 10KB
MessagePushExample$GeneratedCriteria.class 10KB
MessagePushExample$GeneratedCriteria.class 10KB
UserCollectionExample$GeneratedCriteria.class 10KB
UserCollectionExample$GeneratedCriteria.class 10KB
MemberPowerExample$GeneratedCriteria.class 10KB
MemberPowerExample$GeneratedCriteria.class 10KB
CommonAddrExample$Criteria.class 10KB
CommonAddrExample$Criteria.class 10KB
TripExample$Criteria.class 10KB
TripExample$Criteria.class 10KB
PassengerExample$Criteria.class 9KB
PassengerExample$Criteria.class 9KB
ExhibitsPicExample$GeneratedCriteria.class 8KB
ExhibitsPicExample$GeneratedCriteria.class 8KB
MemberExample$Criteria.class 8KB
MemberExample$Criteria.class 8KB
ScenicPicExample$GeneratedCriteria.class 8KB
ScenicPicExample$GeneratedCriteria.class 8KB
UserFeedbackExample$Criteria.class 8KB
UserFeedbackExample$Criteria.class 8KB
NewsPublishExample$Criteria.class 8KB
NewsPublishExample$Criteria.class 8KB
ExhibitsCommentExample$Criteria.class 7KB
ExhibitsCommentExample$Criteria.class 7KB
OrderDetailsExample$Criteria.class 7KB
OrderDetailsExample$Criteria.class 7KB
FabulousDetailsExample$Criteria.class 7KB
FabulousDetailsExample$Criteria.class 7KB
ExhibitionAreaExample$Criteria.class 7KB
ExhibitionAreaExample$Criteria.class 7KB
ScenicRegionExample$Criteria.class 6KB
ScenicRegionExample$Criteria.class 6KB
MessagePushExample$Criteria.class 6KB
MessagePushExample$Criteria.class 6KB
MemberPowerExample$Criteria.class 6KB
MemberPowerExample$Criteria.class 6KB
UserCollectionExample$Criteria.class 6KB
UserCollectionExample$Criteria.class 6KB
AlipayController.class 5KB
AlipayController.class 5KB
共 1202 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
资源评论
程皮
- 粉丝: 258
- 资源: 2568
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Python 程序语言设计模式思路-创建型模式:原型模式:通过复制现有对象来创建新对象,面向对象编程
- 卸载软件geek卸载软件geek
- Python 程序语言设计模式思路-创建型模式:单例模式,确保一个类的唯一实例(装饰器)面向对象编程、继承
- skywalking-plugins.jar skywalking-alarm.jar
- 独栋别墅图纸D020-两层-10.00&11.00米- 施工图.dwg
- Python 程序语言设计模式思路-创建型模式:工厂模式,创建对象的统一接口,封装对象的创建逻辑
- python自学教程-05-json数据格式的介绍.ev4.rar
- python自学教程-04-自定义JavaScript.ev4.rar
- 《淘宝后台系统...》
- skywalking-plugins.jar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功