<?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.cyksj.mapper.manage.help.HelpQuestionClassificationMapper">

    <select id="getQuestionClassificationView"
            resultType="com.cyksj.model.views.HelpQuestionClassificationView">
        select hc.id,
               hc.name,
               hc.goods_id,
               hc.sort,
               hc.content,
        if(gd.id is null, hc.logo,gd.logo) as logo
        from `help_question_classification` hc left join `goods_don` gd
        on gd.id = hc.goods_id
        where hc.deleted is true
          and hc.status is true
        <if test="goodsId != null">
          and hc.goods_id = #{goodsId}
        </if>
        order by sort desc
    </select>
</mapper>