package shop.alien.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import shop.alien.entity.store.WebAudit;
import shop.alien.entity.store.vo.WebAuditVo;

import java.util.List;

public interface WebAuditMapper  extends BaseMapper<WebAudit> {

    @Select("SELECT\n" +
            "CASE\n" +
            "    type \n" +
            "    WHEN 1 THEN\n" +
            "    '店铺入驻' \n" +
            "    WHEN 2 THEN\n" +
            "    '处理退款' \n" +
            "    WHEN 3 THEN\n" +
            "    '商家申诉' \n" +
            "    WHEN 4 THEN\n" +
            "    '套餐' \n" +
            "    WHEN 5 THEN\n" +
            "    '活动' \n" +
            "    WHEN 6 THEN\n" +
            "    '代金券' \n" +
            "    WHEN 7 THEN\n" +
            "    '经营许可证' ELSE '未知类型' \n" +
            "  END AS type,\n" +
            "  COUNT(*) AS typeSum \n" +
            "FROM\n" +
            "  web_audit \n" +
            "  where `status` = '0'\n" +
            "  and `delete_flag` = '0'\n" +
            "GROUP BY\n" +
            "  type;")
    List<WebAuditVo> getAuditSum(QueryWrapper<WebAuditVo> queryWrapper);
}
