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

网站哪个公司做的比较好珠海网站建设那家好

网站哪个公司做的比较好,珠海网站建设那家好,国外用wordpress,公司网站优化推广方案1.1.1 实体类id增加NotNull注释#xff0c;并做分组校验 1.1.1.1 定义分组 1.1.1.2 实体类中指定校验项属于哪个分组 如果说某个校验项没有指定分组,默认属于Default分组 分组之间可以继承, A extends B 那么A中拥有B中所有的校验项package com.geji.pojo;import com.faste…1.1.1 实体类id增加NotNull注释并做分组校验 1.1.1.1 定义分组 1.1.1.2 实体类中指定校验项属于哪个分组 如果说某个校验项没有指定分组,默认属于Default分组 分组之间可以继承, A extends B 那么A中拥有B中所有的校验项package com.geji.pojo;import com.fasterxml.jackson.annotation.JsonFormat; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; import jakarta.validation.groups.Default; import lombok.Data;import java.time.LocalDateTime;Data public class Category {NotNull(groups Update.class)private Integer id;//主键IDNotEmpty(groups{Add.class,Update.class})private String categoryName;//分类名称NotEmpty(groups{Add.class,Update.class})private String categoryAlias;//分类别名private Integer createUser;//创建人IDJsonFormat(pattern yyyy-MM-dd HH:mm:ss)private LocalDateTime createTime;//创建时间JsonFormat(pattern yyyy-MM-dd HH:mm:ss)private LocalDateTime updateTime;//更新时间//如果说某个校验项没有指定分组,默认属于Default分组//分组之间可以继承, A extends B 那么A中拥有B中所有的校验项public interface Add extends Default {}public interface Update extends Default {} }1.1.1.3 Controller中指定校验分组 package com.geji.controller;import com.geji.pojo.Category; import com.geji.pojo.Result; import com.geji.service.CategoryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*;import java.util.List;RestController RequestMapping(/category) public class CategoryController {Autowiredprivate CategoryService categoryService;PostMappingpublic Result add(RequestBody Validated(Category.Add.class) Category category) {categoryService.add(category);return Result.success();}GetMappingpublic ResultListCategory list(){ListCategory cs categoryService.list();return Result.success(cs);}GetMapping(/detail)public ResultCategory detail(Integer id){Category c categoryService.findById(id);return Result.success(c);}PutMappingpublic Result update(RequestBody Validated(Category.Update.class) Category category){categoryService.update(category);return Result.success();}} 1.1.2 Service package com.geji.service;import com.geji.pojo.Category;import java.util.List;public interface CategoryService {void add(Category category);ListCategory list();Category findById(Integer id);void update(Category category); }1.1.3 ServiceImpl package com.geji.service.impl;import com.geji.mapper.CategoryMapper; import com.geji.pojo.Category; import com.geji.service.CategoryService; import com.geji.utils.ThreadLocalUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service;import java.time.LocalDateTime; import java.util.List; import java.util.Map;Service public class CategoryServiceImpl implements CategoryService {Autowiredprivate CategoryMapper categoryMapper;Overridepublic void add(Category category) {//补充属性值category.setCreateTime(LocalDateTime.now());category.setUpdateTime(LocalDateTime.now());MapString,Object map ThreadLocalUtil.get();Integer userId (Integer) map.get(id);category.setCreateUser(userId);categoryMapper.add(category);}Overridepublic ListCategory list() {MapString,Object map ThreadLocalUtil.get();Integer userId (Integer) map.get(id);return categoryMapper.list(userId);}Overridepublic Category findById(Integer id) {Category c categoryMapper.findById(id);return c;}Overridepublic void update(Category category) {category.setUpdateTime(LocalDateTime.now());categoryMapper.update(category);}}1.1.4 Mapper package com.geji.mapper;import com.geji.pojo.Category; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update;import java.util.List;Mapper public interface CategoryMapper {//新增Insert(insert into category(category_name,category_alias,create_user,create_time,update_time) values(#{categoryName},#{categoryAlias},#{createUser},#{createTime},#{updateTime}))void add(Category category);//查询所有Select(select * from category where create_user #{userId})ListCategory list(Integer userId);//根据id查询Select(select * from category where id #{id})Category findById(Integer id);//更新Update(update category set category_name#{categoryName},category_alias#{categoryAlias},update_time#{updateTime} where id#{id})void update(Category category);}1.1.5 postman测试
http://www.hkea.cn/news/14517733/

相关文章:

  • 遵义企业网站建设电影网站建设方案
  • 支持微信支付的网站开发刚做的网站怎么收录
  • 什么都能买到的网站python自学要多久
  • python 网站开发the author wordpress
  • php网站进后台wordpress分类主题模板下载
  • wordpress网站统计代码做驾校题目用什么网站好
  • 做网站图片切图可以用中文吗做网站赠送
  • 虹口房产网站建设app开发价格一览表
  • 湘乡网站seo个人做理财网站
  • 网站搭建上海加强经管学院网站建设
  • 织梦网站备案海口网站建设优化
  • 莱西大型网站建设环球资源网成立时间
  • 做微信网站的职位营销型网站建设市场分析
  • 动易后台 网站统计调查 报表类型怎样使用子网页怎么做
  • 网上拿货做哪个网站好网站建设的三个步骤是什么
  • asp.net门户网站项目怎么做建网站卖产品怎么样
  • php p2p网站源码上海工程项目查询
  • 呼和浩特市网站建设企业所得税是5%还是25%
  • 江苏城乡建设厅官方网站营销推广是一种什么的促销方式
  • 举报网站建设快站公众号工具
  • 域名备案时网站名称防止服务器上的网站被进攻
  • 自己电脑做服务器发布网站西安工业设计公司
  • 校车网站建设我为群众办实事心得体会
  • 自己的服务器 做网站整站下载工具软件
  • 仿腾讯网站源码中企动力科技股份有限公司怎么样
  • 网站的动画效果代码大全百度网站推广关键词怎么查
  • 个人备案网站能用公司重庆市网站推广
  • 服饰类行业_如果要建设网站_说明其建站流程.成全看免费观看
  • 武义公司网站建设wordpress 缩略图不显示
  • 百度如何提交网站网站开发三大元素