<?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.unis.basic.info.modular.pricemonitor.mapper.PriceMonitorMapper">
    <select id="selectPriceMonitor" resultType="com.unis.basic.info.modular.pricemonitor.vo.PriceMonitorVO">
        select t1.name name, t1.address, t2.name orgName,t1.geo_point,t1.id,t1.location_switch,t2.id
        sysOrgId
        from biz_price_monitor t1
        left join sys_org t2 on t1.sys_org_id = t2.id

        <where>
            <if test="name!=null and name!=''">
                and t1.name like concat("%",#{name},"%")
            </if>
            <if test="orgName !=null and orgName!=''">
                and t2.name=#{orgName}
            </if>
            and t1.delete_flag="NOT_DELETE"
        </where>
        order by t1.create_time desc
    </select>

    
    <select id="selectPricemonitorVO" resultType="com.unis.basic.info.modular.usercollect.vo.PricemonitorVO">
        select t2.name, t2.id
        from sys_org t1
                left join biz_price_monitor t2 on t1.id = t2.sys_org_id
        where t1.id = #{orgId}
          and t2.delete_flag = 'NOT_DELETE'
    </select>

</mapper>