說明:
數據庫:表中沒有經度跟緯度字段,只有location字段(point類型) POINT(經度 緯度)
實體類:只有經度 lng 字段、緯度 lat 字段 沒有location字段
<!--添加一個小區-->
<insert id="insertOneDistrict" parameterType="com.diantijiang.saas.order.entity.District"
keyProperty="id" useGeneratedKeys="true">
insert
into
oc_district(
<if test="null != name">
name,
</if>
<if test="null != shortName">
short_name,
</if>
<if test="null != cityId">
city_id,
</if>
<if test="null != city">
city,
</if>
<if test="null != areaId">
area_id,
</if>
<if test="null != area">
area,
</if>
<if test="null != address">
address,
</if>
<if test="null != tel">
tel,
</if>
location
)
values (
<if test="null != name">
#{name},
</if>
<if test="null != shortName">
#{shortName},
</if>
<if test="null != cityId">
#{cityId},
</if>
<if test="null != city">
#{city},
</if>
<if test="null != areaId">
#{areaId},
</if>
<if test="null != area">
#{area},
</if>
<if test="null != address">
#{address},
</if>
<if test="null != tel">
#{tel},
</if>
GeomFromText ('POINT(${lng} ${lat})')
)
</insert>