Commit 1a001d0b by wnb0128

车家智能V1.0.0开发 用户数据--think.wang

1 parent 47f21cec
...@@ -7,10 +7,7 @@ import com.glsx.smart.service.SmartSceneTemplateService; ...@@ -7,10 +7,7 @@ import com.glsx.smart.service.SmartSceneTemplateService;
import com.glsx.smart.service.SmartTemplateParamService; import com.glsx.smart.service.SmartTemplateParamService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
...@@ -47,7 +44,7 @@ public class SceneTemplateController { ...@@ -47,7 +44,7 @@ public class SceneTemplateController {
} }
@RequestMapping(value = "/getById", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/getById", method = {RequestMethod.GET, RequestMethod.POST})
public SmartSceneTemplate getById(Long id) { public SmartSceneTemplate getById(@RequestParam("id") Long id) {
log.info("/sceneTemplate/getById param: {}", id); log.info("/sceneTemplate/getById param: {}", id);
SmartSceneTemplate template = sceneTemplateService.getById(id); SmartSceneTemplate template = sceneTemplateService.getById(id);
if(template != null){ if(template != null){
......
...@@ -5,10 +5,7 @@ import com.glsx.smart.dao.entity.SmartUserRelation; ...@@ -5,10 +5,7 @@ import com.glsx.smart.dao.entity.SmartUserRelation;
import com.glsx.smart.service.SmartUserRelationService; import com.glsx.smart.service.SmartUserRelationService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @Title: UserRelationController.java * @Title: UserRelationController.java
...@@ -28,15 +25,22 @@ public class UserRelationController { ...@@ -28,15 +25,22 @@ public class UserRelationController {
@ResponseBody @ResponseBody
@RequestMapping(value = "/getSingle", method = {RequestMethod.POST}) @RequestMapping(value = "/getSingle", method = {RequestMethod.POST})
public SmartUserRelation getSingle(SmartUserRelation userRelation){ public SmartUserRelation getSingle(@RequestBody SmartUserRelation userRelation){
return userRelationService.getSingle(userRelation); return userRelationService.getSingle(userRelation);
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "/add", method = {RequestMethod.POST}) @RequestMapping(value = "/add", method = {RequestMethod.POST})
public boolean add(SmartUserRelation userRelation){ public Long add(@RequestBody SmartUserRelation userRelation){
log.info("/user/add保存数据参数:{}", JSON.toJSONString(userRelation)); log.info("/user/add保存数据参数:{}", JSON.toJSONString(userRelation));
return userRelationService.insertSelective(userRelation) > 0 ? true : false; 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);
}
} }
...@@ -17,7 +17,7 @@ public interface SmartUserRelationService { ...@@ -17,7 +17,7 @@ public interface SmartUserRelationService {
int insertOrUpdate(SmartUserRelation record); int insertOrUpdate(SmartUserRelation record);
int insertSelective(SmartUserRelation record); Long insertSelective(SmartUserRelation record);
SmartUserRelation getSingle(SmartUserRelation record); SmartUserRelation getSingle(SmartUserRelation record);
......
...@@ -45,8 +45,9 @@ public class SmartUserRelationServiceImpl implements SmartUserRelationService { ...@@ -45,8 +45,9 @@ public class SmartUserRelationServiceImpl implements SmartUserRelationService {
} }
@Override @Override
public int insertSelective(SmartUserRelation record) { public Long insertSelective(SmartUserRelation record) {
return smartUserRelationMapper.insertSelective(record); int i = smartUserRelationMapper.insertSelective(record);
return i > 0 ? record.getId() : 0L;
} }
@Override @Override
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!