<?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_community.dao.VolunteerIntegralMerchantDao">
|
|
<resultMap type="com.panzhihua.service_community.entity.VolunteerIntegralMerchant" id="VolunteerIntegralMerchantMap">
|
<result property="id" column="id" />
|
<result property="name" column="name" />
|
<result property="creationTime" column="creation_time" />
|
<result property="updateTime" column="update_time" />
|
<result property="commodityValue" column="commodity_value" />
|
<result property="integral" column="integral" />
|
<result property="state" column="state" />
|
<result property="coverUrl" column="cover_url" />
|
<result property="content" column="content" />
|
<result property="communityId" column="community_id" />
|
<result property="goodType" column="good_type" />
|
<result property="merchantId" column="merchant_id" />
|
<result property="goodNum" column="good_num" />
|
<result property="goodImgs" column="good_imgs" />
|
</resultMap>
|
|
<sql id="sql_base">
|
id,
|
name,
|
creation_time,
|
update_time,
|
commodity_value,
|
integral,
|
state,
|
cover_url,
|
content,
|
good_type,
|
merchant_id,
|
good_num,
|
good_imgs,
|
community_id
|
</sql>
|
|
|
|
<!--查询单个-->
|
<select id="queryById" resultMap="VolunteerIntegralMerchantMap">
|
select <include refid="sql_base"/>
|
from volunteer_integral_merchant
|
where id= #{id}
|
</select>
|
|
<!-- 分页查询 -->
|
<select id="queryList" resultMap="VolunteerIntegralMerchantMap">
|
select <include refid="sql_base"/>
|
from volunteer_integral_merchant
|
<where>
|
1=1
|
<if test="name!=null">
|
and (volunteer_integral_merchant.name like concat('%',#{name},'%'))
|
</if>
|
<if test="state!=null">
|
and volunteer_integral_merchant.state =#{state}
|
</if>
|
<if test="goodType!=null">
|
and volunteer_integral_merchant.good_type =#{goodType}
|
</if>
|
<if test="merchantId!=null">
|
and volunteer_integral_merchant.merchant_id =#{merchantId}
|
</if>
|
</where>
|
order by creation_time desc
|
</select>
|
|
<insert id="insertVolunteer">
|
insert into volunteer_integral_merchant
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="vimVO.id != null">
|
id,
|
</if>
|
<if test="vimVO.name != null">
|
name,
|
</if>
|
<if test="vimVO.communityId != null">
|
community_id,
|
</if>
|
<if test="vimVO.commodityValue != null">
|
commodity_value,
|
</if>
|
<if test="vimVO.integral != null">
|
integral,
|
</if>
|
<if test="vimVO.state != null">
|
state,
|
</if>
|
<if test="vimVO.coverUrl != null">
|
cover_url,
|
</if>
|
<if test="vimVO.content != null">
|
content,
|
</if>
|
<if test="vimVO.goodType != null">
|
good_type,
|
</if>
|
<if test="vimVO.merchantId != null">
|
merchant_id,
|
</if>
|
<if test="vimVO.goodNum != null">
|
good_num,
|
</if>
|
<if test="vimVO.goodImgs != null">
|
good_imgs,
|
</if>
|
creation_time
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="vimVO.id != null">
|
#{vimVO.id},
|
</if>
|
<if test="vimVO.name != null">
|
#{vimVO.name},
|
</if>
|
<if test="vimVO.communityId != null">
|
#{vimVO.communityId},
|
</if>
|
<if test="vimVO.commodityValue != null">
|
#{vimVO.commodityValue},
|
</if>
|
<if test="vimVO.integral != null">
|
#{vimVO.integral},
|
</if>
|
<if test="vimVO.state != null">
|
#{vimVO.state},
|
</if>
|
<if test="vimVO.coverUrl != null">
|
#{vimVO.coverUrl},
|
</if>
|
<if test="vimVO.content != null">
|
#{vimVO.content},
|
</if>
|
<if test="vimVO.goodType != null">
|
#{vimVO.goodType},
|
</if>
|
<if test="vimVO.merchantId != null">
|
#{vimVO.merchantId},
|
</if>
|
<if test="vimVO.goodNum != null">
|
#{vimVO.goodNum},
|
</if>
|
<if test="vimVO.goodImgs != null">
|
#{vimVO.goodImgs},
|
</if>
|
sysdate()
|
</trim>
|
</insert>
|
|
<update id="updateById">
|
update volunteer_integral_merchant
|
<set>
|
<if test="vimVO.id != null">
|
id=#{vimVO.id},
|
</if>
|
<if test="vimVO.name != null">
|
name=#{vimVO.name},
|
</if>
|
<if test="vimVO.communityId != null">
|
community_id=#{vimVO.communityId},
|
</if>
|
<if test="vimVO.commodityValue != null">
|
commodity_value=#{vimVO.commodityValue},
|
</if>
|
<if test="vimVO.integral != null">
|
integral=#{vimVO.integral},
|
</if>
|
<if test="vimVO.state != null">
|
state=#{vimVO.state},
|
</if>
|
<if test="vimVO.coverUrl != null">
|
cover_url=#{vimVO.coverUrl},
|
</if>
|
<if test="vimVO.content != null">
|
content=#{vimVO.content},
|
</if>
|
<if test="vimVO.goodType != null">
|
good_type=#{vimVO.goodType},
|
</if>
|
<if test="vimVO.merchantId != null">
|
merchant_id=#{vimVO.merchantId},
|
</if>
|
<if test="vimVO.goodNum != null">
|
good_num=#{vimVO.goodNum},
|
</if>
|
<if test="vimVO.goodImgs != null">
|
good_imgs=#{vimVO.goodImgs},
|
</if>
|
update_time=sysdate()
|
</set>
|
where id = #{vimVO.id}
|
</update>
|
|
<delete id="deleteById" parameterType="String">
|
delete from volunteer_integral_merchant where id=#{id}
|
</delete>
|
|
<select id="getNum" parameterType="String" resultType="Integer">
|
select count(id) from volunteer_integral_merchant where merchant_id=#{merchantId} and state="1"
|
</select>
|
|
</mapper>
|