精华内容
下载资源
问答
  • weirdo字体

    2021-07-29 22:38:58
    weirdo字体是一款适用于广告设计方面的字体
  • gradlew installApp ./build/libs/bin/weirdo-scheme 示例输出: >> (define myVar 1) ===> () >> (define myFunc (lambda (arg1 arg2) (+ arg1 arg2 10))) ===> () >> (myFunc 1 2) ===> 13 >> (printenv) ...
  • prntsc-weirdo-源码

    2021-03-16 16:07:25
    prntsc-weirdo
  • 题目链接: csu1651 题解思路 : 用到kruskal算法的思想: 枚举这条路径最小的边作为kruskal算法的起始边 ...当某条边加入一个 边集 后满足起点和终点在一个集合,即可得到一个答案 ...#define MAXN 1

    题目链接:

    csu1651




    题解思路 :

    用到kruskal算法的思想:

    枚举这条路径最小的边作为kruskal算法的起始边

    当某条边加入一个 边集  后满足起点和终点在一个集合,即可得到一个答案

    这些答案的最小值即为answer

    中间会用到几个剪枝



    代码:

    #include<iostream>
    #include<cstdio>
    #include<algorithm>
    #define MAXN 1550
    #define maxx 0x3f3f3f3f
    using namespace std;
    struct node
    {
        int from,to,w;
        friend bool operator<(const node a,node b)
        {
            return a.w<b.w;
        }
    } edge[2*MAXN];
    int fa[MAXN];
    int start,endd,n,m;
    int ans;
    int flag;
    int min(int a,int b)
    {
        return a<b?a:b;
    }
    int Find(int x)
    {
        if(x==fa[x]?x:fa[x]=Find(fa[x]));
    }
    int kruskal(int s)
    {
        for(int i=0; i<n; i++)
            fa[i]=i;
        int d1,d2;
        for(int i=s; i<m; i++)
        {
            d1=Find(edge[i].from);
            d2=Find(edge[i].to);
            if(d1!=d2)
            {
                fa[d1]=d2;
                if(Find(start)==Find(endd))
                    return edge[i].w-edge[s].w;
            }
            if(edge[i].w-edge[s].w>ans) //剪枝
                return maxx;
        }
        flag=0;//枚举完所有边  起点和终点仍不能连通
        return maxx;
    }
    int main()
    {
    //#ifndef ONLINE_JUDGE
    //    freopen("in.txt","r",stdin);
    //    freopen("out.txt","w",stdout);
    //#endif // ONLINE_JUDGE
        while(~scanf("%d%d%d%d",&n,&m,&start,&endd))
        {
            ans=maxx;
            for(int i=0; i<m; i++)
                scanf("%d%d%d",&edge[i].from,&edge[i].to,&edge[i].w);
            sort(edge,edge+m);
            flag=1;
            for(int i=0; i<m&&flag; i++)
                ans=min(kruskal(i),ans);
            printf("%d\n",ans);
        }
        return 0;
    }
    


    展开全文
  • CSUOJ 1651 Weirdo

    2015-06-02 22:37:00
    1651: Weirdo Time Limit:5 SecMemory Limit:128 MBSubmit:40Solved:21[Submit][Status][Web Board] Description 小x是一个奇葩,奇葩的小x终于盼来了五一长。。好吧!短假。早已乏味的大学生活让小x感到绝望。...

    1651: Weirdo

    Time Limit: 5 Sec  Memory Limit: 128 MB
    Submit: 40  Solved: 21
    [Submit][Status][Web Board]

    Description

    小x是一个奇葩,奇葩的小x终于盼来了五一长。。好吧!短假。早已乏味的大学生活让小x感到绝望。与其天天做在电脑面前废寝忘食的打LOL,还不如来一场说走就走的旅行,去看看外面的世界!已经准备去往B市的小x决定让自己的旅行更有意义一点,他觉得人生本就是一场漫长的旅行,重要的不是终点,而是奇葩的路线。他决定找一条通往B市的最均匀的路线!什么样的路线最呀最均匀?当然是这条线路上的路段之间的宽度差的绝对值最小的那条就均匀啦!现在给出n个城市和m条道路及这m条道路的路宽,并且保证居住在A市的小x是可以到达B市,你能帮助小x找出这样的最均匀的路线么,输出这条路线上的最大差值!

    Input

    每个样例的第一行n,m,A,B分别表示有n个点,m条路段,小x的居住地和小x要到的B市,接下来m行,每行三个数字u,v,w分别表示从u到v的这段路的路宽(路是双向的)。 
    2 <= n <= 1500, 
    m <= 3000, 
    0 <= v,u < n, 
    w < INT_MAX

    Output

    每个样例输出一行

    Sample Input

    5 5 4 0
    0 3 22022
    1 2 8871
    1 3 9421
    2 4 24398
    3 4 3344

    Sample Output

    15527

    HINT

     

    Source

     

    解题:直接枚举下界,求最小上界用类似于最小生成树Kruskal的做法

     

     1 #include <iostream>
     2 #include <cstdio>
     3 #include <algorithm>
     4 using namespace std;
     5 typedef long long LL;
     6 const int maxn = 40001;
     7 const int INF = 0x3f3f3f3f;
     8 struct arc{
     9     int u,v,w;
    10     bool operator<(const arc &t) const{
    11         return w < t.w;
    12     }
    13 }e[maxn];
    14 int uf[maxn],n,m,S,T,ret;
    15 bool flag;
    16 int Find(int x){
    17     int t = x;
    18     while(uf[x] != x) x = uf[x];
    19     while(uf[t] != t){
    20         int tmp = uf[t];
    21         uf[t] = x;
    22         t = tmp;
    23     }
    24     return x;
    25 }
    26 int kruskal(int low){
    27     for(int i = 0; i <= n; ++i) uf[i] = i;
    28     for(int i = low; i < m; ++i){
    29         int x = Find(e[i].u);
    30         int y = Find(e[i].v);
    31         if(x == y) continue;
    32         uf[x] = y;
    33         if(Find(S) == Find(T)) return e[i].w - e[low].w;
    34         if((LL)e[low].w + ret <= e[i].w) return INF;
    35     }
    36     flag = false;
    37     return INF;
    38 }
    39 int main(){
    40     //freopen("Weirdo.in","r",stdin);
    41     //freopen("oo.txt","w",stdout);
    42     while(~scanf("%d %d %d %d",&n,&m,&S,&T)){
    43         for(int i = 0; i < m; ++i)
    44             scanf("%d %d %d",&e[i].u,&e[i].v,&e[i].w);
    45         sort(e,e+m);
    46         ret = INF;
    47         flag = true;
    48         for(int i = 0; i < m && flag; ++i)
    49             ret = min(kruskal(i),ret);
    50         printf("%d\n",ret);
    51     }
    52     return 0;
    53 }
    View Code

     

    转载于:https://www.cnblogs.com/crackpotisback/p/4547889.html

    展开全文
  • At the beginning of 2018, "Have you bought a Doge cryptocurrency?" It has become a greeting of the majority of the folks. It is unlucky to buy Dogecoin in the Year of the Dog....

    At the beginning of 2018, "Have you bought a Doge cryptocurrency?" It has become a greeting of the majority of the folks. It is unlucky to buy Dogecoin in the Year of the Dog. It is also said, and it has already doubled the price at the beginning of the year, compared with 2017. The Dogecoin price for the year, that is a proper hundred times.

    In fact, the Dogecoin originally originated from a joke.

    Jackson Palmer, who once worked in the marketing department of Adobe's Sydney office, is a cryptocurrency enthusiast. He has published such a tweet that "investing in dog money must be the next explosive event." Many people disagree with this, but one Called Jackson Palmer, I didn't think so, so I bought the domain name of http://Dogecoin.com.

    Then this Jackson event caught the attention of Billy Markus, a Polish who wanted to build a new cryptocurrency category. In Markus’s own words, ‘My first reaction was that the Dogecoin sounded too funny. The second reaction was that I had to make this coin.’

    In this way, Markus used the code of the Litecoin to derive the Dogecoin in 2013, thus making it more separated from Bitcoin. If the Litecoin is a child of Bitcoin, then the Dogecoin is the grandson of Bitcoin.

    Different from the expensive and arrogant bitcoin, this kind of cheap and sturdy Dogecoin style has attracted the public's attention from the beginning. Shortly after the launch, it was blasted in the foreign forum reddit. In less than two years, it has surpassed the popularity of Bitcoin and Litecoin. It was once the second largest currency after Bitcoin.

    Of course, behind the success of the Dogecoin is relying on the Dogecoin community, a community that is proficient in marketing, and clearly focused on charity and funny propaganda.

    For example, the one-handed dog coin expression pack plays the stalk fire reddit, and the smashing and cute dog currency sucks countlessly; the community raises 5w dollars through dog money, and the Jamaican sleigh team participates in the Olympic champion; sponsors the Kenya clean water project; raises For $55,000, he sponsored a driver in the form of a dog coin to let him ride a dog with a dog coin on the Talladega highway; he even said that he took the Dogecoin to the moon.

    The current Dogecoin market cap is $$594,145,375, ranked 22nd. Dogecoin is still very popular.

    展开全文
  • 1.Article 获得文章总数 获得评论总数 获得浏览总数 统计某一分类的文章数(根据分类ID) 统计某一标签的文章数(根据标签ID) 获得文章(根据查询条件) 获得最新文章 修改文章 删除文章 ...

    1.Article

    • 获得文章总数
    • 获得评论总数
    • 获得浏览总数
    • 统计某一分类的文章数(根据分类ID)
    • 统计某一标签的文章数(根据标签ID)
    • 获得文章(根据查询条件)
    • 获得最新文章
    • 修改文章
    • 删除文章
    • 批量删除文章
    • 添加文章
    • 文章分页显式
    • 文章详细信息显示
    • 获得访问量最多的文章
    • 获得上一篇文章
    • 获得下一篇文章
    • 获得随机文章
    • 获得评论数较多的文章
    • 更新文章评论数
    • 获得相关文章
    • 根据文章ID获得分类ID
    • 获得所有文章
    • 根据文章作者ID获得文章ID列表
    • 获得最后更新时间

    1.1 接口ArticleService

    package com.test.ssm.blog.service;
    
    import com.github.pagehelper.PageInfo;
    import com.test.ssm.blog.entity.Article;
    
    import java.util.HashMap;
    import java.util.List;
    
    public interface ArticleService {
        //获得文章总数
        Integer countArticle(Integer status);
    
        //获得评论总数
        Integer countArticleComment();
    
        //获得浏览总数
        Integer countArticleView();
    
        //统计有这个分类的文章数
        Integer countArticleByCategoryId(Integer categoryId);
    
        //统计有这个标签的
        Integer countArticleByTagId(Integer tagId);
    
        //获得所有文章不分页
        List<Article> listArticle(HashMap<String,Object> criteria);
    
        //获得最新文章
        List<Article> listRecentArticle(Integer limit);
    
        //修改文章详细信息
        void updateArticleDetail(Article article);
    
        //修改文章
        void updateArticle(Article article);
    
        //批量删除文章
        void deleteArticleBatch(List<Integer> ids);
    
        //删除文章
        void deleteArticle(Integer id);
    
        /**
         * 分页显示
         *
         * @param pageIndex 第几页开始
         * @param pageSize  一页显示多少
         * @param criteria  查询条件
         * @return 文章列表
         */
        PageInfo<Article> pageArticle(Integer pageIndex,
                                      Integer pageSize,
                                      HashMap<String, Object> criteria);
        /**
         * 文章详情页面显示
         *
         * @param status 状态
         * @param id     文章ID
         * @return 文章
         */
        Article getArticleByStatusAndId(Integer status, Integer id);
    
        /**
         * 获取访问量较多的文章
         *
         * @param limit 查询数量
         * @return 列表
         */
        List<Article> listArticleByViewCount(Integer limit);
    
        /**
         * 获得上一篇文章
         *
         * @param id 文章ID
         * @return 文章
         */
        Article getAfterArticle(Integer id);
    
        /**
         * 获得下一篇文章
         *
         * @param id 文章ID
         * @return 文章
         */
        Article getPreArticle(Integer id);
    
        /**
         * 获得随机文章
         *
         * @param limit 查询数量
         * @return 列表
         */
        List<Article> listRandomArticle(Integer limit);
    
        /**
         * 获得评论数较多的文章
         *
         * @param limit 查询数量
         * @return 列表
         */
        List<Article> listArticleByCommentCount(Integer limit);
    
        /**
         * 添加文章
         *
         * @param article 文章
         */
        void insertArticle(Article article);
    
    
        /**
         * 更新文章的评论数
         *
         * @param articleId 文章ID
         */
        void updateCommentCount(Integer articleId);
    
        /**
         * 获得最后更新记录
         *
         * @return 文章
         */
        Article getLastUpdateArticle();
    
        /**
         * 获得相关文章
         *
         * @param cateId 分类ID
         * @param limit  查询数量
         * @return 列表
         */
        List<Article> listArticleByCategoryId(Integer cateId, Integer limit);
    
        /**
         * 获得相关文章
         *
         * @param cateIds 分类ID集合
         * @param limit   数量
         * @return 列表
         */
        List<Article> listArticleByCategoryIds(List<Integer> cateIds, Integer limit);
    
    
        /**
         * 根据文章ID获得分类ID列表
         *
         * @param articleId 文章Id
         * @return 列表
         */
        List<Integer> listCategoryIdByArticleId(Integer articleId);
    
        /**
         * 获得所有的文章
         *
         * @return 列表
         */
        List<Article> listAllNotWithContent();
    
    
        List<Integer> listArticleIdByUserId(Integer articleUserId);
    
    }
    

    1.2 实现类ArticleServiceImpl

    package com.test.ssm.blog.service.impl;
    
    
    
    import com.github.pagehelper.PageHelper;
    import com.github.pagehelper.PageInfo;
    
    
    import com.test.ssm.blog.entity.*;
    import com.test.ssm.blog.enums.ArticleCommentStatus;
    import com.test.ssm.blog.mapper.ArticleCategoryRefMapper;
    import com.test.ssm.blog.mapper.ArticleMapper;
    import com.test.ssm.blog.mapper.ArticleTagRefMapper;
    import com.test.ssm.blog.service.ArticleService;
    import lombok.extern.slf4j.Slf4j;
    
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    import org.springframework.transaction.annotation.Transactional;
    
    
    import java.util.ArrayList;
    import java.util.Date;
    import java.util.HashMap;
    import java.util.List;
    
    @Service
    @Slf4j
    public class ArticleServiceImpl implements ArticleService {
    
        @Autowired(required = false)
        private ArticleMapper articleMapper;
    
        @Autowired(required = false)
        private ArticleCategoryRefMapper articleCategoryRefMapper;
    
        @Autowired(required = false)
        private ArticleTagRefMapper articleTagRefMapper;
    
        @Override
        public Integer countArticle(Integer status) {
            Integer count = 0;
            try {
                count = articleMapper.countArticle(status);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("根据状态统计文章数, status:{}, cause:{}", status, e);
            }
            return count;
        }
    
        @Override
        public Integer countArticleComment() {
            Integer count = 0;
            try {
                count = articleMapper.countArticleComment();
            } catch (Exception e) {
                e.printStackTrace();
                log.error("统计文章评论数失败, cause:{}", e);
            }
            return count;
        }
    
    
        @Override
        public Integer countArticleView() {
            Integer count = 0;
            try {
                count = articleMapper.countArticleView();
            } catch (Exception e) {
                e.printStackTrace();
                log.error("统计文章访问量失败, cause:{}", e);
            }
            return count;
        }
    
        @Override
        public Integer countArticleByCategoryId(Integer categoryId) {
            Integer count = 0;
            try {
                count = articleCategoryRefMapper.countArticleByCategoryId(categoryId);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("根据分类统计文章数量失败, categoryId:{}, cause:{}", categoryId, e);
            }
            return count;
        }
    
        @Override
        public Integer countArticleByTagId(Integer tagId) {
            return articleTagRefMapper.countArticleByTagId(tagId);
    
        }
    
        @Override
        public List<Article> listArticle(HashMap<String, Object> criteria) {
            return articleMapper.findAll(criteria);
        }
    
        @Override
        public List<Article> listRecentArticle(Integer limit) {
            return articleMapper.listArticleByLimit(limit);
        }
    
        @Override
        @Transactional(rollbackFor = Exception.class)
        public void updateArticleDetail(Article article) {
            article.setArticleUpdateTime(new Date());
            articleMapper.update(article);
    
            if (article.getTagList() != null) {
                //删除标签和文章关联
                articleTagRefMapper.deleteByArticleId(article.getArticleId());
                //添加标签和文章关联
                for (int i = 0; i < article.getTagList().size(); i++) {
                    ArticleTagRef articleTagRef = new ArticleTagRef(article.getArticleId(), article.getTagList().get(i).getTagId());
                    articleTagRefMapper.insert(articleTagRef);
                }
            }
            if (article.getCategoryList() != null) {
                //添加分类和文章关联
                articleCategoryRefMapper.deleteByArticleId(article.getArticleId());
                //删除分类和文章关联
                for (int i = 0; i < article.getCategoryList().size(); i++) {
                    ArticleCategoryRef articleCategoryRef = new ArticleCategoryRef(article.getArticleId(), article.getCategoryList().get(i).getCategoryId());
                    articleCategoryRefMapper.insert(articleCategoryRef);
                }
            }
        }
    
        @Override
        public void updateArticle(Article article) {
            articleMapper.update(article);
        }
    
        @Override
        public void deleteArticleBatch(List<Integer> ids) {
            articleMapper.deleteBatch(ids);
        }
    
        @Override
        public void deleteArticle(Integer id) {
            System.out.println("into");
            Article article=articleMapper.getArticleById(id);
    
            if(articleTagRefMapper.listTagByArticleId(article.getArticleId())!=null){
                System.out.println("into Tag");
                //删除标签和文章关联
                articleTagRefMapper.deleteByArticleId(article.getArticleId());
                }
            if(articleCategoryRefMapper.listCategoryByArticleId(article.getArticleId())!=null)
            {
                System.out.println("into Category");
                articleCategoryRefMapper.deleteByArticleId(id);
            }
            articleMapper.deleteById(id);
        }
    
    
    
    
        @Override
        public PageInfo<Article> pageArticle(Integer pageIndex,
                                             Integer pageSize,
                                             HashMap<String, Object> criteria) {
            PageHelper.startPage(pageIndex, pageSize);
            List<Article> articleList = articleMapper.findAll(criteria);
            for (int i = 0; i < articleList.size(); i++) {
                //封装CategoryList
                List<Category> categoryList = articleCategoryRefMapper.listCategoryByArticleId(articleList.get(i).getArticleId());
                if (categoryList == null || categoryList.size() == 0) {
                    categoryList = new ArrayList<>();
                    categoryList.add(Category.Default());
                }
                articleList.get(i).setCategoryList(categoryList);
    //            //封装TagList
    //            List<Tag> tagList = articleTagRefMapper.listTagByArticleId(articleList.get(i).getArticleId());
    //            articleList.get(i).setTagList(tagList);
            }
            return new PageInfo<>(articleList);
        }
    
        @Override
        public Article getArticleByStatusAndId(Integer status, Integer id) {
            Article article = articleMapper.getArticleByStatusAndId(status, id);
            if (article != null) {
                List<Category> categoryList = articleCategoryRefMapper.listCategoryByArticleId(article.getArticleId());
                List<Tag> tagList = articleTagRefMapper.listTagByArticleId(article.getArticleId());
                article.setCategoryList(categoryList);
                article.setTagList(tagList);
            }
            return article;
        }
    
    
        @Override
        public List<Article> listArticleByViewCount(Integer limit) {
            return articleMapper.listArticleByViewCount(limit);
        }
    
        @Override
        public Article getAfterArticle(Integer id) {
            return articleMapper.getAfterArticle(id);
        }
    
        @Override
        public Article getPreArticle(Integer id) {
            return articleMapper.getPreArticle(id);
        }
    
        @Override
        public List<Article> listRandomArticle(Integer limit) {
            return articleMapper.listRandomArticle(limit);
        }
    
        @Override
        public List<Article> listArticleByCommentCount(Integer limit) {
            return articleMapper.listArticleByCommentCount(limit);
        }
    
    
        @Override
        @Transactional(rollbackFor = Exception.class)
        public void insertArticle(Article article) {
            //添加文章
            article.setArticleCreateTime(new Date());
            article.setArticleUpdateTime(new Date());
            article.setArticleIsComment(ArticleCommentStatus.ALLOW.getValue());
            article.setArticleViewCount(0);
            article.setArticleLikeCount(0);
            article.setArticleCommentCount(0);
            article.setArticleOrder(1);
            articleMapper.insert(article);
            //添加分类和文章关联
            for (int i = 0; i < article.getCategoryList().size(); i++) {
                ArticleCategoryRef articleCategoryRef = new ArticleCategoryRef(article.getArticleId(), article.getCategoryList().get(i).getCategoryId());
                articleCategoryRefMapper.insert(articleCategoryRef);
            }
            //添加标签和文章关联
            for (int i = 0; i < article.getTagList().size(); i++) {
                ArticleTagRef articleTagRef = new ArticleTagRef(article.getArticleId(), article.getTagList().get(i).getTagId());
                articleTagRefMapper.insert(articleTagRef);
            }
        }
    
    
        @Override
        public void updateCommentCount(Integer articleId) {
            articleMapper.updateCommentCount(articleId);
        }
    
        @Override
        public Article getLastUpdateArticle() {
            return articleMapper.getLastUpdateArticle();
        }
    
        @Override
        public List<Article> listArticleByCategoryId(Integer cateId, Integer limit) {
            return articleMapper.findArticleByCategoryId(cateId, limit);
        }
    
        @Override
        public List<Article> listArticleByCategoryIds(List<Integer> cateIds, Integer limit) {
            if (cateIds == null || cateIds.size() == 0) {
                return null;
            }
            return articleMapper.findArticleByCategoryIds(cateIds, limit);
        }
    
        @Override
        public List<Integer> listCategoryIdByArticleId(Integer articleId) {
            return articleCategoryRefMapper.selectCategoryIdByArticleId(articleId);
        }
    
        @Override
        public List<Article> listAllNotWithContent() {
            return articleMapper.listAllNotWithContent();
        }
    
        @Override
        public List<Integer> listArticleIdByUserId(Integer articleUserId) {
            return articleMapper.selectArticleIdByUserId(articleUserId);
        }
    
    
    }
    

    2.Category

    • 获得分类总数
    • 获得分类列表
    • 获得分类列表(设置分类下的文章数)
    • 根据用户ID获得分类列表
    • 删除分类
    • 根据分类ID查询
    • 添加分类
    • 编辑分类
    • 根据名称查询分类

    2.1 接口CategoryService

    package com.test.ssm.blog.service;
    
    import com.test.ssm.blog.entity.Category;
    
    import java.util.List;
    
    public interface CategoryService {
    
        //获得分类总数
        Integer countCategory();
    
        //获得分类列表
        List<Category> listCategory();
    
        //获得分类列表
        List<Category> listCategoryWithCount();
    
        //根据用户ID获得分类列表
        List<Category> listCategoryWithCountByUserId(Integer categoryUserId);
    
        //删除分类
        void deleteCategory(Integer id);
    
        //根据ID查询分类信息
        Category getCategoryById(Integer id);
    
        //添加分类
        Category insertCategory(Category category);
    
        //更新
        void updateCategory(Category category);
    
        //根据名称查询
        Category getCategoryByName(String name);
    }
    

    2.2 实现类CategoryServiceImpl

    package com.test.ssm.blog.service.impl;
    
    import com.test.ssm.blog.entity.Category;
    import com.test.ssm.blog.mapper.ArticleCategoryRefMapper;
    import com.test.ssm.blog.mapper.CategoryMapper;
    import com.test.ssm.blog.service.CategoryService;
    import lombok.extern.slf4j.Slf4j;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    import org.springframework.transaction.annotation.Transactional;
    import org.springframework.transaction.interceptor.TransactionAspectSupport;
    
    import java.util.List;
    
    @Service
    @Slf4j
    public class CategoryServiceImpl implements CategoryService {
    
        @Autowired(required = false)
        CategoryMapper categoryMapper;
    
        @Autowired(required = false)
        ArticleCategoryRefMapper articleCategoryRefMapper;
    
        @Override
        public Integer countCategory() {
            Integer count = 0;
            try {
                count = categoryMapper.countCategory();
            } catch (Exception e) {
                e.printStackTrace();
                log.error("统计分类失败, cause:{}", e);
            }
            return count;
        }
    
        @Override
        public List<Category> listCategory() {
            List<Category> categoryList = null;
            try {
                categoryList = categoryMapper.listCategory();
            } catch (Exception e) {
                e.printStackTrace();
                log.error("根据文章获得分类列表失败, cause:{}", e);
            }
            return categoryList;
        }
    
        //获得分类列表的时候,设置了和这个分类有关的文章数
        @Override
        public List<Category> listCategoryWithCount() {
           List<Category> categoryList=null;
           try{
               categoryList=categoryMapper.listCategory();
               for(int i=0;i<categoryList.size();i++)
               {
                   //根据分类的ID去查找这个分类下的文章数
                   Integer count=articleCategoryRefMapper.countArticleByCategoryId(categoryList.get(i).getCategoryId());
                   categoryList.get(i).setArticleCount(count);
               }
           }catch (Exception e) {
               e.printStackTrace();
               log.error("根据文章获得分类列表失败, cause:{}", e);
           }
            return categoryList;
        }
    
        @Override
        public List<Category> listCategoryWithCountByUserId(Integer categoryUserId) {
            List<Category> categoryList=null;
            try
            {
                categoryList=categoryMapper.listCategoryByUserId(categoryUserId);
                for(int i=0;i<categoryList.size();i++){
                    Integer count=articleCategoryRefMapper.countArticleByCategoryId(categoryList.get(i).getCategoryId());
                    categoryList.get(i).setArticleCount(count);
                }
            }catch (Exception e){
                e.printStackTrace();
            }
    
            return categoryList;
        }
    
        @Override
        @Transactional(rollbackFor = Exception.class)
        public void deleteCategory(Integer id) {
            try{
                //因为文章和分类有关,所以在分类中删除,也要在文章和分类关联的表里删除
                categoryMapper.deleteCategory(id);
                articleCategoryRefMapper.deleteByCategoryId(id);
            }catch (Exception e){
                e.printStackTrace();
                log.error("删除分类失败, id:{}, cause:{}", id, e);
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
        }
    
        @Override
        public Category getCategoryById(Integer id) {
            return categoryMapper.getCategoryById(id);
        }
    
        @Override
        public Category insertCategory(Category category) {
            categoryMapper.insert(category);
            return category;
        }
    
        @Override
        public void updateCategory(Category category) {
            categoryMapper.update(category);
        }
    
        @Override
        public Category getCategoryByName(String name) {
            Category category = null;
            try {
                category = categoryMapper.getCategoryByName(name);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("更新分类失败, category:{}, cause:{}", category, e);
            }
            return category;
        }
    }
    

    3.Tag

    • 获得标签总数
    • 获得标签列表
    • 获得标签列表(设置标签下的文章数)
    • 根据ID查询信息
    • 添加标签
    • 删除标签
    • 更新标签
    • 根据名称获得标签
    • 根据文章ID获得标签列表
    • 根据用户ID获得标签列表

    3.1 接口TagService

    package com.test.ssm.blog.service;
    
    import com.test.ssm.blog.entity.Tag;
    import javafx.scene.control.TableFocusModel;
    
    import java.util.List;
    
    public interface TagService {
    
        //获得总数
        Integer countTag();
    
        //获得标签列表
        List<Tag> listTag();
    
        //获得标签列表,及文章数目
        List<Tag> listTagWithCount();
    
        //根据ID
        Tag getTagById(Integer id);
    
        //添加
        Tag insertTag(Tag tag);
    
        //更新
        void updateTag(Tag tag);
    
        //删除
        void deleteTag(Integer id);
    
        //根据名称
        Tag getTagByName(String name);
    
        //根据文章ID获得标签
        List<Tag> listTagByArticleId(Integer articleId);
    
        List<Tag> listTagByUserId(Integer tagUserId);
    }
    

    3.2 实现类TageServiceImpl

    package com.test.ssm.blog.service.impl;
    
    import com.test.ssm.blog.entity.Tag;
    import com.test.ssm.blog.mapper.ArticleTagRefMapper;
    import com.test.ssm.blog.mapper.TagMapper;
    import com.test.ssm.blog.service.TagService;
    import lombok.extern.slf4j.Slf4j;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    import org.springframework.transaction.annotation.Transactional;
    import org.springframework.transaction.interceptor.TransactionAspectSupport;
    
    import java.util.List;
    
    @Service
    @Slf4j
    public class TagServiceImpl implements TagService {
    
        @Autowired(required = false)
        TagMapper tagMapper;
    
        @Autowired(required = false)
        ArticleTagRefMapper articleTagRefMapper;
    
        @Override
        public Integer countTag() {
            return tagMapper.countTag();
        }
    
        @Override
        public List<Tag> listTag() {
            List<Tag> tagList = null;
            try {
                tagList = tagMapper.listTag();
            } catch (Exception e) {
                e.printStackTrace();
                log.error("获得所有标签失败, cause:{}", e);
            }
            return tagList;
        }
    
        @Override
        public List<Tag> listTagWithCount() {
            List<Tag> tagList = null;
            try {
                tagList = tagMapper.listTag();
                for (int i = 0; i < tagList.size(); i++) {
                    Integer count = articleTagRefMapper.countArticleByTagId(tagList.get(i).getTagId());
                    tagList.get(i).setArticleCount(count);
                }
            } catch (Exception e) {
                e.printStackTrace();
                log.error("获得所有标签失败, cause:{}", e);
            }
            return tagList;
    
        }
    
        @Override
        public Tag getTagById(Integer id) {
            return tagMapper.getTagById(id);
        }
    
        @Override
        public Tag insertTag(Tag tag) {
            tagMapper.insert(tag);
            return tag;
        }
    
        @Override
        public void updateTag(Tag tag) {
            tagMapper.insert(tag);
        }
    
        @Override
        @Transactional(rollbackFor = Exception.class)
        public void deleteTag(Integer id) {
            try {
                tagMapper.deleteById(id);
                articleTagRefMapper.deleteByTagId(id);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("删除标签失败, id:{}, cause:{}", id, e);
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
        }
    
        @Override
        public Tag getTagByName(String name) {
            Tag tag = null;
            try {
                tag = tagMapper.getTagByName(name);
            } catch (Exception e) {            e.printStackTrace();
                log.error("根据名称获得标签, name:{}, cause:{}", name, e);
            }
            return tag;
        }
    
        @Override
        public List<Tag> listTagByArticleId(Integer articleId) {
            List<Tag> tagList = null;
            try {
                tagList = articleTagRefMapper.listTagByArticleId(articleId);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("根据文章ID获得标签失败,articleId:{}, cause:{}", articleId, e);
            }
            return tagList;
        }
    
        @Override
        public List<Tag> listTagByUserId(Integer tagUserId) {
            List<Tag> tagList=null;
            try
            {
                tagList=tagMapper.listTagByUserId(tagUserId);
                for(int i=0;i<tagList.size();i++)
                {
                    Integer count=articleTagRefMapper.countArticleByTagId(tagList.get(i).getTagId());
                    tagList.get(i).setArticleCount(count);
                }
    
            }catch (Exception e) {
                e.printStackTrace();
            }
            return tagList;
        }
    }
    

    4.Comment

    • 添加评论
    • 根据文章ID获得评论列表
    • 根据评论ID获得评论
    • 获得所有评论
    • 获得评论列表
    • 删除评论
    • 更新评论
    • 统计评论数
    • 获得评论子评论
    • 获得最新评论
    • 根据文章列表ID查找评论列表

    4.1 接口CommentService

    package com.test.ssm.blog.service;
    
    import com.github.pagehelper.PageInfo;
    import com.test.ssm.blog.entity.Article;
    import com.test.ssm.blog.entity.Comment;
    
    import java.util.List;
    
    public interface CommentService {
    
        //添加
        void insertComment(Comment comment);
    
        //根据文章ID获取评论列表
        List<Comment> listCommentByArticleId(Integer articleId);
    
        //根据ID获取
        Comment getCommentById(Integer id);
    
    
        /**
         * 获得所有评论
         * pageIndex 第几页开始
         * pageSize 一页显示的数量
         */
        PageInfo<Comment> listCommentByPage(Integer pageIndex,Integer pageSize);
    
        //获得评论列表
        List<Comment> listComment();
    
        //删除评论
        void deleteComment(Integer id);
    
        //更新
        void updateComment(Comment comment);
    
        //统计评论数
        Integer countComment();
    
        //获得最新评论
        List<Comment> listRecentComment(Integer limit);
    
        //获得评论的子评论
        List<Comment> listChildComment(Integer id);
    
        PageInfo<Comment> listCommentByArticleIds(Integer pageIndex,Integer pageSize,List<Integer> articleIds);
    
    }
    

    4.2 实现类CommentServiceImpl 

    package com.test.ssm.blog.service.impl;
    
    import com.github.pagehelper.PageHelper;
    import com.github.pagehelper.PageInfo;
    import com.test.ssm.blog.entity.Article;
    import com.test.ssm.blog.entity.Comment;
    import com.test.ssm.blog.entity.Page;
    import com.test.ssm.blog.enums.ArticleStatus;
    import com.test.ssm.blog.mapper.ArticleMapper;
    import com.test.ssm.blog.mapper.CommentMapper;
    import com.test.ssm.blog.service.CommentService;
    import lombok.extern.slf4j.Slf4j;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    
    import java.util.List;
    
    @Service
    @Slf4j
    public class CommentServiceImpl implements CommentService {
    
        @Autowired(required = false)
        private CommentMapper commentMapper;
    
        @Autowired(required = false)
        private ArticleMapper articleMapper;
    
        @Override
        public void insertComment(Comment comment) {
            try
            {
                commentMapper.insert(comment);
            }catch (Exception e)
            {
                e.printStackTrace();
                log.error("创建评论失败:comment:{},cause:{}",comment,e);
            }
    
        }
    
        @Override
        public List<Comment> listCommentByArticleId(Integer articleId) {
            List<Comment> commentList=null;
            try {
                commentList=commentMapper.listCommentByArticleId(articleId);
            }catch (Exception e) {
                e.printStackTrace();
                log.error("根据文章ID获得评论列表失败,articleId:{},cause:{}", articleId, e);
            }
            return commentList;
    
        }
    
        @Override
        public Comment getCommentById(Integer id) {
            Comment comment=null;
            try{
                comment=commentMapper.getCommentById(id);
            }catch (Exception e){
                e.printStackTrace();
                log.error("根据评论ID获得评论,id:{}, cause:{}", id, e);
            }
            return comment;
        }
    
        @Override
        public PageInfo<Comment> listCommentByPage(Integer pageIndex, Integer pageSize) {
            PageHelper.startPage(pageIndex,pageSize);
            List<Comment> commentList=null;
            try{
                commentList=commentMapper.listComment();
                for(int i=0;i<commentList.size();i++)
                {
                    //根据文章状态(已发布)和评论中的文章ID获得文章
                    Article article=articleMapper.getArticleByStatusAndId(ArticleStatus.PUBLISH.getValue(),commentList.get(i).getCommentArticleId());
                   //comment中有一个这样的属性      private  Article article;  //非数据库字段。评论的文章
                    commentList.get(i).setArticle(article);
                }
            }catch (Exception e) {
                e.printStackTrace();
                log.error("分页获得评论失败,pageIndex:{}, pageSize:{}, cause:{}", pageIndex, pageSize, e);
            }
            return new PageInfo<>(commentList);
        }
    
        @Override
        public List<Comment> listComment() {
           List<Comment> commentList=null;
           try
           {
               commentList=commentMapper.listComment();
           } catch (Exception e) {
               e.printStackTrace();
               log.error("获得评论列表失败:cause:{}", e);
           }
           return commentList;
    
        }
    
        @Override
        public void deleteComment(Integer id) {
            commentMapper.deleteById(id);
        }
    
        @Override
        public void updateComment(Comment comment) {
            commentMapper.update(comment);
        }
    
        @Override
        public Integer countComment() {
            Integer commentCount = null;
            try {
                commentCount = commentMapper.countComment();
            } catch (Exception e) {
                e.printStackTrace();
                log.error("统计评论数量失败, cause:{}", e);
            }
            return commentCount;
        }
    
        @Override
        public List<Comment> listRecentComment(Integer limit) {
            List<Comment> commentList=null;
            try{
                commentList=commentMapper.listRecentComment(limit);
                for(int i=0;i<commentList.size();i++)
                {
                    Article article = articleMapper.getArticleByStatusAndId(ArticleStatus.PUBLISH.getValue(), commentList.get(i).getCommentArticleId());
                    commentList.get(i).setArticle(article);
                }
            }catch (Exception e){
                e.printStackTrace();
                log.error("获得最新评论失败, limit:{}, cause:{}", limit, e);
            }
            return  commentList;
        }
    
        @Override
        public List<Comment> listChildComment(Integer id) {
           List<Comment> childCommentList=null;
           try
           {
               childCommentList=commentMapper.listChildComment(id);
           }catch (Exception e) {
               e.printStackTrace();
               log.error("获得子评论失败, id:{}, cause:{}", id, e);
           }
            return childCommentList;
    
        }
    
        @Override
        public PageInfo<Comment> listCommentByArticleIds(Integer pageIndex, Integer pageSize,List<Integer> articleIds) {
            PageHelper.startPage(pageIndex,pageSize);
            System.out.println(articleIds.size());
            List<Comment> commentList=null;
            try{
                commentList=commentMapper.listCommentByArticleIds(articleIds);
                for(int i=0;i<commentList.size();i++){
                    Article article = articleMapper.getArticleByStatusAndId(ArticleStatus.PUBLISH.getValue(), commentList.get(i).getCommentArticleId());
                    commentList.get(i).setArticle(article);
                }
            }catch (Exception e)
            {
                e.printStackTrace();
            }
            return new PageInfo<>(commentList);
        }
    
    
    }
    

    5.Link

    • 获得链接总数
    • 获得链接列表
    • 添加链接
    • 删除链接
    • 更新链接
    • 根据ID查询链接 

    5.1 接口LinkService

    package com.test.ssm.blog.service;
    
    import com.test.ssm.blog.entity.Link;
    
    import java.util.List;
    
    public interface LinkService {
    
        //获得链接总数
        Integer countLink(Integer status);
    
        //获得链接列表
        List<Link> listLink(Integer status);
    
        //添加
        void insertLink(Link link);
    
        //删除
        void deleteLink(Integer id);
    
        //更新
        void updateLink(Link link);
    
        //根据ID查询
        Link getLinkById(Integer id);
    
    }
    

    5.2 实现类LinkServiceImpl

    package com.test.ssm.blog.service.impl;
    
    import com.test.ssm.blog.entity.Link;
    import com.test.ssm.blog.mapper.LinkMapper;
    import com.test.ssm.blog.service.LinkService;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    
    import java.util.List;
    
    @Service
    public class LinkServiceImpl implements LinkService {
    
        @Autowired(required = false)
        LinkMapper linkMapper;
    
        @Override
        public Integer countLink(Integer status) {
            return linkMapper.countLink(status);
        }
    
        @Override
        public List<Link> listLink(Integer status) {
            return linkMapper.listLink(status);
        }
    
        @Override
        public void insertLink(Link link) {
            linkMapper.insert(link);
        }
    
        @Override
        public void deleteLink(Integer id) {
            linkMapper.deleteById(id);
        }
    
        @Override
        public void updateLink(Link link) {
            linkMapper.update(link);
        }
    
        @Override
        public Link getLinkById(Integer id) {
            return linkMapper.getLinkById(id);
        }
    }
    

    6.Menu

    • 获得菜单列表
    • 添加菜单
    • 删除菜单
    • 更新菜单
    • 根据ID查询菜单

    6.1 接口MenuService

    package com.test.ssm.blog.service;
    
    
    import com.test.ssm.blog.entity.Menu;
    
    import java.util.List;
    
    public interface MenuService {
    
        //获得菜单列表
        List<Menu> listMenu();
    
        //添加菜单项目
        Menu insertMenu(Menu menu);
    
        //删除菜单项目
        void deleteMenu(Integer id);
    
        //更新
        void updateMenu(Menu menu);
    
        //根据ID获取菜单项目信息
        Menu getMenuById(Integer id);
    }
    

    6.2 实现类MenuServiceImpl

    package com.test.ssm.blog.service.impl;
    
    import com.test.ssm.blog.entity.Menu;
    import com.test.ssm.blog.mapper.MenuMapper;
    import com.test.ssm.blog.service.MenuService;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    
    import java.util.List;
    
    @Service
    public class MenuServiceImpl implements MenuService {
    
        @Autowired(required = false)
        MenuMapper menuMapper;
    
        @Override
        public List<Menu> listMenu() {
            List<Menu> menuList=menuMapper.listMenu();
            return menuList;
        }
    
        @Override
        public Menu insertMenu(Menu menu) {
            menuMapper.insert(menu);
            return menu;
        }
    
        @Override
        public void deleteMenu(Integer id) {
            menuMapper.deleteById(id);
        }
    
        @Override
        public void updateMenu(Menu menu) {
            menuMapper.update(menu);
        }
    
        @Override
        public Menu getMenuById(Integer id) {
            return menuMapper.getMenuById(id);
        }
    }
    

    7.Notice

    • 获得公告列表
    • 添加公告
    • 删除公告
    • 更新公告
    • 根据ID查询公告

    7.1 接口NoticeService

    package com.test.ssm.blog.service;
    
    import com.test.ssm.blog.entity.Notice;
    
    import java.util.List;
    
    public interface NoticeService {
    
        //获得公告列表
        List<Notice> listNotice(Integer status);
    
        //添加公告
        void insertNotice(Notice notice);
    
        //删除
        void deleteNotice(Integer id);
    
        //更新
        void updateNotice(Notice notice);
    
        //根据ID查询
        Notice getNoticeById(Integer id);
    }
    

    7.2 实现类NoticeServiceImpl

    package com.test.ssm.blog.service.impl;
    
    import com.test.ssm.blog.entity.Notice;
    import com.test.ssm.blog.mapper.NoticeMapper;
    import com.test.ssm.blog.service.NoticeService;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    
    import java.util.List;
    
    @Service
    public class NoticeServiceImpl implements NoticeService {
    
        @Autowired(required = false)
       NoticeMapper noticeMapper;
    
    
        @Override
        public List<Notice> listNotice(Integer status) {
            return noticeMapper.listNotice(status);
        }
    
        @Override
        public void insertNotice(Notice notice) {
           noticeMapper.insert(notice);
        }
    
        @Override
        public void deleteNotice(Integer id) {
          noticeMapper.deleteById(id);
        }
    
        @Override
        public void updateNotice(Notice notice) {
            noticeMapper.update(notice);
        }
    
        @Override
        public Notice getNoticeById(Integer id) {
            return noticeMapper.getNoticeById(id);
        }
    }
    

    8.Options

    • 获得站点信息
    • 新建站点
    • 更新站点

    8.1 接口OptionsService

    package com.test.ssm.blog.service;
    
    import com.test.ssm.blog.entity.Options;
    
    public interface OptionsService {
    
        //获得基本信息
        Options getOptions();
    
        //新建基本信息
        void insertOptions(Options options);
    
        //更新基本信息
        void updateOptions(Options options);
    }
    

    8.2 实现类OptionsServiceImpl

    package com.test.ssm.blog.service.impl;
    
    import com.test.ssm.blog.entity.Options;
    import com.test.ssm.blog.mapper.OptionsMapper;
    import com.test.ssm.blog.service.OptionsService;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.cache.annotation.Cacheable;
    import org.springframework.stereotype.Service;
    
    @Service
    public class OptionsServiceImpl implements OptionsService {
    
        @Autowired(required = false)
        OptionsMapper optionsMapper;
    
        @Override
        @Cacheable(value = "default", key = "'options'")
        public Options getOptions() {
            return optionsMapper.getOptions();
        }
    
        /**
         * @Cacheable : 主要针对方法配置,能够根据方法的请求参数对结果进行缓存
         * 参数值:
         *         value 缓存的名称
         *         key 缓存的key(如果指定要按照SpEL表达式编写,如果不指定,则缺省按照方法的所有参数进行组合
         *         condition 缓存的条件,可以为空
         *  加这个注解的意思,当调用这个方法时,会从一个名叫value值的缓存中查询,如果没有,则执行实际方法(即查询数据库),并将执行结果保存在缓存中
         *                   否则返回缓存中的对象
         * @param options
         */
        @Override
        @Cacheable(value = "default", key = "'options'")
        public void insertOptions(Options options) {
            optionsMapper.insert(options);
        }
    
        @Override
        @Cacheable(value = "default", key = "'options'")
        public void updateOptions(Options options) {
            optionsMapper.update(options);
        }
    }
    

    9.User

    • 获得用户列表
    • 根据ID查询用户
    • 添加用户
    • 删除用户
    • 更新用户信息
    • 根据用户名或邮箱查询用户
    • 根据用户名查询用户
    • 根据邮箱查询用户

    9.1 接口UserService

    package com.test.ssm.blog.service;
    
    import com.test.ssm.blog.entity.User;
    
    import java.util.List;
    
    public interface UserService {
        /**
         * 获得用户列表
         */
        List<User> listUser();
    
        /**
         * 根据ID查询信息
         */
        User getUserById(Integer id);
    
        /**
         * 修改用户信息
         */
        void updateUser(User user);
    
        /**
         * 删除用户
         */
        void deleteUser(Integer id);
    
        /**
         * 添加用户
         */
        User insertUser(User user);
    
        /**
         * 根据用户名或邮箱查询用户
         */
        User getUserByNameOrEmail(String str);
    
        /**
         * 根据用户名查询用户
         */
        User getUserByName(String name);
    
        /**
         * 根据邮箱查询用户
         */
        User getUserByEmail(String email);
    
    }
    

    9.2 实现类UserServiceImpl

    package com.test.ssm.blog.service.impl;
    
    import com.test.ssm.blog.entity.User;
    import com.test.ssm.blog.mapper.ArticleMapper;
    import com.test.ssm.blog.mapper.UserMapper;
    import com.test.ssm.blog.service.UserService;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    
    import java.util.Date;
    import java.util.List;
    
    @Service
    public class UserServiceImpl implements UserService {
    
        @Autowired(required = false)
        private UserMapper userMapper;
    
        @Autowired(required = false)
        private ArticleMapper articleMapper;
    
        @Override
        public List<User> listUser() {
            List<User> userList=userMapper.listUser();
            for (int i=0;i<userList.size();i++)
            {
                Integer articleCount=articleMapper.countArticleByUser(userList.get(i).getUserId());
                userList.get(i).setArticleCount(articleCount);
            }
            return userList;
        }
    
        @Override
        public User getUserById(Integer id) {
            return userMapper.getUserById(id);
        }
    
        @Override
        public void updateUser(User user) {
            userMapper.update(user);
        }
    
        @Override
        public void deleteUser(Integer id) {
            userMapper.deleteById(id);
        }
    
        @Override
        public User insertUser(User user) {
           user.setUserRegisterTime(new Date());
           userMapper.insert(user);
           return user;
        }
    
        @Override
        public User getUserByNameOrEmail(String str) {
            return userMapper.getUserByNameOrEmail(str);
        }
    
        @Override
        public User getUserByName(String name) {
            return userMapper.getUserByName(name);
        }
    
        @Override
        public User getUserByEmail(String email) {
            return userMapper.getUserByEmail(email);
        }
    }
    

    10.Page

    • 获得页面列表
    • 根据页面关键字获得页面列表
    • 添加页面
    • 删除页面
    • 编辑页面

    10.1 接口PageService 

    package com.test.ssm.blog.service;
    
    import com.test.ssm.blog.entity.Page;
    
    import java.util.List;
    
    public interface PageService {
    
        //获得页面列表
        List<Page> listPage(Integer status);
    
        //根据页面key获得页面
        Page getPageByKey(Integer status,String key);
    
        //根据ID获取页面
        Page getPageById(Integer id);
    
        //添加页面
        void insertPage(Page page);
    
        //删除页面
        void deletePage(Integer id);
    
        //编辑页面
        void updatePage(Page page);
    }
    

    10.2 实现类PageServiceImpl

    package com.test.ssm.blog.service.impl;
    
    import com.test.ssm.blog.entity.Page;
    import com.test.ssm.blog.mapper.PageMapper;
    import com.test.ssm.blog.service.PageService;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    
    import java.util.List;
    
    @Service
    public class PageServiceImpl implements PageService {
    
        @Autowired(required = false)
        PageMapper pageMapper;
    
        @Override
        public List<Page> listPage(Integer status) {
            return pageMapper.listPage(status);
        }
    
        @Override
        public Page getPageByKey(Integer status, String key) {
            return pageMapper.getPageByKey(status,key);
        }
    
        @Override
        public Page getPageById(Integer id) {
            return pageMapper.getPageById(id);
        }
    
        @Override
        public void insertPage(Page page) {
            pageMapper.insert(page);
        }
    
        @Override
        public void deletePage(Integer id) {
            pageMapper.deleteById(id);
        }
    
        @Override
        public void updatePage(Page page) {
            pageMapper.update(page);
        }
    }
    

     

    展开全文
  • #include<vtkSmartPointer.h> #include<vtkRenderWindow.h> #include<vtkRenderer.h> #include<vtkRenderWindowInteractor.h>...vtkInteractorStyleTrackballCamera.h>...
  • package demo;... * @author Weirdo-world  *  */ public class Demo8 {  public static void main(String[] args) {  String[] s = { "张三", "李四", "王五", ...
  • 在阿里云服务器上,用virtualenv创建虚拟环境时,报了个错误 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ...root@iZwz982qla1uxm1s5dnyo7Z:/usr/lib/python3/dist-packages/virtualenv-15.
  • 深度学习——YOLO模型的原理与实战

    千次阅读 2020-12-03 10:53:21
    YOLO模型的原理与实战 YOLO网络结构 ... YOLO的原理 ...1、原始图片resize到448x448,经过前面卷积网络之后,将图片输出成了一个7*7*30的结构以图示的方式演示 2、默认7*7个单元格,这里用3*3的单元格图演示 ...
  • Python3中使用flask_sqlalchemy的问题

    千次阅读 2018-08-01 09:51:05
    1.Flask-SQLAlchemy Flask-SQLAlchemy 是Flask的数据库扩展,简化了Flask程序中使用 SQLAlchemy的操作,和其他Flask扩展一样,Flask-SQLAlchemy 也使用 pip 安装: pip install flask-sqlalchemy ...
  • (一) Python3在flask_sqlalchemy中相比改动了一些比如模块的导入。 在Python2中应该是 from flask.ext.sqlalchemy impot SQLAlchemy 虽然在Python3中这样使用其实不会错但是Python3中不赞成这样使用可能在未来会...
  • idea 配置使用maven

    2019-04-10 14:29:11
    1、下载maven ... 2、解压maven文件,找到conf文件夹,打开settings.xml配置文件 添加如下代码(设置本地仓库jar文件位置) ...localRepository>D:/zbj/tools/apache-maven-3.6.0/repo<......
  • js05正则表达式

    2018-04-01 09:47:27
    正则表达式1.是什么是对字符串操作的一种逻辑符;2.组成基本字符:abc 123特殊字符 :\d 、\w 、\s等3.作用实现匹配提取替换4.特殊字符1.元符\d表示所有的数字\D表示所有的非数字\w表示字母数字和下划线组成\W有所有...
  • 养兔子

    千次阅读 2017-02-28 21:34:50
    养兔子 Time Limit: 1000MS Memory Limit: 65536KB Problem Description 一对成熟的兔子每天能且只能产下一对小兔子,每次都生一公一母,每只小兔子的成熟期是一天。某人领养了一对小兔子,一公一母,请问第...
  • MyBatisPlus快速入门

    2022-01-02 16:07:54
    user.setName("weirdo"); user.setAge(17); user.setEmail("12341124@qq.com"); int result = userMapper.insert(user); System.out.println(result); System.out.println(user); } Creating a new SqlSession ...
  • /** *@time 2020年8月19日:上午10:48:38 *@author Weirdo *@version 1.0 **/ public class Sington_E { //我在初始化的时候就给你来个对象,你要我就返回,就算你不要,我也创建出来,简单粗暴 private final ...
  • <bean id="userDao" class="com.weirdo.dao.UserDaoImpl"/> <bean id="myAspectj" class="com.weirdo.dao.MyAspectj"/> <aop:config> <aop:aspect id="aspect" ref="myAspectj"> (* com.weirdo.dao.MyAspectj.*.*(.....
  • Add Html Tag ID's-crx插件

    2021-04-02 03:12:22
    语言:English (United ...而不是收到像这样的电子邮件:“您可以将'更多信息'的链接更改为指向http:// localhost / Test而不是http:// localhost / Weirdo“您可以收到一些更适用的信息:”可以您将A-12更改为链接到...
  • “您可以更改”更多信息“的链接指向http:// localhost / Test而不是http:// localhost / Weirdo” 你可以收到一些更适用的东西: “你能改变A-12链接到http:// localhost / Test” 团队中的两个用户都安装了这个...
  • <bean id="user" class="com.weirdo.pojo.User"> 龚启龙说Java"/> bean> <bean id="user" class="com.weirdo.pojo.User"> 李佳怡"/> bean> <bean id="user" class="com.weirdo.pojo.User" > 张可久"/> bean> ...
  • 1、克隆羊问题 ...package com.weirdo.prototype; public class Sheep { private String name; private int age; private String color; public Sheep(String name, int age, String color) { th
  • 关于MyBatis的一些总结

    千次阅读 2021-11-13 23:43:49
    <mappers> <mapper resource="com/weirdo/dao/AuthorMapper.xml"/> mappers> <mappers> <mapper class="com.weirdo.dao.AuthorMapper"/> mappers> mapper.xml中增删改需要提交事务,在测试类中添加 sqlSession....
  • 这时候初始化instance就没有达到懒加载的效果 结论:这种单例模式可用,可能造成内存浪费 package com.weirdo.principle.singleton.type1; public class SingletonTest01 { public static void main(String[] args)...
  • NFS

    2019-10-21 11:54:56
    NFS server:weirdo:x:1000:1000:weirdo:/home/weirdo:/bin/bash NFS client:wang:x:1000:1000:wang:/home/wang:/bin/bash NFS server的配置文件: # cat /etc/exports /data/nfs *(rw,anonuid=1000,anongid=...
  • <context:component-scan base-package="com.weirdo.service"/> *:db.properties"/> <!-- 配置数据库连接池 --> <!-- 基本属性 url、user、password --> ${db.driver}"/> ${db.url}"/> ${db.username}"/> ...
  • Phoebe: Oh that's good, I guess she'll have a choice between my guy and your weirdo. Chandler: Why would our guy be a weirdo? Phoebe:'Cause that's just your taste. Monica: (laughs sarcastically) ...
  • 图解基本排序算法

    2020-08-05 21:21:46
    /** *@time 2020年4月26日:上午10:38:58 *@author Weirdo *@version 1.0 **/ public class Merge { public static void main(String[] args) { // TODO Auto-generated method stub } public static void ...
  • For some weirdo reason, it is not inside the library itself, so we need to copy/download it from github, and use it. 当我们到达pagedList的末尾时,我们需要进行网络调用,将数据插入数据库中并将其显示给...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 1,083
精华内容 433
热门标签
关键字:

weirdo