烟台政务云平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

77 lines
2.9 KiB

<?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.epmet.modules.group.dao.ResiGroupStatisticalDao">
<sql id="sql">
rgs.id AS "id",
rgs.resi_group_id AS "resiGroupId",
rgs.total_members AS "totalMembers",
rgs.total_topics AS "totalTopics",
rgs.total_issues AS "totalIssues",
rgs.total_party_members AS "totalPartyMembers",
rgs.total_earnest_memebers AS "totalEarnestMemebers",
rgs.total_normal_memebers AS "totalNormalMemebers",
rgs.del_flag AS "delFlag",
rgs.revision AS "revision",
rgs.created_by AS "createdBy",
rgs.created_time AS "createdTime",
rgs.updated_by AS "updatedBy",
rgs.updated_time AS "updatedTime"
</sql>
<select id="selectByResiGroupId" resultType="com.epmet.modules.group.entity.ResiGroupStatisticalEntity">
SELECT
<include refid="sql"></include>
FROM resi_group_statistical rgs
WHERE rgs.del_flag = '0'
AND rgs.resi_group_id = #{resiGroupId}
</select>
<!-- 总议题数+1 -->
<update id="incryTotalIssues" parameterType="string">
UPDATE resi_group_statistical
SET TOTAL_ISSUES = TOTAL_ISSUES + 1
WHERE
RESI_GROUP_ID = #{groupId}
AND DEL_FLAG = '0'
</update>
<!-- 批量更新组里的党员数、热心居民数 -->
<update id="incryResiRoleMembersBatch" parameterType="list">
update resi_group_statistical
<trim prefix="set" suffixOverrides=",">
<trim prefix="TOTAL_PARTY_MEMBERS= (case" suffix="end),">
<foreach collection="list" item="i" index="index">
<if test='i.partyFlag == "1"'>
when RESI_GROUP_ID=#{i.groupId} then TOTAL_PARTY_MEMBERS +1
</if>
</foreach>
</trim>
<trim prefix=" TOTAL_EARNEST_MEMEBERS =(case" suffix="end),">
<foreach collection="list" item="i" index="index">
<if test='i.warmFlag == "1"'>
when RESI_GROUP_ID=#{i.groupId} then TOTAL_EARNEST_MEMEBERS + 1
</if>
</foreach>
</trim>
<trim prefix="updated_by =(case" suffix="end)," >
<foreach collection="list" item="i" index="index">
<if test="i.updatedBy!=null">
when RESI_GROUP_ID=#{i.groupId} then #{i.updatedBy}
</if>
</foreach>
</trim>
updated_time = now()
</trim>
where
DEL_FLAG = '0'
<trim prefix="AND ( " suffix=" )">
<foreach collection="list" separator="or" item="i" index="index" >
RESI_GROUP_ID=#{i.groupId}
</foreach>
</trim>
</update>
</mapper>