学习内容 |
package com.example.demo22.mapper;
import com.example.demo22.entity.Article; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper public interface ArticleMapper { //新增文章 @Insert("INSERT into article(title,content,cover_img,state,category_id,create_user,create_time,update_time)"+"values (#{title},#{content},#{coverImg},#{state},#{categoryId},#{createUser},now(),now())") void add(Article article); //分页查询文章 List<Article> list(Integer userId, Integer categoryId, String state); //获取文章详情 @Select("select * from article where id = #{id}") Article select(Integer id); }
package com.example.demo22.service;
import com.example.demo22.entity.User;
public interface UserService { //根据用户名查询用户 User findByUserName(String userAccount); //注册 void register(String userAccount, String userPassword); //更新 void update(User user); //更新头像 void updateAvatar(String avatarUrl); //更新密码 void updatePwd(String newPwd); }
|