<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.mapper.TrainingMapper">

    <select id="currentStudyStatusList" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.TrainingDto">
        select * from (SELECT
        ht.*,
        (select  COUNT(hmt.sequence_nbr) from hygf_maintenance_training  hmt where hmt.training_id = ht.sequence_nbr and hmt.user_id = #{userId} )
        as status
        FROM
        hygf_training AS ht
        )  hh

        where hh.is_delete=0
        <if test="status!=null ">
           and hh.status =#{status}
        </if>
        <if test="name!=null and name!='' ">
            and hh.name like concat(concat('%',#{name}),'%')
        </if>
    </select>
</mapper>
