当前位置: 首页 > 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/14575518/

相关文章:

  • 南京 推广 网站建设网站是怎么建立起来的
  • 网站建设明细标价表手机海报制作app
  • 电商网站建设与运营专业线上推广产品
  • 西安做网站公司哪家好网站建设的简历制作
  • wordpress恢复网站公司网站用wordpress
  • 求一些做里番的网站如何做网站联盟营销
  • 惠州app网站建设排行榜如何在虚拟机里面做网站
  • wordpress子域名网站html网站的规划与建设6
  • 手机如何建免费网站南方人才网
  • 口碑好的网站定制公司网站免费推广策划方案
  • 网站建设平台协议书模板下载网站关键词排名软件推荐
  • 网站域名 设置wordpress 网络图片不显示图片
  • 佛山企业快速建站爱站网站长百度查询权重
  • 个人网站程序下载网页在线翻译
  • 旅游网站开发指导做多国语言网站
  • win2008搭建wordpress怎样才能做好网站优化
  • 建一个网站是不是要开公司可以做app的手机软件
  • 本地做网站顺序常见服务器
  • 资源下载类网站如何做外链网站建设与管理需要什么软件有哪些方面
  • 百度商桥怎么嵌入网站网站如何申请微信支付
  • 唐山cms模板建站网站互点联盟
  • 网站开发深入浅出 - python篇企业网站网页尺寸
  • 哪些软件可以做网站设计网页设计实训报告结束语
  • 网站整合营销建设政务版企业微信app下载安装
  • 网站关于 模板网页设计师职责
  • 信用网站建设工作总结泉州网站建设 首选猴子网络
  • 旅游攻略网站开发装饰
  • 做招商加盟网站wordpress浏览插件
  • 山东青岛网站设计上海的建设项目招投标在哪个网站
  • 厦门市建设局网站住房保障专栏wordpress获取上传文件大小