use of com.topcom.cms.yuqing.domain.UserStyle in project topcom-cloud by 545314690.
the class UserStyleController method setUserStyle.
@ApiOperation("保存userStyle,保证每个用户只有一个UserStyle")
@RequestMapping(value = { "setUserStyle" }, method = { RequestMethod.POST }, produces = { "application/json" }, consumes = { "application/json" })
@ResponseBody
public UserStyle setUserStyle(@CurrentUser User user, @RequestBody UserStyle userStyle) throws Exception {
UserStyle us = this.userStyleManager.findByUserId(user.getId());
if (us == null) {
Date date = new Date();
userStyle.setDateCreated(date);
userStyle.setDateModified(date);
userStyle.setUserId(user.getId());
userStyle = this.manager.save(userStyle);
return userStyle;
} else {
userStyle.setId(us.getId());
userStyle.setDateModified(new Date());
userStyle.setUserId(user.getId());
userStyle = this.manager.save(userStyle);
return userStyle;
}
}
Aggregations