<?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.ComActNeighborCircleTopicWestMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActNeighborCircleTopicWestDO">
|
<id column="id" property="id" />
|
<result column="community_id" property="communityId" />
|
<result column="name" property="name" />
|
<result column="status" property="status" />
|
<result column="create_at" property="createAt" />
|
<result column="create_by" property="createBy" />
|
<result column="count" property="count" />
|
<result column="hot_num" property="hotNum" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, community_id, name, status, create_at, create_by, count, hot_num
|
</sql>
|
|
<select id="pageNeighborTopicByAdmin" parameterType="com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleTopicAdminDTO"
|
resultType="com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleTopicAdminVO">
|
SELECT
|
canct.id,
|
canct.`name`,
|
canct.`status`,
|
canct.create_at,
|
( SELECT count( id ) FROM com_act_neighbor_circle_west WHERE is_del = 2 AND `status` = 2 and topic_id = canct.id) AS `count`,
|
su.`name` as createBy
|
FROM
|
com_act_neighbor_circle_topic_west AS canct
|
LEFT JOIN sys_user AS su ON su.user_id = canct.create_by
|
<where>
|
canct.belong_type = 1
|
<if test="circleTopicAdminDTO.communityId != null">
|
and canct.community_id = ${circleTopicAdminDTO.communityId}
|
</if>
|
<if test="circleTopicAdminDTO.status != null">
|
and canct.status = #{circleTopicAdminDTO.status}
|
</if>
|
<if test="circleTopicAdminDTO.name != null and circleTopicAdminDTO.name != """>
|
and canct.name like concat(#{circleTopicAdminDTO.name},'%')
|
</if>
|
</where>
|
order by canct.create_at desc
|
</select>
|
|
<select id="getNeighborTopicByApp" resultType="com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleTopicAppVO">
|
SELECT canct.id, canct.`name`, canct.hot_num,( SELECT count( id ) FROM com_act_neighbor_circle_west WHERE is_del = 2 AND `status` = 2 and topic_id = canct.id) AS `count`
|
from com_act_neighbor_circle_topic_west as canct where canct.`status` = 1 and canct.community_id = ${communityId} AND canct.belong_type = 1
|
<if test="isZero != null and isZero == 1">
|
and `count` > 0
|
</if>
|
<if test="name != null and name != """>
|
and canct.`name` like concat('%',#{name},'%')
|
</if>
|
order by `count` desc
|
</select>
|
|
<update id="addHotNum">
|
update com_act_neighbor_circle_topic_west set hot_num = hot_num + #{hotNum} where id = #{circleTopicId}
|
</update>
|
|
<update id="addCount">
|
update com_act_neighbor_circle_topic_west set `count` = `count` + 1 where id = #{circleTopicId}
|
</update>
|
</mapper>
|