<?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.JinhuiExperienceActivityDao">
|
|
<resultMap type="com.panzhihua.service_jinhui_community.entity.JinhuiExperienceActivity" id="itemMap">
|
<result property="id" column="id" />
|
<result property="title" column="title" />
|
<result property="address" column="address" />
|
<result property="lat" column="lat" />
|
<result property="lon" column="lon" />
|
<result property="applyStartTime" column="apply_start_time" />
|
<result property="applyEndTime" column="apply_end_time" />
|
<result property="activityStartTime" column="activity_start_time" />
|
<result property="activityEndTime" column="activity_end_time" />
|
<result property="peopleNumber" column="people_number" />
|
<result property="phone" column="phone" />
|
<result property="award" column="award" />
|
<result property="coverImgUrl" column="cover_img_url" />
|
<result property="creationTime" column="creation_time" />
|
<result property="updateTime" column="update_time" />
|
<result property="activityType" column="activity_type" />
|
<result property="content" column="content" />
|
</resultMap>
|
|
<!-- 分页查询 -->
|
<select id="getList" resultMap="itemMap">
|
select
|
id,
|
title,
|
address,
|
lat,
|
lon,
|
apply_start_time,
|
apply_end_time,
|
activity_start_time,
|
activity_end_time,
|
people_number,
|
phone,
|
award,
|
(select count(jae.id) from jinhui_apply_experience as jae
|
where jae.activity_id=jinhui_experience_activity.id) as number,
|
cover_img_url,
|
creation_time,
|
update_time,
|
content,
|
activity_type
|
from jinhui_experience_activity
|
order by creation_time desc
|
</select>
|
|
|
<select id="getDetails" resultMap="itemMap">
|
select
|
jea.id,
|
jea.title,
|
jea.address,
|
jea.lat,
|
jea.lon,
|
jea.apply_start_time,
|
jea.apply_end_time,
|
jea.activity_start_time,
|
jea.activity_end_time,
|
jea.people_number,
|
(count(japply.id)) as number,
|
IF(#{userId} IS NULL, '0',IF(japply.id IS NULL, '0', '1')) as isJoin,
|
IF(#{userId} IS NULL, '0',IF(japply.is_feedback IS NULL, '0', japply.is_feedback))as isFeedback,
|
jea.phone,
|
jea.award,
|
jea.content,
|
jea.cover_img_url,
|
jea.creation_time,
|
jea.update_time,
|
jea.activity_type
|
from jinhui_experience_activity as jea
|
left join jinhui_apply_experience as japply on jea.id=japply.activity_id
|
<where>
|
jea.id=#{id}
|
<if test="userId !=null and userId !='' ">
|
and japply.user_id=#{userId}
|
</if>
|
</where>
|
</select>
|
|
<insert id="addData">
|
insert into jinhui_experience_activity
|
<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.address != null and item.address != '' ">
|
address,
|
</if>
|
<if test="item.lat != null and item.lat != '' ">
|
lat,
|
</if>
|
<if test="item.lon != null and item.lon != '' ">
|
lon,
|
</if>
|
<if test="item.applyStartTime != null">
|
apply_start_time,
|
</if>
|
<if test="item.applyEndTime != null ">
|
apply_end_time,
|
</if>
|
<if test="item.activityStartTime != null ">
|
activity_start_time,
|
</if>
|
<if test="item.activityEndTime != null ">
|
activity_end_time,
|
</if>
|
<if test="item.peopleNumber != null and item.peopleNumber != '' ">
|
people_number,
|
</if>
|
<if test="item.phone != null and item.phone != '' ">
|
phone,
|
</if>
|
<if test="item.award != null and item.award != '' ">
|
award,
|
</if>
|
<if test="item.coverImgUrl != null and item.coverImgUrl != '' ">
|
cover_img_url,
|
</if>
|
<if test="item.activityType != null and item.activityType != '' ">
|
activity_type,
|
</if>
|
<if test="item.content != null and item.content != '' ">
|
content,
|
</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.address != null and item.address != '' ">
|
#{item.address},
|
</if>
|
<if test="item.lat != null and item.lat != '' ">
|
lat=#{item.lat},
|
</if>
|
<if test="item.lon != null and item.lon != '' ">
|
#{item.lon},
|
</if>
|
<if test="item.applyStartTime != null">
|
#{item.applyStartTime},
|
</if>
|
<if test="item.applyEndTime != null ">
|
#{item.applyEndTime},
|
</if>
|
<if test="item.activityStartTime != null ">
|
#{item.activityStartTime},
|
</if>
|
<if test="item.activityEndTime != null ">
|
#{item.activityEndTime},
|
</if>
|
<if test="item.peopleNumber != null and item.peopleNumber != '' ">
|
#{item.peopleNumber},
|
</if>
|
<if test="item.phone != null and item.phone != '' ">
|
#{item.phone},
|
</if>
|
<if test="item.award != null and item.award != '' ">
|
#{item.award},
|
</if>
|
<if test="item.coverImgUrl != null and item.coverImgUrl != '' ">
|
#{item.coverImgUrl},
|
</if>
|
<if test="item.activityType != null and item.activityType != '' ">
|
#{item.activityType},
|
</if>
|
<if test="item.content != null and item.content != '' ">
|
#{item.content},
|
</if>
|
sysdate()
|
</trim>
|
</insert>
|
|
<update id="editData">
|
update jinhui_experience_activity
|
<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.address != null and item.address != '' ">
|
address=#{item.address},
|
</if>
|
<if test="item.lat != null and item.lat != '' ">
|
lat=#{item.lat},
|
</if>
|
<if test="item.lon != null and item.lon != '' ">
|
lon=#{item.lon},
|
</if>
|
<if test="item.applyStartTime != null">
|
apply_start_time=#{item.applyStartTime},
|
</if>
|
<if test="item.applyEndTime != null ">
|
apply_end_time=#{item.applyEndTime},
|
</if>
|
<if test="item.activityStartTime != null ">
|
activity_start_time=#{item.activityStartTime},
|
</if>
|
<if test="item.activityEndTime != null ">
|
activity_end_time=#{item.activityEndTime},
|
</if>
|
<if test="item.peopleNumber != null and item.peopleNumber != '' ">
|
people_number=#{item.peopleNumber},
|
</if>
|
<if test="item.phone != null and item.phone != '' ">
|
phone=#{item.phone},
|
</if>
|
<if test="item.award != null and item.award != '' ">
|
award=#{item.award},
|
</if>
|
<if test="item.coverImgUrl != null and item.coverImgUrl != '' ">
|
cover_img_url=#{item.coverImgUrl},
|
</if>
|
<if test="item.activityType != null and item.activityType != '' ">
|
activity_type=#{item.activityType},
|
</if>
|
<if test="item.content != null and item.content != '' ">
|
content=#{item.content},
|
</if>
|
update_time=sysdate()
|
</set>
|
where id = #{item.id}
|
</update>
|
|
<delete id="expurgateData" parameterType="String">
|
delete from jinhui_experience_activity where id=#{id}
|
</delete>
|
|
|
|
<select id="getTimeList" resultMap="itemMap">
|
select
|
id,
|
title,
|
address,
|
lat,
|
lon,
|
apply_start_time,
|
apply_end_time,
|
activity_start_time,
|
activity_end_time,
|
people_number,
|
phone,
|
award,
|
cover_img_url,
|
creation_time,
|
update_time,
|
activity_type
|
from jinhui_experience_activity
|
where activity_type in (1,2,3)
|
</select>
|
|
|
|
|
|
</mapper>
|