<?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_dangjian.dao.NeedProblemInventoryDAO">
|
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id,
|
title,
|
classify_id,
|
claim_num,
|
address,
|
lat,
|
lon,
|
claim_start_time,
|
claim_end_time,
|
need_start_time,
|
need_end_time,
|
linkman,
|
phone,
|
sign_in_scope,
|
sign_out_scope,
|
award,
|
content,
|
imgs_url,
|
creation_time,
|
update_time,
|
kind,
|
community_id,
|
is_display,
|
user_id
|
</sql>
|
|
|
<select id="getList" resultType="com.panzhihua.common.model.dtos.partybuilding.NeedProblemInventoryDTO">
|
SELECT
|
nfpi.id,
|
nfpi.title,
|
nfpi.classify_id,
|
canct.name as classifyName,
|
nfpi.claim_num,
|
nfpi.address,
|
nfpi.lat,
|
nfpi.lon,
|
nfpi.claim_start_time,
|
nfpi.claim_end_time,
|
nfpi.need_start_time,
|
nfpi.need_end_time,
|
nfpi.linkman,
|
nfpi.phone,
|
nfpi.sign_in_scope,
|
nfpi.sign_out_scope,
|
nfpi.award,
|
nfpi.content,
|
nfpi.imgs_url,
|
nfpi.creation_time,
|
nfpi.update_time,
|
nfpi.kind,
|
nfpi.community_id,
|
nfnpc.punch_start_time,
|
nfnpc.punch_end_time,
|
if(nfnpc.user_id>0,1,0) as isJoin,
|
(select count(task_id) from new_fight_need_problem_claim where task_id=nfpi.id) as joinNum,
|
nfnpc.service_time,
|
nfpi.status,
|
nfpi.is_display,
|
nfpi.user_id
|
FROM new_fight_need_problem_inventory as nfpi
|
left join com_act_neighbor_circle_topic_new as canct on canct.id=nfpi.classify_id
|
left join new_fight_need_problem_claim as nfnpc on nfnpc.task_id=nfpi.id
|
<if test="userIds !=null and userIds != '' ">
|
and nfnpc.user_id=#{userIds}
|
</if>
|
<where>
|
1=1
|
<if test="search !=null and search != '' ">
|
and nfpi.title like concat ('%',#{search},'%')
|
</if>
|
<if test="isDisplay !=null and isDisplay != '' ">
|
and nfpi.is_display=#{isDisplay}
|
</if>
|
<if test="classifyId !=null and classifyId != '' ">
|
and nfpi.classify_id=#{classifyId}
|
</if>
|
<if test="status !=null and status != '' ">
|
and nfpi.status =#{status}
|
</if>
|
<if test="kind !=null and kind != '' ">
|
and nfpi.kind =#{kind}
|
</if>
|
<if test="communityId !=null and communityId != '' ">
|
and nfpi.community_id =#{communityId}
|
</if>
|
<if test="userId !=null and userId != '' ">
|
and nfpi.user_id =#{userId}
|
</if>
|
<if test="startTime != null">
|
AND nfpi.creation_time <![CDATA[ >= ]]> #{startTime}
|
</if>
|
<if test="endTime != null">
|
AND nfpi.creation_time <![CDATA[ <= ]]> #{endTime}
|
</if>
|
</where>
|
GROUP BY nfpi.id
|
order by nfpi.status asc,nfpi.creation_time desc
|
</select>
|
|
|
<select id="getMyJoinList" resultType="com.panzhihua.common.model.dtos.partybuilding.NeedProblemInventoryDTO">
|
SELECT
|
nfpi.id,
|
nfpi.title,
|
nfpi.classify_id,
|
canct.name as classifyName,
|
nfpi.claim_num,
|
nfpi.address,
|
nfpi.lat,
|
nfpi.lon,
|
nfpi.claim_start_time,
|
nfpi.claim_end_time,
|
nfpi.need_start_time,
|
nfpi.need_end_time,
|
nfpi.linkman,
|
nfpi.phone,
|
nfpi.sign_in_scope,
|
nfpi.sign_out_scope,
|
nfpi.award,
|
nfpi.content,
|
nfpi.imgs_url,
|
nfpi.creation_time,
|
nfpi.update_time,
|
nfpi.kind,
|
nfpi.community_id,
|
nfnpc.punch_start_time,
|
nfnpc.punch_end_time,
|
if(nfnpc.user_id>0,1,0) as isJoin,
|
(select count(task_id) from new_fight_need_problem_claim where task_id=nfpi.id) as joinNum,
|
nfpi.status,
|
nfpi.is_display,
|
nfpi.user_id
|
FROM new_fight_need_problem_inventory as nfpi
|
left join com_act_neighbor_circle_topic_new as canct on canct.id=nfpi.classify_id
|
left join new_fight_need_problem_claim as nfnpc on nfnpc.task_id=nfpi.id
|
<if test="userIds !=null and userIds != '' ">
|
and nfnpc.user_id=#{userIds}
|
</if>
|
<where>
|
1=1
|
<if test="isDisplay !=null and isDisplay != '' ">
|
and nfpi.is_display=#{isDisplay}
|
</if>
|
<if test="search !=null and search != '' ">
|
and nfpi.title like concat ('%',#{search},'%')
|
</if>
|
<if test="status !=null and status != '' ">
|
and nfpi.status =#{status}
|
</if>
|
<if test="kind !=null and kind != '' ">
|
and nfpi.kind =#{kind}
|
</if>
|
<if test="userId !=null and userId != '' ">
|
and nfpi.id in(SELECT task_id FROM new_fight_need_problem_claim where user_id=#{userId} )
|
</if>
|
<if test="startTime != null ">
|
AND nfpi.creation_time <![CDATA[ >= ]]> #{startTime}
|
</if>
|
<if test="endTime != null ">
|
AND nfpi.creation_time <![CDATA[ <= ]]> #{endTime}
|
</if>
|
</where>
|
GROUP BY nfpi.id
|
order by nfpi.status asc,nfpi.creation_time desc
|
</select>
|
|
|
<select id="getDetails" resultType="com.panzhihua.common.model.dtos.partybuilding.NeedProblemInventoryDTO">
|
SELECT
|
nfpi.id,
|
nfpi.title,
|
nfpi.classify_id,
|
canct.name as classifyName,
|
nfpi.claim_num,
|
nfpi.address,
|
nfpi.lat,
|
nfpi.lon,
|
nfpi.claim_start_time,
|
nfpi.claim_end_time,
|
nfpi.need_start_time,
|
nfpi.need_end_time,
|
nfpi.linkman,
|
nfpi.phone,
|
nfpi.sign_in_scope,
|
nfpi.sign_out_scope,
|
nfpi.award,
|
nfpi.content,
|
nfpi.imgs_url,
|
nfpi.creation_time,
|
nfpi.update_time,
|
nfpi.kind,
|
nfpi.community_id,
|
nfnpc.punch_start_time,
|
nfnpc.punch_end_time,
|
if(nfnpc.user_id>0,1,0) as isJoin,
|
(select count(task_id) from new_fight_need_problem_claim where task_id=nfpi.id) as joinNum,
|
nfpi.status,
|
nfnpc.service_time,
|
nfpi.is_display,
|
nfpi.user_id
|
FROM new_fight_need_problem_inventory as nfpi
|
left join com_act_neighbor_circle_topic_new as canct on canct.id=nfpi.classify_id
|
left join new_fight_need_problem_claim as nfnpc on nfnpc.task_id=nfpi.id and nfnpc.user_id=#{userIds}
|
<where>
|
1=1
|
<if test="id !=null and id != '' ">
|
and nfpi.id =#{id}
|
</if>
|
</where>
|
GROUP BY nfpi.id
|
</select>
|
|
|
<insert id="addData" useGeneratedKeys="true" keyProperty="id">
|
insert into new_fight_need_problem_inventory
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="item.id != null" >
|
id,
|
</if>
|
<if test="item.title != null and item.title !='' " >
|
title,
|
</if>
|
<if test="item.classifyId != null and item.classifyId !='' " >
|
classify_id,
|
</if>
|
<if test="item.claimNum != null and item.claimNum !='' " >
|
claim_num,
|
</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.claimStartTime != null" >
|
claim_start_time,
|
</if>
|
<if test="item.claimEndTime != null " >
|
claim_end_time,
|
</if>
|
<if test="item.needStartTime != null" >
|
need_start_time,
|
</if>
|
<if test="item.needEndTime != null" >
|
need_end_time,
|
</if>
|
<if test="item.linkman != null and item.linkman !='' " >
|
linkman,
|
</if>
|
<if test="item.phone != null and item.phone !='' " >
|
phone,
|
</if>
|
<if test="item.signInScope != null and item.signInScope !='' " >
|
sign_in_scope,
|
</if>
|
<if test="item.signOutScope != null and item.signOutScope !='' " >
|
sign_out_scope,
|
</if>
|
<if test="item.award != null and item.award !='' " >
|
award,
|
</if>
|
<if test="item.content != null and item.content !='' " >
|
content,
|
</if>
|
<if test="item.imgsUrl != null and item.imgsUrl !='' " >
|
imgs_url,
|
</if>
|
<if test="item.kind != null and item.kind !='' " >
|
kind,
|
</if>
|
<if test="item.userId != null and item.userId !='' " >
|
user_id,
|
</if>
|
<if test="item.communityId != null and item.communityId !='' " >
|
community_id,
|
</if>
|
<if test="item.status != null and item.status !='' " >
|
status,
|
</if>
|
<if test="item.isDisplay != null and item.isDisplay !='' " >
|
is_display,
|
</if>
|
creation_time
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="item.id != null" >
|
#{item.id},
|
</if>
|
<if test="item.title != null and item.title !='' " >
|
#{item.title},
|
</if>
|
<if test="item.classifyId != null and item.classifyId !='' " >
|
#{item.classifyId},
|
</if>
|
<if test="item.claimNum != null and item.claimNum !='' " >
|
#{item.claimNum},
|
</if>
|
<if test="item.address != null and item.address !='' " >
|
#{item.address},
|
</if>
|
<if test="item.lat != null and item.lat !='' " >
|
#{item.lat},
|
</if>
|
<if test="item.lon != null and item.lon !='' " >
|
#{item.lon},
|
</if>
|
<if test="item.claimStartTime != null" >
|
#{item.claimStartTime},
|
</if>
|
<if test="item.claimEndTime != null " >
|
#{item.claimEndTime},
|
</if>
|
<if test="item.needStartTime != null" >
|
#{item.needStartTime},
|
</if>
|
<if test="item.needEndTime != null" >
|
#{item.needEndTime},
|
</if>
|
<if test="item.linkman != null and item.linkman !='' " >
|
#{item.linkman},
|
</if>
|
<if test="item.phone != null and item.phone !='' " >
|
#{item.phone},
|
</if>
|
<if test="item.signInScope != null and item.signInScope !='' " >
|
#{item.signInScope},
|
</if>
|
<if test="item.signOutScope != null and item.signOutScope !='' " >
|
#{item.signOutScope},
|
</if>
|
<if test="item.award != null and item.award !='' " >
|
#{item.award},
|
</if>
|
<if test="item.content != null and item.content !='' " >
|
#{item.content},
|
</if>
|
<if test="item.imgsUrl != null and item.imgsUrl !='' " >
|
#{item.imgsUrl},
|
</if>
|
<if test="item.kind != null and item.kind !='' " >
|
#{item.kind},
|
</if>
|
<if test="item.userId != null and item.userId !='' " >
|
#{item.userId},
|
</if>
|
<if test="item.communityId != null and item.communityId !='' " >
|
#{item.communityId},
|
</if>
|
<if test="item.status != null and item.status !='' " >
|
#{item.status},
|
</if>
|
<if test="item.isDisplay != null and item.isDisplay !='' " >
|
#{item.isDisplay},
|
</if>
|
sysdate()
|
</trim>
|
</insert>
|
|
<update id="editData">
|
update new_fight_need_problem_inventory
|
<set>
|
<if test="item.id != null" >
|
id=#{item.id},
|
</if>
|
<if test="item.title != null and item.title !='' " >
|
title=#{item.title},
|
</if>
|
<if test="item.classifyId != null and item.classifyId !='' " >
|
classify_id=#{item.classifyId},
|
</if>
|
<if test="item.claimNum != null and item.claimNum !='' " >
|
claim_num=#{item.claimNum},
|
</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.claimStartTime != null" >
|
claim_start_time=#{item.claimStartTime},
|
</if>
|
<if test="item.claimEndTime != null " >
|
claim_end_time=#{item.claimEndTime},
|
</if>
|
<if test="item.needStartTime != null" >
|
need_start_time=#{item.needStartTime},
|
</if>
|
<if test="item.needEndTime != null" >
|
need_end_time=#{item.needEndTime},
|
</if>
|
<if test="item.linkman != null and item.linkman !='' " >
|
linkman=#{item.linkman},
|
</if>
|
<if test="item.phone != null and item.phone !='' " >
|
phone=#{item.phone},
|
</if>
|
<if test="item.signInScope != null and item.signInScope !='' " >
|
sign_in_scope=#{item.signInScope},
|
</if>
|
<if test="item.signOutScope != null and item.signOutScope !='' " >
|
sign_out_scope=#{item.signOutScope},
|
</if>
|
<if test="item.award != null and item.award !='' " >
|
award=#{item.award},
|
</if>
|
<if test="item.content != null and item.content !='' " >
|
content=#{item.content},
|
</if>
|
<if test="item.imgsUrl != null and item.imgsUrl !='' " >
|
imgs_url=#{item.imgsUrl},
|
</if>
|
<if test="item.kind != null and item.kind !='' " >
|
kind=#{item.kind},
|
</if>
|
<if test="item.userId != null and item.userId !='' " >
|
user_id=#{item.userId},
|
</if>
|
<if test="item.communityId != null and item.communityId !='' " >
|
community_id=#{item.communityId},
|
</if>
|
<if test="item.status != null and item.status !='' " >
|
status=#{item.status},
|
</if>
|
<if test="item.isDisplay != null and item.isDisplay !='' " >
|
is_display=#{item.isDisplay},
|
</if>
|
update_time=sysdate()
|
</set>
|
where id = #{item.id}
|
</update>
|
|
<delete id="expurgateData" parameterType="String">
|
delete from new_fight_need_problem_inventory where id=#{id}
|
</delete>
|
|
|
<!-- <foreach collection="userIds" item="ids" index="index"-->
|
<!-- open="(" close=")" separator=",">-->
|
<!-- #{ids}-->
|
<!-- </foreach>-->
|
|
|
|
<select id="getTimeList" resultType="com.panzhihua.common.model.dtos.partybuilding.NeedProblemInventoryDTO">
|
SELECT
|
nfpi.id,
|
nfpi.claim_start_time,
|
nfpi.claim_end_time,
|
nfpi.need_start_time,
|
nfpi.need_end_time,
|
nfpi.status
|
FROM new_fight_need_problem_inventory as nfpi
|
where nfpi.status in (1,2)
|
|
</select>
|
|
<select id="getOpenIdList" resultType="string">
|
SELECT s.openid
|
FROM com_pb_member m
|
LEFT JOIN sys_user s on s.user_id=m.user_id
|
WHERE help_community_id=#{communityId}
|
</select>
|
|
|
</mapper>
|