package cn.common.repository.repository;
import cn.common.common.repository.BaseRepository;
import cn.common.repository.entity.MainIndexType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author Singer create by singer email:singer-coder@qq.com
 * @projectName wx-mini-api
 * @Description: 首页分类->Repository
 * @date 2019-09-27
 */
@Mapper
public interface MainIndexTypeRepository extends BaseRepository<MainIndexType> {


    /**
     * 根据业务主键批量删除
     * @title: AuthRoleRepository.java
     * @author create by Singer - Singer email:singer-coder@qq.com
     * @date 2019/4/28 11:05
     * @param mainIdList 业务主键ID集合
     * @param deleteStatus 是否删除 1 删除 2 未删除
     * @return List
     */
    @Update("<script>" +
            " UPDATE main_index_type item set item.delete_status = #{deleteStatus} " +
            " WHERE item.main_index_type_id IN " +
            " <foreach collection='mainIdList' item= 'item' index= 'index' open='(' separator=',' close=')' > " +
            "          #{item} " +
            " </foreach>" +
            "</script>")
    void batchUpdateDeleteStatus(@Param("deleteStatus") Integer deleteStatus,
                                 @Param("mainIdList") List<String> mainIdList);

}
