<?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.ComActSocialWorkerDao">
|
|
<resultMap type="com.panzhihua.service_community.entity.ComActSocialWorker" id="ComActSocialWorkerBaseResultMap">
|
<result property="id" column="id"/>
|
<result property="socialOrgId" column="social_org_id"/>
|
<result property="name" column="name"/>
|
<result property="telephone" column="telephone"/>
|
<result property="gen" column="gen"/>
|
<result property="streetId" column="street_id"/>
|
<result property="communityId" column="community_id"/>
|
<result property="createBy" column="create_by"/>
|
<result property="createAt" column="create_at"/>
|
<result property="updateBy" column="update_by"/>
|
<result property="updateAt" column="update_at"/>
|
<result property="idCard" column="id_card"/>
|
<result property="skillType" column="skill_type"/>
|
<result property="joinTime" column="join_time"/>
|
<result property="address" column="address"/>
|
<result property="image" column="image"/>
|
</resultMap>
|
|
<!-- 分页查询 -->
|
<select id="findByPage" resultType="com.panzhihua.common.model.vos.civil.ComActSocialWorkerVO"
|
parameterType="com.panzhihua.common.model.dtos.civil.PageComActSocialWorkerDTO">
|
SELECT a.*,b.name as socialOrgId,c.name as communityName,e.name as streetId
|
FROM com_act_social_worker a
|
left join com_act_social_org b on a.social_org_id = b.id
|
left join com_act c on a.community_id = c.community_id
|
left join com_street e on c.street_id = e.street_id
|
<if test="pageComActSocialWorkerDTO.skillType != null">
|
JOIN mysql.help_topic h ON h.help_topic_id < ( length( a.skill_type ) - length( REPLACE ( a.skill_type, ',', '' ))+ 1 )
|
</if>
|
<where>
|
<if test="pageComActSocialWorkerDTO.skillType != null">
|
AND substring_index( substring_index( a.skill_type, ',', h.help_topic_id + 1 ), ',',- 1 ) = #{pageComActSocialWorkerDTO.skillType}
|
</if>
|
<if test="pageComActSocialWorkerDTO.id!=null">
|
AND a.id = #{pageComActSocialWorkerDTO.id}
|
</if>
|
<if test="pageComActSocialWorkerDTO.socialOrgId!=null">
|
AND a.social_org_id = #{pageComActSocialWorkerDTO.socialOrgId}
|
</if>
|
<if test="pageComActSocialWorkerDTO.name!=null and pageComActSocialWorkerDTO.name!=''">
|
AND a.name like concat('%',#{pageComActSocialWorkerDTO.name},'%')
|
</if>
|
<if test="pageComActSocialWorkerDTO.keyword!=null and pageComActSocialWorkerDTO.keyword!=''">
|
AND (a.name like concat('%',#{pageComActSocialWorkerDTO.keyword},'%') or a.telephone like
|
concat('%',#{pageComActSocialWorkerDTO.keyword},'%') )
|
</if>
|
<if test="pageComActSocialWorkerDTO.ageBegin!=null">
|
AND a.age>=#{pageComActSocialWorkerDTO.ageBegin}
|
</if>
|
<if test="pageComActSocialWorkerDTO.ageEnd!=null">
|
AND #{pageComActSocialWorkerDTO.ageEnd} >= a.age
|
</if>
|
<if test="pageComActSocialWorkerDTO.telephone!=null">
|
AND a.telephone = #{pageComActSocialWorkerDTO.telephone}
|
</if>
|
<if test="pageComActSocialWorkerDTO.gen!=null">
|
AND a.gen = #{pageComActSocialWorkerDTO.gen}
|
</if>
|
<if test="pageComActSocialWorkerDTO.streetId!=null">
|
AND e.street_id = #{pageComActSocialWorkerDTO.streetId}
|
</if>
|
<if test="pageComActSocialWorkerDTO.communityId!=null and pageComActSocialWorkerDTO.communityId!=0">
|
AND a.community_id = #{pageComActSocialWorkerDTO.communityId}
|
</if>
|
<if test="pageComActSocialWorkerDTO.createBy!=null">
|
AND a.create_by = #{pageComActSocialWorkerDTO.createBy}
|
</if>
|
<if test="pageComActSocialWorkerDTO.updateBy!=null">
|
AND a.update_by = #{pageComActSocialWorkerDTO.updateBy}
|
</if>
|
</where>
|
order by create_at desc
|
</select>
|
|
<select id="queryAll" resultType="com.panzhihua.common.model.dtos.civil.ComActSocialWorkerExcelVO">
|
SELECT a.social_org_id,a.name as
|
name,a.birthday,a.telephone,a.gen,a.social_worker_code,a.skill_field,a.business_scope,b.name as
|
socialOrgId,c.name as communityId,e.name as streetId
|
FROM com_act_social_worker a left join com_act_social_org b on a.social_org_id = b.id
|
left join com_act c on a.community_id = c.community_id
|
left join com_street e on a.street_id = e.street_id
|
<where>
|
<if test="socialOrgId!=null">
|
AND a.social_org_id = #{socialOrgId}
|
</if>
|
<if test="name!=null and name !=''">
|
AND a.name like concat('%',#{name},'%')
|
</if>
|
<if test="streetId!=null">
|
AND a.street_id = #{streetId}
|
</if>
|
<if test="communityId!=null and communityId!=0">
|
AND a.community_id = #{communityId}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectType" resultType="Integer">
|
select count(id) from com_act_social_worker where street_id = 15
|
<if test="type ==1">
|
and 30 >age
|
</if>
|
<if test="type ==2">
|
and 59 >=age and age >=30
|
</if>
|
<if test="type ==3">
|
and age >=60
|
</if>
|
<if test="communityId !=null">
|
and community_id=#{communityId}
|
</if>
|
</select>
|
|
<select id="selectSkillType"
|
resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenHmkProjectTypeInfo">
|
select count(*) count,t1.name from com_act_social_worker t INNER JOIN com_act_column t1 on t.skill_type = t1.id
|
where t.street_id = 15 <if test="communityId!=null">and t.community_id = #{communityId}</if> GROUP BY t1.id
|
</select>
|
|
<select id="selectActivity" resultType="com.panzhihua.common.model.vos.civil.ComActSocialWorkerVO">
|
select t.*
|
from com_act_social_worker t
|
LEFT JOIN sys_user t1 on t.telephone = t1.phone
|
where t1.user_id in (select distinct user_id from com_act_act_regist where activity_id = #{id})
|
</select>
|
|
<select id="selectOneById" resultType="com.panzhihua.common.model.vos.civil.ComActSocialWorkerVO">
|
SELECT a.*, b.name as socialOrgId, c.name as communityName, e.name as streetId
|
FROM com_act_social_worker a
|
left join com_act_social_org b on a.social_org_id = b.id
|
left join com_act c on a.community_id = c.community_id
|
left join com_street e on c.street_id = e.street_id
|
where a.id =#{id}
|
</select>
|
<select id="selectIncludeSkillWorkerList"
|
resultType="com.panzhihua.service_community.entity.ComActSocialWorker">
|
SELECT
|
a.*
|
FROM
|
com_act_social_worker a
|
JOIN mysql.help_topic b ON b.help_topic_id < ( length( a.skill_type ) - length( REPLACE ( a.skill_type, ',', '' ))+ 1 )
|
WHERE substring_index( substring_index( a.skill_type, ',', b.help_topic_id + 1 ), ',',- 1 ) = #{id}
|
</select>
|
</mapper>
|