前端保存
(@RequestBody YonghuEntity yonghu, HttpServletRequest request)
| 203 | * 前端保存 |
| 204 | */ |
| 205 | @RequestMapping("/add") |
| 206 | public R add(@RequestBody YonghuEntity yonghu, HttpServletRequest request){ |
| 207 | yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); |
| 208 | //ValidatorUtils.validateEntity(yonghu); |
| 209 | YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", yonghu.getYonghuzhanghao())); |
| 210 | if(user!=null) { |
| 211 | return R.error("用户已存在"); |
| 212 | } |
| 213 | |
| 214 | yonghu.setId(new Date().getTime()); |
| 215 | yonghuService.insert(yonghu); |
| 216 | return R.ok(); |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * 修改 |