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.CailiaochukuEntity;
import com.entity.view.CailiaochukuView;
import com.service.CailiaochukuService;
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("/cailiaochuku")
public class CailiaochukuController {
@Autowired
private CailiaochukuService cailiaochukuService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,CailiaochukuEntity cailiaochuku,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yuangong")) {
cailiaochuku.setYuangonggonghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<CailiaochukuEntity> ew = new EntityWrapper<CailiaochukuEntity>();
PageUtils page = cailiaochukuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cailiaochuku), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,CailiaochukuEntity cailiaochuku,
HttpServletRequest request){
EntityWrapper<CailiaochukuEntity> ew = new EntityWrapper<CailiaochukuEntity>();
PageUtils page = cailiaochukuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cailiaochuku), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( CailiaochukuEntity cailiaochuku){
EntityWrapper<CailiaochukuEntity> ew = new EntityWrapper<CailiaochukuEntity>();
ew.allEq(MPUtil.allEQMapPre( cailiaochuku, "cailiaochuku"));
return R.ok().put("data", cailiaochukuService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(CailiaochukuEntity cailiaochuku){
EntityWrapper< CailiaochukuEntity> ew = new EntityWrapper< CailiaochukuEntity>();
ew.allEq(MPUtil.allEQMapPre( cailiaochuku, "cailiaochuku"));
CailiaochukuView cailiaochukuView = cailiaochukuService.selectView(ew);
return R.ok("查询材料出库成功").put("data", cailiaochukuView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
CailiaochukuEntity cailiaochuku = cailiaochukuService.selectById(id);
return R.ok().put("data", cailiaochuku);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
CailiaochukuEntity cailiaochuku = cailiaochukuService.selectById(id);
return R.ok().put("data", cailiaochuku);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody CailiaochukuEntity cailiaochuku, HttpServletRequest request){
cailiaochuku.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(cailiaochuku);
cailiaochukuService.insert(cailiaochuku);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody CailiaochukuEntity cailiaochuku, HttpServletRequest request){
cailiaochuku.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(cailiaochuku);
cailiaochukuService.insert(cailiaochuku);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody CailiaochukuEntity cailiaochuku, HttpServletRequest request){
//ValidatorUtils.validateEntity(cailiaochuku);
cailiaochukuService.updateById(cailiaochuku);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
cailiaochukuService.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<CailiaochukuEntity> wrapper = new EntityWrapper<CailiaochukuEntity>();
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 = cailiaochukuService.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<CailiaochukuEntity> ew = new EntityWrapper<CailiaochukuEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yuangong")) {
ew.eq("yuangonggonghao", (String)request.getSession().getAttribute("username"));
}
List<Map<String, Object>> result = cailiaochukuService.selectValue(params, ew);
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于SSM的汽车零部件加工的erp系统源码.zip (491个子文件)
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
ChanpinchukuController.java 11KB
CailiaochukuController.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
CailiaochukuServiceImpl.java 3KB
ChanpinchukuServiceImpl.java 3KB
ChanpinxinxiServiceImpl.java 3KB
CailiaorukuServiceImpl.java 3KB
ChanpinrukuServiceImpl.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
ChanpinxinxiDao.java 1KB
ChanpinchukuDao.java 1KB
CailiaochukuDao.java 1KB
CommonServiceImpl.java 1KB
CailiaorukuDao.java 1KB
ChanpinrukuDao.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
共 491 条
- 1
- 2
- 3
- 4
- 5
资源评论
入伍击寇
- 粉丝: 138
- 资源: 5032
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功