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

会展中心网站建设家装设计师收费标准

会展中心网站建设,家装设计师收费标准,中国建设平台官网,广州安全教育平台入口登录官网//1.配置项目环境#xff0c;创建Spring Boot项目。 //2.数据库设置#xff0c;配置数据库。 //3.创建实体类#xff0c;映射到数据库。 //4.创建数据处理层类#xff0c;Repository //5.创建业务处理类#xff0c;Service类 //6.创建控制器类#xff0c;Controller类 Ar…//1.配置项目环境创建Spring Boot项目。 //2.数据库设置配置数据库。 //3.创建实体类映射到数据库。 //4.创建数据处理层类Repository //5.创建业务处理类Service类 //6.创建控制器类Controller类 Article.java java import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; Entity     public class Article{     Id         GeneratedValue(strategy GenerationType.AOTU)         private Long id;         private String title;         private String content;         private String author;            //省略构造函数、getter和setter方法       //省略toString方法       //一个实体类完成了 }  ArticleRepository.java数据访问层类     java     import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import java.util.List; public interface ArticleRepository extends JpaRepositoryArticle,Long{ //可以在此自定义查询方法 //根据作者名查询文章 ListArticle findByAuthor(String author); //根据标题和作者查询文章 ListArticle findByTitleAndAuthor(String title,String author); //使用JPQL查询语句查询文章 Query(Select a FROM Article a WHERE a.title LIKE %:keyword% OR a.content LIKE %:keyword%) ListArticle fintByKeyword(String keyword); }      ArticleService.Java(业务逻辑层)     java     import org.springframework.beans.factory. annotation.Autowired;     import org.springframework.stereotype.Service;     import java.util.List;     import java.util.Optional; Service     public class ArticleService{     private final ArticleRepository articleRepository;          Autowired     public ArticleService(ArticleRepository articleRepository){     this.articleRepository articleRepository;         }          public ListArticlegetAllArticles(){     return articleRepository.findAll();     }          public OptionalArticlegetArticleById(Long id){         return articleRepository.findByID(id);     }          public Article createArticle(Article article){     return articleRepository.save(article);     }          /**     public void updateArticle(Long id, Article article) {         OptionalArticle existingArticle articleRepository.findById(id);         if (existingArticle.isPresent()) {             Article updatedArticle existingArticle.get();             updatedArticle.setTitle(article.getTitle());             updatedArticle.setContent(article.getContent());             updatedArticle.setAuthor(article.getAuthor());             articleRepository.save(updatedArticle);         }     }          **/          public void deleteArticle(Long id){         articleRepository.deleteById(id);     }      } ArticleController.java(控制器类)     java     import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Optional; RestContrller RequestMapping(/articles) public class ArticleController{     private final ArticleService articleService;          Autowired     public ArticleControler(     ArticleService articleService     ){     tihs.articleService articleService;     }          GetMapping         public ResponseEntityListArticlegetAllArticles(){     ListArticlearticles articleService.getAllArticles;     return new ResponseEntity(articles,HttpStatus.OK)     }  //以下为粘贴         GetMapping(/{id})     public ResponseEntityArticle getArticleById(PathVariable Long id) {         OptionalArticle article articleService.getArticleById(id);         return article.map(value - new ResponseEntity(value, HttpStatus.OK))                       .orElseGet(() - new ResponseEntity(HttpStatus.NOT_FOUND));     }     PostMapping     public ResponseEntityArticle createArticle(RequestBody Article article) {         Article createdArticle articleService.createArticle(article);         return new ResponseEntity(createdArticle, HttpStatus.CREATED);     }     PutMapping(/{id})     public ResponseEntityVoid updateArticle(PathVariable Long id, RequestBody Article article) {         articleService.updateArticle(id, article);         return new ResponseEntity(HttpStatus.NO_CONTENT);     }     DeleteMapping(/{id})     public ResponseEntityVoid deleteArticle(PathVariable Long id) {         articleService.deleteArticle(id);         return new ResponseEntity(HttpStatus.NO_CONTENT);     } } }
http://www.pierceye.com/news/342999/

相关文章:

  • 公司网站不续费农村未来10大暴利行业
  • 代做设计网站好跨境电商排名
  • 网站备案状态查询东莞智通人才市场招聘官网
  • 做微网站要多少钱更合网站设计制作
  • 网站如何留住客户企业建设网站需要注意什么
  • 中国最受欢迎的网站网站建设要知道的
  • 软件开发公司网站模板天津网站建设方案报价
  • 做面条的网站旅游网络营销如何做
  • 知乎的网站建设和网站运营网站建设需求说明
  • 天津做陶瓷的公司网站番禺核酸检测定点医院名单
  • 教育网站赏析delphi网站开发教程
  • 电商网站设计说明书php网站服务器架设
  • 精品课程网站开发项目电子商务的分类
  • 网站建设成品动漫网站建设答辩ppt
  • 邯郸网站设计价格做网站哪便宜
  • 建设网站的一般步骤网站设计下载
  • 广东同江医院网站建设建站网站图片不显示
  • 免费在线响应式网站自助建站网站网页怎么设计
  • 池州网站建设抚顺网站建设公司
  • 网站如可引导客户义乌小程序开发制作公司
  • 环境设计排版素材网站周口市住房和城乡建设局网站
  • 建设部资质查询网站wordpress采集英文
  • 深圳北站设计方案高质量网站外链平台
  • 苏州做网站优化的公司国外 网站页面
  • 网站建设流程发布网站和网页制作鲜花网站建设论文百度文库
  • 建个人网站赚钱吗手机网站页面大小
  • php简单购物网站源码海口网红美食餐厅
  • 傻瓜式建站软件长沙做软件的公司
  • 旅行社营业网点可以做网站吗别人网站建设多少钱
  • 南宁设计网站建设教程网站建设