<?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.njcn.csdevice.mapper.CsTouristDataPOMapper">
  <resultMap id="BaseResultMap" type="com.njcn.csdevice.pojo.po.CsTouristDataPO">
    <!--@mbg.generated-->
    <!--@Table cs_tourist_data-->
    <result column="enginer_id" jdbcType="VARCHAR" property="enginerId" />
    <result column="project_id" jdbcType="VARCHAR" property="projectId" />
    <result column="device_id" jdbcType="VARCHAR" property="deviceId" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    enginer_id, project_id, device_id
  </sql>

  <select id="queryAll" resultType="com.njcn.csdevice.pojo.vo.CsTouristDataParmVO">
    SELECT
    a.device_id,
    a.enginer_id,
    a.project_id,
    b. NAME deviceName,
    c. NAME projectName,
    d. NAME enginerName
    FROM
    cs_tourist_data a
    LEFT JOIN cs_ledger b ON a.device_id = b.id
    LEFT JOIN cs_ledger c ON a.project_id = c.id
    LEFT JOIN cs_ledger d ON a.enginer_id = d.id where b.state=1 and c.state=1 and d.state=1;
  </select>
</mapper>