<?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.ComActSocialProjectDao">
|
|
<resultMap type="com.panzhihua.service_community.entity.ComActSocialProject" id="ComActSocialProjectBaseResultMap">
|
<result property="id" column="id"/>
|
<result property="name" column="name"/>
|
<result property="type" column="type"/>
|
<result property="status" column="status"/>
|
<result property="createTime" column="create_time"/>
|
<result property="communityId" column="community_id"/>
|
<result property="streetId" column="street_id"/>
|
<result property="responsibility" column="responsibility"/>
|
<result property="parentId" column="parent_id"/>
|
<result property="url" column="url"/>
|
<result property="image" column="image"/>
|
<result property="content" column="content"/>
|
</resultMap>
|
|
<select id="pageList" resultType="com.panzhihua.common.model.vos.community.social.SocialProjectVO">
|
select t.*,t1.name as columnName,t2.name as secondColumnName from com_act_social_project t
|
left join com_act_column t1 on t.column_id = t1.id
|
left join com_act_column t2 on t.second_column_id = t2.id
|
<where>
|
1=1
|
<if test="commonPage.paramId2==null">
|
<if test="commonPage.communityId !=0 and commonPage.communityId !=null">
|
and (t.community_id =#{commonPage.communityId} or t.responsibility_id =#{commonPage.communityId})
|
</if>
|
<if test="commonPage.streetId !=0 and commonPage.streetId !=null">
|
and t.street_id =#{commonPage.streetId}
|
</if>
|
</if>
|
<if test="commonPage.paramId2!=null">
|
and (t.street_id = #{commonPage.streetId} or t.community_id =#{commonPage.communityId})
|
</if>
|
<if test="commonPage.status !=null">
|
and t.status =#{commonPage.status}
|
</if>
|
<if test="commonPage.type !=null">
|
and t.type =#{commonPage.type}
|
</if>
|
<if test="commonPage.keyword !=null and commonPage.keyword !=''">
|
and (t.name like concat('%',#{commonPage.keyword},'%') or responsibility like
|
concat('%',#{commonPage.keyword},'%') )
|
</if>
|
<if test="commonPage.beginTime !=null">
|
and t.create_time >= #{commonPage.beginTime}
|
</if>
|
<if test="commonPage.endTime !=null">
|
and #{commonPage.endTime} >= t.create_time
|
</if>
|
<if test="commonPage.paramId!=null and commonPage.paramId !=0">
|
and t.parent_id = #{commonPage.paramId}
|
</if>
|
<if test="commonPage.paramId ==0 and commonPage.streetId!=null">
|
and t.parent_id = #{commonPage.paramId}
|
</if>
|
<if test="commonPage.columnId !=null">
|
and t.column_id = #{commonPage.columnId}
|
</if>
|
<if test="commonPage.columnId !=null">
|
and t.column_id = #{commonPage.columnId}
|
</if>
|
<if test="commonPage.secondColumnId !=null">
|
and t.second_column_id = #{commonPage.secondColumnId}
|
</if>
|
</where>
|
order by t.create_time desc
|
</select>
|
|
<select id="getByApplet" resultType="com.panzhihua.common.model.vos.community.social.SocialProjectVO">
|
select t.*, t1.phone as streetPhone, t2.name as columnName, t3.name as secondColumnName,t1.name as streetName,t4.name as communityName,t4.contacts_phone as communityPhone
|
from com_act_social_project t
|
LEFT JOIN com_street t1 on t.street_id = t1.street_id
|
LEFT JOIN com_act_column t2 on t.column_id = t2.id
|
LEFT JOIN com_act_column t3 on t.second_column_id = t3.id
|
LEFT JOIN com_act t4 on t.community_id = t4.community_id
|
where t.id = #{id}
|
</select>
|
|
<select id="selectBaseInfo" resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenHmkProjectInfo">
|
select (select count(*) from com_act_social_project where street_id =15 <if test="communityId!=null">and
|
community_id = #{communityId}</if>) count,
|
(select count(*) from com_act_social_project where street_id =15 and status >=2 <if test="communityId!=null">and
|
community_id = #{communityId}</if>) assigned,
|
(select count(*) from com_act_social_project where street_id =15 and 1 >=status <if test="communityId!=null">and
|
community_id = #{communityId}</if>) assign
|
</select>
|
|
<select id="selectType" resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenHmkProjectTypeInfo">
|
select count(id) as count,type as name from com_act_social_project where street_id = 15
|
<if test="orgName !=null and orgName!=''">
|
and responsibility=#{orgName}
|
</if>
|
<if test="communityId !=null">
|
and community_id=#{communityId}
|
</if>
|
GROUP BY type
|
</select>
|
|
<select id="selectActivity" resultType="integer">
|
select count(*) from com_act_activity
|
<where>
|
is_project = 1
|
<if test="type =1">
|
and volunteer_max > 0
|
</if>
|
<if test="type =2">
|
and volunteer_max = 0
|
</if>
|
<if test="communityId !=null">
|
and community_id = #{communityId}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectIndexBaseInfo"
|
resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenHmkBaseInfo">
|
select (select count(*) from com_act_social_project where street_id = 15) projectCount,
|
(select count(*) from com_act_activity where is_project = 1) activityCount,
|
(select count(*) from com_act_social_worker where street_id = 15) socialWorkerCount,
|
(select count(*) from com_mng_population where street_id = 15) userCount,
|
(select count(*) from com_act_social_org where street_id = 15) socialOrgCount,
|
(select count(*) from com_act_social_worker_service) serviceCount
|
</select>
|
|
<select id="selectActivityCountMonth"
|
resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenActivityLine">
|
select (select count(id) from com_act_activity where status!=6 and is_project = 1 and publish_at >= DATE_FORMAT( CONCAT(#{year}, '-',
|
#{date}, '-00'), '%Y-%m-00 00:00:00') and DATE_FORMAT( LAST_DAY(CONCAT(
|
#{year}, '-',
|
#{date}, '-00')), '%Y-%m-%d 23:59:59') >=publish_at) y,
|
(
|
select count(id)
|
from com_act_activity
|
where status!=6
|
and is_project = 1
|
and DATE_FORMAT( LAST_DAY(CONCAT(#{year}
|
, '-'
|
, #{date}
|
, '-00'))
|
, '%Y-%m-%d 23:59:59') >=publish_at) countY
|
</select>
|
|
<select id="selectByLevel" resultType="com.panzhihua.common.model.vos.community.social.SocialProjectVO">
|
select t.*, t1.name as columnName, t2.name as secondColumnName
|
from com_act_social_project t
|
left join com_act_column t1 on t.column_id = t1.id
|
left join com_act_column t2 on t.second_column_id = t2.id
|
where t.id = #{id}
|
</select>
|
</mapper>
|