}
@RequestMapping(value="/vote-action", method=RequestMethod.GET)
public @ResponseBody Object doVoteAction(@RequestParam String code,
@RequestParam Long linkedId,@RequestParam String entity, @RequestAttr User user) {
VoteRecord voteRecord = voteRecordService.getVoteRecord(linkedId, entity, user);
if(voteRecord==null) {
voteRecord = new VoteRecord(code, linkedId, entity);
voteRecord.setUser(user);
voteRecordService.createVoteRecord(voteRecord);
} else {
voteRecord.setCode(code);
voteRecord.setLinkedId(linkedId);
voteRecord.setEntity(entity);
voteRecord.setUser(user);
voteRecordService.updateVoteRecord(voteRecord);
}
return Collections.singletonMap("id", voteRecord.getId());
}