短剧新需求
This commit is contained in:
parent
3ffe266b0c
commit
d2279ff182
|
|
@ -14,6 +14,8 @@ import java.util.List;
|
|||
*/
|
||||
@Mapper
|
||||
public interface ExtSysDao {
|
||||
long commonCount(@Param("keywords") String keywords);
|
||||
|
||||
List<InviteFriendDTO> findInviteFriendList(@Param("keywords") String keywords);
|
||||
|
||||
List<SignInNumDTO> findInviteSignInList(@Param("userId") Long userId);
|
||||
|
|
|
|||
|
|
@ -82,8 +82,9 @@ public class ExtSysServiceImpl implements ExtSysService {
|
|||
|
||||
@Override
|
||||
public PageUtils queryInviteFriendRecord(Integer page, Integer limit, String keywords) {
|
||||
String countSql = sqlFetcher.getSqlFromXml("com.sqx.modules.ext.dao.ExtSysDao.commonCount", keywords);
|
||||
int totalCount = getTotalCount(countSql);
|
||||
String sql = sqlFetcher.getSqlFromXml("com.sqx.modules.ext.dao.ExtSysDao.findInviteFriendList", keywords);
|
||||
int totalCount = getTotalCount(sql);
|
||||
List<InviteFriendDTO> list = getQueryList(sql, InviteFriendDTO.class, totalCount, page, limit);
|
||||
return new PageUtils(list, totalCount, limit, page);
|
||||
}
|
||||
|
|
@ -91,7 +92,7 @@ public class ExtSysServiceImpl implements ExtSysService {
|
|||
@Override
|
||||
public PageUtils queryInviteSignInRecord(Integer page, Integer limit, Long userId) {
|
||||
String sql = sqlFetcher.getSqlFromXml("com.sqx.modules.ext.dao.ExtSysDao.findInviteSignInList", userId);
|
||||
int totalCount = getTotalCount(sql);
|
||||
int totalCount = getFullTotalCount(sql);
|
||||
List<SignInNumDTO> list = getQueryList(sql, SignInNumDTO.class, totalCount, page, limit);
|
||||
return new PageUtils(list, totalCount, limit, page);
|
||||
}
|
||||
|
|
@ -99,15 +100,16 @@ public class ExtSysServiceImpl implements ExtSysService {
|
|||
@Override
|
||||
public PageUtils queryInviteAwardDetailRecord(Integer page, Integer limit, Long userId) {
|
||||
String sql = sqlFetcher.getSqlFromXml("com.sqx.modules.ext.dao.ExtSysDao.findInviteAwardDetailList", userId);
|
||||
int totalCount = getTotalCount(sql);
|
||||
int totalCount = getFullTotalCount(sql);
|
||||
List<InviteAwardDTO> list = getQueryList(sql, InviteAwardDTO.class, totalCount, page, limit);
|
||||
return new PageUtils(list, totalCount, limit, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils queryLotteryCountPage(Integer page, Integer limit, String keywords) {
|
||||
String countSql = sqlFetcher.getSqlFromXml("com.sqx.modules.ext.dao.ExtSysDao.commonCount", keywords);
|
||||
int totalCount = getTotalCount(countSql);
|
||||
String sql = sqlFetcher.getSqlFromXml("com.sqx.modules.ext.dao.ExtSysDao.findLotteryCountList", keywords);
|
||||
int totalCount = getTotalCount(sql);
|
||||
List<LotteryCountQueryDTO> list = getQueryList(sql, LotteryCountQueryDTO.class, totalCount, page, limit);
|
||||
return new PageUtils(list, totalCount, limit, page);
|
||||
}
|
||||
|
|
@ -115,13 +117,20 @@ public class ExtSysServiceImpl implements ExtSysService {
|
|||
@Override
|
||||
public PageUtils queryLotteryDetailPage(Integer page, Integer limit, Long userId) {
|
||||
String sql = sqlFetcher.getSqlFromXml("com.sqx.modules.ext.dao.ExtSysDao.findLotteryDetailPage", userId);
|
||||
int totalCount = getTotalCount(sql);
|
||||
int totalCount = getFullTotalCount(sql);
|
||||
List<LotteryDetailDTO> list = getQueryList(sql, LotteryDetailDTO.class, totalCount, page, limit);
|
||||
return new PageUtils(list, totalCount, limit, page);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private int getTotalCount(String sql) {
|
||||
private int getTotalCount(String countSql) {
|
||||
System.out.println("CountSQL:" + countSql);
|
||||
Number count = Db.use(profiles).queryNumber(countSql);
|
||||
return count.intValue();
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private int getFullTotalCount(String sql) {
|
||||
String countSql = StrUtil.format("select count(*) from ({}) as tmp", sql);
|
||||
System.out.println("CountSQL:" + countSql);
|
||||
Number count = Db.use(profiles).queryNumber(countSql);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,29 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.sqx.modules.ext.dao.ExtSysDao">
|
||||
|
||||
<sql id="commonCountSql">
|
||||
<where>
|
||||
<if test="keywords != null and keywords != ''">
|
||||
and (t1.user_name = '${keywords}' or t1.phone = '${keywords}')
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
<select id="commonCount" resultType="java.lang.Long">
|
||||
select
|
||||
sum(count)
|
||||
from (
|
||||
SELECT count(1) as count from `duanju-0`.tb_user t1 <include refid="commonCountSql"/>
|
||||
union
|
||||
SELECT count(1) as count from `duanju-1`.tb_user t1 <include refid="commonCountSql"/>
|
||||
union
|
||||
SELECT count(1) as count from `duanju-2`.tb_user t1 <include refid="commonCountSql"/>
|
||||
union
|
||||
SELECT count(1) as count from `duanju-3`.tb_user t1 <include refid="commonCountSql"/>
|
||||
union
|
||||
SELECT count(1) as count from `duanju-4`.tb_user t1 <include refid="commonCountSql"/>
|
||||
) t
|
||||
</select>
|
||||
|
||||
<select id="findInviteFriendList" resultType="com.sqx.modules.ext.dto.InviteFriendDTO">
|
||||
select
|
||||
t1.user_id as userId,
|
||||
|
|
@ -92,4 +115,6 @@
|
|||
where t1.user_id = ${userId}
|
||||
order by t1.id desc
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue