<?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.ruoyi.info.service.mapper.ServiceProductMapper">

    <resultMap type="com.ruoyi.info.service.domain.ServiceProduct" id="ServiceProductResult">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="serviceCategorizeId" column="service_categorize_id"/>
        <result property="image" column="image"/>
        <result property="sellingPrice" column="selling_price"/>
        <result property="originalPrice" column="original_price"/>
        <result property="costPrice" column="cost_price"/>
        <result property="serviceUnit" column="service_unit"/>
        <result property="serviceUnitDuration" column="service_unit_duration"/>
        <result property="serviceDescription" column="service_description"/>
        <result property="serviceNotice" column="service_notice"/>
        <result property="status" column="status"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="createBy" column="create_by"/>
        <result property="updateBy" column="update_by"/>
        <result property="delFlag" column="del_flag"/>
    </resultMap>

    <select id="queryDelById" resultType="com.ruoyi.info.service.domain.vo.ServiceProductVo">
        select * from tb_service_product where id = #{id}
    </select>

    <select id="queryServiceCategorizeStatistics"
            resultType="com.ruoyi.info.service.domain.vo.ServiceCategorizeStatisticsVo">
        select
        service_categorize_id as serviceCategorizeId,
        count(1) as serviceProductNum
        from tb_service_product
        where del_flag = 0
        group by service_categorize_id
    </select>


</mapper>
