<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      EasyExcel

      依賴配置:

      <dependency>
          <groupId>com.alibaba</groupId>
          <artifactId>easyexcel<artifactId>
          <version>2.2.0-beta2</version>
      </dependency>

      實(shí)體類配置:

      @Data
      public class SubjectEeVo {
      
          @ExcelProperty(value = "id" ,index = 0)
          private Long id;
      
          @ExcelProperty(value = "課程分類名稱" ,index = 1)
          private String title;
      
          @ExcelProperty(value = "上級id" ,index = 2)
          private Long parentId;
      
          @ExcelProperty(value = "排序" ,index = 3)
          private Integer sort;
      
      }

      導(dǎo)入時(shí),需要配置監(jiān)聽器

      @Component
      public class SubjectListener extends AnalysisEventListener<SubjectEeVo> {
          @Resource
          private SubjectMapper dictMapper;
          //一行一行讀取
          @Override
          public void invoke(SubjectEeVo subjectEeVo, AnalysisContext analysisContext) {
              //調(diào)用方法添加數(shù)據(jù)庫
              Subject subject = new Subject();
              BeanUtils.copyProperties(subjectEeVo,subject);
              dictMapper.insert(subject);
          }
          @Override
          public void doAfterAllAnalysed(AnalysisContext analysisContext) {
          }
      }

      導(dǎo)入業(yè)務(wù):

       @PostMapping("importData")
          public Result importData(MultipartFile file) {
              subjectService.importDictData(file);
              return Result.ok();
          }
          /**
                 * 導(dǎo)入
          */
          @Override
          public void importDictData(MultipartFile file) {
              try {
                  EasyExcel.read(file.getInputStream(),
                          SubjectEeVo.class,subjectListener).sheet().doRead();
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }

      導(dǎo)出業(yè)務(wù):

       @GetMapping(value = "/exportData")
          public void exportData(HttpServletResponse response) {
              subjectService.exportData(response);
          } 
          /**
           * 導(dǎo)出課表
           * @param response
           */
          @Override
          public void exportData(HttpServletResponse response) {
      
              try {
                  response.setContentType("application/vnd.ms-excel");
                  response.setCharacterEncoding("utf-8");
                  // 這里URLEncoder.encode可以防止中文亂碼 當(dāng)然和easyexcel沒有關(guān)系
                  String fileName = URLEncoder.encode("課程分類", "UTF-8");
                  response.setHeader("Content-disposition", "attachment;filename="+ fileName + ".xlsx");
                  List<Subject> dictList = baseMapper.selectList(null);
                  List<SubjectEeVo> dictVoList = dictList.stream().map(sub -> {
                      SubjectEeVo subjectEeVo = new SubjectEeVo();
                      BeanUtils.copyProperties(sub, subjectEeVo);
                      return subjectEeVo;
                  }).collect(Collectors.toList());
                  EasyExcel.write(response.getOutputStream(), SubjectEeVo.class)
                          .sheet("課程分類").doWrite(dictVoList);
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }

      曲線圖:

      <template>
          <div class="app-container">
            <!--表單-->
            <el-form :inline="true" class="demo-form-inline">
              <el-form-item>
                <el-date-picker
                  v-model="startDate"
                  type="date"
                  placeholder="選擇開始日期"
                  value-format="yyyy-MM-dd" />
              </el-form-item>
              <el-form-item>     
                <el-date-picker
                  v-model="endDate"
                  type="date"
                  placeholder="選擇截止日期"
                  value-format="yyyy-MM-dd" />
              </el-form-item>
              <el-button
                :disabled="btnDisabled"
                type="primary"
                icon="el-icon-search"
                @click="showChart()">查詢</el-button>
            </el-form>
            <div id="chart" class="chart" style="height:500px;" />
          </div>
        </template>
        <script>
        import echarts from 'echarts'
        import api from '@/api/vod/videoVisitor'
        
        export default {
          data() {
            return {
              courseId: '',
              startDate: '',
              endDate: '',
              btnDisabled: false
            }
          },
          created() {
            this.courseId = this.$route.params.id
            // 初始化最近十天數(shù)據(jù)
            let currentDate = new Date();
            this.startDate = this.dateFormat(new Date(currentDate.getTime()-7*24*3600*1000))
            this.endDate = this.dateFormat(currentDate)
            this.showChart()
          },
          methods: {
            showChart() {
              api.findCount(this.courseId, this.startDate, this.endDate).then(response => {
                this.setChartData(response.data)
              })
            },
            setChartData(data) {
              // 基于準(zhǔn)備好的dom,初始化echarts實(shí)例
              var myChart = echarts.init(document.getElementById('chart'))
              // 指定圖表的配置項(xiàng)和數(shù)據(jù)
              var option = {
                title: {
                  text: '觀看課程人數(shù)統(tǒng)計(jì)'
                },
                xAxis: {
                  data: data.xData
                },
                yAxis: {
                  minInterval: 1
                },
                series: [{
                  type: 'line',
                  data: data.yData
                }]
              }
              // 使用剛指定的配置項(xiàng)和數(shù)據(jù)顯示圖表。
              myChart.setOption(option)
            },
            dateFormat(date) {
              let fmt = 'YYYY-mm-dd'
              let ret;
              const opt = {
                "Y+": date.getFullYear().toString(),        //
                "m+": (date.getMonth() + 1).toString(),     //
                "d+": date.getDate().toString(),            //
                "H+": date.getHours().toString(),           // 時(shí)
                "M+": date.getMinutes().toString(),         //
                "S+": date.getSeconds().toString()          //
                // 有其他格式化字符需求可以繼續(xù)添加,必須轉(zhuǎn)化成字符串
              };
              for (let k in opt) {
                ret = new RegExp("(" + k + ")").exec(fmt);
                if (ret) {
                  fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
                };
              };
              return fmt;
            }
          }
        }
        </script>

       

      posted @ 2023-07-22 13:33  jessi呀  閱讀(253)  評論(0)    收藏  舉報(bào)
      主站蜘蛛池模板: 中文字幕精品亚洲字幕成| 国产成人亚洲精品狼色在线| 丰满无码人妻热妇无码区| 高清无码18| 欧美www在线观看| 草草浮力地址线路①屁屁影院| 日韩中文字幕一区二区不卡| 亚洲天堂精品一区二区| 人妻饥渴偷公乱中文字幕| japanese无码中文字幕| A毛片终身免费观看网站| 玩两个丰满老熟女久久网| 人妻精品动漫h无码| 干老熟女干老穴干老女人| 熟女系列丰满熟妇AV| 贺兰县| 国产老熟女国语免费视频| 色综合 图片区 小说区| 日韩深夜福利视频在线观看| 国产成人亚洲精品自产在线| 亚洲精品久久久久国色天香| 狠狠v日韩v欧美v| 国产婷婷综合在线视频中文| 亚洲av伊人久久综合性色| 免费高清特级毛片A片| 国产色无码专区在线观看| 国模无吗一区二区二区视频| 日日摸天天爽天天爽视频| 久久精品丝袜高跟鞋| 欧美日韩亚洲国产| 色悠悠久久精品综合视频| 中文字幕亚洲高清在线一区| 色猫咪av在线观看| 九九热99精品视频在线| 欧美乱妇高清无乱码免费| 九九热精品在线观看| 国产精品人妻一区二区高 | 日韩丝袜亚洲国产欧美一区| 中文乱码字幕在线中文乱码| 日韩成人无码影院| 亚洲国产片一区二区三区|