UserRelationController.java 1.48 KB
package com.glsx.smart.controller;

import com.alibaba.fastjson.JSON;
import com.glsx.smart.dao.entity.SmartUserRelation;
import com.glsx.smart.service.SmartUserRelationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Title: UserRelationController.java
 * @Description:用户关系控制类
 * @author think.wang
 * @version V1.0  
 * @Company: Didihu.com.cn
 * @Copyright Copyright (c) 2017
 */
@Slf4j
@RestController
@RequestMapping("/user")
public class UserRelationController {

	@Autowired
	private SmartUserRelationService userRelationService;
	
	@ResponseBody
	@RequestMapping(value = "/getSingle", method = {RequestMethod.POST})
	public SmartUserRelation getSingle(@RequestBody SmartUserRelation userRelation){
		return userRelationService.getSingle(userRelation);
	}

	@ResponseBody
	@RequestMapping(value = "/add", method = {RequestMethod.POST})
	public Long add(@RequestBody SmartUserRelation userRelation){
		log.info("/user/add保存数据参数:{}", JSON.toJSONString(userRelation));
		return userRelationService.insertSelective(userRelation);
	}

    @ResponseBody
    @RequestMapping(value = "/update", method = {RequestMethod.POST})
    public Integer update(@RequestBody SmartUserRelation userRelation){
        log.info("/user/update保存数据参数:{}", JSON.toJSONString(userRelation));
        return userRelationService.updateByPrimaryKeySelective(userRelation);
    }

}