package com.sxl.controller.admin;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.sxl.controller.MyController;
import com.sxl.util.StringHelper;
@Controller("frontController")
@RequestMapping(value = "/front")
public class FrontController extends MyController {
@RequestMapping(value = "/index")
public String frame(Model model, HttpServletRequest request)
throws Exception {
String sql = "select a.*,(select name from t_user b where b.id=a.userId) name from t_product a where 1=1 order by id desc limit 4";
List list = db.queryForList(sql);
System.out.println(list);
request.setAttribute("list", list);
//随机推荐4个
sql = "select a.*,(select name from t_user b where b.id=a.userId) name from t_product a where 1=1 ORDER BY RAND() LIMIT 4";
List list2 = db.queryForList(sql);
request.setAttribute("list2", list2);
sql = "select * from t_lbt";
List list3 = db.queryForList(sql);
request.setAttribute("list3", list3);
sql="select a.* from t_zx a where 1=1 and types='景区' ";
sql+=" ORDER BY RAND() LIMIT 4";
List jqList = db.queryForList(sql);
request.setAttribute("jqList", jqList);
sql="select a.* from t_zx a where 1=1 and types='线路' ";
sql+=" ORDER BY RAND() LIMIT 4";
List xlList = db.queryForList(sql);
request.setAttribute("xlList", xlList);
return "/front/index";
}
@RequestMapping(value = "/login")
public String login(Model model, HttpServletRequest request)
throws Exception {
return "/front/login";
}
@RequestMapping(value = "/all")
public String all(Model model, HttpServletRequest request,Long typesId,String productName)
throws Exception {
String sql="select a.* from t_types a where 1=1";
sql+=" order by id desc";
List typesList = db.queryForList(sql);
request.setAttribute("typesList", typesList);
sql="select a.*,(select typesName from t_types b where a.typesId=b.id) typesName,(select name from t_user b where b.id=a.userId) name from t_product a where 1=1";
if(typesId!=null&&!"".equals(typesId)){
sql+=" and a.typesId="+typesId;
}
if(productName!=null&&!"".equals(productName)){
sql+=" and a.productName like '%"+productName+"%' ";
}
sql+=" order by id desc";
List list = db.queryForList(sql);
request.setAttribute("list", list);
return "/front/all";
}
@RequestMapping(value = "/jfdh")
public String jfdh(Model model, HttpServletRequest request)
throws Exception {
String sql="select a.* from t_jfdh a where 1=1";
sql+=" order by id desc";
List list = db.queryForList(sql);
request.setAttribute("list", list);
return "/front/jfdh";
}
@RequestMapping(value = "/dhjfSave")
public ResponseEntity<String> dhjfSave(Model model,
HttpServletRequest request,Long id) throws Exception {
Map map = db.queryForMap("select * from t_jfdh where id="+id);
String jf = map.get("jfCost").toString();
String jfName = map.get("jfName").toString();
//订单
String sql = "insert into t_order(orderNum,customerId,productDetail,allPrice,status,insertDate) values(?,?,?,?,?,now())";
int result = db.update(sql, new Object[] { System.currentTimeMillis()+"",
getCustomer(request).get("id").toString(), jfName+"积分兑换["+jf+"]", 0+"", "兑换完成" });
sql="update t_customer set jf = jf-"+jf+" where id="+getCustomer(request).get("id");
db.update(sql);
//积分减少
return renderData(true, "操作成功", null);
}
@RequestMapping(value = "/register")
public String register(Model model, HttpServletRequest request)
throws Exception {
System.out.println("112312312");
return "/front/register";
}
@RequestMapping(value = "/detail")
public String detail(Model model, HttpServletRequest request, Long id)
throws Exception {
String sql = "select a.*,(select typesName from t_types b where a.typesId=b.id) typesName," +
"(select name from t_user b where b.id=a.userId) name from t_product a where id=" + id;
Map map = db.queryForMap(sql);
request.setAttribute("map", map);
String sql2="select a.*,(select max(customerName) from t_customer b where a.customerId=b.id) customerName from t_pinglun_product a where productId=? order by id desc";
List<Map> list = db.queryForList(sql2,new Object[]{id});
model.addAttribute("list", list);
return "/front/detail";
}
@RequestMapping(value = "/myOrder")
public String myOrder(Model model, HttpServletRequest request)
throws Exception {
String sql = "select a.*,(select max(customerName) from t_customer b where a.customerId=b.id) customerName from t_order a where 1=1 ";
if (1 == 1) {
sql += "and customerId=" + getCustomer(request).get("id") + " ";
}
sql += " order by id desc";
List list = db.queryForList(sql);
request.setAttribute("orderList", list);
return "/front/myOrder";
}
@RequestMapping(value = "/deleteOneOrder")
public ResponseEntity<String> deleteOneOrder(Model model,
HttpServletRequest request,Long id) throws Exception {
String sql="delete from t_order where id="+id;
db.update(sql);
return renderData(true, "操作成功", null);
}
@RequestMapping(value = "/addShopcar")
public ResponseEntity<String> addShopcar(Model model,
HttpServletRequest request, Long id, Integer num) throws Exception {
int result = 0;
// 判断该用户是否
String sql = "select * from t_shopcar where productId=? and customerId=?";
Map map = db.queryForMap(sql, new Object[] { id.toString(),
getCustomer(request).get("id").toString() });
if (map != null && map.size() > 0) {
sql = "update t_shopcar set productId=?,num=num+" + num
+ " where id=?";
result = db.update(sql, new Object[] { id, map.get("id") });
} else {
sql = "insert into t_shopcar(productId,num,customerId) values(?,?,?)";
result = db.update(sql, new Object[] { id, num,
getCustomer(request).get("id").toString() });
}
if (result == 1) {
return renderData(true, "操作成功", null);
} else {
return renderData(false, "操作失败", null);
}
}
@RequestMapping(value = "/checkIsLogin")
public ResponseEntity<String> checkIsLogin(Model model,
HttpServletRequest request) throws Exception {
Map customer = getCustomer(request);
if (customer != null && customer.size() > 0) {
return renderData(true, "操作成功", null);
} else {
return renderData(false, "操作失败", null);
}
}
@RequestMapping(value = "/pay")
public ResponseEntity<String> pay(Model model, HttpServletRequest request)
throws Exception {
String sql = "select a.*,(select productName from t_product b where a.productId=b.id) productName,"
+ "(select price from t_product b where a.productId=b.id) price,(select jf from t_product b where a.productId=b.id) jf from t_shopcar a where customerId="
+ getCustomer(request).get("id");
sql += " order by id desc";
List<Map> list = db.queryForList(sql);
int total = 0;
int jf = 0;
String productDetail = "";
for (int i = 0; i < list.size(); i++) {
productDetail += "," + list.get(i).get("productName") + "["
+ list.get(i).get("num") + "]";
total += Integer.parseInt(list.get(i).get("price").toString())
* Integer.parseInt(list.get(i).get("num").toString());
// jf+=Integer.parseInt(list.get(i).get("jf").toString())
// * Integer.parseInt(list.get(i).get("num").toString());
String sql2="update t_product set nums=nums-"+list.get(i).get("num").toString()+" where id="+list.get(i).get("productId").toString();
db.update(sql2);
}
total+=20;
sql = "insert in
没有合适的资源?快使用搜索试试~ 我知道了~
旅游网站~springmvc加mysql实现的旅游类网站功能齐全
共1218个文件
gif:305个
js:251个
jar:108个
4星 · 超过85%的资源 需积分: 50 43 下载量 93 浏览量
2019-04-30
12:33:40
上传
评论 11
收藏 37.3MB RAR 举报
温馨提示
实现功能:查看景区,线路,酒店信息,购物车等等。后台管理功能齐全。
资源推荐
资源详情
资源评论
收起资源包目录
旅游网站~springmvc加mysql实现的旅游类网站功能齐全 (1218个子文件)
FrontController.class 28KB
Client.class 16KB
FileController.class 14KB
Uploader.class 10KB
HssfHelper.class 10KB
DBHelper.class 8KB
OrderController.class 6KB
BaseController.class 6KB
WeatherUtil.class 6KB
ProductController.class 6KB
FlightUtil.class 6KB
AdminCustomerController.class 6KB
MessageController.class 6KB
ContactController.class 5KB
WdxxController.class 5KB
ShopcarController.class 5KB
MyController.class 5KB
PinglunController.class 5KB
FtpUtil.class 5KB
AdminUserController.class 5KB
KcController.class 5KB
ZxController.class 5KB
JfdhController.class 5KB
DateUtil.class 5KB
TypesController.class 4KB
BkController.class 4KB
CustomerLoginController.class 4KB
UserLoginController.class 4KB
LbtController.class 4KB
CustomerController.class 4KB
LngLat.class 4KB
RandomValidateCode.class 4KB
UserController.class 4KB
Sign.class 4KB
FileUtil.class 4KB
OperateImage.class 4KB
ProtalSessionHandlerInterceptor.class 3KB
AdminController.class 3KB
AdminLoginController.class 3KB
ValidatorUtil.class 3KB
StringHelper.class 3KB
UTF8StringHttpMessageConverter.class 3KB
TjController.class 3KB
StringUtil.class 2KB
PublicController.class 2KB
FileController$uploadFile.class 2KB
SystemProperties.class 2KB
DBHelper$1.class 2KB
MD5Util.class 2KB
ELSetPropertyTag.class 1KB
ExcelSelfUse.class 1KB
OverOutWrapper.class 1KB
ImageTools.class 1KB
Ehcache.class 1KB
MessageSourceHelper.class 1KB
MP3Player.class 1KB
BatchSql.class 1KB
SpringApplicationContextHolder.class 1KB
DateConverter.class 1KB
JacksonJsonUtil.class 1000B
TagParams.class 792B
Response.class 743B
IndexController.class 742B
ExcelView.class 453B
.classpath 572B
bootstrap.css 115KB
bootstrap.min.css 98KB
editor_ie7.css 47KB
editor_iequirks.css 46KB
editor_ie8.css 46KB
editor_ie.css 45KB
editor_gecko.css 45KB
editor.css 45KB
font-awesome.css 21KB
font-awesome.css 21KB
video-js.css 21KB
bootstrap-theme.min.css 19KB
font-awesome.min.css 17KB
dialog_ie7.css 17KB
dialog_ie8.css 16KB
dialog_iequirks.css 16KB
dialog_ie.css 16KB
dialog_opera.css 16KB
dialog.css 15KB
select2.min.css 15KB
custom-styles.css 13KB
style.css 11KB
video-js.min.css 11KB
cssCharts.css 10KB
checkbox3.min.css 7KB
style.css 7KB
fox.css 7KB
fox.css 7KB
style.css 6KB
datepicker.css 5KB
dataTables.bootstrap.css 5KB
sample.css 5KB
datepicker.css 5KB
skin.css 4KB
skin.css 4KB
共 1218 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
资源评论
- 伊·易2022-05-05你好,请问有这个文档吗?
- weixin_414287442019-12-25sql怎么是空的?
lxy38
- 粉丝: 4
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功