基于javaweb+mysql的ssm+maven购物商城管理系统(java+vue+elementui+ssm+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8、Node.js≥10
开发工具
后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM+Maven购物商城管理系统(java+vue+elementui+ssm+mysql)
项目介绍
角色:管理员、用户
网上购物商城包括管理员: 首页、个人中心、用户管理、关于我们管理、商品信息管理、商品类型管理、 新闻类别管理、举报投诉管理、订单信息管理、售后管理、新闻信息管理、我的收藏管理、留言板管理、 交流论坛、系统管理,用户:首页、个人中心、举报投诉管理、订单信息管理、售后管理、我的收藏管理等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目; 6.数据库:MySql 5.7/8.0等版本均可;
技术栈
后端:SSM(Spring+SpringMVC+Mybatis) 前端:Vue+elementui
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目; 3. 将项目中db.xml配置文件中的数据库配置改为自己的配置,然后运行;
*/
@RequestMapping("/lists")
public R list( DiscussxinwenxinxiEntity discussxinwenxinxi){
EntityWrapper<DiscussxinwenxinxiEntity> ew = new EntityWrapper<DiscussxinwenxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( discussxinwenxinxi, "discussxinwenxinxi"));
return R.ok().put("data", discussxinwenxinxiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(DiscussxinwenxinxiEntity discussxinwenxinxi){
EntityWrapper< DiscussxinwenxinxiEntity> ew = new EntityWrapper< DiscussxinwenxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( discussxinwenxinxi, "discussxinwenxinxi"));
DiscussxinwenxinxiView discussxinwenxinxiView = discussxinwenxinxiService.selectView(ew);
return R.ok("查询新闻信息评论表成功").put("data", discussxinwenxinxiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
DiscussxinwenxinxiEntity discussxinwenxinxi = discussxinwenxinxiService.selectById(id);
return R.ok().put("data", discussxinwenxinxi);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
DiscussxinwenxinxiEntity discussxinwenxinxi = discussxinwenxinxiService.selectById(id);
return R.ok().put("data", discussxinwenxinxi);
}
/**
* 后端保存
*/
public R save(@RequestBody DiscussshangpinxinxiEntity discussshangpinxinxi, HttpServletRequest request){
discussshangpinxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(discussshangpinxinxi);
discussshangpinxinxiService.insert(discussshangpinxinxi);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody DiscussshangpinxinxiEntity discussshangpinxinxi, HttpServletRequest request){
discussshangpinxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(discussshangpinxinxi);
discussshangpinxinxiService.insert(discussshangpinxinxi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody DiscussshangpinxinxiEntity discussshangpinxinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(discussshangpinxinxi);
discussshangpinxinxiService.updateById(discussshangpinxinxi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
discussshangpinxinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<YonghuEntity> wrapper = new EntityWrapper<YonghuEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = yonghuService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
package com.controller;
//ValidatorUtils.validateEntity(forum);
forum.setUserid((Long)request.getSession().getAttribute("userId"));
forumService.insert(forum);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody ForumEntity forum, HttpServletRequest request){
//ValidatorUtils.validateEntity(forum);
forumService.updateById(forum);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
forumService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
if(user==null) {
return R.error("账号不存在");
}
user.setPassword("123456");
userService.update(user,null);
return R.ok("密码已重置为:123456");
}
/**
* 列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,UserEntity user){
EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/list")
public R list( UserEntity user){
EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
ew.allEq(MPUtil.allEQMapPre( user, "user"));
return R.ok().put("data", userService.selectListView(ew));
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id){
UserEntity user = userService.selectById(id);
return R.ok().put("data", user);
}
/**
* 获取用户的session用户信息
*/
@RequestMapping("/session")
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<ShouhouEntity> wrapper = new EntityWrapper<ShouhouEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
wrapper.eq("zhanghao", (String)request.getSession().getAttribute("username"));
}
int count = shouhouService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
package com.controller;
/**
* 留言板
* 后端接口
* @email
*/
@RestController
@RequestMapping("/messages")
public class MessagesController {
@Autowired
private MessagesService messagesService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,MessagesEntity messages,
HttpServletRequest request){
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
messages.setUserid((Long)request.getSession().getAttribute("userId"));
}
EntityWrapper<MessagesEntity> ew = new EntityWrapper<MessagesEntity>();
PageUtils page = messagesService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, messages), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,MessagesEntity messages, HttpServletRequest request){
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
messages.setUserid((Long)request.getSession().getAttribute("userId"));
}
try {
File file1 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face1);
File file2 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face2);
String img1 = Base64Util.encode(FileUtil.FileToByte(file1));
String img2 = Base64Util.encode(FileUtil.FileToByte(file2));
MatchRequest req1 = new MatchRequest(img1, "BASE64");
MatchRequest req2 = new MatchRequest(img2, "BASE64");
ArrayList<MatchRequest> requests = new ArrayList<MatchRequest>();
requests.add(req1);
requests.add(req2);
res = client.match(requests);
System.out.println(res.get("result"));
} catch (FileNotFoundException e) {
e.printStackTrace();
return R.error("文件不存在");
} catch (IOException e) {
e.printStackTrace();
}
return R.ok().put("data", com.alibaba.fastjson.JSONObject.parse(res.get("result").toString()));
}
/**
* 获取table表中的column列表(联动接口)
* @param table
* @param column
* @return
*/
@IgnoreAuth
@RequestMapping("/option/{tableName}/{columnName}")
public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,String level,String parent) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
if(StringUtils.isNotBlank(level)) {
params.put("level", level);
}
if(StringUtils.isNotBlank(parent)) {
params.put("parent", parent);
}
List<String> data = commonService.getOption(params);
return R.ok().put("data", data);
}
/**
* 根据table中的column获取单条记录
* @param table
* @param column
* @return
*/
@IgnoreAuth
@RequestMapping("/follow/{tableName}/{columnName}")
public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, @RequestParam String columnValue) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<MessagesEntity> wrapper = new EntityWrapper<MessagesEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = messagesService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
package com.controller;
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody XinwenxinxiEntity xinwenxinxi, HttpServletRequest request){
xinwenxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(xinwenxinxi);
xinwenxinxiService.insert(xinwenxinxi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody XinwenxinxiEntity xinwenxinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(xinwenxinxi);
xinwenxinxiService.updateById(xinwenxinxi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
xinwenxinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ShouhouEntity shouhou, HttpServletRequest request){
EntityWrapper<ShouhouEntity> ew = new EntityWrapper<ShouhouEntity>();
PageUtils page = shouhouService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shouhou), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ShouhouEntity shouhou){
EntityWrapper<ShouhouEntity> ew = new EntityWrapper<ShouhouEntity>();
ew.allEq(MPUtil.allEQMapPre( shouhou, "shouhou"));
return R.ok().put("data", shouhouService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(ShouhouEntity shouhou){
EntityWrapper< ShouhouEntity> ew = new EntityWrapper< ShouhouEntity>();
ew.allEq(MPUtil.allEQMapPre( shouhou, "shouhou"));
ShouhouView shouhouView = shouhouService.selectView(ew);
return R.ok("查询售后成功").put("data", shouhouView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ShouhouEntity shouhou = shouhouService.selectById(id);
return R.ok().put("data", shouhou);
}
/**
* 前端详情
*/
@RequestMapping("/update")
public R update(@RequestBody XinwenxinxiEntity xinwenxinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(xinwenxinxi);
xinwenxinxiService.updateById(xinwenxinxi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
xinwenxinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
@RequestMapping("/lists")
public R list( DingdanxinxiEntity dingdanxinxi){
EntityWrapper<DingdanxinxiEntity> ew = new EntityWrapper<DingdanxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( dingdanxinxi, "dingdanxinxi"));
return R.ok().put("data", dingdanxinxiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(DingdanxinxiEntity dingdanxinxi){
EntityWrapper< DingdanxinxiEntity> ew = new EntityWrapper< DingdanxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( dingdanxinxi, "dingdanxinxi"));
DingdanxinxiView dingdanxinxiView = dingdanxinxiService.selectView(ew);
return R.ok("查询订单信息成功").put("data", dingdanxinxiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
DingdanxinxiEntity dingdanxinxi = dingdanxinxiService.selectById(id);
return R.ok().put("data", dingdanxinxi);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
DingdanxinxiEntity dingdanxinxi = dingdanxinxiService.selectById(id);
return R.ok().put("data", dingdanxinxi);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody DingdanxinxiEntity dingdanxinxi, HttpServletRequest request){
dingdanxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(dingdanxinxi);
dingdanxinxiService.insert(dingdanxinxi);
return R.ok();
/**
* 在线客服
* 后端接口
* @email
*/
@RestController
@RequestMapping("/chat")
public class ChatController {
@Autowired
private ChatService chatService;
/**
* 后端列表
*/
@RequestMapping("/page")
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
forumService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<ForumEntity> wrapper = new EntityWrapper<ForumEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = forumService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* 新闻类别
* 后端接口
* @email
*/
@RestController
@RequestMapping("/xinwenleibie")
public class XinwenleibieController {
@Autowired
private XinwenleibieService xinwenleibieService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,XinwenleibieEntity xinwenleibie,
HttpServletRequest request){
EntityWrapper<XinwenleibieEntity> ew = new EntityWrapper<XinwenleibieEntity>();
PageUtils page = xinwenleibieService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xinwenleibie), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,XinwenleibieEntity xinwenleibie, HttpServletRequest request){
EntityWrapper<XinwenleibieEntity> ew = new EntityWrapper<XinwenleibieEntity>();
PageUtils page = xinwenleibieService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xinwenleibie), params), params));
return R.ok().put("data", page);
@Autowired
private ChatService chatService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ChatEntity chat,
HttpServletRequest request){
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
chat.setUserid((Long)request.getSession().getAttribute("userId"));
}
EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>();
PageUtils page = chatService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chat), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ChatEntity chat, HttpServletRequest request){
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
chat.setUserid((Long)request.getSession().getAttribute("userId"));
}
EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>();
PageUtils page = chatService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chat), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ChatEntity chat){
EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>();
ew.allEq(MPUtil.allEQMapPre( chat, "chat"));
return R.ok().put("data", chatService.selectListView(ew));
}
* @param table
* @param map
* @return
*/
@RequestMapping("/sh/{tableName}")
public R sh(@PathVariable("tableName") String tableName, @RequestBody Map<String, Object> map) {
map.put("table", tableName);
commonService.sh(map);
return R.ok();
}
/**
* 获取需要提醒的记录数
* @param tableName
* @param columnName
* @param type 1:数字 2:日期
* @param map
* @return
*/
@IgnoreAuth
@RequestMapping("/remind/{tableName}/{columnName}/{type}")
public R remindCount(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("table", tableName);
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
@Autowired
private XinwenxinxiService xinwenxinxiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,XinwenxinxiEntity xinwenxinxi,
HttpServletRequest request){
EntityWrapper<XinwenxinxiEntity> ew = new EntityWrapper<XinwenxinxiEntity>();
PageUtils page = xinwenxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xinwenxinxi), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,XinwenxinxiEntity xinwenxinxi, HttpServletRequest request){
EntityWrapper<XinwenxinxiEntity> ew = new EntityWrapper<XinwenxinxiEntity>();
PageUtils page = xinwenxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xinwenxinxi), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( XinwenxinxiEntity xinwenxinxi){
EntityWrapper<XinwenxinxiEntity> ew = new EntityWrapper<XinwenxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( xinwenxinxi, "xinwenxinxi"));
return R.ok().put("data", xinwenxinxiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(XinwenxinxiEntity xinwenxinxi){
EntityWrapper< XinwenxinxiEntity> ew = new EntityWrapper< XinwenxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( xinwenxinxi, "xinwenxinxi"));
XinwenxinxiView xinwenxinxiView = xinwenxinxiService.selectView(ew);
return R.ok("查询新闻信息成功").put("data", xinwenxinxiView);
}
/**
* 商品信息评论表
* 后端接口
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,XinwenleibieEntity xinwenleibie,
HttpServletRequest request){
EntityWrapper<XinwenleibieEntity> ew = new EntityWrapper<XinwenleibieEntity>();
PageUtils page = xinwenleibieService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xinwenleibie), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,XinwenleibieEntity xinwenleibie, HttpServletRequest request){
EntityWrapper<XinwenleibieEntity> ew = new EntityWrapper<XinwenleibieEntity>();
PageUtils page = xinwenleibieService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xinwenleibie), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( XinwenleibieEntity xinwenleibie){
EntityWrapper<XinwenleibieEntity> ew = new EntityWrapper<XinwenleibieEntity>();
ew.allEq(MPUtil.allEQMapPre( xinwenleibie, "xinwenleibie"));
return R.ok().put("data", xinwenleibieService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(XinwenleibieEntity xinwenleibie){
EntityWrapper< XinwenleibieEntity> ew = new EntityWrapper< XinwenleibieEntity>();
ew.allEq(MPUtil.allEQMapPre( xinwenleibie, "xinwenleibie"));
XinwenleibieView xinwenleibieView = xinwenleibieService.selectView(ew);
return R.ok("查询新闻类别成功").put("data", xinwenleibieView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
XinwenleibieEntity xinwenleibie = xinwenleibieService.selectById(id);
return R.ok().put("data", xinwenleibie);
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){
shangpinxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(shangpinxinxi);
shangpinxinxiService.insert(shangpinxinxi);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){
shangpinxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(shangpinxinxi);
shangpinxinxiService.insert(shangpinxinxi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(shangpinxinxi);
shangpinxinxiService.updateById(shangpinxinxi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
shangpinxinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
if(childs == null || childs.size()==0) {
return null;
}
forum.setChilds(childs);
for(ForumEntity forumEntity : childs) {
getChilds(forumEntity);
}
return forum;
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ForumEntity forum, HttpServletRequest request){
forum.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(forum);
forum.setUserid((Long)request.getSession().getAttribute("userId"));
forumService.insert(forum);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ForumEntity forum, HttpServletRequest request){
forum.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(forum);
forum.setUserid((Long)request.getSession().getAttribute("userId"));
forumService.insert(forum);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody ForumEntity forum, HttpServletRequest request){
//ValidatorUtils.validateEntity(forum);
forumService.updateById(forum);//全部更新
return R.ok();
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<DingdanxinxiEntity> wrapper = new EntityWrapper<DingdanxinxiEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
wrapper.eq("zhanghao", (String)request.getSession().getAttribute("username"));
}
int count = dingdanxinxiService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
package com.controller;
/**
* 交流论坛
* 后端接口
* @email
*/
@GetMapping(value = "logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
if(user==null) {
return R.error("账号不存在");
}
user.setPassword("123456");
userService.update(user,null);
return R.ok("密码已重置为:123456");
}
/**
* 列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,UserEntity user){
EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/list")
public R list( UserEntity user){
EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
ew.allEq(MPUtil.allEQMapPre( user, "user"));
return R.ok().put("data", userService.selectListView(ew));
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id){
UserEntity user = userService.selectById(id);
return R.ok().put("data", user);
}
/**
* 获取用户的session用户信息