package com.bomaos.designer.mapper;

import com.bomaos.designer.model.DesignerWork;
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 java.util.List;

@Mapper
public interface DesignerMapper {

    @Insert("INSERT INTO designer_works(title, description, image_url, designer_id, upload_time) " +
            "VALUES(#{title}, #{description}, #{imageUrl}, #{designerId}, #{uploadTime})")
    int uploadDesign(DesignerWork work);

    @Select("SELECT * FROM designer_works WHERE designer_id = #{designerId}")
    List<DesignerWork> findByDesignerId(@Param("designerId") Integer designerId);
}
