|
@@ -7,6 +7,8 @@ import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.smart.modules.base.entity.DeviceInfo;
|
|
|
import com.jpsoft.smart.modules.base.service.DeviceInfoService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@@ -20,27 +22,14 @@ import java.util.*;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/deviceInfo")
|
|
|
-@Api(description = "deviceInfo")
|
|
|
+@Api(description = "设备信息")
|
|
|
public class DeviceInfoController {
|
|
|
private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
|
|
@Autowired
|
|
|
private DeviceInfoService deviceInfoService;
|
|
|
|
|
|
- @ApiOperation(value="创建空记录")
|
|
|
- @GetMapping("create")
|
|
|
- public MessageResult<DeviceInfo> create(){
|
|
|
- MessageResult<DeviceInfo> msgResult = new MessageResult<>();
|
|
|
-
|
|
|
- DeviceInfo deviceInfo = new DeviceInfo();
|
|
|
-
|
|
|
- msgResult.setData(deviceInfo);
|
|
|
- msgResult.setResult(true);
|
|
|
-
|
|
|
- return msgResult;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value="添加信息")
|
|
|
+ @ApiOperation(value="添加设备")
|
|
|
@PostMapping("add")
|
|
|
public MessageResult<DeviceInfo> add(@RequestBody DeviceInfo deviceInfo,@RequestAttribute String subject){
|
|
|
MessageResult<DeviceInfo> msgResult = new MessageResult<>();
|
|
@@ -71,7 +60,7 @@ public class DeviceInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="获取信息")
|
|
|
+ @ApiOperation(value="获取设备信息")
|
|
|
@GetMapping("edit/{id}")
|
|
|
public MessageResult<DeviceInfo> edit(@PathVariable("id") String id){
|
|
|
MessageResult<DeviceInfo> msgResult = new MessageResult<>();
|
|
@@ -97,7 +86,7 @@ public class DeviceInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="更新用户")
|
|
|
+ @ApiOperation(value="更新设备信息")
|
|
|
@PostMapping("update")
|
|
|
public MessageResult<DeviceInfo> update(@RequestBody DeviceInfo deviceInfo,@RequestAttribute String subject){
|
|
|
MessageResult<DeviceInfo> msgResult = new MessageResult<>();
|
|
@@ -126,7 +115,7 @@ public class DeviceInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="删除")
|
|
|
+ @ApiOperation(value="删除设备")
|
|
|
@PostMapping("delete/{id}")
|
|
|
public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
|
|
|
MessageResult<Integer> msgResult = new MessageResult<>();
|
|
@@ -158,7 +147,7 @@ public class DeviceInfoController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @ApiOperation(value="批量删除")
|
|
|
+ @ApiOperation(value="批量删除设备")
|
|
|
@PostMapping("batchDelete")
|
|
|
public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
|
|
|
MessageResult<Integer> msgResult = new MessageResult<>();
|
|
@@ -193,10 +182,15 @@ public class DeviceInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="列表")
|
|
|
+ @ApiOperation(value="设备列表")
|
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "aliasName",value = "设备别名", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "deviceNo",value = "编号", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "address",value = "位置", paramType = "query")
|
|
|
+ })
|
|
|
public MessageResult<Map> pageList(
|
|
|
- String id,
|
|
|
+ String aliasName,String deviceNo,String address,
|
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
@RequestAttribute String subject){
|
|
@@ -209,10 +203,16 @@ public class DeviceInfoController {
|
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("id_","asc"));
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
- searchParams.put("id","%" + id + "%");
|
|
|
+ if (StringUtils.isNotEmpty(aliasName)) {
|
|
|
+ searchParams.put("aliasName","%" + aliasName + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(deviceNo)) {
|
|
|
+ searchParams.put("deviceNo","%" + deviceNo + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(address)) {
|
|
|
+ searchParams.put("address","%" + address + "%");
|
|
|
}
|
|
|
|
|
|
Page<DeviceInfo> page = deviceInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|