Commit 114d53d5 by 高鹏

Merge branch 'feat-zyjmaster' into 'master'

合并

See merge request rays/pcloud-book!124
parents cb5aea14 101ca0cf
package com.pcloud.book.group.dao;
import com.pcloud.book.advertising.dto.GroupMasterDTO;
import com.pcloud.book.advertising.dto.WeixinClassifyInfoDTO;
import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.entity.GroupQrcode;
......@@ -208,6 +209,36 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
/**
* 根据分类id获取分类下的群---不分页
*/
/**
* 书下所有群
* @param bookId
* @return
*/
public List<Long> getIdsByBookId(Long bookId);
/**
* 群所属书id
* @param qrcodeId
* @return
*/
public Long getBookIdByGroupQrcodeId(Long qrcodeId);
/**
* 查书下群数量群人数
* @param bookId
* @return
*/
public Map<String, Object> getGroupCountUserCountByBookId(Long bookId);
/**
* 查询微信群广告标记列表
* @param map
* @return
*/
public List<GroupMasterDTO> listPageGroupMaster(Map<String, Object> map);
List<ClassifyQrcodeVO> getQrcodeByClassify(Long classifyId);
}
......@@ -2,6 +2,7 @@ package com.pcloud.book.group.dao.impl;
import com.google.common.collect.Maps;
import com.pcloud.book.advertising.dto.GroupMasterDTO;
import com.pcloud.book.advertising.dto.WeixinClassifyInfoDTO;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dto.*;
......@@ -203,4 +204,24 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
return this.getSqlSession().selectList(this.getStatement("getQrcodeByClassify"), classifyId);
}
@Override
public List<Long> getIdsByBookId(Long bookId) {
return getSessionTemplate().selectList(getStatement("getIdsByBookId"), bookId);
}
@Override
public Long getBookIdByGroupQrcodeId(Long qrcodeId) {
return getSessionTemplate().selectOne(getStatement("getBookIdByGroupQrcodeId"), qrcodeId);
}
@Override
public Map<String, Object> getGroupCountUserCountByBookId(Long bookId) {
return getSessionTemplate().selectOne(getStatement("getGroupCountUserCountByBookId"), bookId);
}
@Override
public List<GroupMasterDTO> listPageGroupMaster(Map<String, Object> map) {
return getSessionTemplate().selectList(getStatement("listPageGroupMaster"), map);
}
}
......@@ -343,4 +343,29 @@
update_time=now()
where id = #{bookGroupId} and is_delete = 0
</update>
<select id="listPageBook4AdMaster" parameterType="map" resultType="com.pcloud.book.advertising.dto.Book4AdvertisingMasterDTO">
SELECT
b.BOOK_ID bookId,
b.ISBN isbn,
b.BOOK_NAME bookName,
g.create_time createTime
FROM
book_group g
LEFT JOIN book b ON g.book_id = b.BOOK_ID
WHERE
g.is_delete = 0
AND b.IS_DELETE = 0
AND g.book_id != 0
<if test="name != null">
AND (
b.BOOK_NAME LIKE CONCAT('%', #{name},'%')
OR b.ISBN LIKE CONCAT('%', #{name},'%')
)
</if>
GROUP BY
g.book_id
ORDER BY
g.create_time DESC, g.id DESC
</select>
</mapper>
\ No newline at end of file
......@@ -543,6 +543,99 @@
id = #{qrcodeId}
</update>
<select id="listPageGroupMaster" parameterType="map" resultType="com.pcloud.book.advertising.dto.GroupMasterDTO">
SELECT
q.weixin_group_id wxGroupId,
q.id groupQrcodeId,
q.group_name groupName,
c.create_user adviserId,
b.BOOK_NAME bookName,
c.classify classify,
q.user_number userNumber,
q.qrcode_url qrcodeUrl,
bg.dep_label_id depLabelId,
bg.pro_label_id proLabelId,
bg.pur_label_id purLabelId,
q.create_time createTime,
t.create_time tagTime,
b.ISBN isbn
FROM
book_group_qrcode q
LEFT JOIN book_group_classify c ON c.id = q.classify_id
LEFT JOIN book b ON c.book_id = b.book_id
LEFT JOIN book_group bg ON c.book_group_id = bg.id
LEFT JOIN advertising_group_tag t ON q.id = t.group_qrcode_id
WHERE
c.create_user IS NOT NULL
AND c.is_delete = 0
AND q.is_delete = 0
AND b.IS_DELETE = 0
AND bg.is_delete = 0
<if test="name != null">
AND (
b.BOOK_NAME LIKE CONCAT('%', #{name},'%')
OR q.group_name LIKE CONCAT('%', #{name},'%')
OR c.classify LIKE CONCAT('%', #{name},'%')
)
</if>
<if test="query != null">
AND (
b.BOOK_NAME LIKE CONCAT('%', #{query},'%')
OR q.group_name LIKE CONCAT('%', #{query},'%')
OR b.ISBN LIKE CONCAT('%', #{query},'%')
)
</if>
<if test="depLabelId != null">
AND bg.dep_label_id = #{depLabelId}
</if>
<if test="proLabelId != null">
AND bg.pro_label_id = #{proLabelId}
</if>
<if test="purLabelId != null">
AND bg.pur_label_id = #{purLabelId}
</if>
<if test="masterId != null">
AND t.master_id = #{masterId}
</if>
<if test="startTime != null and endTime!= null">
AND t.create_time BETWEEN #{startTime} AND #{endTime}
</if>
GROUP BY q.id
ORDER BY
q.create_time DESC, q.id DESC
</select>
<select id="getIdsByBookId" resultType="long" parameterType="long">
SELECT
q.id
FROM
book_group_qrcode q
LEFT JOIN book_group_classify c ON q.classify_id = c.id
WHERE
c.book_id = #{bookId}
</select>
<select id="getBookIdByGroupQrcodeId" resultType="long" parameterType="long">
SELECT
c.book_id
FROM
book_group_qrcode q
LEFT JOIN book_group_classify c ON q.classify_id = c.id
WHERE
q.id = #{qrcodeId}
</select>
<select id="getGroupCountUserCountByBookId" resultType="map" parameterType="long">
SELECT
COUNT(q.id) groupCount,
IFNULL(SUM(q.user_number), 0) userNum
FROM
book_group_qrcode q
LEFT JOIN book_group_classify c ON q.classify_id = c.id
WHERE
c.book_id = #{bookId}
</select>
<select id="getQrcodeByClassify" parameterType="long" resultType="com.pcloud.book.group.vo.ClassifyQrcodeVO">
select id, classify_id classifyId, group_name groupName, user_number userNumber, weixin_group_id weixinGroupId, create_time createdTime
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment