package com.zt.plat.module.base.dal.mysql.tmpltp;

import java.util.*;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscItmBsnDO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.base.controller.admin.templtp.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 业务实例条款值 Mapper
 *
 * @author 后台管理-1
 */
@Mapper
public interface TmplInscItmBsnMapper extends BaseMapperX<TmplInscItmBsnDO> {

    default PageResult<TmplInscItmBsnDO> selectPage(TmplInscItmBsnPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TmplInscItmBsnDO>()
                .eqIfPresent(TmplInscItmBsnDO::getBsnId, reqVO.getBsnId())
                .eqIfPresent(TmplInscItmBsnDO::getInscItmId, reqVO.getInstceItmId())
                .eqIfPresent(TmplInscItmBsnDO::getVal, reqVO.getVal())
                .betweenIfPresent(TmplInscItmBsnDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TmplInscItmBsnDO::getId));
    }

    @Delete({
            "<script>",
            "DELETE FROM bse_tmpl_insc_itm_bsn",
            "WHERE bsn_id IN",
            "<foreach collection='ids' item='id' open='(' separator=',' close=')'>",
            "#{id}",
            "</foreach>",
            "</script>"
    })
    int physicalDeleteByBsnIds(@Param("ids") List<String> ids);
}
