<?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="org.springblade.modules.ldt.mall.mapper.MallMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="mallResultMap" type="org.springblade.modules.ldt.mall.entity.Mall">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="name" property="name"/>
        <result column="province" property="province"/>
        <result column="province_code" property="provinceCode"/>
        <result column="city" property="city"/>
        <result column="city_code" property="cityCode"/>
        <result column="area" property="area"/>
        <result column="area_code" property="areaCode"/>
        <result column="address" property="address"/>
        <result column="longitude" property="longitude"/>
        <result column="latitude" property="latitude"/>
        <result column="person_tel" property="personTel"/>
        <result column="person_name" property="personName"/>
        <result column="boundary_path" property="boundaryPath"/>
        <result column="pic" property="pic"/>
        <result column="introduce" property="introduce"/>
        <result column="payment_days" property="paymentDays"/>
        <result column="had_verify_point_value" property="hadVerifyPointValue"/>
    </resultMap>

    <resultMap id="mallResultVOMap" type="org.springblade.modules.ldt.mall.vo.MallVO" extends="mallResultMap">
        <result column="activity_counts" property="activityCounts"/>
    </resultMap>


    <select id="selectMallPage" resultMap="mallResultMap">
        select * from ldt_mall where is_deleted = 0
    </select>

    <select id="pageWithActivityCount" resultMap="mallResultVOMap">
        select
         lm.*,(select count(id) from ldt_activity where is_deleted = 0 and audit_status=1 and mall_id=lm.id) as activity_counts
         from ldt_mall lm
         where lm.is_deleted = 0
    </select>

</mapper>
