package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.HuowuxinxiEntity;
import com.entity.view.HuowuxinxiView;
import com.service.HuowuxinxiService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 货物信息
* 后端接口
* @author
* @email
* @date 2022-02-19 15:44:29
*/
@RestController
@RequestMapping("/huowuxinxi")
public class HuowuxinxiController {
@Autowired
private HuowuxinxiService huowuxinxiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,HuowuxinxiEntity huowuxinxi,
HttpServletRequest request){
EntityWrapper<HuowuxinxiEntity> ew = new EntityWrapper<HuowuxinxiEntity>();
PageUtils page = huowuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, huowuxinxi), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,HuowuxinxiEntity huowuxinxi,
HttpServletRequest request){
EntityWrapper<HuowuxinxiEntity> ew = new EntityWrapper<HuowuxinxiEntity>();
PageUtils page = huowuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, huowuxinxi), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( HuowuxinxiEntity huowuxinxi){
EntityWrapper<HuowuxinxiEntity> ew = new EntityWrapper<HuowuxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( huowuxinxi, "huowuxinxi"));
return R.ok().put("data", huowuxinxiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(HuowuxinxiEntity huowuxinxi){
EntityWrapper< HuowuxinxiEntity> ew = new EntityWrapper< HuowuxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( huowuxinxi, "huowuxinxi"));
HuowuxinxiView huowuxinxiView = huowuxinxiService.selectView(ew);
return R.ok("查询货物信息成功").put("data", huowuxinxiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
HuowuxinxiEntity huowuxinxi = huowuxinxiService.selectById(id);
huowuxinxi.setClicknum(huowuxinxi.getClicknum()+1);
huowuxinxi.setClicktime(new Date());
huowuxinxiService.updateById(huowuxinxi);
return R.ok().put("data", huowuxinxi);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
HuowuxinxiEntity huowuxinxi = huowuxinxiService.selectById(id);
huowuxinxi.setClicknum(huowuxinxi.getClicknum()+1);
huowuxinxi.setClicktime(new Date());
huowuxinxiService.updateById(huowuxinxi);
return R.ok().put("data", huowuxinxi);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody HuowuxinxiEntity huowuxinxi, HttpServletRequest request){
huowuxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(huowuxinxi);
huowuxinxiService.insert(huowuxinxi);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody HuowuxinxiEntity huowuxinxi, HttpServletRequest request){
huowuxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(huowuxinxi);
huowuxinxiService.insert(huowuxinxi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody HuowuxinxiEntity huowuxinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(huowuxinxi);
huowuxinxiService.updateById(huowuxinxi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
huowuxinxiService.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<HuowuxinxiEntity> wrapper = new EntityWrapper<HuowuxinxiEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = huowuxinxiService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* 前端智能排序
*/
@IgnoreAuth
@RequestMapping("/autoSort")
public R autoSort(@RequestParam Map<String, Object> params,HuowuxinxiEntity huowuxinxi, HttpServletRequest request,String pre){
EntityWrapper<HuowuxinxiEntity> ew = new EntityWrapper<HuowuxinxiEntity>();
Map<String, Object> newMap = new HashMap<String, Object>();
Map<String, Object> param = new HashMap<String, Object>();
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
String newKey = entry.getKey();
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}
params.put("sort", "clicknum");
params.put("order", "desc");
PageUtils page = huowuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, huowuxinxi), params), params));
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
环境说明: 开发语言:Java 框架:ssm JDK版本:JDK1.8 数据库:mysql 5.7+ 部署容器:tomcat7+ 数据库工具:Navicat11+ 开发软件:eclipse/myeclipse/idea(推荐idea) Maven包:Maven3.3.9
资源推荐
资源详情
资源评论
收起资源包目录
java毕业设计之仓库管理信息系统源码(ssm完整前后端+mysql).zip (460个子文件)
update-password.vue.bak 3KB
IndexMain.vue.bak 2KB
IndexAsideStatic.vue.bak 2KB
BreadCrumbs.vue.bak 2KB
IndexHeader.vue.bak 2KB
3-build.bat 15B
2-run.bat 14B
1-install.bat 12B
.classpath 1KB
org.eclipse.wst.common.component 689B
org.eclipse.wst.jsdt.ui.superType.container 49B
app.93c218e3.css 264KB
bootstrap.css 143KB
bootstrap.min.css 118KB
chunk-vendors.1f0a25b2.css 37KB
canvas-bg-1.css 391B
canvas-bg-2.css 83B
canvas-bg-3.css 61B
glyphicons-halflings-regular.eot 20KB
.gitignore 10B
index.html 924B
index.html 552B
favicon.ico 4KB
favicon.ico 4KB
HuowuxinxiController.java 11KB
HuowuchukuController.java 10KB
HuowurukuController.java 10KB
YuangongController.java 9KB
CangkugonggaoController.java 8KB
CangkuxinxiController.java 8KB
StoreupController.java 7KB
GongyingshangController.java 7KB
CommonController.java 6KB
KehuxinxiController.java 6KB
UserController.java 5KB
MPUtil.java 5KB
HuowuxinxiEntity.java 5KB
CangkuxinxiEntity.java 4KB
HuowurukuEntity.java 4KB
HuowuchukuEntity.java 4KB
HuowuxinxiModel.java 4KB
CangkugonggaoEntity.java 4KB
YuangongEntity.java 4KB
HuowuxinxiVO.java 4KB
BaiduUtil.java 4KB
StoreupEntity.java 4KB
KehuxinxiEntity.java 3KB
GongyingshangEntity.java 3KB
FileController.java 3KB
CangkuxinxiModel.java 3KB
HuowurukuModel.java 3KB
ConfigController.java 3KB
CangkuxinxiVO.java 3KB
HuowuchukuModel.java 3KB
HuowurukuVO.java 3KB
AuthorizationInterceptor.java 3KB
HuowuchukuVO.java 3KB
Query.java 3KB
CangkugonggaoModel.java 3KB
YuangongModel.java 3KB
HuowuxinxiServiceImpl.java 2KB
HuowuchukuServiceImpl.java 2KB
HuowurukuServiceImpl.java 2KB
CangkugonggaoVO.java 2KB
YuangongVO.java 2KB
TokenServiceImpl.java 2KB
StoreupModel.java 2KB
StoreupVO.java 2KB
CommonUtil.java 2KB
TokenEntity.java 2KB
KehuxinxiModel.java 2KB
GongyingshangModel.java 2KB
KehuxinxiVO.java 2KB
CangkugonggaoServiceImpl.java 2KB
GongyingshangServiceImpl.java 2KB
GongyingshangVO.java 2KB
PageUtils.java 2KB
CangkuxinxiServiceImpl.java 2KB
KehuxinxiServiceImpl.java 2KB
YuangongServiceImpl.java 2KB
StoreupServiceImpl.java 2KB
CommonServiceImpl.java 1KB
HuowuxinxiDao.java 1KB
HuowuchukuDao.java 1KB
HuowurukuDao.java 1KB
UserServiceImpl.java 1KB
HuowuxinxiService.java 1KB
HuowuchukuService.java 1KB
HuowurukuService.java 1KB
UserEntity.java 1KB
SpringContextUtils.java 1KB
ValidatorUtils.java 1KB
SQLFilter.java 1KB
CangkugonggaoService.java 1KB
GongyingshangService.java 1KB
CangkugonggaoDao.java 1KB
GongyingshangDao.java 1KB
CangkuxinxiService.java 1KB
CangkuxinxiDao.java 1014B
HttpClientUtils.java 1013B
共 460 条
- 1
- 2
- 3
- 4
- 5
资源评论
大学生资源网
- 粉丝: 131
- 资源: 1334
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 5.23-Java概述,JDK安装及注释、关键字、标识符、数据类型、变量、常量的介绍
- 《Python基础》实验三指导书(1).doc
- TensorFlow 深度学习、机器学习-任何能够用计算流图形来表达的计算,都可以使用TensorFlow
- 一个基于springboot+sureness的面向REST API资源无状态认证权限管理系统
- 王博外文文献.pdf
- python毕业设计基于社区检测的多任务聚类联邦学习项目源码+使用说明(高分项目).zip
- Javaweb项目源码-编程爱好者博客地带.zip
- java各个技术栈相关知识点
- PYthon代码 pdf合并
- 内容涵盖:Java、MyBatis、ZooKeeper、Dubbo、Elasticsearch、Memcached、 Redis
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功