提交 ad5bf72a 编写于 作者: 喷火的神灵's avatar 喷火的神灵 🎱

计数字段功能修正

上级 1bd97db5
package cn.tedu.youbiliprojectbackend.modules.tag.classification.controller;
import cn.tedu.youbiliprojectbackend.common.web.response.RestBean;
import cn.tedu.youbiliprojectbackend.common.web.response.ServiceCode;
import cn.tedu.youbiliprojectbackend.modules.tag.classification.pojo.vo.CategoryTitleVO;
import cn.tedu.youbiliprojectbackend.modules.tag.classification.service.ICategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 类别控制器
*
* @author 万佳兴
*/
@Slf4j
@RestController
@RequestMapping("/category/select/")
public class CategoryController {
@Autowired
private ICategoryService categoryService;
public CategoryController() {
log.info("创建类别控制器:CategoryController");
}
@GetMapping("/all-list")
public RestBean<List<CategoryTitleVO>> listAll() {
List<CategoryTitleVO> categoryTitleVOS = categoryService.listTile();
return RestBean.success(categoryTitleVOS);
}
@GetMapping("/small-list")
public RestBean<String> listSmallCat() {
return RestBean.success("成功");
}
@GetMapping("/video-list")
public RestBean<String> listVideo() {
return RestBean.success("成功");
}
}
package cn.tedu.youbiliprojectbackend.modules.tag.classification.dao.mapper;
import cn.tedu.youbiliprojectbackend.modules.tag.classification.pojo.entity.Category;
import cn.tedu.youbiliprojectbackend.modules.tag.classification.pojo.vo.CategoryListVO;
import cn.tedu.youbiliprojectbackend.modules.tag.classification.pojo.vo.CategoryTitleVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 类别mapper接口
*
* @author 万佳兴
*/
@Repository
public interface CategoryMapper extends BaseMapper<Category> {
/**
* 查询视频分类名称
* @return CategoryTitleVO
*/
List<CategoryTitleVO> list();
}
package cn.tedu.youbiliprojectbackend.modules.tag.classification.dao.repository;
import cn.tedu.youbiliprojectbackend.modules.tag.classification.pojo.vo.CategoryTitleVO;
import java.util.List;
/**
* 类别的repository接口
*
* @author 万佳兴
*/
public interface ICategoryRepository {
/**
* 查询视频分类名称
* @return CategoryTitleVO
*/
List<CategoryTitleVO> list();
}
package cn.tedu.youbiliprojectbackend.modules.tag.classification.dao.repository.impl;
import cn.tedu.youbiliprojectbackend.modules.tag.classification.dao.mapper.CategoryMapper;
import cn.tedu.youbiliprojectbackend.modules.tag.classification.dao.repository.ICategoryRepository;
import cn.tedu.youbiliprojectbackend.modules.tag.classification.pojo.vo.CategoryTitleVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 类别的repository实现类
*
* @author 万佳兴
*/
@Slf4j
@Repository
public class CategoryRepositoryImpl implements ICategoryRepository {
@Autowired
private CategoryMapper categoryMapper;
public CategoryRepositoryImpl() {
log.info("创建存储库对象:CategoryRepositoryImpl");
}
@Override
public List<CategoryTitleVO> list() {
return categoryMapper.list();
}
}
package cn.tedu.youbiliprojectbackend.modules.tag.classification.pojo.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 类别的实体类
*
* @author 万佳兴
*/
@Data
@TableName("category")
public class Category implements Serializable {
/**
* 分类ID
*/
@TableId(type = IdType.AUTO)
private Long categoryID;
/**
* 分类名称
*/
private String categoryName;
/**
* 分类描述
*/
private String description;
/**
* 状态 1表示启用 0表示未启用
*/
private Integer enable;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime gmtCreate;
@TableField(fill = FieldFill.UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime gmtModified;
}
package cn.tedu.youbiliprojectbackend.modules.tag.classification.pojo.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.io.Serializable;
/**
* 类别的vo类
*
* @author 万佳兴
*/
@Data
public class CategoryListVO implements Serializable {
/**
* 分类ID
*/
@TableId(type = IdType.AUTO)
private Long categoryID;
/**
* 分类名称
*/
private String categoryName;
/**
* 视频ID
*/
private Long videoID;
}
package cn.tedu.youbiliprojectbackend.modules.tag.classification.pojo.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.io.Serializable;
@Data
public class CategoryTitleVO implements Serializable {
/**
* 分类ID
*/
@TableId(type = IdType.AUTO)
private Long categoryID;
/**
* 分类名称
*/
private String categoryName;
}
package cn.tedu.youbiliprojectbackend.modules.tag.classification.service;
import cn.tedu.youbiliprojectbackend.modules.tag.classification.pojo.vo.CategoryTitleVO;
import java.util.List;
/**
* 类别的service接口
*
* @author 万佳兴
*/
public interface ICategoryService {
/**
* 查询视频分类名称
* @return CategoryTitleVO
*/
List<CategoryTitleVO> listTile();
}
package cn.tedu.youbiliprojectbackend.modules.tag.classification.service.impl;
import cn.tedu.youbiliprojectbackend.modules.tag.classification.dao.repository.ICategoryRepository;
import cn.tedu.youbiliprojectbackend.modules.tag.classification.pojo.vo.CategoryTitleVO;
import cn.tedu.youbiliprojectbackend.modules.tag.classification.service.ICategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 类别的service接口的实现类
*
* @author 万佳兴
*/
@Slf4j
@Service
public class CategoryServiceImpl implements ICategoryService {
@Autowired
private ICategoryRepository categoryRepository;
public CategoryServiceImpl() {
log.info("创建业务层对象:CategoryServiceImpl");
}
@Override
public List<CategoryTitleVO> listTile() {
return categoryRepository.list();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册