<?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_equipment.dao.UnionStoreMapper">
|
<resultMap type="com.panzhihua.service_equipment.model.dos.UnionStore" id="UnionStoreMap">
|
<result property="id" column="id"/>
|
<result property="goodName" column="good_name"/>
|
<result property="conversionPrice" column="conversion_price"/>
|
<result property="stock" column="stock"/>
|
<result property="pickGoods" column="pick_goods"/>
|
<result property="goodsUrl" column="goods_url"/>
|
<result property="pickGoodsAddress" column="pick_goods_address"/>
|
<result property="lat" column="lat"/>
|
<result property="lng" column="lng"/>
|
<result property="content" column="content"/>
|
<result property="communityId" column="community_id"/>
|
<result property="goodsType" column="goods_type"/>
|
<result property="goodNum" column="good_num"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="userId" column="user_id"/>
|
<result property="openingHours" column="opening_hours"/>
|
<result property="goodsCoverUrl" column="goods_cover_url"/>
|
|
</resultMap>
|
|
<sql id="base_sql">
|
id,
|
good_name,
|
conversion_price,
|
stock,
|
pick_goods,
|
goods_url,
|
pick_goods_address,
|
lat,
|
lng,
|
content,
|
community_id,
|
(select uos.name from union_outdoor_site as uos where community_id=uos.area_code) as communityName,
|
goods_type,
|
good_num,
|
user_id,
|
opening_hours,
|
goods_cover_url,
|
create_time,
|
update_time
|
</sql>
|
|
<select id="getList" resultMap="UnionStoreMap">
|
select <include refid="base_sql"/>
|
from union_store
|
<where>
|
1=1
|
<if test="communityId!=null and communityId!='' ">
|
and community_id=#{communityId}
|
</if>
|
<if test="goodsType!=null and goodsType!='' ">
|
and goods_type=#{goodsType}
|
</if>
|
<if test="nameOrNum!=null and nameOrNum!='' ">
|
and (good_name like concat('%',#{nameOrNum},'%')) or (good_num like concat('%',#{nameOrNum},'%'))
|
</if>
|
</where>
|
order by create_time desc
|
</select>
|
|
|
<select id="getData" resultMap="UnionStoreMap">
|
select <include refid="base_sql"/>
|
from union_store
|
where id=#{id}
|
</select>
|
|
|
<insert id="insert">
|
insert into union_store
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="item.id != null and item.id != '' ">
|
id,
|
</if>
|
<if test="item.goodName != null and item.goodName != '' ">
|
good_name,
|
</if>
|
<if test="item.conversionPrice != null and item.conversionPrice != '' ">
|
conversion_price,
|
</if>
|
<if test="item.stock != null and item.stock != '' ">
|
stock,
|
</if>
|
<if test="item.pickGoods != null and item.pickGoods != '' ">
|
pick_goods,
|
</if>
|
<if test="item.goodsUrl != null and item.goodsUrl != '' ">
|
goods_url,
|
</if>
|
<if test="item.pickGoodsAddress != null and item.pickGoodsAddress != '' ">
|
pick_goods_address,
|
</if>
|
<if test="item.lat != null and item.lat != '' ">
|
lat,
|
</if>
|
<if test="item.lng != null and item.lng != '' ">
|
lng,
|
</if>
|
<if test="item.content != null and item.content != '' ">
|
content,
|
</if>
|
<if test="item.goodsType != null and item.goodsType != '' ">
|
goods_type,
|
</if>
|
<if test="item.goodNum != null and item.goodNum != '' ">
|
good_num,
|
</if>
|
<if test="item.userId != null and item.userId != '' ">
|
user_id,
|
</if>
|
<if test="item.openingHours != null and item.openingHours != '' ">
|
opening_hours,
|
</if>
|
<if test="item.goodsCoverUrl != null and item.goodsCoverUrl != '' ">
|
goods_cover_url,
|
</if>
|
create_time
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="item.id != null and item.id != '' ">
|
#{item.id},
|
</if>
|
<if test="item.goodName != null and item.goodName != '' ">
|
#{item.goodName},
|
</if>
|
<if test="item.conversionPrice != null and item.conversionPrice != '' ">
|
#{item.conversionPrice},
|
</if>
|
<if test="item.stock != null and item.stock != '' ">
|
#{item.stock},
|
</if>
|
<if test="item.pickGoods != null and item.pickGoods != '' ">
|
#{item.pickGoods},
|
</if>
|
<if test="item.goodsUrl != null and item.goodsUrl != '' ">
|
#{item.goodsUrl},
|
</if>
|
<if test="item.pickGoodsAddress != null and item.pickGoodsAddress != '' ">
|
#{item.pickGoodsAddress},
|
</if>
|
<if test="item.lat != null and item.lat != '' ">
|
#{item.lat},
|
</if>
|
<if test="item.lng != null and item.lng != '' ">
|
#{item.lng},
|
</if>
|
<if test="item.content != null and item.content != '' ">
|
#{item.content},
|
</if>
|
<if test="item.goodsType != null and item.goodsType != '' ">
|
#{item.goodsType},
|
</if>
|
<if test="item.goodNum != null and item.goodNum != '' ">
|
#{item.goodNum},
|
</if>
|
<if test="item.userId != null and item.userId != '' ">
|
#{item.userId},
|
</if>
|
<if test="item.openingHours != null and item.openingHours != '' ">
|
#{item.openingHours},
|
</if>
|
<if test="item.goodsCoverUrl != null and item.goodsCoverUrl != '' ">
|
#{item.goodsCoverUrl},
|
</if>
|
sysdate()
|
</trim>
|
</insert>
|
|
<update id="update">
|
update union_store
|
<set>
|
<if test="item.id != null and item.id != '' ">
|
id=#{item.id},
|
</if>
|
<if test="item.goodName != null and item.goodName != '' ">
|
good_name=#{item.goodName},
|
</if>
|
<if test="item.conversionPrice != null and item.conversionPrice != '' ">
|
conversion_price=#{item.conversionPrice},
|
</if>
|
<if test="item.stock != null and item.stock != '' ">
|
stock=#{item.stock},
|
</if>
|
<if test="item.pickGoods != null and item.pickGoods != '' ">
|
pick_goods=#{item.pickGoods},
|
</if>
|
<if test="item.goodsUrl != null and item.goodsUrl != '' ">
|
goods_url=#{item.goodsUrl},
|
</if>
|
<if test="item.pickGoodsAddress != null and item.pickGoodsAddress != '' ">
|
pick_goods_address=#{item.pickGoodsAddress},
|
</if>
|
<if test="item.lat != null and item.lat != '' ">
|
lat=#{item.lat},
|
</if>
|
<if test="item.lng != null and item.lng != '' ">
|
lng=#{item.lng},
|
</if>
|
<if test="item.content != null and item.content != '' ">
|
content=#{item.content},
|
</if>
|
<if test="item.goodsType != null and item.goodsType != '' ">
|
goods_type=#{item.goodsType},
|
</if>
|
<if test="item.goodNum != null and item.goodNum != '' ">
|
good_num=#{item.goodNum},
|
</if>
|
<if test="item.userId != null and item.userId != '' ">
|
user_id=#{item.userId},
|
</if>
|
<if test="item.openingHours != null and item.openingHours != '' ">
|
opening_hours=#{item.openingHours},
|
</if>
|
<if test="item.goodsCoverUrl != null and item.goodsCoverUrl != '' ">
|
goods_cover_url=#{item.goodsCoverUrl},
|
</if>
|
update_time=sysdate()
|
</set>
|
where id = #{item.id}
|
</update>
|
|
<delete id="delete" parameterType="String">
|
delete from union_store where id=#{id}
|
</delete>
|
|
|
|
|
</mapper>
|