package com.shuju.test2.controller;
import java.util.Date;
import java.util.HashMap;
import com.shuju.test2.bean.DemoUserLog;
import com.shuju.test2.cache.DemoUserLogCache;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
@RestController
@RequestMapping("/api")
public class ApiController {
@Autowired
private DemoUserLogCache demoUserLogCache;
@RequestMapping(value = "/select", method = RequestMethod.GET)
@ApiOperation(value = "查找", notes = "根据用户ID查找用户")
public DemoUserLog get(@RequestParam(defaultValue = "1") Integer id) {
return demoUserLogCache.selectById(id);
}
@RequestMapping(value = "/update", method = RequestMethod.GET)
public DemoUserLog update(@RequestParam(defaultValue = "1") Integer id) {
DemoUserLog bean = demoUserLogCache.selectById(id);
bean.setUserName("测试222");
bean.setCreateTime(new Date());
demoUserLogCache.updateById(bean);
return bean;
}
@ApiIgnore
@RequestMapping(value = "/del", method = RequestMethod.GET)
public String del(@RequestParam(defaultValue = "1") Integer id) {
return demoUserLogCache.deleteById(id);
}
}