class TagController {
    @Autowired
    private TagService tagService;

    @PostMapping
    @Operation(summary = "Add Tag", description = "新增标签")
    public ResponseEntity<Message<Void>> addNewTags(@Valid @RequestBody List<Tag> tags) {
        // Verify request data  校验请求数据 去重
        tags = tags.stream().peek(tag -> {
            tag.setType((byte) 1);
            tag.setId(null);
        }).distinct().collect(Collectors.toList());
        tagService.addTags(tags);
        return ResponseEntity.ok(Message.success("Add success"));
    }

    @PutMapping
    @Operation(summary = "Modify an existing tag", description = "修改一个已存在标签")
    public ResponseEntity<Message<Void>> modifyMonitor(@Valid @RequestBody Tag tag) {
        // Verify request data  校验请求数据
        if (tag.getId() == null || tag.getName() == null) {
            throw new IllegalArgumentException("The Tag not exist.");
        }
        tagService.modifyTag(tag);
        return ResponseEntity.ok(Message.success("Modify success"));
    }

    @GetMapping()
    @Operation(summary = "Get tags information", description = "根据条件获取标签信息")
    public ResponseEntity<Message<Page<Tag>>> getTags(
            @Parameter(description = "Tag content search | 标签内容模糊查询", example = "status") @RequestParam(required = false) String search,
            @Parameter(description = "Tag type | 标签类型", example = "0") @RequestParam(required = false) Byte type,
            @Parameter(description = "List current page | 列表当前分页", example = "0") @RequestParam(defaultValue = "0") int pageIndex,
            @Parameter(description = "Number of list pagination | 列表分页数量", example = "8") @RequestParam(defaultValue = "8") int pageSize) {<FILL_FUNCTION_BODY>}

    @DeleteMapping()
    @Operation(summary = "Delete tags based on ID", description = "根据TAG ID删除TAG")
    public ResponseEntity<Message<Void>> deleteTags(
            @Parameter(description = "TAG IDs | 监控任务ID列表", example = "6565463543") @RequestParam(required = false) List<Long> ids) {
        if (ids != null && !ids.isEmpty()) {
            tagService.deleteTags(new HashSet<>(ids));
        }
        return ResponseEntity.ok(Message.success("Delete success"));
    }
}

        // Get tag information
        Specification<Tag> specification = (root, query, criteriaBuilder) -> {
            List<Predicate> andList = new ArrayList<>();
            if (type != null) {
                Predicate predicateApp = criteriaBuilder.equal(root.get("type"), type);
                andList.add(predicateApp);
            }
            Predicate[] andPredicates = new Predicate[andList.size()];
            Predicate andPredicate = criteriaBuilder.and(andList.toArray(andPredicates));

            List<Predicate> orList = new ArrayList<>();
            if (search != null && !search.isEmpty()) {
                Predicate predicateName = criteriaBuilder.like(root.get("name"), "%" + search + "%");
                orList.add(predicateName);
                Predicate predicateValue = criteriaBuilder.like(root.get("value"), "%" + search + "%");
                orList.add(predicateValue);
            }
            Predicate[] orPredicates = new Predicate[orList.size()];
            Predicate orPredicate = criteriaBuilder.or(orList.toArray(orPredicates));

            if (andPredicate.getExpressions().isEmpty() && orPredicate.getExpressions().isEmpty()) {
                return query.where().getRestriction();
            } else if (andPredicate.getExpressions().isEmpty()) {
                return query.where(orPredicate).getRestriction();
            } else if (orPredicate.getExpressions().isEmpty()) {
                return query.where(andPredicate).getRestriction();
            } else {
                return query.where(andPredicate, orPredicate).getRestriction();
            }
        };
        PageRequest pageRequest = PageRequest.of(pageIndex, pageSize);
        Page<Tag> alertPage = tagService.getTags(specification, pageRequest);
        Message<Page<Tag>> message = Message.success(alertPage);
        return ResponseEntity.ok(message);
    
<no_super_class>