zoukankan      html  css  js  c++  java
  • springboot项目在普通类中调用maper或者service接口

    package com.zch.tools;
    
    import com.zch.bean.TableBean;
    import com.zch.bean.TranslateBean;
    import com.zch.mapper.FillerMapper;
    import org.apache.poi.hwpf.HWPFDocument;
    import org.apache.poi.hwpf.usermodel.*;
    import org.apache.poi.poifs.filesystem.POIFSFileSystem;
    import org.apache.poi.xwpf.usermodel.XWPFDocument;
    import org.apache.poi.xwpf.usermodel.XWPFTable;
    import org.apache.poi.xwpf.usermodel.XWPFTableCell;
    import org.apache.poi.xwpf.usermodel.XWPFTableRow;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Component;
    
    import javax.annotation.PostConstruct;
    import java.io.FileInputStream;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    
    /**
     * @Author:zhaochunhui;
     * @Description:
     * @Date:Create in 10:24 2019/12/29
     */
    //1
    @Component
    public class Judge {
    
        //2
        @Autowired
        private FillerMapper fillerMapper;
    
        public static Judge judge;
    
        //3
        @PostConstruct
        public void init(){
            judge = this ;
            //4
            judge.fillerMapper = this.fillerMapper;
        }
    
        //你要封装的方法
        public  void judgeProductStatus(){
            //5
            judge.fillerMapper.getEngCharByChainChar();
        }
    
    
    }
  • 相关阅读:
    pytest ini配置文件格式
    C#星辰之路
    bootstrap
    rabbitmq 安装
    curl 下载文件
    mysql 面试题
    mvn --version
    后台运行的nohup vs &
    scp
    linux下.tar.gz和.gz文件解压详解
  • 原文地址:https://www.cnblogs.com/zhaochunhui/p/12114443.html
Copyright © 2011-2022 走看看