<?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.panzhihua.service_jinhui_community.dao.JinhuiInterspaceDao">
|
|
<resultMap type="com.panzhihua.service_jinhui_community.entity.JinhuiInterspace" id="itemMap">
|
<result property="id" column="id" />
|
<result property="title" column="title" />
|
<result property="intendant" column="intendant" />
|
<result property="intendantPhone" column="intendant_phone" />
|
<result property="intendantType" column="intendant_type" />
|
<result property="content" column="content" />
|
<result property="address" column="address" />
|
<result property="lon" column="lon" />
|
<result property="lat" column="lat" />
|
<result property="imgUrl" column="img_url" />
|
<result property="creationTime" column="creation_time" />
|
<result property="updateTime" column="update_time" />
|
<result property="price" column="price" />
|
</resultMap>
|
|
|
<!-- 分页查询 -->
|
<select id="getList" resultMap="itemMap">
|
select
|
id,
|
title,
|
intendant,
|
intendant_phone,
|
intendant_type,
|
(select intendant_name from jinhui_intendant_type where jinhui_interspace.intendant_type=jinhui_intendant_type.id) as intendantName,
|
content,
|
address,
|
lon,
|
lat,
|
img_url,
|
creation_time,
|
update_time,
|
price
|
from jinhui_interspace
|
<where>
|
<if test="intendantType !=null and intendantType !='' ">
|
intendant_type=#{intendantType}
|
</if>
|
</where>
|
order by creation_time desc
|
</select>
|
|
|
<select id="getDetails" resultMap="itemMap">
|
select
|
id,
|
title,
|
intendant,
|
intendant_phone,
|
intendant_type,
|
(select intendant_name from jinhui_intendant_type where jinhui_interspace.intendant_type=jinhui_intendant_type.id) as intendantName,
|
content,
|
address,
|
lon,
|
lat,
|
img_url,
|
creation_time,
|
update_time,
|
price
|
from jinhui_interspace
|
where
|
id=#{id}
|
</select>
|
|
<insert id="addData">
|
insert into jinhui_interspace
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="item.id != null and item.id != '' ">
|
id,
|
</if>
|
<if test="item.title != null and item.title != '' ">
|
title,
|
</if>
|
<if test="item.intendant != null and item.intendant != '' ">
|
intendant,
|
</if>
|
<if test="item.intendantPhone != null and item.intendantPhone != '' ">
|
intendant_phone,
|
</if>
|
<if test="item.intendantType != null and item.intendantType != '' ">
|
intendant_type,
|
</if>
|
<if test="item.content != null and item.content != '' ">
|
content,
|
</if>
|
<if test="item.address != null and item.address != '' ">
|
address,
|
</if>
|
<if test="item.lon != null and item.lon != '' ">
|
lon,
|
</if>
|
<if test="item.lat != null and item.lat != '' ">
|
lat,
|
</if>
|
<if test="item.imgUrl != null and item.imgUrl != '' ">
|
img_url,
|
</if>
|
<if test="item.price != null and item.price != '' ">
|
price,
|
</if>
|
creation_time
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="item.id != null and item.id != '' ">
|
#{item.id},
|
</if>
|
<if test="item.title != null and item.title != '' ">
|
#{item.title},
|
</if>
|
<if test="item.intendant != null and item.intendant != '' ">
|
#{item.intendant},
|
</if>
|
<if test="item.intendantPhone != null and item.intendantPhone != '' ">
|
#{item.intendantPhone},
|
</if>
|
<if test="item.intendantType != null and item.intendantType != '' ">
|
#{item.intendantType},
|
</if>
|
<if test="item.content != null and item.content != '' ">
|
#{item.content},
|
</if>
|
<if test="item.address != null and item.address != '' ">
|
#{item.address},
|
</if>
|
<if test="item.lon != null and item.lon != '' ">
|
#{item.lon},
|
</if>
|
<if test="item.lat != null and item.lat != '' ">
|
#{item.lat},
|
</if>
|
<if test="item.imgUrl != null and item.imgUrl != '' ">
|
#{item.imgUrl},
|
</if>
|
<if test="item.price != null and item.price != '' ">
|
#{item.price},
|
</if>
|
sysdate()
|
</trim>
|
</insert>
|
|
<update id="editData">
|
update jinhui_interspace
|
<set>
|
<if test="item.id != null and item.id != '' ">
|
id=#{item.id},
|
</if>
|
<if test="item.title != null and item.title != '' ">
|
title=#{item.title},
|
</if>
|
<if test="item.intendant != null and item.intendant != '' ">
|
intendant=#{item.intendant},
|
</if>
|
<if test="item.intendantPhone != null and item.intendantPhone != '' ">
|
intendant_phone=#{item.intendantPhone},
|
</if>
|
<if test="item.intendantType != null and item.intendantType != '' ">
|
intendant_type=#{item.intendantType},
|
</if>
|
<if test="item.content != null and item.content != '' ">
|
content=#{item.content},
|
</if>
|
<if test="item.address != null and item.address != '' ">
|
address=#{item.address},
|
</if>
|
<if test="item.lon != null and item.lon != '' ">
|
lon=#{item.lon},
|
</if>
|
<if test="item.lat != null and item.lat != '' ">
|
lat=#{item.lat},
|
</if>
|
<if test="item.imgUrl != null and item.imgUrl != '' ">
|
img_url=#{item.imgUrl},
|
</if>
|
<if test="item.price != null and item.price != '' ">
|
price=#{item.price},
|
</if>
|
update_time=sysdate()
|
</set>
|
where id = #{item.id}
|
</update>
|
|
<delete id="expurgateData" parameterType="String">
|
delete from jinhui_interspace where id=#{id}
|
</delete>
|
|
</mapper>
|