业务层 - taotao-manager-service

目录结构

业务层 - taotao-manager-service_第1张图片
image.png

pom




    
        taotao-manager
        com.taotao
        1.0-SNAPSHOT
    
    4.0.0

    taotao-manager-service
    
        
        
            com.taotao
            taotao-manager-dao
            1.0-SNAPSHOT
        

        
        
            org.springframework
            spring-aop
        


        
        
            org.springframework
            spring-aspects
        

        
        
            org.springframework
            spring-beans
        

        
        
            org.springframework
            spring-context
        

        
        
            org.springframework
            spring-context-support
        

        
        
            org.springframework
            spring-core
        

        
        
            org.springframework
            spring-expression
        

        
        
            org.springframework
            spring-jdbc
        

        
        
            org.springframework
            spring-tx
        

        
        
            org.springframework
            spring-web
        

        
        
            org.springframework
            spring-webmvc
        

        
        
            org.springframework
            spring-orm
        
    


定义业务接口

package com.taotao.service;

import com.taotao.pojo.User;
import org.slf4j.LoggerFactory;

public interface UserService {


    User userById(int i );
}




定义业务实现

package com.taotao.service.impl;

import com.taotao.mapper.UserMapper;
import com.taotao.pojo.User;
import com.taotao.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class IUserService implements UserService {
  final static Logger logger = LoggerFactory.getLogger(IUserService.class);

    @Autowired
    private UserMapper userMapper;

    @Override
    public User userById(int i) {

        System.out.println("service "+i);
        User user = userMapper.selectByPrimaryKey(i);
        System.out.println(user);
        return user;
    }
}

主要处理一些业务 , 事务, 查询 ,缓存,

你可能感兴趣的:(业务层 - taotao-manager-service)