收益相关代码更新

This commit is contained in:
但星霖 2024-03-18 17:46:58 +08:00
parent 1cdaacd865
commit 402a84dc44
10 changed files with 876 additions and 0 deletions

View File

@ -0,0 +1,64 @@
package com.playlet.web.controller.app;
import com.github.pagehelper.PageInfo;
import com.playlet.common.core.controller.BaseController;
import com.playlet.common.core.domain.Result;
import com.playlet.common.core.page.TableDataInfo;
import com.playlet.system.domain.PlayletItem;
import com.playlet.system.domain.PlayletRevenueRecord;
import com.playlet.system.pojo.vo.RevenueRecordStatisticsVO;
import com.playlet.system.service.IPlayletRevenueRecordService;
import com.playlet.web.service.app.PlayletRevenueRecordAppService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Date: 2024-03-17
* @Author: 但星霖
* @Version: v1.0
* @Description: 短剧任务收益Controller
*/
@Controller
@RequestMapping("/app/record")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PlayletRevenueRecordAppController extends BaseController {
private final PlayletRevenueRecordAppService service;
@ResponseBody
@PostMapping("/getRecordList")
@ApiOperation(value = "分页查询短剧收益基础列表")
public Result<PageInfo<PlayletRevenueRecord>> recordList(@RequestBody PlayletRevenueRecord playletRevenueRecord,
@RequestParam(value = "pageNum") Integer pageNum,
@RequestParam(value = "pageSize") Integer pageSize) {
return Result.success(service.getItemPage(playletRevenueRecord, pageSize, pageNum));
}
@ResponseBody
@PostMapping("/statistics/time")
@ApiOperation(value = "短剧收益时间统计")
public Result<PlayletRevenueRecord> statisticsTime(@RequestBody PlayletRevenueRecord playletRevenueRecord) {
return Result.success(service.statisticsTime(playletRevenueRecord));
}
@ResponseBody
@PostMapping("/statistics")
@ApiOperation(value = "短剧收益统计")
public Result<RevenueRecordStatisticsVO> statistics(@RequestBody PlayletRevenueRecord playletRevenueRecord) {
return Result.success(service.statistics(playletRevenueRecord));
}
@ResponseBody
@PostMapping("/statistics/time/type")
@ApiOperation(value = "短剧收益时间统计分类")
public Result<List<PlayletRevenueRecord>> statisticsTimeType(@RequestBody PlayletRevenueRecord playletRevenueRecord) {
return Result.success(service.statisticsTimeType(playletRevenueRecord));
}
}

View File

@ -0,0 +1,127 @@
package com.playlet.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.playlet.common.annotation.Log;
import com.playlet.common.enums.BusinessType;
import com.playlet.system.domain.PlayletRevenueRecord;
import com.playlet.system.service.IPlayletRevenueRecordService;
import com.playlet.common.core.controller.BaseController;
import com.playlet.common.core.domain.AjaxResult;
import com.playlet.common.utils.poi.ExcelUtil;
import com.playlet.common.core.page.TableDataInfo;
/**
* @Date: 2024-03-17
* @Author: 但星霖
* @Version: v1.0
* @Description: 短剧任务收益Controller
*/
@Controller
@RequestMapping("/system/record")
public class PlayletRevenueRecordController extends BaseController{
private String prefix = "system/record";
@Autowired
private IPlayletRevenueRecordService playletRevenueRecordService;
@RequiresPermissions("system:record:view")
@GetMapping()
public String record()
{
return prefix + "/record";
}
/**
* 查询短剧任务收益列表
*/
@RequiresPermissions("system:record:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(PlayletRevenueRecord playletRevenueRecord)
{
startPage();
List<PlayletRevenueRecord> list = playletRevenueRecordService.selectPlayletRevenueRecordList(playletRevenueRecord);
return getDataTable(list);
}
/**
* 导出短剧任务收益列表
*/
@RequiresPermissions("system:record:export")
@Log(title = "短剧任务收益", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(PlayletRevenueRecord playletRevenueRecord)
{
List<PlayletRevenueRecord> list = playletRevenueRecordService.selectPlayletRevenueRecordList(playletRevenueRecord);
ExcelUtil<PlayletRevenueRecord> util = new ExcelUtil<PlayletRevenueRecord>(PlayletRevenueRecord.class);
return util.exportExcel(list, "短剧任务收益数据");
}
/**
* 新增短剧任务收益
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存短剧任务收益
*/
@RequiresPermissions("system:record:add")
@Log(title = "短剧任务收益", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(PlayletRevenueRecord playletRevenueRecord)
{
return toAjax(playletRevenueRecordService.insertPlayletRevenueRecord(playletRevenueRecord));
}
/**
* 修改短剧任务收益
*/
@RequiresPermissions("system:record:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
PlayletRevenueRecord playletRevenueRecord = playletRevenueRecordService.selectPlayletRevenueRecordById(id);
mmap.put("playletRevenueRecord", playletRevenueRecord);
return prefix + "/edit";
}
/**
* 修改保存短剧任务收益
*/
@RequiresPermissions("system:record:edit")
@Log(title = "短剧任务收益", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(PlayletRevenueRecord playletRevenueRecord)
{
return toAjax(playletRevenueRecordService.updatePlayletRevenueRecord(playletRevenueRecord));
}
/**
* 删除短剧任务收益
*/
@RequiresPermissions("system:record:remove")
@Log(title = "短剧任务收益", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(playletRevenueRecordService.deletePlayletRevenueRecordByIds(ids));
}
}

View File

@ -0,0 +1,24 @@
package com.playlet.web.service.app;
import com.github.pagehelper.PageInfo;
import com.playlet.system.domain.PlayletRevenueRecord;
import com.playlet.system.pojo.vo.RevenueRecordStatisticsVO;
import java.util.List;
/**
* @Date: 2024-03-17
* @Author: 但星霖
* @Version: v1.0
* @Description: 短剧任务收益Service app接口
*/
public interface PlayletRevenueRecordAppService {
PageInfo<PlayletRevenueRecord> getItemPage(PlayletRevenueRecord record, Integer pageSize, Integer pageNum);
PlayletRevenueRecord statisticsTime(PlayletRevenueRecord record);
RevenueRecordStatisticsVO statistics(PlayletRevenueRecord record);
List<PlayletRevenueRecord> statisticsTimeType(PlayletRevenueRecord record);
}

View File

@ -0,0 +1,152 @@
package com.playlet.web.service.app.impl;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.playlet.system.domain.PlayletRevenueRecord;
import com.playlet.system.pojo.vo.RevenueRecordStatisticsVO;
import com.playlet.system.service.IPlayletRevenueRecordService;
import com.playlet.web.service.app.PlayletRevenueRecordAppService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Date: 2024-03-18 15:52
* @Author: 但星霖
* @Version: v1.0
* @Description: 短剧任务收益Service app接口实现
*/
@Slf4j
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PlayletRevenueRecordAppServiceImpl implements PlayletRevenueRecordAppService {
private final IPlayletRevenueRecordService revenueRecordService;
@Override
public PageInfo<PlayletRevenueRecord> getItemPage(PlayletRevenueRecord record, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
List<PlayletRevenueRecord> revenueRecordList = revenueRecordService.selectPlayletRevenueRecordList(record);
return PageInfo.of(revenueRecordList);
}
@Override
public PlayletRevenueRecord statisticsTime(PlayletRevenueRecord record) {
PlayletRevenueRecord revenueRecord = new PlayletRevenueRecord();
List<PlayletRevenueRecord> revenueRecordList = revenueRecordService.selectPlayletRevenueRecordList(record);
if (CollectionUtils.isNotEmpty(revenueRecordList)) {
long rechargeMoney = 0L;
long refundMoney = 0L;
long estimateEarnings = 0L;
for (PlayletRevenueRecord revenue : revenueRecordList) {
rechargeMoney = rechargeMoney + revenue.getRechargeMoney();
refundMoney = refundMoney + revenue.getRefundMoney();
estimateEarnings = estimateEarnings + revenue.getEstimateEarnings();
}
revenueRecord.setRechargeMoney(rechargeMoney);
revenueRecord.setRefundMoney(refundMoney);
revenueRecord.setEstimateEarnings(estimateEarnings);
} else {
revenueRecord.setRechargeMoney(0L);
revenueRecord.setRefundMoney(0L);
revenueRecord.setEstimateEarnings(0L);
}
return revenueRecord;
}
@Override
public RevenueRecordStatisticsVO statistics(PlayletRevenueRecord record) {
RevenueRecordStatisticsVO vo = new RevenueRecordStatisticsVO();
// 总金额
List<PlayletRevenueRecord> revenueRecordListByTotal = revenueRecordService.selectPlayletRevenueRecordList(record);
if (CollectionUtils.isNotEmpty(revenueRecordListByTotal)) {
vo.setTotalMoney(revenueRecordListByTotal.stream().mapToLong(PlayletRevenueRecord::getPracticalEarnings).sum());
}
// 开始时间结束时间缺省值
Long startTime = System.currentTimeMillis();
Long endTime = System.currentTimeMillis();
// 今日
startTime = timeGain(null);
timeSupplement(record, startTime, endTime);
List<PlayletRevenueRecord> revenueRecordListByDay = revenueRecordService.selectPlayletRevenueRecordList(record);
if (CollectionUtils.isNotEmpty(revenueRecordListByDay)) {
vo.setTodayEstimate(revenueRecordListByDay.stream().mapToLong(PlayletRevenueRecord::getEstimateEarnings).sum());
}
// 七日
startTime = timeGain(-7);
timeSupplement(record, startTime, endTime);
List<PlayletRevenueRecord> revenueRecordListBySevenDay = revenueRecordService.selectPlayletRevenueRecordList(record);
if (CollectionUtils.isNotEmpty(revenueRecordListBySevenDay)) {
vo.setSevenDaysEstimate(revenueRecordListBySevenDay.stream().mapToLong(PlayletRevenueRecord::getEstimateEarnings).sum());
}
// 昨日
startTime = timeGain(-1);
endTime = timeGain(null);
timeSupplement(record, startTime, endTime);
List<PlayletRevenueRecord> revenueRecordListByYesterday = revenueRecordService.selectPlayletRevenueRecordList(record);
if (CollectionUtils.isNotEmpty(revenueRecordListByYesterday)) {
vo.setSevenDaysEstimate(revenueRecordListByYesterday.stream().mapToLong(PlayletRevenueRecord::getEstimateEarnings).sum());
}
// 本月
startTime = timeGain(1);
timeSupplement(record, startTime, endTime);
List<PlayletRevenueRecord> revenueRecordListByMoney = revenueRecordService.selectPlayletRevenueRecordList(record);
if (CollectionUtils.isNotEmpty(revenueRecordListByMoney)) {
vo.setSevenDaysEstimate(revenueRecordListByMoney.stream().mapToLong(PlayletRevenueRecord::getEstimateEarnings).sum());
}
return vo;
}
@Override
public List<PlayletRevenueRecord> statisticsTimeType(PlayletRevenueRecord record) {
List<PlayletRevenueRecord> listByReturn = new ArrayList<>();
List<PlayletRevenueRecord> revenueRecordList = revenueRecordService.selectPlayletRevenueRecordList(record);
if (CollectionUtils.isNotEmpty(revenueRecordList)) {
Map<Long, List<PlayletRevenueRecord>> listMap = revenueRecordList.stream().collect(Collectors.groupingBy(PlayletRevenueRecord::getEarningsType));
for (Long key : listMap.keySet()) {
List<PlayletRevenueRecord> list = listMap.get(key);
long rechargeMoney = 0L;
long refundMoney = 0L;
long estimateEarnings = 0L;
for (PlayletRevenueRecord revenue : list) {
rechargeMoney = rechargeMoney + revenue.getRechargeMoney();
refundMoney = refundMoney + revenue.getRefundMoney();
estimateEarnings = estimateEarnings + revenue.getEstimateEarnings();
}
PlayletRevenueRecord revenueRecord = new PlayletRevenueRecord();
revenueRecord.setEarningsType(key);
revenueRecord.setRechargeMoney(rechargeMoney);
revenueRecord.setRefundMoney(refundMoney);
revenueRecord.setEstimateEarnings(estimateEarnings);
listByReturn.add(revenueRecord);
}
}
return listByReturn;
}
// 时间更新
private void timeSupplement(PlayletRevenueRecord record, Long startTime, Long endTime) {
record.setStartTime(startTime);
record.setEndTime(endTime);
}
// 获取时间
private Long timeGain(Integer day) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
if (ObjectUtils.isNotNull(day)) {
calendar.set(Calendar.DATE, day);
}
return calendar.getTimeInMillis();
}
}

View File

@ -0,0 +1,121 @@
package com.playlet.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.playlet.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.playlet.common.annotation.Excel;
/**
* @Date: 2024-03-17
* @Author: 但星霖
* @Version: v1.0
* @Description: 短剧任务收益对象 playlet_revenue_record
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "短剧*短剧任务收益对象")
@TableName(value = "playlet_revenue_record")
public class PlayletRevenueRecord extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 短剧任务收益主键id
*/
@ApiModelProperty(value = "id?")
private Long id;
/**
* 退款金额(后台转换保留分 直接*100 例如1块钱 在这里应表示100)
*/
@Excel(name = "退款金额(后台转换,保留分 直接*100 例如1块钱 在这里应表示100)")
@ApiModelProperty(value = "退款金额(后台转换,保留分 直接*100 例如1块钱 在这里应表示100)")
private Long refundMoney;
/**
* 剧场id
*/
@Excel(name = "剧场id")
@ApiModelProperty(value = "剧场id")
private Long playletItemId;
/**
* 用户id
*/
@Excel(name = "用户id")
@ApiModelProperty(value = "用户id")
private Long userId;
/**
* 来源平台 1 抖音 2 快手 3 视频号
*/
@Excel(name = "来源平台 1 抖音 2 快手 3 视频号")
@ApiModelProperty(value = "来源平台 1 抖音 2 快手 3 视频号")
private Long sourcePlatform;
/**
* 收益类型 1 充值收益 2 广告收益
*/
@Excel(name = "收益类型 1 充值收益 2 广告收益")
@ApiModelProperty(value = "收益类型 1 充值收益 2 广告收益")
private Long earningsType;
/**
* 点击次数
*/
@Excel(name = "点击次数")
@ApiModelProperty(value = "点击次数")
private Long clicksNumber;
/**
* 点击人数
*/
@Excel(name = "点击人数")
@ApiModelProperty(value = "点击人数")
private Long clicksNumberPeople;
/**
* 充值金额(后台转换保留分 直接*100 例如1块钱 在这里应表示100)
*/
@Excel(name = "充值金额(后台转换,保留分 直接*100 例如1块钱 在这里应表示100)")
@ApiModelProperty(value = "充值金额(后台转换,保留分 直接*100 例如1块钱 在这里应表示100)")
private Long rechargeMoney;
/**
* 预估收益(后台转换保留分 直接*100 例如1块钱 在这里应表示100)
*/
@Excel(name = "预估收益(后台转换,保留分 直接*100 例如1块钱 在这里应表示100)")
@ApiModelProperty(value = "预估收益(后台转换,保留分 直接*100 例如1块钱 在这里应表示100)")
private Long estimateEarnings;
/**
* 实际收益(后台转换保留分 直接*100 例如1块钱 在这里应表示100)
*/
@Excel(name = "实际收益(后台转换,保留分 直接*100 例如1块钱 在这里应表示100)")
@ApiModelProperty(value = "实际收益(后台转换,保留分 直接*100 例如1块钱 在这里应表示100)")
private Long practicalEarnings;
/**
* 推送收益时间(此处为外部平台推入 建议使用时间戳后续数据转换)
*/
@Excel(name = "推送收益时间(此处为外部平台推入 建议使用时间戳后续数据转换。)")
@ApiModelProperty(value = "推送收益时间(此处为外部平台推入 建议使用时间戳后续数据转换。) 时间戳")
private Long pushTime;
/** 剧场类型 */
@Excel(name = "剧场类型")
@ApiModelProperty(value = "剧场类型")
private Integer itemType;
@TableField(exist = false)
@ApiModelProperty(value = "开始时间")
private Long startTime;
@TableField(exist = false)
@ApiModelProperty(value = "结束时间")
private Long endTime;
}

View File

@ -0,0 +1,63 @@
package com.playlet.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.playlet.system.domain.PlayletRevenueRecord;
import java.util.List;
/**
* @Date: 2024-03-17
* @Author: 但星霖
* @Version: v1.0
* @Description: 短剧任务收益Mapper接口
*/
public interface PlayletRevenueRecordMapper extends BaseMapper<PlayletRevenueRecord> {
/**
* 查询短剧任务收益
*
* @param id 短剧任务收益主键
* @return 短剧任务收益
*/
public PlayletRevenueRecord selectPlayletRevenueRecordById(Long id);
/**
* 查询短剧任务收益列表
*
* @param playletRevenueRecord 短剧任务收益
* @return 短剧任务收益集合
*/
public List<PlayletRevenueRecord> selectPlayletRevenueRecordList(PlayletRevenueRecord playletRevenueRecord);
/**
* 新增短剧任务收益
*
* @param playletRevenueRecord 短剧任务收益
* @return 结果
*/
public int insertPlayletRevenueRecord(PlayletRevenueRecord playletRevenueRecord);
/**
* 修改短剧任务收益
*
* @param playletRevenueRecord 短剧任务收益
* @return 结果
*/
public int updatePlayletRevenueRecord(PlayletRevenueRecord playletRevenueRecord);
/**
* 删除短剧任务收益
*
* @param id 短剧任务收益主键
* @return 结果
*/
public int deletePlayletRevenueRecordById(Long id);
/**
* 批量删除短剧任务收益
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePlayletRevenueRecordByIds(String[] ids);
}

View File

@ -0,0 +1,31 @@
package com.playlet.system.pojo.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Date: 2024-03-18 16:19
* @Author: 但星霖
* @Version: v1.0
* @Description: 短剧任务收益统计vo
*/
@Data
@ApiModel(value = "短剧任务统计")
public class RevenueRecordStatisticsVO {
@ApiModelProperty(value = "总收益")
private Long totalMoney = 0L;
@ApiModelProperty(value = "今日预估")
private Long todayEstimate = 0L;
@ApiModelProperty(value = "七日预估")
private Long sevenDaysEstimate = 0L;
@ApiModelProperty(value = "本月预估")
private Long thisMonthEstimate = 0L;
@ApiModelProperty(value = "昨日预估")
private Long yesterdayEstimate = 0L;
}

View File

@ -0,0 +1,63 @@
package com.playlet.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.playlet.system.domain.PlayletRevenueRecord;
import java.util.List;
/**
* @Date: 2024-03-17
* @Author: 但星霖
* @Version: v1.0
* @Description: 短剧任务收益Service接口
*/
public interface IPlayletRevenueRecordService extends IService<PlayletRevenueRecord> {
/**
* 查询短剧任务收益
*
* @param id 短剧任务收益主键
* @return 短剧任务收益
*/
public PlayletRevenueRecord selectPlayletRevenueRecordById(Long id);
/**
* 查询短剧任务收益列表
*
* @param playletRevenueRecord 短剧任务收益
* @return 短剧任务收益集合
*/
public List<PlayletRevenueRecord> selectPlayletRevenueRecordList(PlayletRevenueRecord playletRevenueRecord);
/**
* 新增短剧任务收益
*
* @param playletRevenueRecord 短剧任务收益
* @return 结果
*/
public int insertPlayletRevenueRecord(PlayletRevenueRecord playletRevenueRecord);
/**
* 修改短剧任务收益
*
* @param playletRevenueRecord 短剧任务收益
* @return 结果
*/
public int updatePlayletRevenueRecord(PlayletRevenueRecord playletRevenueRecord);
/**
* 批量删除短剧任务收益
*
* @param ids 需要删除的短剧任务收益主键集合
* @return 结果
*/
public int deletePlayletRevenueRecordByIds(String ids);
/**
* 删除短剧任务收益信息
*
* @param id 短剧任务收益主键
* @return 结果
*/
public int deletePlayletRevenueRecordById(Long id);
}

View File

@ -0,0 +1,93 @@
package com.playlet.system.service.impl;
import java.util.List;
import com.playlet.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.playlet.system.mapper.PlayletRevenueRecordMapper;
import com.playlet.system.domain.PlayletRevenueRecord;
import com.playlet.system.service.IPlayletRevenueRecordService;
import com.playlet.common.core.text.Convert;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Date: 2024-03-17
* @Author: 但星霖
* @Version: v1.0
* @Description: 短剧任务收益Service业务层处理
*/
@Service
public class PlayletRevenueRecordServiceImpl extends ServiceImpl<PlayletRevenueRecordMapper, PlayletRevenueRecord> implements IPlayletRevenueRecordService {
@Autowired
private PlayletRevenueRecordMapper playletRevenueRecordMapper;
/**
* 查询短剧任务收益
*
* @param id 短剧任务收益主键
* @return 短剧任务收益
*/
@Override
public PlayletRevenueRecord selectPlayletRevenueRecordById(Long id) {
return playletRevenueRecordMapper.selectPlayletRevenueRecordById(id);
}
/**
* 查询短剧任务收益列表
*
* @param playletRevenueRecord 短剧任务收益
* @return 短剧任务收益
*/
@Override
public List<PlayletRevenueRecord> selectPlayletRevenueRecordList(PlayletRevenueRecord playletRevenueRecord) {
return playletRevenueRecordMapper.selectPlayletRevenueRecordList(playletRevenueRecord);
}
/**
* 新增短剧任务收益
*
* @param playletRevenueRecord 短剧任务收益
* @return 结果
*/
@Override
public int insertPlayletRevenueRecord(PlayletRevenueRecord playletRevenueRecord) {
playletRevenueRecord.setCreateTime(DateUtils.getNowDate());
return playletRevenueRecordMapper.insertPlayletRevenueRecord(playletRevenueRecord);
}
/**
* 修改短剧任务收益
*
* @param playletRevenueRecord 短剧任务收益
* @return 结果
*/
@Override
public int updatePlayletRevenueRecord(PlayletRevenueRecord playletRevenueRecord) {
playletRevenueRecord.setUpdateTime(DateUtils.getNowDate());
return playletRevenueRecordMapper.updatePlayletRevenueRecord(playletRevenueRecord);
}
/**
* 批量删除短剧任务收益
*
* @param ids 需要删除的短剧任务收益主键
* @return 结果
*/
@Override
public int deletePlayletRevenueRecordByIds(String ids) {
return playletRevenueRecordMapper.deletePlayletRevenueRecordByIds(Convert.toStrArray(ids));
}
/**
* 删除短剧任务收益信息
*
* @param id 短剧任务收益主键
* @return 结果
*/
@Override
public int deletePlayletRevenueRecordById(Long id) {
return playletRevenueRecordMapper.deletePlayletRevenueRecordById(id);
}
}

View File

@ -0,0 +1,138 @@
<?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.playlet.system.mapper.PlayletRevenueRecordMapper">
<resultMap type="PlayletRevenueRecord" id="PlayletRevenueRecordResult">
<result property="id" column="id" />
<result property="refundMoney" column="refund_money" />
<result property="playletItemId" column="playlet_item_id" />
<result property="userId" column="user_id" />
<result property="sourcePlatform" column="source_platform" />
<result property="earningsType" column="earnings_type" />
<result property="clicksNumber" column="clicks_number" />
<result property="clicksNumberPeople" column="clicks_number_people" />
<result property="rechargeMoney" column="recharge_money" />
<result property="estimateEarnings" column="estimate_earnings" />
<result property="practicalEarnings" column="practical_earnings" />
<result property="pushTime" column="push_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="itemType" column="item_type" />
</resultMap>
<sql id="selectPlayletRevenueRecordVo">
select id, refund_money, playlet_item_id, user_id, source_platform, earnings_type, clicks_number, clicks_number_people, recharge_money, estimate_earnings, practical_earnings, push_time, create_by, create_time, update_by, update_time, remark, item_type from playlet_revenue_record
</sql>
<select id="selectPlayletRevenueRecordList" parameterType="PlayletRevenueRecord" resultMap="PlayletRevenueRecordResult">
<include refid="selectPlayletRevenueRecordVo"/>
<where>
<if test="refundMoney != null "> and refund_money = #{refundMoney}</if>
<if test="playletItemId != null "> and playlet_item_id = #{playletItemId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="sourcePlatform != null "> and source_platform = #{sourcePlatform}</if>
<if test="earningsType != null "> and earnings_type = #{earningsType}</if>
<if test="clicksNumber != null "> and clicks_number = #{clicksNumber}</if>
<if test="clicksNumberPeople != null "> and clicks_number_people = #{clicksNumberPeople}</if>
<if test="rechargeMoney != null "> and recharge_money = #{rechargeMoney}</if>
<if test="estimateEarnings != null "> and estimate_earnings = #{estimateEarnings}</if>
<if test="practicalEarnings != null "> and practical_earnings = #{practicalEarnings}</if>
<!-- <if test="pushTime != null "> and push_time = #{pushTime}</if> -->
<if test="startTime != null and startTime != 0" >
and push_time <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != 0" >
and push_time <![CDATA[ <= ]]> #{endTime}
</if>guog
<if test="itemType != null "> and item_type = #{itemType}</if>
</where>
</select>
<select id="selectPlayletRevenueRecordById" parameterType="Long" resultMap="PlayletRevenueRecordResult">
<include refid="selectPlayletRevenueRecordVo"/>
where id = #{id}
</select>
<insert id="insertPlayletRevenueRecord" parameterType="PlayletRevenueRecord" useGeneratedKeys="true" keyProperty="id">
insert into playlet_revenue_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="refundMoney != null">refund_money,</if>
<if test="playletItemId != null">playlet_item_id,</if>
<if test="userId != null">user_id,</if>
<if test="sourcePlatform != null">source_platform,</if>
<if test="earningsType != null">earnings_type,</if>
<if test="clicksNumber != null">clicks_number,</if>
<if test="clicksNumberPeople != null">clicks_number_people,</if>
<if test="rechargeMoney != null">recharge_money,</if>
<if test="estimateEarnings != null">estimate_earnings,</if>
<if test="practicalEarnings != null">practical_earnings,</if>
<if test="pushTime != null">push_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="itemType != null ">item_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="refundMoney != null">#{refundMoney},</if>
<if test="playletItemId != null">#{playletItemId},</if>
<if test="userId != null">#{userId},</if>
<if test="sourcePlatform != null">#{sourcePlatform},</if>
<if test="earningsType != null">#{earningsType},</if>
<if test="clicksNumber != null">#{clicksNumber},</if>
<if test="clicksNumberPeople != null">#{clicksNumberPeople},</if>
<if test="rechargeMoney != null">#{rechargeMoney},</if>
<if test="estimateEarnings != null">#{estimateEarnings},</if>
<if test="practicalEarnings != null">#{practicalEarnings},</if>
<if test="pushTime != null">#{pushTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="itemType != null ">#{itemType},</if>
</trim>
</insert>
<update id="updatePlayletRevenueRecord" parameterType="PlayletRevenueRecord">
update playlet_revenue_record
<trim prefix="SET" suffixOverrides=",">
<if test="refundMoney != null">refund_money = #{refundMoney},</if>
<if test="playletItemId != null">playlet_item_id = #{playletItemId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="sourcePlatform != null">source_platform = #{sourcePlatform},</if>
<if test="earningsType != null">earnings_type = #{earningsType},</if>
<if test="clicksNumber != null">clicks_number = #{clicksNumber},</if>
<if test="clicksNumberPeople != null">clicks_number_people = #{clicksNumberPeople},</if>
<if test="rechargeMoney != null">recharge_money = #{rechargeMoney},</if>
<if test="estimateEarnings != null">estimate_earnings = #{estimateEarnings},</if>
<if test="practicalEarnings != null">practical_earnings = #{practicalEarnings},</if>
<if test="pushTime != null">push_time = #{pushTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="itemType != null ">item_type = #{itemType},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePlayletRevenueRecordById" parameterType="Long">
delete from playlet_revenue_record where id = #{id}
</delete>
<delete id="deletePlayletRevenueRecordByIds" parameterType="String">
delete from playlet_revenue_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>