<?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.rongwei.trainingcommon.sys.dao.SubjectDao">
    <sql id="BaseColumn">
    ${alias}.id AS ${prefix}id,${alias}.subjectname AS ${prefix}subjectname,${alias}.subjecttype AS ${prefix}subjecttype,
    ${alias}.subjectcourseids AS ${prefix}subjectcourseids,${alias}.subjectcoursenames AS ${prefix}subjectcoursenames,${alias}.rightanswer AS ${prefix}rightanswer,
    ${alias}.tenantid AS ${prefix}tenantid,${alias}.roption AS ${prefix}roption,
    ${alias}.createusername AS ${prefix}createusername,${alias}.modifyusername AS ${prefix}modifyusername,
    ${alias}.deleted AS ${prefix}deleted,${alias}.remark AS ${prefix}remark,
    ${alias}.createdate AS ${prefix}createdate,${alias}.createuserid AS ${prefix}createuserid,
    ${alias}.createusername AS ${prefix}createusername,${alias}.modifydate AS ${prefix}modifydate,${alias}.modifyuserid AS ${prefix}modifyuserid,
    ${alias}.modifyusername AS ${prefix}modifyusername
    </sql>
    <!-- 通用查询映射结果 -->
    <resultMap type="com.rongwei.training.domain.SubjectDo" id="BaseResultMap">
        <result column="id" property="id" jdbcType="VARCHAR"/>
        <result column="subjectname" property="subjectname" jdbcType="VARCHAR"/>
        <result column="subjecttype" property="subjecttype" jdbcType="VARCHAR"/>
        <result column="subjectcourseids" property="subjectcourseids" jdbcType="VARCHAR"/>
        <result column="subjectcoursenames" property="subjectcoursenames" jdbcType="VARCHAR"/>
        <result column="rightanswer" property="rightanswer" jdbcType="VARCHAR"/>
        <result column="tenantid" property="tenantid" jdbcType="VARCHAR"/>
        <result column="roption" property="roption" jdbcType="VARCHAR"/>
        <result column="createusername" property="createusername" jdbcType="VARCHAR"/>
        <result column="modifyusername" property="modifyusername" jdbcType="VARCHAR"/>
        <result column="deleted" property="deleted" jdbcType="VARCHAR"/>
        <result column="remark" property="remark" jdbcType="VARCHAR"/>
        <result column="createdate" property="createdate" jdbcType="DATE"/>
        <result column="createuserid" property="createuserid" jdbcType="VARCHAR"/>
        <result column="createusername" property="createusername" jdbcType="VARCHAR"/>
        <result column="modifydate" property="modifydate" jdbcType="DATE"/>
        <result column="modifyuserid" property="modifyuserid" jdbcType="VARCHAR"/>
        <result column="modifyusername" property="modifyusername" jdbcType="VARCHAR"/>
    </resultMap>

    <select id="selectInfoByCourseIds" resultMap="BaseResultMap">
        SELECT
        <include refid="BaseColumn">
            <property name="alias" value="t"/>
            <property name="prefix" value=""/>
        </include>
        from training_subject t
        where t.deleted = '0' and
        <foreach collection="courseIds" item="courseId" separator="or" open="(" close=")">
            t.SUBJECTCOURSEIDS like CONCAT('%',#{courseId},'%')
        </foreach>
    </select>
</mapper>