<?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.VolunteerCreditsExchangeDao">
|
|
<resultMap type="com.panzhihua.service_community.entity.VolunteerCreditsExchange" id="VolunteerCreditsExchangeMap">
|
<result property="id" column="id" />
|
<result property="goodsName" column="goods_name" />
|
<result property="creationTime" column="creation_time" />
|
<result property="updateTime" column="update_time" />
|
<result property="communityId" column="community_id" />
|
<result property="orderNumber" column="order_number" />
|
<result property="goodsId" column="goods_id" />
|
<result property="goodsUrl" column="goods_url" />
|
<result property="needScore" column="need_score" />
|
<result property="userId" column="user_id" />
|
<result property="condition" column="condition" />
|
<result property="disposeTime" column="dispose_time" />
|
<result property="orderType" column="order_type" />
|
<result property="palyIntegral" column="paly_integral" />
|
<result property="merchantId" column="merchant_id" />
|
<result property="palyNum" column="paly_num" />
|
<result property="isEvaluate" column="is_evaluate" />
|
</resultMap>
|
|
|
<select id="getData" resultMap="VolunteerCreditsExchangeMap">
|
select
|
vce.id,
|
vce.order_number,
|
vce.goods_id,
|
(select vim.name from volunteer_integral_merchant as vim where vim.id=vce.goods_id) as goods_name,
|
(select vim.cover_url from volunteer_integral_merchant as vim where vim.id=vce.goods_id) as goods_url,
|
vce.need_score,
|
vce.user_id,
|
(select sy.name from sys_user as sy where sy.user_id=vce.user_id) as userName,
|
(select sy.phone from sys_user as sy where sy.user_id=vce.user_id) as userPhone,
|
vce.creation_time,
|
vce.condition,
|
vce.dispose_time,
|
vce.community_id,
|
vce.order_type,
|
vce.paly_integral,
|
vce.merchant_id,
|
(select vm.name from volunteer_merchant as vm where vce.merchant_id=vm.id) as merchantName,
|
vce.paly_num,
|
vce.is_evaluate,
|
vce.update_time
|
from volunteer_credits_exchange as vce
|
where vce.id=#{id} or vce.order_number=#{id}
|
</select>
|
|
<!-- 分页查询 -->
|
<select id="getList" resultMap="VolunteerCreditsExchangeMap">
|
select
|
vce.id,
|
vce.order_number,
|
vce.goods_id,
|
(select vim.name from volunteer_integral_merchant as vim where vim.id=vce.goods_id) as goods_name,
|
(select vim.cover_url from volunteer_integral_merchant as vim where vim.id=vce.goods_id) as goods_url,
|
vce.need_score,
|
vce.user_id,
|
(select sy.name from sys_user as sy where sy.user_id=vce.user_id) as userName,
|
(select sy.phone from sys_user as sy where sy.user_id=vce.user_id) as userPhone,
|
vce.creation_time,
|
vce.condition,
|
vce.dispose_time,
|
vce.community_id,
|
vce.order_type,
|
vce.paly_integral,
|
vce.merchant_id,
|
(select vm.name from volunteer_merchant as vm where vce.merchant_id=vm.id) as merchantName,
|
vce.paly_num,
|
vce.is_evaluate,
|
vce.update_time
|
from volunteer_credits_exchange as vce
|
<where>
|
1=1
|
<if test="goodsId!=null and goodsId!='' ">
|
and vce.goods_id=#{goodsId}
|
</if>
|
<if test="orderNumber!=null and orderNumber!='' ">
|
and vce.order_number=#{orderNumber}
|
</if>
|
<if test="goodsName!=null and goodsName!='' ">
|
and ((select vim.name from volunteer_integral_merchant as vim where vim.id=vce.goods_id) like concat('%',#{goodsName},'%'))
|
</if>
|
<if test="condition!=null and condition!='' ">
|
and vce.condition=#{condition}
|
</if>
|
<if test="userName!=null and userName!='' ">
|
and ((select su.name from sys_user as su where su.user_id=vce.user_id) like concat('%',#{userName},'%')) or
|
((select su.phone from sys_user as su where su.user_id=vce.user_id) like concat('%',#{userName},'%'))
|
</if>
|
<if test="communityId!=null and communityId!='' ">
|
and vce.community_id=#{communityId}
|
</if>
|
<if test="userId!=null and userId!='' ">
|
and vce.user_id=#{userId}
|
</if>
|
<if test="orderType!=null and orderType!='' ">
|
and vce.order_type=#{orderType}
|
</if>
|
<if test="merchantId!=null and merchantId!='' ">
|
and vce.merchant_id=#{merchantId}
|
</if>
|
</where>
|
order by vce.creation_time desc
|
</select>
|
|
<insert id="insertData">
|
insert into volunteer_credits_exchange
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="item.id != null">
|
id,
|
</if>
|
<if test="item.goodsName != null">
|
goods_name,
|
</if>
|
<if test="item.communityId != null">
|
community_id,
|
</if>
|
<if test="item.orderNumber != null">
|
order_number,
|
</if>
|
<if test="item.goodsId != null">
|
goods_id,
|
</if>
|
<if test="item.goodsUrl != null">
|
goods_url,
|
</if>
|
<if test="item.needScore != null">
|
need_score,
|
</if>
|
<if test="item.userId != null">
|
user_id,
|
</if>
|
<if test="item.condition != null">
|
volunteer_credits_exchange.condition,
|
</if>
|
<if test="item.disposeTime != null">
|
dispose_time,
|
</if>
|
<if test="item.orderType != null">
|
order_type,
|
</if>
|
<if test="item.palyIntegral != null">
|
paly_integral,
|
</if>
|
<if test="item.merchantId != null">
|
merchant_id,
|
</if>
|
<if test="item.palyNum != null">
|
paly_num,
|
</if>
|
<if test="item.isEvaluate != null">
|
is_evaluate,
|
</if>
|
creation_time
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="item.id != null">
|
#{item.id},
|
</if>
|
<if test="item.goodsName != null">
|
#{item.goodsName},
|
</if>
|
<if test="item.communityId != null">
|
#{item.communityId},
|
</if>
|
<if test="item.orderNumber != null">
|
#{item.orderNumber},
|
</if>
|
<if test="item.goodsId != null">
|
#{item.goodsId},
|
</if>
|
<if test="item.goodsUrl != null">
|
#{item.goodsUrl},
|
</if>
|
<if test="item.needScore != null">
|
#{item.needScore},
|
</if>
|
<if test="item.userId != null">
|
#{item.userId},
|
</if>
|
<if test="item.condition != null">
|
#{item.condition},
|
</if>
|
<if test="item.disposeTime != null">
|
#{item.disposeTime},
|
</if>
|
<if test="item.orderType != null">
|
#{item.orderType},
|
</if>
|
<if test="item.palyIntegral != null">
|
#{item.palyIntegral},
|
</if>
|
<if test="item.merchantId != null">
|
#{item.merchantId},
|
</if>
|
<if test="item.palyNum != null">
|
#{item.palyNum},
|
</if>
|
<if test="item.isEvaluate != null">
|
#{item.isEvaluate},
|
</if>
|
sysdate()
|
</trim>
|
</insert>
|
|
<update id="update">
|
update volunteer_credits_exchange
|
<set>
|
<if test="item.id != null">
|
id=#{item.id},
|
</if>
|
<if test="item.goodsName != null">
|
goods_name=#{item.goodsName},
|
</if>
|
<if test="item.communityId != null">
|
community_id=#{item.communityId},
|
</if>
|
<if test="item.orderNumber != null">
|
order_number=#{item.orderNumber},
|
</if>
|
<if test="item.goodsId != null">
|
goods_id=#{item.goodsId},
|
</if>
|
<if test="item.goodsUrl != null">
|
goods_url=#{item.goodsUrl},
|
</if>
|
<if test="item.needScore != null">
|
need_score=#{item.needScore},
|
</if>
|
<if test="item.userId != null">
|
user_id=#{item.userId},
|
</if>
|
<if test="item.condition != null">
|
volunteer_credits_exchange.condition=#{item.condition},
|
</if>
|
<if test="item.disposeTime != null">
|
dispose_time=#{item.disposeTime},
|
</if>
|
<if test="item.orderType != null">
|
order_type=#{item.orderType},
|
</if>
|
<if test="item.palyIntegral != null">
|
paly_integral=#{item.palyIntegral},
|
</if>
|
<if test="item.merchantId != null">
|
merchant_id=#{item.merchantId},
|
</if>
|
<if test="item.palyNum != null">
|
paly_num=#{item.palyNum},
|
</if>
|
<if test="item.isEvaluate != null">
|
is_evaluate=#{item.isEvaluate},
|
</if>
|
update_time=sysdate()
|
</set>
|
where id = #{item.id}
|
</update>
|
|
|
<update id="conditionData" parameterType="String">
|
update volunteer_credits_exchange as vce
|
set vce.dispose_time=sysdate(),vce.condition='1',vce.update_time=sysdate()
|
where vce.id=#{id}
|
</update>
|
|
|
<delete id="delete" parameterType="String">
|
delete from volunteer_credits_exchange where id=#{id}
|
</delete>
|
|
|
|
|
|
</mapper>
|