package com.example.mapper; import com.example.entity.Goods; import com.example.entity.Type; import org.apache.ibatis.annotations.Select; import java.util.List; /** * 操作goods相关数据接口 */ public interface GoodsMapper { /** * 新增 */ int insert(Goods goods); /** * 删除 */ int deleteById(Integer id); /** * 修改 */ int updateById(Goods goods); /** * 根据ID查询 */ Goods selectById(Integer id); /** * 查询所有 */ List selectAll(Goods goods); @Select("select * from goods order by count desc limit 15") List selectTop15(); @Select("select * from goods where type_id = #{id}") List selectByTypeId(Integer id); @Select("select * from goods where business_id = #{id}") List selectByBusinessId(Integer id); @Select("select * from goods where name like concat('%', #{name}, '%')") List selectByName(String name); }