class CommandController {

    @Resource(name = "${registry.type}" + "CommandService")
    private CommandService commandService;

    /**
     * 获取所有指令
     *
     * @return
     */
    @RequestMapping(value = "", method = RequestMethod.GET)
    public ResponseEntity<List<JSONObject>> getAllCommands() {
        List<JSONObject> result = commandService.getAllCommands();
        return new ResponseEntity<List<JSONObject>>(result, HttpStatus.OK);
    }

    /**
     * 获取指定group的指令列表
     *
     * @param group
     * @return
     */
    @RequestMapping(value = "/{group}", method = RequestMethod.GET)
    public ResponseEntity<String> getCommandsByGroup(@PathVariable("group") String group) {
        if (StringUtils.isEmpty(group)) {
            return new ResponseEntity<String>(HttpStatus.BAD_REQUEST);
        }

        String result = commandService.getCommands(group);
        return new ResponseEntity<String>(result, HttpStatus.OK);
    }

    /**
     * 向指定group添加指令
     *
     * @param group
     * @param clientCommand
     * @return
     */
    @RequestMapping(value = "/{group}", method = RequestMethod.POST)
    public ResponseEntity<Boolean> addCommand(@PathVariable("group") String group, @RequestBody ClientCommand clientCommand) {
        if (StringUtils.isEmpty(group) || clientCommand == null) {
            return new ResponseEntity<Boolean>(HttpStatus.BAD_REQUEST);
        }

        boolean result = commandService.addCommand(group, clientCommand);
        HttpStatus status;
        if (result) {
            status = HttpStatus.OK;
        } else {
            status = HttpStatus.NOT_MODIFIED;
        }
        return new ResponseEntity<Boolean>(result, status);
    }

    /**
     * 更新指定group的某条指令
     *
     * @param group
     * @param clientCommand
     * @return
     */
    @RequestMapping(value = "/{group}", method = RequestMethod.PUT)
    public ResponseEntity<Boolean> updateCommand(@PathVariable("group") String group, @RequestBody ClientCommand clientCommand) {
        if (StringUtils.isEmpty(group) || clientCommand == null) {
            return new ResponseEntity<Boolean>(HttpStatus.BAD_REQUEST);
        }


        boolean result = commandService.updateCommand(group, clientCommand);
        HttpStatus status;
        if (result) {
            status = HttpStatus.OK;
        } else {
            status = HttpStatus.NOT_MODIFIED;
        }
        return new ResponseEntity<Boolean>(result, status);
    }


    /**
     * 删除指定group的某条指令
     *
     * @param group
     * @param index
     * @return
     */
    @RequestMapping(value = "/{group}/{index}", method = RequestMethod.DELETE)
    public ResponseEntity<Boolean> deleteCommand(@PathVariable("group") String group, @PathVariable("index") int index) {<FILL_FUNCTION_BODY>}

    /**
     * 预览指令
     *
     * @param group
     * @param clientCommand
     * @param previewIP
     * @return
     */
    @RequestMapping(value = "/{group}/preview", method = RequestMethod.POST)
    public ResponseEntity<List<JSONObject>> previewCommand(
            @PathVariable("group") String group,
            @RequestBody ClientCommand clientCommand,
            @RequestParam(value = "previewIP", required = false) String previewIP) {
        if (StringUtils.isEmpty(group) || clientCommand == null) {
            return new ResponseEntity<List<JSONObject>>(HttpStatus.BAD_REQUEST);
        }

        List<JSONObject> results = commandService.previewCommand(group, clientCommand, previewIP);
        return new ResponseEntity<List<JSONObject>>(results, HttpStatus.OK);
    }


    @RequestMapping(value = "/operationRecord", method = RequestMethod.GET)
    public ResponseEntity<List<OperationRecord>> getAllRecord() {
        List<OperationRecord> results = commandService.getAllRecord();
        if (results == null) {
            return new ResponseEntity<List<OperationRecord>>(HttpStatus.NO_CONTENT);
        }
        return new ResponseEntity<List<OperationRecord>>(results, HttpStatus.OK);
    }
}

        if (StringUtils.isEmpty(group)) {
            return new ResponseEntity<Boolean>(HttpStatus.BAD_REQUEST);
        }

        boolean result = commandService.deleteCommand(group, index);
        HttpStatus status;
        if (result) {
            status = HttpStatus.OK;
        } else {
            status = HttpStatus.NOT_MODIFIED;
        }
        return new ResponseEntity<Boolean>(result, status);
    
<no_super_class>