✨ 仪表盘界面新增文章/用户/银行账户新增信息列表功能
This commit is contained in:
parent
8f7ddddc44
commit
28641bb942
@ -9,7 +9,8 @@ import java.util.Arrays;
|
|||||||
public enum TransactionEnum {
|
public enum TransactionEnum {
|
||||||
ArticleSponsor("0", 20, "文章赞赏"),
|
ArticleSponsor("0", 20, "文章赞赏"),
|
||||||
Answer("1", 30, "答题奖励"),
|
Answer("1", 30, "答题奖励"),
|
||||||
CorrectAnswer("2", 50, "答题奖励");
|
CorrectAnswer("2", 50, "答题奖励"),
|
||||||
|
NewbieRewards("3", 200, "新手奖励");
|
||||||
|
|
||||||
private String dataType;
|
private String dataType;
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package com.rymcu.forest.mapper;
|
package com.rymcu.forest.mapper;
|
||||||
|
|
||||||
|
import com.rymcu.forest.dto.ArticleDTO;
|
||||||
|
import com.rymcu.forest.dto.BankAccountDTO;
|
||||||
|
import com.rymcu.forest.dto.UserInfoDTO;
|
||||||
import com.rymcu.forest.dto.admin.DashboardData;
|
import com.rymcu.forest.dto.admin.DashboardData;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -63,18 +66,38 @@ public interface DashboardMapper {
|
|||||||
List<DashboardData> selectLastThirtyDaysVisitData();
|
List<DashboardData> selectLastThirtyDaysVisitData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* 获取历史 1 年文章数据
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DashboardData> selectHistoryArticleData();
|
List<DashboardData> selectHistoryArticleData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 获取历史 1 年用户数据
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DashboardData> selectHistoryUserData();
|
List<DashboardData> selectHistoryUserData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 获取历史 1 年访问数据
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DashboardData> selectHistoryVisitData();
|
List<DashboardData> selectHistoryVisitData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新增用户列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<UserInfoDTO> selectNewUsers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新增银行账号列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<BankAccountDTO> selectNewBankAccounts();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新增文章列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ArticleDTO> selectNewArticles();
|
||||||
}
|
}
|
||||||
|
@ -37,4 +37,11 @@ public interface TransactionRecordMapper extends Mapper<TransactionRecord> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean existsWithBankAccountAndFunds(@Param("bankAccount") String bankAccount, @Param("funds") String funds);
|
Boolean existsWithBankAccountAndFunds(@Param("bankAccount") String bankAccount, @Param("funds") String funds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询是否已发放
|
||||||
|
* @param bankAccount
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean existsWithNewbieRewards(@Param("bankAccount") String bankAccount);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
package com.rymcu.forest.service;
|
package com.rymcu.forest.service;
|
||||||
|
|
||||||
|
import com.rymcu.forest.dto.ArticleDTO;
|
||||||
|
import com.rymcu.forest.dto.BankAccountDTO;
|
||||||
|
import com.rymcu.forest.dto.UserInfoDTO;
|
||||||
import com.rymcu.forest.dto.admin.Dashboard;
|
import com.rymcu.forest.dto.admin.Dashboard;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,4 +30,21 @@ public interface DashboardService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Map history();
|
Map history();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新增用户列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<UserInfoDTO> newUsers();
|
||||||
|
|
||||||
|
/**获取新增银行账号列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<BankAccountDTO> newBankAccounts();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新增文章列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ArticleDTO> newArticles();
|
||||||
}
|
}
|
||||||
|
@ -46,4 +46,12 @@ public interface TransactionRecordService extends Service<TransactionRecord> {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
TransactionRecord bankTransfer(Integer idUser, TransactionEnum transactionType) throws Exception;
|
TransactionRecord bankTransfer(Integer idUser, TransactionEnum transactionType) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发放新手奖励
|
||||||
|
* @param transactionRecord
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
TransactionRecord newbieRewards(TransactionRecord transactionRecord) throws Exception;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
package com.rymcu.forest.service.impl;
|
package com.rymcu.forest.service.impl;
|
||||||
|
|
||||||
|
import com.rymcu.forest.dto.ArticleDTO;
|
||||||
|
import com.rymcu.forest.dto.ArticleTagDTO;
|
||||||
|
import com.rymcu.forest.dto.BankAccountDTO;
|
||||||
|
import com.rymcu.forest.dto.UserInfoDTO;
|
||||||
import com.rymcu.forest.dto.admin.Dashboard;
|
import com.rymcu.forest.dto.admin.Dashboard;
|
||||||
import com.rymcu.forest.dto.admin.DashboardData;
|
import com.rymcu.forest.dto.admin.DashboardData;
|
||||||
|
import com.rymcu.forest.mapper.ArticleMapper;
|
||||||
import com.rymcu.forest.mapper.DashboardMapper;
|
import com.rymcu.forest.mapper.DashboardMapper;
|
||||||
import com.rymcu.forest.service.DashboardService;
|
import com.rymcu.forest.service.DashboardService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -18,6 +23,8 @@ public class DashboardServiceImpl implements DashboardService {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DashboardMapper dashboardMapper;
|
private DashboardMapper dashboardMapper;
|
||||||
|
@Resource
|
||||||
|
private ArticleMapper articleMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dashboard dashboard() {
|
public Dashboard dashboard() {
|
||||||
@ -46,7 +53,6 @@ public class DashboardServiceImpl implements DashboardService {
|
|||||||
while (now.isAfter(localDate)) {
|
while (now.isAfter(localDate)) {
|
||||||
String date = localDate.toString();
|
String date = localDate.toString();
|
||||||
dates.add(date);
|
dates.add(date);
|
||||||
|
|
||||||
articles.forEach(article->{
|
articles.forEach(article->{
|
||||||
if (date.equals(article.getLabel())) {
|
if (date.equals(article.getLabel())) {
|
||||||
articleData.add(article.getValue());
|
articleData.add(article.getValue());
|
||||||
@ -88,7 +94,7 @@ public class DashboardServiceImpl implements DashboardService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map history() {
|
public Map history() {
|
||||||
Map map = new HashMap(4);
|
Map<String, Object> map = new HashMap(4);
|
||||||
ArrayList<String> dates = new ArrayList(30);
|
ArrayList<String> dates = new ArrayList(30);
|
||||||
ArrayList<Integer> articleData = new ArrayList(30);
|
ArrayList<Integer> articleData = new ArrayList(30);
|
||||||
ArrayList<Integer> userData = new ArrayList(30);
|
ArrayList<Integer> userData = new ArrayList(30);
|
||||||
@ -177,4 +183,24 @@ public class DashboardServiceImpl implements DashboardService {
|
|||||||
map.put("visits", visitData);
|
map.put("visits", visitData);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserInfoDTO> newUsers() {
|
||||||
|
return dashboardMapper.selectNewUsers();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BankAccountDTO> newBankAccounts() {
|
||||||
|
return dashboardMapper.selectNewBankAccounts();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ArticleDTO> newArticles() {
|
||||||
|
List<ArticleDTO> list = dashboardMapper.selectNewArticles();
|
||||||
|
list.forEach(article -> {
|
||||||
|
List<ArticleTagDTO> tags = articleMapper.selectTags(article.getIdArticle());
|
||||||
|
article.setTags(tags);
|
||||||
|
});
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,20 @@ public class TransactionRecordServiceImpl extends AbstractService<TransactionRec
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TransactionRecord newbieRewards(TransactionRecord transactionRecord) throws Exception {
|
||||||
|
// 判断是否重复发放
|
||||||
|
Boolean result = transactionRecordMapper.existsWithNewbieRewards(transactionRecord.getToBankAccount());
|
||||||
|
if (result) {
|
||||||
|
return transactionRecord;
|
||||||
|
}
|
||||||
|
BankAccount formBankAccount = bankAccountService.findSystemBankAccount();
|
||||||
|
transactionRecord.setFormBankAccount(formBankAccount.getBankAccount());
|
||||||
|
transactionRecord.setMoney(new BigDecimal(TransactionEnum.NewbieRewards.getMoney()));
|
||||||
|
transactionRecord.setFunds(TransactionEnum.NewbieRewards.getDescription());
|
||||||
|
return transfer(transactionRecord);
|
||||||
|
}
|
||||||
|
|
||||||
private String nextTransactionNo() {
|
private String nextTransactionNo() {
|
||||||
String orderNo = "E";
|
String orderNo = "E";
|
||||||
String key = "orderId";
|
String key = "orderId";
|
||||||
|
@ -1,14 +1,23 @@
|
|||||||
package com.rymcu.forest.web.api.admin;
|
package com.rymcu.forest.web.api.admin;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.rymcu.forest.core.result.GlobalResult;
|
import com.rymcu.forest.core.result.GlobalResult;
|
||||||
import com.rymcu.forest.core.result.GlobalResultGenerator;
|
import com.rymcu.forest.core.result.GlobalResultGenerator;
|
||||||
|
import com.rymcu.forest.dto.ArticleDTO;
|
||||||
|
import com.rymcu.forest.dto.BankAccountDTO;
|
||||||
|
import com.rymcu.forest.dto.UserInfoDTO;
|
||||||
import com.rymcu.forest.dto.admin.Dashboard;
|
import com.rymcu.forest.dto.admin.Dashboard;
|
||||||
import com.rymcu.forest.service.DashboardService;
|
import com.rymcu.forest.service.DashboardService;
|
||||||
|
import com.rymcu.forest.util.Utils;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,4 +47,43 @@ public class DashboardController {
|
|||||||
Map map = dashboardService.history();
|
Map map = dashboardService.history();
|
||||||
return GlobalResultGenerator.genSuccessResult(map);
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/new-users")
|
||||||
|
public GlobalResult newUsers(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows) {
|
||||||
|
PageHelper.startPage(page, rows);
|
||||||
|
List<UserInfoDTO> list = dashboardService.newUsers();
|
||||||
|
PageInfo<UserInfoDTO> pageInfo = new PageInfo<>(list);
|
||||||
|
Map<String, Object> map = new HashMap<String, Object>(2);
|
||||||
|
map.put("users", pageInfo.getList());
|
||||||
|
Map pagination = Utils.getPagination(pageInfo);
|
||||||
|
map.put("pagination", pagination);
|
||||||
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/new-bank-accounts")
|
||||||
|
public GlobalResult newBankAccounts(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows) {
|
||||||
|
PageHelper.startPage(page, rows);
|
||||||
|
List<BankAccountDTO> list = dashboardService.newBankAccounts();
|
||||||
|
PageInfo<BankAccountDTO> pageInfo = new PageInfo(list);
|
||||||
|
Map map = new HashMap(2);
|
||||||
|
map.put("bankAccounts", pageInfo.getList());
|
||||||
|
Map pagination = new HashMap(4);
|
||||||
|
pagination.put("pageSize", pageInfo.getPageSize());
|
||||||
|
pagination.put("total", pageInfo.getTotal());
|
||||||
|
pagination.put("currentPage", pageInfo.getPageNum());
|
||||||
|
map.put("pagination", pagination);
|
||||||
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/new-articles")
|
||||||
|
public GlobalResult newArticles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows) {
|
||||||
|
PageHelper.startPage(page, rows);
|
||||||
|
List<ArticleDTO> list = dashboardService.newArticles();
|
||||||
|
PageInfo<ArticleDTO> pageInfo = new PageInfo<>(list);
|
||||||
|
Map<String, Object> map = new HashMap<>(2);
|
||||||
|
map.put("articles", pageInfo.getList());
|
||||||
|
Map pagination = Utils.getPagination(pageInfo);
|
||||||
|
map.put("pagination", pagination);
|
||||||
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,4 +27,10 @@ public class TransactionRecordController {
|
|||||||
return GlobalResultGenerator.genSuccessResult(transactionRecord);
|
return GlobalResultGenerator.genSuccessResult(transactionRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/newbie-rewards")
|
||||||
|
public GlobalResult newbieRewards(@RequestBody TransactionRecord transactionRecord) throws Exception {
|
||||||
|
transactionRecord = transactionRecordService.newbieRewards(transactionRecord);
|
||||||
|
return GlobalResultGenerator.genSuccessResult(transactionRecord);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,46 +5,133 @@
|
|||||||
<result column="label" property="label"></result>
|
<result column="label" property="label"></result>
|
||||||
<result column="value" property="value"></result>
|
<result column="value" property="value"></result>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
<resultMap id="UserInfoResultMapper" type="com.rymcu.forest.dto.UserInfoDTO">
|
||||||
|
<result column="id" property="idUser"/>
|
||||||
|
<result column="account" property="account"/>
|
||||||
|
<result column="nickname" property="nickname"/>
|
||||||
|
<result column="sex" property="sex"/>
|
||||||
|
<result column="avatar_type" property="avatarType"/>
|
||||||
|
<result column="avatar_url" property="avatarUrl"/>
|
||||||
|
<result column="email" property="email"/>
|
||||||
|
<result column="phone" property="phone"/>
|
||||||
|
<result column="status" property="status"/>
|
||||||
|
<result column="last_login_time" property="lastLoginTime"/>
|
||||||
|
<result column="last_online_time" property="lastOnlineTime"/>
|
||||||
|
<result column="created_time" property="createdTime"/>
|
||||||
|
<result column="signature" property="signature"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="BankAccountResultMap" type="com.rymcu.forest.dto.BankAccountDTO">
|
||||||
|
<result column="id" property="idBankAccount"></result>
|
||||||
|
<result column="id_bank" property="idBank"></result>
|
||||||
|
<result column="bank_name" property="bankName"></result>
|
||||||
|
<result column="bank_account" property="bankAccount"></result>
|
||||||
|
<result column="account_balance" property="accountBalance"></result>
|
||||||
|
<result column="account_owner" property="accountOwner"></result>
|
||||||
|
<result column="account_owner_name" property="accountOwnerName"></result>
|
||||||
|
<result column="created_time" property="createdTime"></result>
|
||||||
|
</resultMap>
|
||||||
|
<resultMap id="ArticleResultMap" type="com.rymcu.forest.dto.ArticleDTO">
|
||||||
|
<result column="id" property="idArticle"></result>
|
||||||
|
<result column="article_title" property="articleTitle"></result>
|
||||||
|
<result column="article_permalink" property="articlePermalink"></result>
|
||||||
|
<result column="created_time" property="updatedTime"></result>
|
||||||
|
<result column="article_perfect" property="articlePerfect"></result>
|
||||||
|
<result column="article_status" property="articleStatus"></result>
|
||||||
|
<result column="article_tags" property="articleTags"></result>
|
||||||
|
</resultMap>
|
||||||
<select id="selectUserCount" resultType="java.lang.Integer">
|
<select id="selectUserCount" resultType="java.lang.Integer">
|
||||||
select count(*) from forest_user
|
select count(*)
|
||||||
|
from forest_user
|
||||||
</select>
|
</select>
|
||||||
<select id="selectNewUserCount" resultType="java.lang.Integer">
|
<select id="selectNewUserCount" resultType="java.lang.Integer">
|
||||||
select count(*) from forest_user where created_time > str_to_date(date_format(sysdate(),'%Y-%m-%d'),'%Y-%m-%d')
|
select count(*)
|
||||||
|
from forest_user
|
||||||
|
where created_time > str_to_date(date_format(sysdate(), '%Y-%m-%d'), '%Y-%m-%d')
|
||||||
</select>
|
</select>
|
||||||
<select id="selectArticleCount" resultType="java.lang.Integer">
|
<select id="selectArticleCount" resultType="java.lang.Integer">
|
||||||
select count(*) from forest_article
|
select count(*)
|
||||||
|
from forest_article
|
||||||
</select>
|
</select>
|
||||||
<select id="selectNewArticleCount" resultType="java.lang.Integer">
|
<select id="selectNewArticleCount" resultType="java.lang.Integer">
|
||||||
select count(*) from forest_article where created_time > str_to_date(date_format(sysdate(),'%Y-%m-%d'),'%Y-%m-%d') and article_status = 0
|
select count(*)
|
||||||
|
from forest_article
|
||||||
|
where created_time > str_to_date(date_format(sysdate(), '%Y-%m-%d'), '%Y-%m-%d')
|
||||||
|
and article_status = 0
|
||||||
</select>
|
</select>
|
||||||
<select id="selectCountViewNum" resultType="java.lang.Integer">
|
<select id="selectCountViewNum" resultType="java.lang.Integer">
|
||||||
select count(*) from forest_visit
|
select count(*)
|
||||||
|
from forest_visit
|
||||||
</select>
|
</select>
|
||||||
<select id="selectTodayViewNum" resultType="java.lang.Integer">
|
<select id="selectTodayViewNum" resultType="java.lang.Integer">
|
||||||
select count(*) from forest_visit where created_time > str_to_date(date_format(sysdate(),'%Y-%m-%d'),'%Y-%m-%d')
|
select count(*)
|
||||||
|
from forest_visit
|
||||||
|
where created_time > str_to_date(date_format(sysdate(), '%Y-%m-%d'), '%Y-%m-%d')
|
||||||
</select>
|
</select>
|
||||||
<select id="selectLastThirtyDaysArticleData" resultMap="DashboardDataResultMap">
|
<select id="selectLastThirtyDaysArticleData" resultMap="DashboardDataResultMap">
|
||||||
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label from forest_article
|
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label
|
||||||
where created_time > str_to_date(date_format(date_sub(sysdate(),interval + 30 day),'%Y-%m-%d'),'%Y-%m-%d') and article_status = 0 GROUP BY date_format(created_time, '%Y-%m-%d')
|
from forest_article
|
||||||
|
where created_time > str_to_date(date_format(date_sub(sysdate(), interval + 30 day), '%Y-%m-%d'), '%Y-%m-%d')
|
||||||
|
and article_status = 0
|
||||||
|
GROUP BY date_format(created_time, '%Y-%m-%d')
|
||||||
</select>
|
</select>
|
||||||
<select id="selectLastThirtyDaysUserData" resultMap="DashboardDataResultMap">
|
<select id="selectLastThirtyDaysUserData" resultMap="DashboardDataResultMap">
|
||||||
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label from forest_user
|
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label
|
||||||
where created_time > str_to_date(date_format(date_sub(sysdate(),interval + 30 day),'%Y-%m-%d'),'%Y-%m-%d') GROUP BY date_format(created_time, '%Y-%m-%d')
|
from forest_user
|
||||||
|
where created_time > str_to_date(date_format(date_sub(sysdate(), interval + 30 day), '%Y-%m-%d'), '%Y-%m-%d')
|
||||||
|
GROUP BY date_format(created_time, '%Y-%m-%d')
|
||||||
</select>
|
</select>
|
||||||
<select id="selectLastThirtyDaysVisitData" resultMap="DashboardDataResultMap">
|
<select id="selectLastThirtyDaysVisitData" resultMap="DashboardDataResultMap">
|
||||||
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label from forest_visit
|
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label
|
||||||
where created_time > str_to_date(date_format(date_sub(sysdate(),interval + 30 day),'%Y-%m-%d'),'%Y-%m-%d') GROUP BY date_format(created_time, '%Y-%m-%d')
|
from forest_visit
|
||||||
|
where created_time > str_to_date(date_format(date_sub(sysdate(), interval + 30 day), '%Y-%m-%d'), '%Y-%m-%d')
|
||||||
|
GROUP BY date_format(created_time, '%Y-%m-%d')
|
||||||
</select>
|
</select>
|
||||||
<select id="selectHistoryArticleData" resultMap="DashboardDataResultMap">
|
<select id="selectHistoryArticleData" resultMap="DashboardDataResultMap">
|
||||||
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label from forest_article
|
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label
|
||||||
where created_time > str_to_date(date_format(date_sub(sysdate(),interval + 1 year),'%Y-%m-%d'),'%Y-%m-%d') and article_status = 0 GROUP BY date_format(created_time, '%Y-%m')
|
from forest_article
|
||||||
|
where created_time > str_to_date(date_format(date_sub(sysdate(), interval + 1 year), '%Y-%m-%d'), '%Y-%m-%d')
|
||||||
|
and article_status = 0
|
||||||
|
GROUP BY date_format(created_time, '%Y-%m')
|
||||||
</select>
|
</select>
|
||||||
<select id="selectHistoryUserData" resultMap="DashboardDataResultMap">
|
<select id="selectHistoryUserData" resultMap="DashboardDataResultMap">
|
||||||
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label from forest_user
|
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label
|
||||||
where created_time > str_to_date(date_format(date_sub(sysdate(),interval + 1 year),'%Y-%m-%d'),'%Y-%m-%d') GROUP BY date_format(created_time, '%Y-%m')
|
from forest_user
|
||||||
|
where created_time > str_to_date(date_format(date_sub(sysdate(), interval + 1 year), '%Y-%m-%d'), '%Y-%m-%d')
|
||||||
|
GROUP BY date_format(created_time, '%Y-%m')
|
||||||
</select>
|
</select>
|
||||||
<select id="selectHistoryVisitData" resultMap="DashboardDataResultMap">
|
<select id="selectHistoryVisitData" resultMap="DashboardDataResultMap">
|
||||||
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label from forest_visit
|
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label
|
||||||
where created_time > str_to_date(date_format(date_sub(sysdate(),interval + 1 year),'%Y-%m-%d'),'%Y-%m-%d') GROUP BY date_format(created_time, '%Y-%m')
|
from forest_visit
|
||||||
|
where created_time > str_to_date(date_format(date_sub(sysdate(), interval + 1 year), '%Y-%m-%d'), '%Y-%m-%d')
|
||||||
|
GROUP BY date_format(created_time, '%Y-%m')
|
||||||
|
</select>
|
||||||
|
<select id="selectNewUsers" resultMap="UserInfoResultMapper">
|
||||||
|
select id, nickname, avatar_url, account, created_time
|
||||||
|
from forest_user
|
||||||
|
where created_time > str_to_date(date_format(date_sub(sysdate(), interval + 1 year), '%Y-%m-%d'), '%Y-%m-%d')
|
||||||
|
order by created_time desc
|
||||||
|
</select>
|
||||||
|
<select id="selectNewBankAccounts" resultMap="BankAccountResultMap">
|
||||||
|
select fu.nickname as account_owner_name, fba.bank_account, fba.account_balance
|
||||||
|
from forest_bank_account fba
|
||||||
|
join forest_user fu on fba.account_owner = fu.id
|
||||||
|
where fba.created_time >
|
||||||
|
str_to_date(date_format(date_sub(sysdate(), interval + 1 year), '%Y-%m-%d'), '%Y-%m-%d')
|
||||||
|
order by fba.created_time desc
|
||||||
|
</select>
|
||||||
|
<select id="selectNewArticles" resultMap="ArticleResultMap">
|
||||||
|
select art.id,
|
||||||
|
art.article_title,
|
||||||
|
art.article_tags,
|
||||||
|
art.article_permalink,
|
||||||
|
art.article_perfect,
|
||||||
|
art.article_status,
|
||||||
|
art.created_time
|
||||||
|
from forest_article art
|
||||||
|
where article_status = 0
|
||||||
|
and art.created_time >
|
||||||
|
str_to_date(date_format(date_sub(sysdate(), interval + 1 year), '%Y-%m-%d'), '%Y-%m-%d')
|
||||||
|
order by art.created_time desc
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -12,17 +12,32 @@
|
|||||||
<result column="transaction_time" property="transactionTime"></result>
|
<result column="transaction_time" property="transactionTime"></result>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<update id="transfer">
|
<update id="transfer">
|
||||||
update forest_bank_account set account_balance = account_balance - #{money} where bank_account = #{formBankAccount};
|
update forest_bank_account
|
||||||
update forest_bank_account set account_balance = account_balance + #{money} where bank_account = #{toBankAccount};
|
set account_balance = account_balance - #{money}
|
||||||
|
where bank_account = #{formBankAccount};
|
||||||
|
update forest_bank_account
|
||||||
|
set account_balance = account_balance + #{money}
|
||||||
|
where bank_account = #{toBankAccount};
|
||||||
</update>
|
</update>
|
||||||
<select id="selectTransactionRecords" resultMap="DTOResultMap">
|
<select id="selectTransactionRecords" resultMap="DTOResultMap">
|
||||||
select * from forest_transaction_record ftr
|
select *
|
||||||
|
from forest_transaction_record ftr
|
||||||
where (form_bank_account = #{bankAccount} or to_bank_account = #{bankAccount})
|
where (form_bank_account = #{bankAccount} or to_bank_account = #{bankAccount})
|
||||||
and transaction_time between str_to_date(#{startDate}, '%Y-%m-%d') and str_to_date(#{endDate}, '%Y-%m-%d') + interval 1 day
|
and transaction_time between str_to_date(#{startDate}, '%Y-%m-%d') and str_to_date(#{endDate}, '%Y-%m-%d') + interval 1 day
|
||||||
order by transaction_time desc
|
order by transaction_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="existsWithBankAccountAndFunds" resultType="java.lang.Boolean">
|
<select id="existsWithBankAccountAndFunds" resultType="java.lang.Boolean">
|
||||||
select ifnull((select false from forest_transaction_record where to_bank_account = #{bankAccount}
|
select ifnull((select false
|
||||||
and funds = #{funds} and transaction_time > str_to_date(date_format(sysdate(),'%Y-%m-%d'),'%Y-%m-%d') limit 1), true)
|
from forest_transaction_record
|
||||||
|
where to_bank_account = #{bankAccount}
|
||||||
|
and funds = #{funds}
|
||||||
|
and transaction_time > str_to_date(date_format(sysdate(), '%Y-%m-%d'), '%Y-%m-%d')
|
||||||
|
limit 1), true)
|
||||||
|
</select>
|
||||||
|
<select id="existsWithNewbieRewards" resultType="java.lang.Boolean">
|
||||||
|
select ifnull((select true
|
||||||
|
from forest_transaction_record
|
||||||
|
where to_bank_account = #{bankAccount} and funds = '新手奖励'
|
||||||
|
limit 1), false)
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user