|
|
@@ -0,0 +1,76 @@
|
|
|
+package com.wxxcx.targets;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+
|
|
|
+import com.pub.log.Log;
|
|
|
+import com.pub.page.Page;
|
|
|
+import com.pub.page.PageRecord;
|
|
|
+import com.pub.util.JSONUtil;
|
|
|
+import com.pub.util.R;
|
|
|
+import com.pub.util.SQLUtil;
|
|
|
+
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import springfox.documentation.annotations.ApiIgnore;
|
|
|
+
|
|
|
+@Controller
|
|
|
+@RequestMapping("/Target")
|
|
|
+@Api(tags = "设备分享")
|
|
|
+public class TargetController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TargetService targetService;
|
|
|
+
|
|
|
+ @ResponseBody
|
|
|
+ @GetMapping("/getTargetByDevID")
|
|
|
+ @ApiOperation(value = "查询target记录")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name ="dev_id",value="设备ID",dataType = "String",paramType = "query")
|
|
|
+ })
|
|
|
+ public R getTargetByDevID(@ApiIgnore TargetVO vo) {
|
|
|
+ R r =JSONUtil.getSuccessMsg(null);
|
|
|
+ TargetVO target =targetService.getTargetByDevID(vo);
|
|
|
+ r.data.put("target", target);
|
|
|
+ return r;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResponseBody
|
|
|
+ @GetMapping("/queryTargetList")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "page", value = "页码", dataType = "int", required = true, paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "rows", value = "每页条数", dataType = "int", required = true, paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "sort", value = "排序字段", dataType = "String", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "order", value = "排序方式", dataType = "String", paramType = "query"),
|
|
|
+ })
|
|
|
+ public R queryTargetList(@ApiIgnore Page page,@ApiIgnore TargetVO vo) {
|
|
|
+ R r =JSONUtil.getSuccessMsg(null);
|
|
|
+ StringBuffer condition =SQLUtil.getCondition(vo);
|
|
|
+ PageRecord<TargetVO> pr =targetService.queryTargetList(page, condition);
|
|
|
+ r.data.put("pr", pr);
|
|
|
+ return r;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResponseBody
|
|
|
+ @PostMapping("/saveOrUpdate")
|
|
|
+ @ApiOperation(value = "保存或更新设备")
|
|
|
+ @ApiImplicitParam(name = "设备实体对象", value = "对应表:dev_target", required = true, dataType = "TargetVO")
|
|
|
+ public R saveOrUpdate(@ApiIgnore @RequestBody TargetVO vo) {
|
|
|
+ R map =JSONUtil.getSuccessMsg("操作成功");
|
|
|
+ try {
|
|
|
+ targetService.saveOrUpdate(vo);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ Log.error(ex);
|
|
|
+ map =JSONUtil.getErrorMsg(ex);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+}
|