<?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.casic.missiles.modular.system.dao.DeptPermissionConfigDao">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.casic.missiles.modular.system.model.TenantDept">
        <id column="id" property="id"/>
        <result column="tenant_id" property="tenantId"/>
        <result column="dept_id" property="deptId"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <select id="getListPage" resultType="MAP">
        SELECT id AS "id",deptid AS "deptid",communication AS "communication",
         well_type AS "wellType",device_type AS "deviceType",area AS "area",map AS "map",lng as "lng",lat AS "lat"
        FROM config_dept_permission
        WHERE 1=1
        <if test="deptid != -1  and deptid !=''">
            AND DEPTID = #{deptid}
        </if>
    </select>

    <select id="getPid" resultType="Long">
       SELECT ID
	   FROM sys_dict
	   WHERE  code='sluicewellType'
    </select>

    <select id="getDeviceName" resultType="String">
        SELECT TYPE_NAME
        FROM   base_device_type
        WHERE id=#{deviceType}
    </select>

    <select id="getWellName" resultType="String">
       SELECT NAME
	   FROM sys_dict
	   WHERE  PID=#{pid}  AND  CODE=#{wellType}
    </select>

</mapper>
