Newer
Older
huludao / src / main / resources / mapper / project / ProjectLandMapper.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.project.dao.ProjectLandMapper">

    <!-- 通用映射列 -->
    <resultMap id="BaseResultMap" type="com.xf.huludao.project.entity.ProjectLand">
        <result column="id" property="id"/>
        <result column="project_id" property="projectId"/>
        <result column="version" property="version"/>
        <result column="name" property="name"/>
        <result column="geometry" property="geometry"/>
        <result column="pic_info" property="picInfo"/>
        <result column="remark" property="remark"/>
        <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"/>
    </resultMap>

    <!-- 通用数据库列 -->
    <sql id="Base_Column_List">
              id,
              project_id,
              version,
              `name`,
              ST_AsText(geometrys) as geometry,
              pic_info,
              remark,
              create_user,
              create_dept,
              create_time,
              update_user,
              update_time,
              status,
              is_deleted
          </sql>

    <sql id="Where_Condition">
        <if test="request.id != null and request.id != ''">
            and id = #{request.id}
        </if>
        <if test="request.projectId != null and request.projectId != ''">
            and project_id = #{request.projectId}
        </if>
        <if test="request.version != null and request.version != ''">
            and version = #{request.version}
        </if>
        <if test="request.name != null and request.name != ''">
            and `name` = #{request.name}
        </if>
        <if test="request.geometry != null and request.geometry != ''">
            and geometry = #{request.geometry}
        </if>
        <if test="request.picInfo != null and request.picInfo != ''">
            and pic_info = #{request.picInfo}
        </if>
        <if test="request.remark != null and request.remark != ''">
            and remark = #{request.remark}
        </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.createTime != null and request.createTime != ''">
            and create_time = #{request.createTime}
        </if>
        <if test="request.updateUser != null and request.updateUser != ''">
            and update_user = #{request.updateUser}
        </if>
        <if test="request.updateTime != null and request.updateTime != ''">
            and update_time = #{request.updateTime}
        </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
        pl.id,
        pl.project_id,
        pl.version,
        pl.`name`,
        ST_AsText(pl.geometrys) as geometry,
        pl.pic_info,
        pl.remark,
        pl.create_user,
        pl.create_dept,
        pl.create_time,
        pl.update_user,
        pl.update_time,
        pl.status,
        pl.is_deleted,
        p.project_type,
        p.project_name
        from project_land pl
        left join project p on pl.project_id = p.project_no
        where is_deleted = 0
        <include refid="Where_Condition"/>
        order by pl.update_time desc
    </select>

    <select id="exportProjectLand" resultType="com.xf.huludao.project.entity.ProjectLand">
        SELECT * FROM project_land ${ew.customSqlSegment}
    </select>

    <update id="updateLand">
       update project_land set geometrys = ST_GeomFromText(geometry)
       where id in
        <foreach collection="ids" item="item" open="(" close=")" separator=",">
            #{item}
        </foreach>
    </update>


    <update id="updateByName">
        update project_land set geometrys = ST_GeomFromText(geometry)
        where is_deleted = 0 and name =#{name}
    </update>

    <select id="selectColorByProjectNo" resultType="String">
        select remark from blade_dict_biz `bdb`
        left join project `p` on `bdb`.`dict_key` = p.project_type
        where p.project_no = #{projectNo}
    </select>

</mapper>