src/main/java/com/secondshop/mappers/UserMapper.java

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.secondshop.mappers;

import com.secondshop.models.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 用户Mapper
 */
public interface UserMapper {
    /**
     * 查找所有的用户
     * @return
     */
    @Select("select * from user_table;")
    List<User> getAllUser();

    /**
     * 根据id查找用户
     * @param id
     * @return
     */
    @Select("select * from user_table where id = #{id}")
    User getUserById(int id);

    /**
     * 根据email查找用户
     * @param email
     * @return
     */
    @Select("select * from user_table where email = #{email}")
    User getUserByEmail(String email);

    /**
     * 根据手机号码查找用户
     * @param mobile
     * @return
     */
    @Select("select * from user_table where mobile = #{mobile}")
    User getUserByMobile(String mobile);

    /**
     * 插入新用户
     * @param user
     * @return
     */
    @Insert("insert into user_table (name, mobile, email, password, code, photo_url, role_id, gender, register_date, status_id) " +
            "values (#{name}, #{mobile}, #{email}, #{password}, #{code}, '/statics/image/photos/default/default.png', 102, #{gender}, now(), 4);")
    int insertUser(User user);

    /**
     * 更新用户
     * @param user
     * @return
     */
    @Update("UPDATE user_table SET name = #{name}, mobile = #{mobile}, email = #{email}, gender = #{gender}, photo_url = #{photoUrl},account=#{account} where id = #{id};")

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。