<?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.fzm.mall.server.admin.goods_center.mapper.CategorySpuMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.fzm.mall.server.admin.goods_center.model.CategorySpu">
        <id column="id" property="id" />
        <result column="goods_id" property="goodsId" />
        <result column="category_id" property="categoryId" />
        <result column="status" property="status" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>

    <select id="selectGoodsOnShelves" resultType="integer">
        select COUNT(*)
        from goods_category_spu cs
        left join goods_spu s on cs.goods_id = s.goods_id
        where cs.category_id = #{categoryId} and cs.status = 1 and s.status = 1
    </select>
</mapper>
