Newer
Older
huludao / src / main / resources / mapper / pipenetwork / PipeNetworkPointMapper.xml
<?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.xf.huludao.pipenetwork.dao.PipeNetworkPointMapper">

    <!-- 通用映射列 -->
    <resultMap id="BaseResultMap" type="com.xf.huludao.pipenetwork.entity.PipeNetworkPoint">
        <result column="id" property="id"/>
        <result column="point_number" property="pointNumber"/>
        <result column="original_x" property="originalX"/>
        <result column="original_y" property="originalY"/>
        <result column="transfrom_x" property="transfromX"/>
        <result column="transfrom_y" property="transfromY"/>
        <result column="geometrys" property="geometrys" typeHandler="com.xf.huludao.commons.GeometryTypeHandler"/>
        <result column="ground_elevation" property="groundElevation"/>
        <result column="point_type" property="pointType"/>
        <result column="point_type_two" property="pointTypeTwo"/>
        <result column="intercep_well_type" property="intercepWellType"/>
        <result column="check_well_type" property="checkWellType"/>
        <result column="manhole_cover_logo" property="manholeCoverLogo"/>
        <result column="manhole_cover_material" property="manholeCoverMaterial"/>
        <result column="manhole_cover_shape" property="manholeCoverShape"/>
        <result column="manhole_cover_size_one" property="manholeCoverSizeOne"/>
        <result column="manhole_cover_size_two" property="manholeCoverSizeTwo"/>
        <result column="manhole_cover_type" property="manholeCoverType"/>
        <result column="manhole_standard" property="manholeStandard"/>
        <result column="manhole_bearing_level" property="manholeBearingLevel"/>
        <result column="for_network" property="forNetwork"/>
        <result column="well_ladder" property="wellLadder"/>
        <result column="water_quality" property="waterQuality"/>
        <result column="defect_type" property="defectType"/>
        <result column="well_chamber_material" property="wellChamberMaterial"/>
        <result column="well_chamber_size" property="wellChamberSize"/>
        <result column="bottomhole_form" property="bottomholeForm"/>
        <result column="well_depth" property="wellDepth"/>
        <result column="depth_of_water" property="depthOfWater"/>
        <result column="mud_depth" property="mudDepth"/>
        <result column="weir_crest_highth" property="weirCrestHighth"/>
        <result column="drain_type" property="drainType"/>
        <result column="road_name" property="roadName"/>
        <result column="drainage_type" property="drainageType"/>
        <result column="construction_date" property="constructionDate"/>
        <result column="repair_date" property="repairDate"/>
        <result column="ownership_units" property="ownershipUnits"/>
        <result column="operational_units" property="operationalUnits"/>
        <result column="data_source" property="dataSource"/>
        <result column="remark" property="remark"/>
        <result column="data_sources" property="dataSources"/>
        <result column="data_gain_time" property="dataGainTime"/>
        <result column="update_logo" property="updateLogo"/>
        <result column="model_id" property="modelId"/>
        <result column="z" property="z"/>
        <result column="create_time" property="createTime"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="update_time" property="updateTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>

    <!-- 通用数据库列 -->
    <sql id="Base_Column_List">
         id,
              point_number,
              original_x,
              original_y,
              transfrom_x,
              transfrom_y,
              ST_AsText(geometrys) as geometrys,
              ground_elevation,
              point_type,
              point_type_two,
              intercep_well_type,
              check_well_type,
              manhole_cover_logo,
              manhole_cover_material,
              manhole_cover_shape,
              manhole_cover_size_one,
              manhole_cover_size_two,
              manhole_cover_type,
              manhole_standard,
              manhole_bearing_level,
              for_network,
              well_ladder,
              water_quality,
              defect_type,
              well_chamber_material,
              well_chamber_size,
              bottomhole_form,
              well_depth,
              depth_of_water,
              mud_depth,
              weir_crest_highth,
              drain_type,
              road_name,
              drainage_type,
              construction_date,
              repair_date,
              ownership_units,
              operational_units,
              data_source,
              remark,
              data_sources,
              data_gain_time,
              update_logo,
              model_id,
              z,
              create_time,
              create_user,
              create_dept,
              update_time,
              update_user,
              status,
              is_deleted
    </sql>

    <sql id="Where_Condition">
        <if test="request.id != null and request.id != ''">
            and id = #{request.id}
        </if>
        <if test="request.pointNumber != null and request.pointNumber != ''">
            and point_number = #{request.pointNumber}
        </if>
        <if test="request.originalX != null and request.originalX != ''">
            and original_x = #{request.originalX}
        </if>
        <if test="request.originalY != null and request.originalY != ''">
            and original_y = #{request.originalY}
        </if>
        <if test="request.transfromX != null and request.transfromX != ''">
            and transfrom_x = #{request.transfromX}
        </if>
        <if test="request.transfromY != null and request.transfromY != ''">
            and transfrom_y = #{request.transfromY}
        </if>
        <if test="request.geometrys != null and request.geometrys != ''">
            and geometrys = #{request.geometrys}
        </if>
        <if test="request.groundElevation != null and request.groundElevation != ''">
            and ground_elevation = #{request.groundElevation}
        </if>
        <if test="request.pointType != null and request.pointType != ''">
            and point_type = #{request.pointType}
        </if>
        <if test="request.pointTypeTwo != null and request.pointTypeTwo != ''">
            and point_type_two = #{request.pointTypeTwo}
        </if>
        <if test="request.intercepWellType != null and request.intercepWellType != ''">
            and intercep_well_type = #{request.intercepWellType}
        </if>
        <if test="request.checkWellType != null and request.checkWellType != ''">
            and check_well_type = #{request.checkWellType}
        </if>
        <if test="request.manholeCoverLogo != null and request.manholeCoverLogo != ''">
            and manhole_cover_logo = #{request.manholeCoverLogo}
        </if>
        <if test="request.manholeCoverMaterial != null and request.manholeCoverMaterial != ''">
            and manhole_cover_material = #{request.manholeCoverMaterial}
        </if>
        <if test="request.manholeCoverShape != null and request.manholeCoverShape != ''">
            and manhole_cover_shape = #{request.manholeCoverShape}
        </if>
        <if test="request.manholeCoverSizeOne != null and request.manholeCoverSizeOne != ''">
            and manhole_cover_size_one = #{request.manholeCoverSizeOne}
        </if>
        <if test="request.manholeCoverSizeTwo != null and request.manholeCoverSizeTwo != ''">
            and manhole_cover_size_two = #{request.manholeCoverSizeTwo}
        </if>
        <if test="request.manholeCoverType != null and request.manholeCoverType != ''">
            and manhole_cover_type = #{request.manholeCoverType}
        </if>
        <if test="request.manholeStandard != null and request.manholeStandard != ''">
            and manhole_standard = #{request.manholeStandard}
        </if>
        <if test="request.manholeBearingLevel != null and request.manholeBearingLevel != ''">
            and manhole_bearing_level = #{request.manholeBearingLevel}
        </if>
        <if test="request.forNetwork != null and request.forNetwork != ''">
            and for_network = #{request.forNetwork}
        </if>
        <if test="request.wellLadder != null and request.wellLadder != ''">
            and well_ladder = #{request.wellLadder}
        </if>
        <if test="request.waterQuality != null and request.waterQuality != ''">
            and water_quality = #{request.waterQuality}
        </if>
        <if test="request.defectType != null and request.defectType != ''">
            and defect_type = #{request.defectType}
        </if>
        <if test="request.wellChamberMaterial != null and request.wellChamberMaterial != ''">
            and well_chamber_material = #{request.wellChamberMaterial}
        </if>
        <if test="request.wellChamberSize != null and request.wellChamberSize != ''">
            and well_chamber_size = #{request.wellChamberSize}
        </if>
        <if test="request.bottomholeForm != null and request.bottomholeForm != ''">
            and bottomhole_form = #{request.bottomholeForm}
        </if>
        <if test="request.wellDepth != null and request.wellDepth != ''">
            and well_depth = #{request.wellDepth}
        </if>
        <if test="request.depthOfWater != null and request.depthOfWater != ''">
            and depth_of_water = #{request.depthOfWater}
        </if>
        <if test="request.mudDepth != null and request.mudDepth != ''">
            and mud_depth = #{request.mudDepth}
        </if>
        <if test="request.weirCrestHighth != null and request.weirCrestHighth != ''">
            and weir_crest_highth = #{request.weirCrestHighth}
        </if>
        <if test="request.drainType != null and request.drainType != ''">
            and drain_type = #{request.drainType}
        </if>
        <if test="request.roadName != null and request.roadName != ''">
            and road_name like concat('%',#{request.roadName},'%')
        </if>
        <if test="request.drainageType != null and request.drainageType != ''">
            and drainage_type = #{request.drainageType}
        </if>
        <if test="request.constructionDate != null and request.constructionDate != ''">
            and construction_date = #{request.constructionDate}
        </if>
        <if test="request.repairDate != null and request.repairDate != ''">
            and repair_date = #{request.repairDate}
        </if>
        <if test="request.ownershipUnits != null and request.ownershipUnits != ''">
            and ownership_units = #{request.ownershipUnits}
        </if>
        <if test="request.operationalUnits != null and request.operationalUnits != ''">
            and operational_units = #{request.operationalUnits}
        </if>
        <if test="request.dataSource != null and request.dataSource != ''">
            and data_source = #{request.dataSource}
        </if>
        <if test="request.remark != null and request.remark != ''">
            and remark = #{request.remark}
        </if>
        <if test="request.dataSources != null and request.dataSources != ''">
            and data_sources = #{request.dataSources}
        </if>
        <if test="request.dataGainTime != null and request.dataGainTime != ''">
            and data_gain_time = #{request.dataGainTime}
        </if>
        <if test="request.updateLogo != null and request.updateLogo != ''">
            and update_logo = #{request.updateLogo}
        </if>
        <if test="request.modelId != null and request.modelId != ''">
            and model_id = #{request.modelId}
        </if>
        <if test="request.z != null and request.z != ''">
            and z = #{request.z}
        </if>
        <if test="request.createTime != null and request.createTime != ''">
            and create_time = #{request.createTime}
        </if>
        <if test="request.createUser != null and request.createUser != ''">
            and create_user = #{request.createUser}
        </if>
        <if test="request.createDept != null and request.createDept != ''">
            and create_dept = #{request.createDept}
        </if>
        <if test="request.updateTime != null and request.updateTime != ''">
            and update_time = #{request.updateTime}
        </if>
        <if test="request.updateUser != null and request.updateUser != ''">
            and update_user = #{request.updateUser}
        </if>
        <if test="request.status != null and request.status != ''">
            and status = #{request.status}
        </if>
        <if test="request.isDeleted != null and request.isDeleted != ''">
            and is_deleted = #{request.isDeleted}
        </if>
    </sql>

    <select id="selectByCondition" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from pipe_network_point
        where is_deleted = 0
        <include refid="Where_Condition"/>
    </select>

    <select id="exportPipeNetworkPoint" resultType="com.xf.huludao.pipenetwork.entity.PipeNetworkPoint">
        SELECT * FROM pipe_network_point ${ew.customSqlSegment}
    </select>


    <select id="statisticsPoint" resultType="com.xf.huludao.pipenetwork.vo.DataStatistisVO">
        select  manhole_cover_material as `name`,count(id) as count from pipe_network_point GROUP BY manhole_cover_material order by count desc
    </select>

    <select id="statisticsAsset" resultType="com.xf.huludao.pipenetwork.vo.DataStatistisVO">
        select  point_type as `name`,count(id) as count from pipe_network_point GROUP BY point_type
    </select>


    <select id="listNodes" resultMap="BaseResultMap">
       (select b.*,a.st_code
        from pipe_network_linestring_part a
        LEFT JOIN pipe_network_point b on b.point_number = a.start_point_number
        where b.id is not null)
        UNION
        (select b.*,a.st_code
        from pipe_network_linestring_part a
        LEFT JOIN pipe_network_point b on b.point_number = a.end_point_number
        where b.id is not null)
    </select>

    <select id="selectPointsAndLines" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from pipe_network_point
        where is_deleted = 0
        <include refid="Where_Condition"/>
    </select>

    <select id="selectBatchPointNums" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from pipe_network_point
        where is_deleted = 0 and point_number in
        <foreach collection="collect" item="item" open="(" close=")" separator=",">
            #{item}
        </foreach>
    </select>

    <select id="selectAll" resultType="com.xf.huludao.pipenetwork.entity.dto.PipeDataDto">
        select
        id,
        ST_AsText(geometrys) as geometrys
        from pipe_network_point
        where is_deleted = 0
    </select>
</mapper>