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

国内买机票的网站建设渭南做网站价格

国内买机票的网站建设,渭南做网站价格,企业网上登记注册,建设旅游网站财务分析文章目录 前言一、后端代码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.hkea.cn/news/14525221/

相关文章:

  • 自己随便玩玩的网站怎么建设怎么创建一个博客网站吗
  • 建网站pc版徐州地产开发公司招聘
  • 网站首页动画效果电商网站的宣传推广
  • 无锡手机网站开发西宁企业网站开发定制
  • 网站仿静态和静态的区别电商分销
  • 网站管理与开发怎么做网站上海旅游网站建设
  • 哪些网站可以找到做药人的信息北京科技公司
  • 无icp备案的网站合法吗友情链接多久有效果
  • 亚马逊在电子商务网站建设北京做网站公司哪家强
  • 济南哪里有做网站的网站设计与网页制作在线
  • 郑州区块链数字钱包网站开发过程wordpress 中表格 宽度
  • 上海网站建设的价格低小程序游戏源码wordpress
  • 长沙口碑好的做网站公司哪家好打开英文网站字体不对
  • 网站系统 建设和软件岗位职责网站直播的功能怎样做
  • 做家务的男人网站特种工建设网站
  • 公司有些网站打不开wordpress the7汉化版
  • 做面包网站抖音小程序多少钱
  • 南宁seo网站排名优化广告logo图片大全
  • 电子商务网站建设 上海那里有做网站
  • 温州苍南网站建设图书网站建设实训心得
  • 大型网站tag标签 索引wordpress怎么连接主机
  • 网站建设一般用英文怎么说做网站 就上宝华建站
  • 备案网站多长时间站群cms建站系统免费
  • 做网站打广告图片素材北京网站建设认知
  • 域名注册网站免费网站排名应该怎么做
  • 如何给网站做关键字怎么找网站站长
  • 重庆中小企业网站建设公司ppt哪个网站做的好
  • 湖南宁乡建设局网站两学一做微网站交流
  • 个人网站方案建设书网站seo快速优化
  • 网站建设要哪些seo网络软件开发专业是做什么的