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.ChanpinchukuEntity;
import com.entity.view.ChanpinchukuView;
import com.service.ChanpinchukuService;
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-24 14:41:59
*/
@RestController
@RequestMapping("/chanpinchuku")
public class ChanpinchukuController {
@Autowired
private ChanpinchukuService chanpinchukuService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ChanpinchukuEntity chanpinchuku,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yuangong")) {
chanpinchuku.setYuangonggonghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<ChanpinchukuEntity> ew = new EntityWrapper<ChanpinchukuEntity>();
PageUtils page = chanpinchukuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chanpinchuku), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ChanpinchukuEntity chanpinchuku,
HttpServletRequest request){
EntityWrapper<ChanpinchukuEntity> ew = new EntityWrapper<ChanpinchukuEntity>();
PageUtils page = chanpinchukuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chanpinchuku), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ChanpinchukuEntity chanpinchuku){
EntityWrapper<ChanpinchukuEntity> ew = new EntityWrapper<ChanpinchukuEntity>();
ew.allEq(MPUtil.allEQMapPre( chanpinchuku, "chanpinchuku"));
return R.ok().put("data", chanpinchukuService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(ChanpinchukuEntity chanpinchuku){
EntityWrapper< ChanpinchukuEntity> ew = new EntityWrapper< ChanpinchukuEntity>();
ew.allEq(MPUtil.allEQMapPre( chanpinchuku, "chanpinchuku"));
ChanpinchukuView chanpinchukuView = chanpinchukuService.selectView(ew);
return R.ok("查询产品出库成功").put("data", chanpinchukuView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ChanpinchukuEntity chanpinchuku = chanpinchukuService.selectById(id);
return R.ok().put("data", chanpinchuku);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
ChanpinchukuEntity chanpinchuku = chanpinchukuService.selectById(id);
return R.ok().put("data", chanpinchuku);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ChanpinchukuEntity chanpinchuku, HttpServletRequest request){
chanpinchuku.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(chanpinchuku);
chanpinchukuService.insert(chanpinchuku);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ChanpinchukuEntity chanpinchuku, HttpServletRequest request){
chanpinchuku.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(chanpinchuku);
chanpinchukuService.insert(chanpinchuku);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody ChanpinchukuEntity chanpinchuku, HttpServletRequest request){
//ValidatorUtils.validateEntity(chanpinchuku);
chanpinchukuService.updateById(chanpinchuku);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
chanpinchukuService.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<ChanpinchukuEntity> wrapper = new EntityWrapper<ChanpinchukuEntity>();
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("yuangong")) {
wrapper.eq("yuangonggonghao", (String)request.getSession().getAttribute("username"));
}
int count = chanpinchukuService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* (按值统计)
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}")
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
EntityWrapper<ChanpinchukuEntity> ew = new EntityWrapper<ChanpinchukuEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yuangong")) {
ew.eq("yuangonggonghao", (String)request.getSession().getAttribute("username"));
}
List<Map<String, Object>> result = chanpinchukuService.selectValue(params, ew);
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
开发语言:Java 框架:ssm,jsp JDK版本:JDK1.8 服务器:tomcat7+ 数据库:mysql5.7+ 数据库工具:navicat 开发软件:eclipse/idea
资源推荐
资源详情
资源评论
收起资源包目录
java毕业设计之关于汽车零部件加工的erp系统源码(ssm+mysql+说明文档).zip (489个子文件)
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.fcdcc2de.css 266KB
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
CailiaochukuController.java 11KB
ChanpinchukuController.java 11KB
ChanpinrukuController.java 10KB
CailiaorukuController.java 10KB
LingjiancailiaoController.java 10KB
ChanpinxinxiController.java 9KB
YuangongController.java 9KB
JingliController.java 9KB
ChanpinleixingController.java 7KB
GongyingshangController.java 7KB
CommonController.java 6KB
ChanpinchukuEntity.java 6KB
ChanpinrukuEntity.java 6KB
CailiaochukuEntity.java 6KB
CailiaorukuEntity.java 6KB
UserController.java 5KB
MPUtil.java 5KB
LingjiancailiaoEntity.java 5KB
YuangongEntity.java 5KB
ChanpinchukuModel.java 4KB
ChanpinrukuModel.java 4KB
CailiaochukuModel.java 4KB
CailiaorukuModel.java 4KB
ChanpinchukuVO.java 4KB
ChanpinrukuVO.java 4KB
CailiaochukuVO.java 4KB
CailiaorukuVO.java 4KB
ChanpinxinxiEntity.java 4KB
LingjiancailiaoModel.java 4KB
LingjiancailiaoVO.java 4KB
BaiduUtil.java 4KB
YuangongModel.java 4KB
JingliEntity.java 4KB
GongyingshangEntity.java 4KB
YuangongVO.java 3KB
FileController.java 3KB
ConfigController.java 3KB
ChanpinxinxiModel.java 3KB
AuthorizationInterceptor.java 3KB
ChanpinxinxiVO.java 3KB
LingjiancailiaoServiceImpl.java 3KB
Query.java 3KB
ChanpinchukuServiceImpl.java 3KB
CailiaochukuServiceImpl.java 3KB
ChanpinxinxiServiceImpl.java 3KB
ChanpinrukuServiceImpl.java 3KB
CailiaorukuServiceImpl.java 3KB
TokenServiceImpl.java 2KB
JingliModel.java 2KB
CommonUtil.java 2KB
JingliVO.java 2KB
GongyingshangModel.java 2KB
TokenEntity.java 2KB
GongyingshangVO.java 2KB
ChanpinleixingEntity.java 2KB
ChanpinleixingServiceImpl.java 2KB
GongyingshangServiceImpl.java 2KB
PageUtils.java 2KB
YuangongServiceImpl.java 2KB
JingliServiceImpl.java 2KB
LingjiancailiaoDao.java 1KB
ChanpinchukuDao.java 1KB
ChanpinxinxiDao.java 1KB
CailiaochukuDao.java 1KB
CommonServiceImpl.java 1KB
ChanpinrukuDao.java 1KB
CailiaorukuDao.java 1KB
LingjiancailiaoService.java 1KB
ChanpinxinxiService.java 1KB
CailiaochukuService.java 1KB
ChanpinchukuService.java 1KB
UserServiceImpl.java 1KB
CailiaorukuService.java 1KB
ChanpinrukuService.java 1KB
UserEntity.java 1KB
SpringContextUtils.java 1KB
共 489 条
- 1
- 2
- 3
- 4
- 5
资源评论
码农落落
- 粉丝: 999
- 资源: 4364
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 保险箱检测51-YOLO(v5至v11)、COCO、CreateML、Paligemma、TFRecord、VOC数据集合集.rar
- 五相电机邻近四矢量SVPWM模型-MATLAB-Simulink仿真模型包括: (1)原理说明文档(重要):包括扇区判断、矢量作用时间计算、矢量作用顺序及切时间计算、PWM波的生成; (2)输出部分仿
- 一对一MybatisProgram.zip
- 时变动态分位数CoVaR、delta-CoVaR,分位数回归 △CoVaR测度 溢出效应 动态 Adrian2016基于分位数回归方法计算动态条件在险价值 R语言代码,代码更数据就能用,需要修改的
- 人物检测37-YOLO(v5至v11)、COCO、CreateML、Paligemma、TFRecord、VOC数据集合集.rar
- 人物检测26-YOLO(v5至v11)、COCO、CreateML、Paligemma、TFRecord、VOC数据集合集.rar
- 人和箱子检测2-YOLO(v5至v11)、COCO、CreateML、Paligemma、TFRecord、VOC数据集合集.rar
- 清华大学2022年秋季学期 高等数值分析课程报告
- GEE错误集-Cannot add an object of type <Element> to the map. Might be fixable with an explicit .pdf
- 清华大学2022年秋季学期 高等数值分析课程报告
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功