当前位置: 首页 > news >正文

网站路径改版如何做301重定向公司域名注册步骤

网站路径改版如何做301重定向,公司域名注册步骤,里水九江网站建设,软件开发和网站开发区别文章目录 前言一、后端代码1. CategoryController2. service3. CategoryMapper4. Category 二、测试1. 失败(校验)2.正常 总结 前言 从这开始进入文章相关的接口开发,本章主要介绍定义文章分类接口和新增文章分类 建表语句和测试用例,在SpringBoot专栏首…

文章目录

  • 前言
  • 一、后端代码
    • 1. CategoryController
    • 2. service
    • 3. CategoryMapper
    • 4. Category
  • 二、测试
    • 1. 失败(校验)
    • 2.正常
  • 总结


前言

从这开始进入文章相关的接口开发,本章主要介绍定义文章分类接口和新增文章分类

建表语句和测试用例,在SpringBoot专栏首页,此处只涉及后端代码。


一、后端代码

1. CategoryController

package org.example.springboot3.bigevent.controller;import org.example.springboot3.bigevent.entity.Category;
import org.example.springboot3.bigevent.entity.Result;
import org.example.springboot3.bigevent.service.CategoryService;
import org.example.springboot3.bigevent.utils.ThreadLocalUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;/*** Create by zjg on 2024/5/26*/
@RestController
public class CategoryController {@AutowiredCategoryService categoryService;@PostMapping("/category")public Result add(@RequestBody @Validated Category category){Map<String, Object> claims = ThreadLocalUtil.get();Integer userId = (Integer) claims.get("userId");category.setCreateUser(userId);int i = categoryService.add(category);if(i!=1){return Result.error("新增文章分类失败,请稍后重试!");}return Result.success("新增文章分类成功");}
}

2. service

package org.example.springboot3.bigevent.service;import org.example.springboot3.bigevent.entity.Category;/*** Create by zjg on 2024/5/26*/
public interface CategoryService {public int add(Category category);
}
package org.example.springboot3.bigevent.service;import org.example.springboot3.bigevent.entity.Category;
import org.example.springboot3.bigevent.mapper.CategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;/*** Create by zjg on 2024/5/26*/
@Service
public class CategoryServiceImpl implements CategoryService{@AutowiredCategoryMapper categoryMapper;@Overridepublic int add(Category category) {category.setCreateTime(LocalDateTime.now());category.setUpdateTime(LocalDateTime.now());return categoryMapper.insert(category);}
}

3. CategoryMapper

package org.example.springboot3.bigevent.mapper;import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.example.springboot3.bigevent.entity.Category;/*** Create by zjg on 2024/5/26*/
@Mapper
public interface CategoryMapper extends BaseMapper<Category> {
}

4. Category

package org.example.springboot3.bigevent.entity;import jakarta.validation.constraints.NotEmpty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.time.LocalDateTime;@Getter
@Setter
@ToString
public class Category {@TableId(type= IdType.AUTO)private Integer id;//主键ID@NotEmpty(message = "分类名称不能为空")private String categoryName;//分类名称@NotEmpty(message = "分类别名不能为空")private String categoryAlias;//分类别名private Integer createUser;//创建人IDprivate LocalDateTime createTime;//创建时间private LocalDateTime updateTime;//更新时间
}

二、测试

1. 失败(校验)

在这里插入图片描述

2.正常

在这里插入图片描述
在这里插入图片描述


总结

回到顶部

http://www.tj-hxxt.cn/news/12234.html

相关文章:

  • 网站双链接怎么做360seo优化
  • 极简主义的网站chatgpt网页
  • 怎么建设网站规划最全的搜索引擎
  • 丹江口网站建设seo推广视频隐迅推专业
  • 怎么做网站在线客服新东方英语线下培训学校
  • 项目外包和人力外包的区别厦门seo排名公司
  • 哈尔滨无障碍网站建设百度电脑版官方下载
  • php建站系统源码网站seo优化皆宣徐州百都网络不错
  • 网站排名有什么用网站提交入口大全
  • 网站建设 熊掌号佛山市seo推广联系方式
  • 网站建设 定制搜索最全的搜索引擎
  • 免费crm网站下载的软件百度云资源搜索平台
  • 宁波网站排名优化上海网站制作开发
  • 学生诚信档案建设网站seo排名需要多少钱
  • 哈尔滨做设计和网站的公司吗深圳seo推广外包
  • 网站加载速度影响因素seo用什么论坛引流
  • 东莞做网站做什么赚钱seo关键词布局
  • 中山企业网站东莞做网站的联系电话
  • 贵州网站开发制作公司企业网站建设专业服务
  • ppt做杂志模板下载网站有哪些百度知道电脑版网页入口
  • 中国设计网站导航免费网络营销软件
  • 优化网站怎么做搜索引擎营销的优缺点
  • 蝙蝠做等级的网站又一病毒来了比新冠可怕
  • 在线做ppt的网站在线看seo网站
  • b2b网站类型有哪些百度app优化
  • 广州17年seo优化技术电话百度网站优化公司
  • 大厂网站建设优化方案官网
  • 独立网站需要怎么做sem是什么职位
  • 青岛做网站的信息技术公司今日头条郑州头条新闻
  • 3g电影网站排行榜军事新闻头条最新消息