package com.rongwei.sfcommon.sys.dao;

import com.rongwe.scentity.domian.CheckTemplateItemsDo;
import com.rongwei.rwcommon.base.BaseDao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 检查模板检查项明细表
 *
 * @author chglee
 * @email 1992lcg@163.com
 * @date 2020-07-17 09:33:23
 */
public interface CheckTemplateItemsDao extends BaseDao<CheckTemplateItemsDo> {

    @Select("select a.* from asp_check_template_items a left join asp_check_template b on a.CHECKTEMPLATEID=b.ID " +
            "where a.DELETED='0' and b.DELETED='0' and a.CHECKITEMCONTENTID in (${id})")
    List<CheckTemplateItemsDo> getItemByContentId(@Param("id") String id);

    @Update("update asp_check_template_items set DELETED = '0',MODIFYDATE = NOW() where ID in (${ids}) and DELETED = '1'")
    void templateItemsDeleteResolve(@Param("ids") String ids);

    @Select("select * from asp_check_template_items a left join asp_check_template b on a.CHECKTEMPLATEID=b.ID \n" +
            "where b.ENABLESTATUS = '10' and a.CHECKITEMCONTENTID = #{checkitemcontentid} and a.DELETED='0' and b.DELETED='0'")
    List<CheckTemplateItemsDo> getNewTemplateItems(@Param("checkitemcontentid") String checkitemcontentid);
}