package com.neko.service.user.impl;

import com.neko.dao.mapper.InvestMapper;
import com.neko.dao.mapper.UserMapper;
import com.neko.dao.po.Invest;
import com.neko.dao.po.User;
import com.neko.service.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * Created by ssjk on 2016/10/31.
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Autowired
    InvestMapper investMapper;

    @Override
    @Cacheable(key = "#id.toString()", value = "userCache")
    public User findUserById(Integer id) {
        System.out.println(123);
        return userMapper.selectByPrimaryKey(id);
    }

    @Override
    public void insertUser(User user) {
        userMapper.insert(user);
    }

    @Override
    public void invest(Invest invest) {

    }

}

@@ -610,16 +610,33 @@
 (key = %22
+'userid:'.concat(
 #id.toSt
@@ -641,16 +641,17 @@
 String()
+)
 %22, value

修改key，string+id号