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 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.YuangonggongziEntity;
import com.entity.view.YuangonggongziView;
import com.service.YuangonggongziService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import java.io.IOException;
/**
* 员工工资
* 后端接口
* @author
* @email
* @date 2022-04-02 16:46:23
*/
@RestController
@RequestMapping("/yuangonggongzi")
public class YuangonggongziController {
@Autowired
private YuangonggongziService yuangonggongziService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,YuangonggongziEntity yuangonggongzi,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yuangong")) {
yuangonggongzi.setYuangonggonghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<YuangonggongziEntity> ew = new EntityWrapper<YuangonggongziEntity>();
PageUtils page = yuangonggongziService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yuangonggongzi), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,YuangonggongziEntity yuangonggongzi,
HttpServletRequest request){
EntityWrapper<YuangonggongziEntity> ew = new EntityWrapper<YuangonggongziEntity>();
PageUtils page = yuangonggongziService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yuangonggongzi), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( YuangonggongziEntity yuangonggongzi){
EntityWrapper<YuangonggongziEntity> ew = new EntityWrapper<YuangonggongziEntity>();
ew.allEq(MPUtil.allEQMapPre( yuangonggongzi, "yuangonggongzi"));
return R.ok().put("data", yuangonggongziService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(YuangonggongziEntity yuangonggongzi){
EntityWrapper< YuangonggongziEntity> ew = new EntityWrapper< YuangonggongziEntity>();
ew.allEq(MPUtil.allEQMapPre( yuangonggongzi, "yuangonggongzi"));
YuangonggongziView yuangonggongziView = yuangonggongziService.selectView(ew);
return R.ok("查询员工工资成功").put("data", yuangonggongziView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
YuangonggongziEntity yuangonggongzi = yuangonggongziService.selectById(id);
return R.ok().put("data", yuangonggongzi);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
YuangonggongziEntity yuangonggongzi = yuangonggongziService.selectById(id);
return R.ok().put("data", yuangonggongzi);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody YuangonggongziEntity yuangonggongzi, HttpServletRequest request){
yuangonggongzi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yuangonggongzi);
yuangonggongziService.insert(yuangonggongzi);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody YuangonggongziEntity yuangonggongzi, HttpServletRequest request){
yuangonggongzi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yuangonggongzi);
yuangonggongziService.insert(yuangonggongzi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody YuangonggongziEntity yuangonggongzi, HttpServletRequest request){
//ValidatorUtils.validateEntity(yuangonggongzi);
yuangonggongziService.updateById(yuangonggongzi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
yuangonggongziService.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<YuangonggongziEntity> wrapper = new EntityWrapper<YuangonggongziEntity>();
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 = yuangonggongziService.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<YuangonggongziEntity> ew = new EntityWrapper<YuangonggongziEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yuangong")) {
ew.eq("yuangonggonghao", (String)request.getSession().getAttribute("usernam
逃逸的卡路里
- 粉丝: 1w+
- 资源: 5356
最新资源
- 流水线贴膜机完成项目程序,包含PLC程序和触摸屏程序,程序内 包含上下气缸控制,夹紧气缸控制,输送带电机控制,贴膜伺服控制,旋转电机控制等类容,非常适合学习简单控制工艺及运动控制初学者学习,该程序支持
- PLC与变频器RS指令无协议通讯 适应支持MODBUS.RTU模式的各品牌变频器 RS485ADP或者RS485BD板都可以 本程序编写了CRC循环冗余校验码程序,针对FX1N.2N没有CRC专
- 自己封装的爱普生机器人与三菱的MC协议通信驱动程序,提供项目源码、MC协议源码,需要一定基础(通信 MC协议 爱普生机器人编程)才能调的通
- 紧急道,紧急避障,横纵向联合控制,模型预测控制+pid控制方案,通过控制转角以及车轮力矩实现道,避障轨迹 matlab用的是2016,carsim用的是2018
- 基于plc智能停车场车位控制仿真 功能介绍: ①假设某停车场共有16个车位 ②在停车场入口处装设有一传感器,用来检测车辆进入的数目 ③在停车场出口处装设有一传感器,用来检测车辆出去的数目 ④尚有
- 能量和储备调度的分布鲁棒联合机会约束 测试环境:MATLAB 关键词:分布式鲁棒优化,能量和储备调度,联合机会约束 我们开发了一个两阶段的随机计划,为能源和储备调度的联合电力和天然气系统的高渗透的可再
- 插电式混合动力汽车的能量管理:模型预测控制的凸优化算法 测试环境:MATLAB 关键词:乘法器交替方向法、能量管理、内点法、模型预测控制、插电式混合动力汽车 求解非线性损耗混合动力汽车能量管理模型预测
- 储能参与调频调峰联合优化运行 关键词:储能 调频 调峰 储能优化 联合优化 测试环境:matlab平台 通过一个联合优化框架同时使用电池存储系统进行调峰和频率调节,该框架可以捕捉到电池 化、操作限
- 基于最小二乘法和快速解耦法的电网状态估计 测试环境:MATLAB 电网状态估计问题的实质是当方程的个数大于变量的个数时,对方程变量进行无偏估计 对于电网系统,变量为节点电压(即状态值,由实部和虚部
- 四轮轮毂电机驱动车辆,驱动电机故障状态估计(UKF) 软件使用:Matlab Simulink 适用场景:采用无迹卡尔曼滤波UKF进行轮毂电机状态估计,失效电机估计状态为0,正常电机状态为1 产品
- 汇川H3UCAN总线高性能PLC实机程序,本体应用五轴?CAN总线轴控两轴SV630总线伺服电机,最大可扩充16轴运动总线 另外一路MODBUS总线控制高频温控器 配合台湾威纶通TK6071IP触
- 倒立摆源码 13年国赛电赛旋转倒立摆 完整全功能 程序 倒立摆 pid算法 程序使用时可根据硬件需要自行调节 基本要求 1. 摆杆从处于自然下垂状态(摆角 0°)开始,驱动电机带动旋转臂作往复旋转使
- 成熟 步进电机驱动 方案 全套
- 考虑电动汽车调度潜力的两阶段充电桩市场投标 代码 测试环境:MATLAB 关键词:电动汽车,车并网,纳什均衡,投标策略 充电站投标优化能降低电力成本甚至通过电取益 考虑了电动汽车成为柔性储荷资源的
- 四相8 6极开关磁阻电机maxwell仿真资料
- labview串口,网口,DSC可用OPC通讯链接三菱欧姆龙西门子等PLC 需要的取,可帮助使用 通过NI-OPC控制三菱,欧姆龙西门子等各种型号PLC
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈