36 lines
1.5 KiB
Java
36 lines
1.5 KiB
Java
package vvpkassistant.User.mapper;
|
|
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
import org.apache.ibatis.annotations.Insert;
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
import org.apache.ibatis.annotations.Param;
|
|
import org.apache.ibatis.annotations.Select;
|
|
import vvpkassistant.User.model.UserModel;
|
|
import vvpkassistant.pk.model.PkRecord;
|
|
import java.util.List;
|
|
|
|
@Mapper
|
|
public interface UserDao extends BaseMapper<UserModel> {
|
|
|
|
// 根据用户的手机号查询用户
|
|
@Select("SELECT * FROM `user` WHERE phone_number = #{phoneNumber}")
|
|
UserModel queryWithPhoneNumber(@Param("phoneNumber") String phoneNumber);
|
|
|
|
// 我邀请的pk数据
|
|
@Select("SELECT * FROM pk_record WHERE user_id_b = #{userId} ORDER BY id DESC LIMIT #{page}, #{size};")
|
|
List<PkRecord> getMyGuestPkList(@Param("userId") Integer userId , @Param("page") Integer page, @Param("size") Integer size);
|
|
|
|
// 我发起的pk数据
|
|
@Select("SELECT * FROM pk_record WHERE user_id_a = #{userId} ORDER BY id DESC LIMIT #{page}, #{size};")
|
|
List<PkRecord> findCreatedPk(@Param("userId") Integer userId , @Param("page") Integer page, @Param("size") Integer size);
|
|
|
|
// 签到
|
|
@Insert("insert into `sign_in_records` set user_id = #{userId} , time = replace(current_date, '-', '')")
|
|
int signIn(@Param("userId") int userId);
|
|
|
|
// 查询当天签到状态
|
|
@Select("SELECT COUNT(*) FROM `sign_in_records` WHERE user_id = #{userId} AND time = REPLACE(CURDATE(), '-', '')")
|
|
int checkSignStatus(@Param("userId") int userId);
|
|
|
|
}
|