码迷,mamicode.com
首页 > 编程语言 > 详细

springboot项目在普通类中调用maper或者service接口

时间:2019-12-29 12:52:47      阅读:215      评论:0      收藏:0      [点我收藏+]

标签:com   put   private   model   imp   tran   pos   code   des   

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();
    }


}

springboot项目在普通类中调用maper或者service接口

标签:com   put   private   model   imp   tran   pos   code   des   

原文地址:https://www.cnblogs.com/zhaochunhui/p/12114443.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!