feat: 增加查询命令接口
parent
8c3feab2d7
commit
182c047a33
@ -0,0 +1,55 @@
|
||||
package com.shxy.xymanager_admin.controller;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.shxy.xymanager_common.base.BaseController;
|
||||
import com.shxy.xymanager_common.base.ResponseReult;
|
||||
import com.shxy.xymanager_common.entity.MntnCmdHistory;
|
||||
import com.shxy.xymanager_common.entity.MntnCmds;
|
||||
import com.shxy.xymanager_common.model.CmdModel;
|
||||
import com.shxy.xymanager_service.service.CmdService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@Api(tags = {"命令相关接口"})
|
||||
@RequestMapping("cmd")
|
||||
@Slf4j
|
||||
public class CmdController extends BaseController {
|
||||
|
||||
@Resource
|
||||
CmdService cmdsService;
|
||||
|
||||
@PostMapping("send")
|
||||
@ApiOperation("下达命令")
|
||||
public ResponseReult<String> send(@RequestBody CmdModel model) throws Exception {
|
||||
cmdsService.send(model);
|
||||
return ResponseReult.success("OK");
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
@ApiOperation("查询")
|
||||
public ResponseReult<PageInfo<MntnCmds>> list(String cmdid, String action,
|
||||
Integer pageNum, Integer pageSize) {
|
||||
pageNum = this.initPageNum(pageNum);
|
||||
pageSize = this.initPageSize(pageSize);
|
||||
PageInfo<MntnCmds> result = cmdsService.list(cmdid, action,
|
||||
pageNum, pageSize);
|
||||
return ResponseReult.success(result);
|
||||
}
|
||||
|
||||
@GetMapping("listHistory")
|
||||
@ApiOperation("查询历史")
|
||||
public ResponseReult<PageInfo<MntnCmdHistory>> listHistory(String cmdid, String action,
|
||||
Integer pageNum, Integer pageSize) {
|
||||
pageNum = this.initPageNum(pageNum);
|
||||
pageSize = this.initPageSize(pageSize);
|
||||
PageInfo<MntnCmdHistory> result = cmdsService.listHistory(cmdid, action,
|
||||
pageNum, pageSize);
|
||||
return ResponseReult.success(result);
|
||||
}
|
||||
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package com.shxy.xymanager_admin.controller;
|
||||
|
||||
import com.shxy.xymanager_common.base.BaseController;
|
||||
import com.shxy.xymanager_common.base.ResponseReult;
|
||||
import com.shxy.xymanager_common.model.CmdModel;
|
||||
import com.shxy.xymanager_service.service.MntnCmdsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@Api(tags = {"命令相关接口"})
|
||||
@RequestMapping("cmd")
|
||||
@Slf4j
|
||||
public class MntnController extends BaseController {
|
||||
|
||||
@Resource
|
||||
MntnCmdsService cmdsService;
|
||||
|
||||
@PostMapping("send")
|
||||
@ApiOperation("下达命令")
|
||||
public ResponseReult<String> send(@RequestBody CmdModel model) throws Exception {
|
||||
cmdsService.send(model);
|
||||
return ResponseReult.success("OK");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.shxy.xymanager_service.service;
|
||||
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.shxy.xymanager_common.entity.MntnCmdHistory;
|
||||
import com.shxy.xymanager_common.entity.MntnCmds;
|
||||
import com.shxy.xymanager_common.model.CmdModel;
|
||||
|
||||
|
||||
public interface CmdService {
|
||||
|
||||
PageInfo<MntnCmds> list(String cmdid, String action,
|
||||
Integer pageNum, Integer pageSize);
|
||||
|
||||
PageInfo<MntnCmdHistory> listHistory(String cmdid, String action,
|
||||
Integer pageNum, Integer pageSize);
|
||||
|
||||
void send(CmdModel model) throws Exception;
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package com.shxy.xymanager_service.service;
|
||||
|
||||
|
||||
import com.shxy.xymanager_common.entity.MntnCmds;
|
||||
import com.shxy.xymanager_common.model.CmdModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MntnCmdsService {
|
||||
|
||||
List<MntnCmds> listAll();
|
||||
|
||||
void send(CmdModel model) throws Exception;
|
||||
}
|
Loading…
Reference in New Issue