Commit 3e90096d authored by wujipeng's avatar wujipeng
Browse files

标签接口

parent b501cdb6
package com.platform.controller;
import com.platform.model.dto.TagDTO;
import com.platform.model.resp.Result;
import com.platform.service.TagService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @author wujipeng
* @version 1.0
* @create 2025-08-05 20:16
*/
@RestController
@RequestMapping("/tag")
public class TagController extends BaseController {
@Resource
private TagService tagService;
@ApiOperation("标签列表")
@GetMapping("/list")
public Result list() {
return Result.data(tagService.list());
}
@ApiOperation("标签详情")
@GetMapping("/{id}")
public Result detail(@PathVariable String id) {
return Result.data(tagService.getById(id));
}
@ApiOperation("新增编辑")
@PostMapping("/saveOrUpdate")
public Result add(@RequestBody TagDTO tagDTO) {
return Result.data(tagService.saveOrUpdate(tagDTO));
}
@ApiOperation("删除")
@DeleteMapping("/{id}")
public Result delete(@PathVariable String id) {
return Result.data(tagService.removeById(id));
}
}
package com.platform.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.platform.model.entity.TagEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* @author wujipeng
* @version 1.0
* @create 2025-08-05 20:15
*/
@Mapper
public interface TagMapper extends BaseMapper<TagEntity> {
}
package com.platform.model.dto;
import com.platform.model.entity.TagEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author wujipeng
* @version 1.0
* @create 2025-08-05 20:20
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class TagDTO extends TagEntity {
}
package com.platform.model.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @author wujipeng
* @version 1.0
* @create 2025-08-05 20:05
*/
@Data
@TableName("tag")
public class TagEntity {
@TableId(type = IdType.ASSIGN_ID)
private String id;
private String name;
}
package com.platform.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.platform.model.entity.TagEntity;
/**
* @author wujipeng
* @version 1.0
* @create 2025-08-05 20:16
*/
public interface TagService extends IService<TagEntity> {
}
package com.platform.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.platform.mapper.TagMapper;
import com.platform.model.entity.TagEntity;
import com.platform.service.TagService;
import org.springframework.stereotype.Service;
/**
* @author wujipeng
* @version 1.0
* @create 2025-08-05 20:16
*/
@Service
public class TagServiceImpl extends ServiceImpl<TagMapper, TagEntity> implements TagService {
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment