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

苏州哪里有做淘宝网站的WordPress模板博客主题

苏州哪里有做淘宝网站的,WordPress模板博客主题,网站开发流程视频,学网站开发应该学什么文章目录 前言一、后端代码1. CategoryController2. service3. CategoryMapper4. Category 二、测试1. 失败(校验)2.正常 总结 前言 从这开始进入文章相关的接口开发#xff0c;本章主要介绍定义文章分类接口和新增文章分类 建表语句和测试用例#xff0c;在SpringBoot专栏首… 文章目录 前言一、后端代码1. CategoryController2. service3. CategoryMapper4. 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){MapString, 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 BaseMapperCategory { } 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;//主键IDNotEmpty(message 分类名称不能为空)private String categoryName;//分类名称NotEmpty(message 分类别名不能为空)private String categoryAlias;//分类别名private Integer createUser;//创建人IDprivate LocalDateTime createTime;//创建时间private LocalDateTime updateTime;//更新时间 } 二、测试 1. 失败(校验) 2.正常 总结 回到顶部
http://www.pierceye.com/news/774149/

相关文章:

  • 展示网站和营销网站的区别舆情分析师
  • 做网站用那一种语言最好网站推广指的是什么
  • 有哪些网站可以学做糕点的专业做网站建设公司怎么样
  • 广州网站排名怎么优化androidapp开发教程
  • 永顺网站建设网站建设免费建站
  • 建立一个网站需要多少钱?jquery网站后台模板
  • PHP网站开发工程师招聘营销型网站主机
  • 百度招聘 网站开发书画网站免费源码
  • 4s店网站建设贺贵江seo教程
  • 做网站的公司一般怎么培训销售wordpress引用php
  • 自己怎样做网站平台网页设计做网站首页
  • 费县做网站点石家装
  • 科技网站制作案例图片制作在线网页
  • 怀柔成都网站建设网络推广图片
  • 网站建设微信运营公司中国室内设计公司
  • app推广平台网站建设银行东营分行网站
  • 校园二手交易网站设计的原则群辉搭wordpress
  • 无锡网站建设网页制作seo网站优化培训要多少钱
  • 一个人可以做几个网站seo页面检测
  • 在哪里可以找到做网站的公司wordpress下拉
  • 企业网站更新什么内容网站设计怎么保持风格一致
  • 网页设计作业网站素材和效果图网站开发和网络安全
  • 开发一个彩票网站多少钱怎么为一个网站做外链
  • 一家专门做动漫的网站怎么查企业注册信息
  • 中太建设集团官方网站微信网页链接怎么制作
  • 做家政网上推广网站长沙网站建设有哪些
  • 西安网站建设 招聘西安是哪个省属于哪个市
  • 灯饰网站开发中国十大门窗品牌
  • 移动网站开发认证基层建设被哪些网站全文收录
  • 中国电子商务网站小吃网站建设