查询
/**
* 按条件查询房主信息
*/
@RequestMapping("/OwnerAll")
@ResponseBody
public Object findOwnerAll(@RequestParam(defaultValue = "1") int page,@RequestParam(defaultValue = "5") int limit, Owner owner) {
JsonObject jsonObject = new JsonObject();
PageInfo<Owner> pageInfo = ownerService.findOwnerAll(page, limit, owner);
jsonObject.setCode(0);
jsonObject.setMsg("success");
jsonObject.setCount(pageInfo.getTotal());
jsonObject.setData(pageInfo.getList());
return jsonObject;
}
接口名称
户主信息查询
接口地址
http://localhost:8080/owner/OwnerAll
请求方式
POST
参数名称 |
参数类型 |
是否必填 |
详细说明 |
page |
int |
否 |
想要查看的页数 |
limit |
int |
否 |
想要显示的信息量 |
identity |
int |
否 |
模糊查询需要的身份证号 |
custname |
String |
否 |
模糊查询需要的姓名 |
添加
/**
* 添加户主信息
*/
@RequestMapping("/addOwner")
@ResponseBody
public R addOwner(@RequestBody Owner owner) {
System.out.println(owner);
return ownerService.addOwner(owner) > 0 ? R.ok() : R.fail(400,"添加失败");
}
接口名称
户主信息添加
接口地址
http://localhost:8080/owner/addOwner
请求方式
POST
参数名称 |
参数类型 |
是否必填 |
详细说明 |
identity |
string |
是 |
纯数字的字符串 |
custname |
string |
是 |
|
sex |
string |
是 |
"男" 或 "女" |
address |
string |
是 |
|
phone |
string |
是 |
|
career |
string |
是 |
|
remarks |
string |
否 |
|
createTime |
string |
否 |
"yyyy-MM-dd hh-mm-ss" |
djr |
string |
否 |
|
请求参数示例
{
"id":"29",
"identity": "12321321",
"custname": "zoe",
"sex": "男",
"address": "1",
"phone": "1",
"career": "1",
"remarks": "1",
"createTime": "1997-12-12 02-22-50",
"djr": "哈哈哈"
}
删除
@RequestMapping("/deleteOwner")
@ResponseBody
public R deleteOwner(String ids) {
// 前端传来字符串格式为: 1,2,3,4
List<String> id = Arrays.asList(ids.split(","));
for (String index : id) {
int i = ownerService.deleteOwner(Long.parseLong(index));
if ( i < 0 ) {
return R.fail(400,"删除失败");
}
}
return R.ok();
}
接口名称
户主信息添加
接口地址
http://localhost:8080/owner/deleteOwner
请求方式
POST
参数名称 |
参数类型 |
是否必填 |
详细说明 |
ids |
string |
是 |
"1" 或者 "1,2,3,4" |
修改跟添加一模一样: 就是id参数是必填