<?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.hxhq.business.mapper.TemplateMapper">
    <select id="queryList">
        SELECT t.`id`,t.`sn`,t.`show_sn`,t.`name`,t.`dept_id`,t.`status`,t.`need_pre`,t.`type`,d.`dept_name`,t.product
        FROM `t_template` t
        LEFT JOIN `sys_dept` d ON t.`dept_id`=d.`dept_id`
        <if test="ew.sqlSegment != '' and ew.sqlSegment != null">
            <where>
                ${ew.sqlSegment}
            </where>
        </if>
    </select>

    <select id="getStepListByTemplateStepGroupIds" resultType="com.hxhq.business.domain.Step">
        SELECT DISTINCT id,`name` FROM `t_step`
        WHERE del_flag='0' AND
        FIND_IN_SET(id,
            (SELECT GROUP_CONCAT(step_ids) FROM `t_step_group` WHERE del_flag='0' AND FIND_IN_SET(id,#{stepGroupIds}))
        )
    </select>
</mapper>