2023.2.24总结

package com.itheima.mapper;

import com.itheima.pojo.Brand;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface BrandMapper {

    /**
     * 查询所有
     * @return
     */
    @Select("select * from tb_brand")
    @ResultMap("brandResultMap")
    List<Brand> selectAll();
    @Insert("insert into tb_brand values (null,#{brandName},#{companyName},#{ordered},#{description},#{status})")
    void add(Brand brand);

    void deletebyids(@Param("ids") int[] ids);

    @Select("select * from tb_brand limit #{begin},#{size}")
    @ResultMap("brandResultMap")
    List<Brand> selectByPage(@Param("begin") int begin,@Param("size") int size);
    @Select("select count(*) from tb_brand ")
    int selectTotalCount();
    //带条件的分页查询
    List<Brand> selectByPageConditon(@Param("begin") int begin,@Param("size") int size,@Param("brand") Brand brand);

    int selectConditonCount(Brand brand);
    @Delete("delete from tb_brand where id=#{id}")
    void deleteById(int id);
}

  javawevMvc三层架构Dao层代码


posted @ 2023-02-24 21:39  樱花开到我身边  阅读(17)  评论(0)    收藏  举报