<?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.ProjectAreaMapper"> <!-- 通用映射列 --> <resultMap id="BaseResultMap" type="com.xf.huludao.project.entity.ProjectArea"> <result column="id" property="id"/> <result column="name" property="name"/> <result column="type_code" property="typeCode"/> <result column="type_name" property="typeName"/> <result column="geometry" property="geometry"/> <result column="geometrys" property="geometrys"/> <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, `name`, type_code, type_name, ST_AsText(geometrys) as geometry, 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.name != null and request.name != ''"> and name = #{request.name} </if> <if test="request.typeCode != null and request.typeCode != ''"> and type_code = #{request.typeCode} </if> <if test="request.typeName != null and request.typeName != ''"> and type_name = #{request.typeName} </if> <if test="request.geometry != null and request.geometry != ''"> and geometry = #{request.geometry} </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 <include refid="Base_Column_List"/> from project_area where is_deleted = 0 <include refid="Where_Condition"/> order by update_time desc </select> <select id="exportProjectArea" resultType="com.xf.huludao.project.entity.ProjectArea"> SELECT * FROM project_area ${ew.customSqlSegment} </select> <update id="updateGeoById"> update project_area set geometrys = ST_GeomFromText(geometry) where is_deleted = 0 and id =#{id} </update> <update id="updateArea"> update project_area set geometrys = ST_GeomFromText(geometry) where id in <foreach collection="ids" item="item" open="(" close=")" separator=","> #{item} </foreach> </update> <update id="updateGeo"> update project_area set `name` = #{request.name}, type_code = #{request.typeCode}, type_name = #{request.typeName}, geometrys = ST_GeomFromText(#{request.geometry}), geometry = #{request.geometry}, remark = #{request.remark} where id = #{request.id} </update> </mapper>