package cn.iselab.mooctest.user.mapper;

import cn.iselab.mooctest.user.model.UserIntegral;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.CrudRepository;

import javax.transaction.Transactional;
import java.util.List;

/**
 * @Author ROKG
 * @Description
 * @Date: Created in 上午11:40 2018/2/13
 * @Modified By:
 */
@Mapper
public interface UserIntegralMapper {

    @Select("select * from user_integral where user_id=#{userId}")
    List<UserIntegral> findByUserId(long userId);

    @Select("select * from user_integral")
    List<UserIntegral> findAll();

    @Insert("insert into user_integral(user_id,total,enabled,create_time) values(#{userId},#{total},#{enabled},#{createTime})")
    void save(UserIntegral integral);

    @Update("update user_integral set total=#{total},enabled=#{enabled} where id=#{id}")
    void update(UserIntegral integral);
}
