前言:
如今我们对“个人博客网站html源码免费”大体比较关切,朋友们都想要知道一些“个人博客网站html源码免费”的相关资讯。那么小编在网络上汇集了一些有关“个人博客网站html源码免费””的相关资讯,希望你们能喜欢,看官们快快来学习一下吧!随着网络技术渗透到社会生活的各个方面,传统的交流方式也面临着变化。互联网是一个非常重要的方向。基于Web技术的网络考试系统可以在全球范围内使用互联网,可以在本地或异地进行通信,大大提高了通信和交换的灵活性。在当今高速发展的互联网时代,博客已经成为人们不可或缺的一部分。互联网日志,翻译博客或博客的博客通常是个人管理的,不定期发表新文章的网站。博客的文章通常按照从新到旧的顺序排列,很多博客集中于提供对特定主题的意见或新闻,其他博客则用作个人日记。一般博客包括文本、图像、结合其他博客或网站的链接和与主题相关的其他媒体。让读者以互动方式留下评论的能力是许多博客的重要因素。大部分博客内容主要是文本。博客是社交媒体网络的一部分。
博客在中国的发展始于1998年,但直到2000年才真正流行起来。2000年博客进入中国,迅速发展起来,但平淡无奇。直到2004年木子美事件,中国人才理解和使用博客。2005年,不看好博客的新浪、搜狐等国内网站也加入博客阵营,开始进入博客的春秋战国时代。博客比电子邮件和讨论组更简单,因此成为家庭、部门、公司和团队越来越广泛使用的交流工具。
开发环境:
开发工具:IDEA、jdk1.8、SpringBoot
数据库:MySQL
所用技术:
前端:LayUI、JQuery、HTML5+CSS3、Ajax
后端:SpringBoot+Spring-Data-Jpa
安全控件:SpringSecurity
页面采用:Thymeleaf
项目管理:Maven
基本功能:
注册、登录、发博客、查看博客、博客审核(管理员)、个人资料设置、密码修改、权限修改(管理员)等。
部分代码展示:
public class BlogsController extends CommonController<Blogs, Integer, BlogsForm> { @Autowired private BlogsSerive blogService; @Autowired private SystemDataService dataService; @Autowired private UserUtils userUtils; @Autowired private CommentService commentService; @Override public void manage(ModelMap map) { map.put("user", userUtils.getUser()); super.manage(map); } @Override public void edit(BlogsForm form, ModelMap map) throws InstantiationException, IllegalAccessException { map.put("sf", dataService.findByDictionariesCode("SJZD_BKFL")); map.put("type", dataService.findByDictionariesCode("SJZD_WZLX")); super.edit(form, map); } @Override public Object save(BlogsForm form) { System.out.println(form.getText()+"========="); form.setUser(userUtils.getUser()); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { Blogs model = new Blogs(); String name = userUtils.getName(); Integer id = form.getId(); if(id != null) { model = blogService.findById(id); model.setUpdateDate(sdf.format(new Date())); model.setUpdateName(name); }else { form.setCreateDate(sdf.format(new Date())); form.setCreateName(name); model.setUpdateDate(sdf.format(new Date())); model.setUpdateName(name); } BeanUtils.copyProperties(form, model,"id"); blogService.save(model); Integer id2; if(form.getId() != null) { id2 = form.getId(); }else { id2 = blogService.findByUserNicknameAndUpdateDate(name, model.getUpdateDate()).getId(); } return new AjaxResult(id2+""); } catch (Exception e) { return new AjaxResult(false,"数据保存失败"); } } /** * 访问页面 * @param id * @param map */ @RequestMapping(value="/visit") public void visit(Integer id, ModelMap map) { map.put("blog", blogService.findById(id)); map.put("comment", commentService.findByBlogId(id)); } /** * 访问页面数据 * @param id * @return */ @RequestMapping(value="/blogText") @ResponseBody public Object blogText(Integer id) { return blogService.findById(id).getText(); } @RequestMapping(value="/audit") public void audit(ModelMap map) { } @RequestMapping(value="/indexBlog") public void indexBlog() { } /** * 同意 * @param id * @return */ @RequestMapping(value="/consent") @ResponseBody public Object consent(Integer id) { try { Blogs blogs = blogService.findById(id); blogs.setBlogStatic("审核通过"); blogService.save(blogs); return new AjaxResult("同意成功"); } catch (Exception e) { return new AjaxResult(false,"同意失败"); } } /** * 拒绝 * @param id * @return */ @RequestMapping(value="/refuse") @ResponseBody public Object refuse(Integer id, String jy) { try { Blogs blogs = blogService.findById(id); blogs.setBlogStatic("已拒绝"); blogs.setSuggest(jy); blogService.save(blogs); return new AjaxResult("拒绝成功"); } catch (Exception e) { return new AjaxResult(false,"拒绝失败"); } } @RequestMapping(value="/fysj") @ResponseBody public Object fysj(Integer page, BlogsForm form) { Sort sort=Sort.by(Sort.Direction.DESC, "updateDate"); Pageable pageable = PageRequest.of(page-1, 10, sort); Page<Blogs> blog; Specification<Blogs> spec = buildSpec2(form); blog = blogService.findAll(spec, pageable); return FlowloadUtils.buildResult(blog); } @RequestMapping(value="/fysj2") @ResponseBody public Object fysj2(Integer page, BlogsForm form) { Sort sort=Sort.by(Sort.Direction.DESC, "updateDate"); Pageable pageable = PageRequest.of(page-1, 10, sort); Page<Blogs> blog; Specification<Blogs> spec = buildSpec3(form); blog = blogService.findAll(spec, pageable); return FlowloadUtils.buildResult(blog); } private Specification<Blogs> buildSpec3(BlogsForm form) { Specification<Blogs> specification = new Specification<Blogs>() { private static final long serialVersionUID = 1L; @Override public Predicate toPredicate(Root<Blogs> root, CriteriaQuery<?> query, CriteriaBuilder cb) { HashSet<Predicate> rules=new HashSet<>(); Predicate difficultylevel = cb.equal(root.get("blogStatic"), "审核通过"); rules.add(difficultylevel); return cb.and(rules.toArray(new Predicate[rules.size()])); } }; return specification; } private Specification<Blogs> buildSpec2(BlogsForm form) { Specification<Blogs> specification = new Specification<Blogs>() { private static final long serialVersionUID = 1L; @Override public Predicate toPredicate(Root<Blogs> root, CriteriaQuery<?> query, CriteriaBuilder cb) { HashSet<Predicate> rules=new HashSet<>(); SysUser user = userUtils.getUser(); Predicate difficultylevel = cb.equal(root.get("user").get("id"), user.getId()); rules.add(difficultylevel); return cb.and(rules.toArray(new Predicate[rules.size()])); } }; return specification; } @RequestMapping(value="/page2") @ResponseBody public HashMap<String, Object> page2(ModelMap map, DataGridParam param, BlogsForm form) { Sort sort=Sort.by("id"); Pageable pabeable = param.getPageable(sort); Specification<Blogs> spec = buildSpec1(form); Page<Blogs> page = blogService.findAll(spec, pabeable); return DataGridUtils.buildResult(page); } private Specification<Blogs> buildSpec1(BlogsForm form) { Specification<Blogs> specification = new Specification<Blogs>() { private static final long serialVersionUID = 1L; @Override public Predicate toPredicate(Root<Blogs> root, CriteriaQuery<?> query, CriteriaBuilder cb) { HashSet<Predicate> rules=new HashSet<>(); Predicate difficultylevel = cb.like(root.get("blogStatic"), "%待审核%"); rules.add(difficultylevel); return cb.and(rules.toArray(new Predicate[rules.size()])); } }; return specification; } /** * 评论 */ @RequestMapping(value="/comment") @ResponseBody public Object comment(String comment, Integer id) { try { SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Comment model = new Comment(); model.setText(comment); model.setUser(userUtils.getUser()); model.setBlog(blogService.findById(id)); model.setRead2(false); model.setCreateDate(sdf.format(new Date())); commentService.save(model); return new AjaxResult("评论成功"); } catch (Exception e) { return new AjaxResult(false,"评论失败"); } }}
获取源码请关注后私信“20230728”
标签: #个人博客网站html源码免费