Controller层
@SysLog("参数信息做新增")
@RequestMapping("/save")
@RequiresPermissions("xxx:weeklightlimit:save")
public R save(@RequestBody WeekLightLimitEntity weekLightLimit){
try {
int oltpwr=weekLightLimit.getOltpwr();
int ontpwr=weekLightLimit.getOntpwr();
int noLightUp=weekLightLimit.getNoLightUp();
int noLightDown=weekLightLimit.getNoLightDown();
if(oltpwr>ontpwr||noLightUp<noLightDown){
return R.error("提示信息");
}else {
System.out.println("数据输入正确");
};
Integer deptId=weekLightLimit.getDeptId();
System.out.println(deptId);
List<Integer> deptIdList=weekLightLimitService.findAllDeptId();
System.out.println(deptIdList);
for(Integer list:deptIdList) {
if(deptId==list) {
return R.error("提示信息");
}else {
System.out.println(deptId+"并未配置");
};
};
weekLightLimit.setCreateTime(new Date());
weekLightLimit.setUpdateTime(new Date());
weekLightLimitService.save(weekLightLimit);
}catch(Exception e) {
e.printStackTrace();
}
return R.ok();
}
Service接口实现类
@Override
public boolean save(T entity) {
return retBool(baseMapper.insert(entity));
}
原文:https://www.cnblogs.com/pureray-hui/p/12337261.html