无关风月
2025-03-20 2ad97245d64b65132507cab36ad89d968edb7705
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/BannerMapper.xml
@@ -2,22 +2,22 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.stylefeng.guns.modular.system.dao.BannerMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Banner">
        <id column="id" property="id" />
        <result column="type" property="type" />
        <result column="name" property="name" />
        <result column="img" property="img" />
        <result column="modelId" property="modelId" />
        <result column="pageId" property="pageId" />
        <result column="turnId" property="turnId" />
        <result column="sort" property="sort" />
        <result column="state" property="state" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, type, name, img, modelId, pageId, turnId, sort, state
    </sql>
    <select id="getBanners" resultType="com.stylefeng.guns.modular.system.warpper.res.BannerRes">
        select id, img_url as imgUrl, content from t_banner where `position` = #{position} order by `sort` desc
    </select>
    <select id="list" resultType="com.stylefeng.guns.modular.system.dto.BannerVo">
        SELECT tb.id,tb.position,tb.sort,tb.img_url as imgUrl,su.`name` as createBy,tb.insert_time as insertTime
        from t_banner tb
                 LEFT JOIN sys_user su on tb.insert_user_id = su.id
        <where>
            <if test="null != position">
                and tb.position = #{position}
            </if>
            <if test="null != sort">
                and tb.sort = #{sort}
            </if>
        </where>
    </select>
</mapper>
</mapper>