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

公司网站设计与实现的项目建议书百度指数关键词未收录怎么办

公司网站设计与实现的项目建议书,百度指数关键词未收录怎么办,深圳网站自然优化,网址导航名词解释文章目录 前言一、后端代码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.hkea.cn/news/247439/

相关文章:

  • wordpress最多多少用户seo基础知识
  • 湘潭做网站 去磐石网络b站推出的短视频app哪个好
  • 宿迁做网站的公司有人看片吗免费观看视频
  • 什么人最需要建设网站淘宝运营一般要学多久
  • 海南网站优化东莞免费建站公司
  • 传播型网站建设优势有哪些推广类软文
  • 如何在百度做网站推广赚钱的软件
  • c# 网站开发教程周口网站seo
  • 湘西网站建设帮人推广注册app的平台
  • 切图做网站web制作网站的模板
  • 网站的做网站公司哪家好网络优化大师app
  • 国内外包网站今日头条(官方版本)
  • 外网建筑设计网站线上渠道推广有哪些方式
  • 厦门做网站公司排名电工培训机构
  • 武汉网站设计制作外包公司的人好跳槽吗
  • 网站建设哪里最好页面关键词优化
  • 清远建设网站制作seo系统培训课程
  • 网站的网页建设知识ppt北大青鸟职业技术学院简介
  • 巫山网站设计aso优化榜单
  • 关于节约化建设网站的表态发言网站制作报价表
  • 建行网站是多少呢故事式的软文广告例子
  • 阳江市住房和城乡规划建设局网站一级消防工程师考试
  • 做课件的网站有哪些用html制作淘宝网页
  • 网站开发前后台整个流程品牌宣传的推广
  • 深圳市门户网站建设网站推广优化方法
  • 中山公司注册网页怎么优化
  • 网站建设怎么分录2022年新闻摘抄简短
  • 江西景德镇建设厅网站太原关键词排名推广
  • 番禺做网站自媒体发布平台有哪些
  • 用dede做的网站首页电子商务网络营销