inleft
2022-02-21 c5e66af68d7eded8bcc55e0fe26d034d30735c16
分类统计
6 files modified
85 ■■■■■ changed files
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticletype/controller/BlogArticleTypeOutsideController.java 23 ●●●●● patch | view | raw | blame | history
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticletype/mapper/BlogArticleTypeMapper.java 4 ●●●● patch | view | raw | blame | history
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticletype/mapper/mapping/BlogArticleTypeMapper.xml 29 ●●●●● patch | view | raw | blame | history
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticletype/param/BlogArticleTypeVo.java 9 ●●●● patch | view | raw | blame | history
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticletype/service/BlogArticleTypeService.java 4 ●●●● patch | view | raw | blame | history
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticletype/service/impl/BlogArticleTypeServiceImpl.java 16 ●●●●● patch | view | raw | blame | history
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticletype/controller/BlogArticleTypeOutsideController.java
@@ -24,22 +24,18 @@
 */
package vip.xiaonuo.modular.blogarticletype.controller;
import cn.hutool.core.bean.BeanUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.core.annotion.BusinessLog;
import vip.xiaonuo.core.consts.MyConstant;
import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
import vip.xiaonuo.core.pojo.response.ResponseData;
import vip.xiaonuo.core.pojo.response.SuccessResponseData;
import vip.xiaonuo.modular.blogarticletype.entity.BlogArticleType;
import vip.xiaonuo.modular.blogarticletype.param.BlogArticleTypeVo;
import vip.xiaonuo.modular.blogarticletype.service.BlogArticleTypeService;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
 * blog文章分类控制器
@@ -65,15 +61,16 @@
    @BusinessLog(title = "外部blog系统_blog文章分类_查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData queryBlogArticleType() {
        List<BlogArticleTypeVo> list = blogArticleTypeService.lambdaQuery()
                .eq(BlogArticleType::getIsEnable, MyConstant.Yes)
                .orderByAsc(BlogArticleType::getTopValue)
                .orderByDesc(BlogArticleType::getCreateDate)
                .list().stream().map(e -> {
                    BlogArticleTypeVo vo = new BlogArticleTypeVo();
                    BeanUtil.copyProperties(e, vo);
                    return vo;
                }).collect(Collectors.toList());
        List<BlogArticleTypeVo>  list=  blogArticleTypeService.listCount();
//        List<BlogArticleTypeVo> list = blogArticleTypeService.lambdaQuery()
//                .eq(BlogArticleType::getIsEnable, MyConstant.Yes)
//                .orderByAsc(BlogArticleType::getTopValue)
//                .orderByDesc(BlogArticleType::getCreateDate)
//                .list().stream().map(e -> {
//                    BlogArticleTypeVo vo = new BlogArticleTypeVo();
//                    BeanUtil.copyProperties(e, vo);
//                    return vo;
//                }).collect(Collectors.toList());
        return new SuccessResponseData(list);
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticletype/mapper/BlogArticleTypeMapper.java
@@ -26,6 +26,9 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import vip.xiaonuo.modular.blogarticletype.entity.BlogArticleType;
import vip.xiaonuo.modular.blogarticletype.param.BlogArticleTypeVo;
import java.util.List;
/**
 * blog文章分类
@@ -34,4 +37,5 @@
 * @date 2022-02-15 15:17:15
 */
public interface BlogArticleTypeMapper extends BaseMapper<BlogArticleType> {
    List<BlogArticleTypeVo> listCount();
}
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticletype/mapper/mapping/BlogArticleTypeMapper.xml
@@ -2,4 +2,33 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="vip.xiaonuo.modular.blogarticletype.mapper.BlogArticleTypeMapper">
    <select id="listCount" resultType="vip.xiaonuo.modular.blogarticletype.param.BlogArticleTypeVo">
        SELECT
            t1.id,
            t1.type_name AS typeName,
            t2.count
        FROM
            blog_article_type t1,
            (
                SELECT
                    t.id,
                    count(t.id) count
                FROM
                    blog_article a,
                    blog_article_type t
                WHERE
                    a.article_type_id = t.id
                AND a.is_enable = 1
                AND a.editor_status = 1
                AND t.is_enable = 1
                GROUP BY
                    t.id
            ) t2
        WHERE
            t1.id = t2.id
        ORDER BY
            t1.top_value ASC,
            t1.create_date DESC
    </select>
</mapper>
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticletype/param/BlogArticleTypeVo.java
@@ -24,10 +24,7 @@
 */
package vip.xiaonuo.modular.blogarticletype.param;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
 * blog文章分类
@@ -48,9 +45,7 @@
     */
    private String typeName;
    /**
     * 创建时间
     */
    private Date createDate;
    private Long count;
}
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticletype/service/BlogArticleTypeService.java
@@ -28,6 +28,8 @@
import vip.xiaonuo.core.pojo.page.PageResult;
import vip.xiaonuo.modular.blogarticletype.entity.BlogArticleType;
import vip.xiaonuo.modular.blogarticletype.param.BlogArticleTypeParam;
import vip.xiaonuo.modular.blogarticletype.param.BlogArticleTypeVo;
import java.util.List;
/**
@@ -94,4 +96,6 @@
     */
     void export(BlogArticleTypeParam blogArticleTypeParam);
    List<BlogArticleTypeVo> listCount();
}
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticletype/service/impl/BlogArticleTypeServiceImpl.java
@@ -26,12 +26,10 @@
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import vip.xiaonuo.core.consts.CommonConstant;
import vip.xiaonuo.core.enums.CommonStatusEnum;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import vip.xiaonuo.core.exception.ServiceException;
import vip.xiaonuo.core.factory.PageFactory;
import vip.xiaonuo.core.pojo.page.PageResult;
@@ -40,10 +38,9 @@
import vip.xiaonuo.modular.blogarticletype.enums.BlogArticleTypeExceptionEnum;
import vip.xiaonuo.modular.blogarticletype.mapper.BlogArticleTypeMapper;
import vip.xiaonuo.modular.blogarticletype.param.BlogArticleTypeParam;
import vip.xiaonuo.modular.blogarticletype.param.BlogArticleTypeVo;
import vip.xiaonuo.modular.blogarticletype.service.BlogArticleTypeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
@@ -133,4 +130,9 @@
        PoiUtil.exportExcelWithStream("SnowyBlogArticleType.xls", BlogArticleType.class, list);
    }
    @Override
    public List<BlogArticleTypeVo> listCount() {
        return this.baseMapper.listCount();
    }
}