This commit is contained in:
Redkale
2016-08-31 09:21:12 +08:00
parent 78ac88b57c
commit d40ea81fc3

View File

@@ -26,7 +26,7 @@ public class HelloService2 implements Service {
private DataSource source; private DataSource source;
//增加记录 //增加记录
@RestMapping(name = "create", authignore = true) @RestMapping(name = "create", auth = false)
public RetResult<HelloEntity> createHello(UserInfo info, @RestParam("bean") HelloEntity entity) { public RetResult<HelloEntity> createHello(UserInfo info, @RestParam("bean") HelloEntity entity) {
entity.setCreator(info == null ? 0 : info.getUserid()); //设置当前用户ID entity.setCreator(info == null ? 0 : info.getUserid()); //设置当前用户ID
entity.setCreatetime(System.currentTimeMillis()); entity.setCreatetime(System.currentTimeMillis());
@@ -35,26 +35,26 @@ public class HelloService2 implements Service {
} }
//删除记录 //删除记录
@RestMapping(name = "delete", authignore = true) @RestMapping(name = "delete", auth = false)
public void deleteHello(@RestParam("#") int id) { //通过 /hello/delete/1234 删除对象 public void deleteHello(@RestParam("#") int id) { //通过 /hello/delete/1234 删除对象
source.delete(HelloEntity.class, id); source.delete(HelloEntity.class, id);
} }
//修改记录 //修改记录
@RestMapping(name = "update", authignore = true) @RestMapping(name = "update", auth = false)
public void updateHello(@RestParam("bean") HelloEntity entity) { //通过 /hello/update?bean={...} 修改对象 public void updateHello(@RestParam("bean") HelloEntity entity) { //通过 /hello/update?bean={...} 修改对象
entity.setUpdatetime(System.currentTimeMillis()); entity.setUpdatetime(System.currentTimeMillis());
source.update(entity); source.update(entity);
} }
//查询列表 //查询列表
@RestMapping(name = "query", authignore = true) @RestMapping(name = "query", auth = false)
public Sheet<HelloEntity> queryHello(@RestParam("bean") HelloBean bean, Flipper flipper) { //通过 /hello/query/offset:0/limit:20?bean={...} 查询列表 public Sheet<HelloEntity> queryHello(@RestParam("bean") HelloBean bean, Flipper flipper) { //通过 /hello/query/offset:0/limit:20?bean={...} 查询列表
return source.querySheet(HelloEntity.class, flipper, bean); return source.querySheet(HelloEntity.class, flipper, bean);
} }
//查询单个 //查询单个
@RestMapping(name = "find", authignore = true) @RestMapping(name = "find", auth = false)
public HelloEntity findHello(@RestParam("#") int id) { //通过 /hello/find/1234 查询对象 public HelloEntity findHello(@RestParam("#") int id) { //通过 /hello/find/1234 查询对象
return source.find(HelloEntity.class, id); return source.find(HelloEntity.class, id);
} }