用户查询任务代码更新
This commit is contained in:
parent
edac08c351
commit
cd7bb43e61
|
|
@ -1,12 +1,18 @@
|
|||
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.system.domain.PlayletItem;
|
||||
import com.playlet.system.domain.PlayletTask;
|
||||
import com.playlet.web.service.app.PlayletItemAppService;
|
||||
import com.playlet.web.service.app.PlayletTaskAppService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -22,4 +28,41 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class PlayletTaskAppController extends BaseController {
|
||||
|
||||
private final PlayletTaskAppService playletTaskAppService;
|
||||
|
||||
/**
|
||||
* 分页查询任务列表
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping("/getItemList")
|
||||
@ApiOperation(value = "分页查询任务列表")
|
||||
public Result<PageInfo<PlayletTask>> getItemList(@RequestBody PlayletTask playletTask,
|
||||
@RequestParam(value = "pageNum") Integer pageNum,
|
||||
@RequestParam(value = "pageSize") Integer pageSize) {
|
||||
return Result.success(playletTaskAppService.getItemPage(playletTask, pageNum, pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询任务列表
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping("/getItemList/list")
|
||||
@ApiOperation(value = "分页查询用户任务列表")
|
||||
public Result<PageInfo<PlayletTask>> getItemListByUser(@RequestBody PlayletTask playletTask,
|
||||
@RequestParam(value = "pageNum") Integer pageNum,
|
||||
@RequestParam(value = "pageSize") Integer pageSize) {
|
||||
return Result.success(playletTaskAppService.getItemPageByUser(playletTask, pageNum, pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务详情
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/load/{taskId}")
|
||||
@ApiOperation(value = "分页查询任务列表")
|
||||
public Result<PlayletTask> loadByTaskId(@PathVariable("taskId") Long taskId) {
|
||||
return Result.success(playletTaskAppService.selectPlayletTaskById(taskId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,15 +2,14 @@ package com.playlet.web.controller.system;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.playlet.common.core.domain.Result;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
import com.playlet.common.annotation.Log;
|
||||
import com.playlet.common.enums.BusinessType;
|
||||
import com.playlet.system.domain.PlayletTask;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,67 @@
|
|||
package com.playlet.web.service.app;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.playlet.system.domain.PlayletTask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Date: 2024-03-22 00:02
|
||||
* @Author: 但星霖
|
||||
* @Version: v1.0
|
||||
* @Description:
|
||||
* @Description: 任务app Service接口
|
||||
*/
|
||||
public interface PlayletTaskAppService {
|
||||
|
||||
PageInfo<PlayletTask> getItemPage(PlayletTask playletTask, Integer pageSize, Integer pageNum);
|
||||
|
||||
PageInfo<PlayletTask> getItemPageByUser(PlayletTask playletTask, Integer pageSize, Integer pageNum);
|
||||
|
||||
/**
|
||||
* 查询任务
|
||||
*
|
||||
* @param id 任务主键
|
||||
* @return 任务
|
||||
*/
|
||||
PlayletTask selectPlayletTaskById(Long id);
|
||||
|
||||
/**
|
||||
* 查询任务列表
|
||||
*
|
||||
* @param playletTask 任务
|
||||
* @return 任务集合
|
||||
*/
|
||||
List<PlayletTask> selectPlayletTaskList(PlayletTask playletTask);
|
||||
|
||||
/**
|
||||
* 新增任务
|
||||
*
|
||||
* @param playletTask 任务
|
||||
* @return 结果
|
||||
*/
|
||||
int insertPlayletTask(PlayletTask playletTask);
|
||||
|
||||
/**
|
||||
* 修改任务
|
||||
*
|
||||
* @param playletTask 任务
|
||||
* @return 结果
|
||||
*/
|
||||
int updatePlayletTask(PlayletTask playletTask);
|
||||
|
||||
/**
|
||||
* 批量删除任务
|
||||
*
|
||||
* @param ids 需要删除的任务主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayletTaskByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除任务信息
|
||||
*
|
||||
* @param id 任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayletTaskById(Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
package com.playlet.web.service.app;
|
||||
|
||||
import com.playlet.system.domain.PlayletUserTask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Date: 2024-03-22 12:13
|
||||
* @Author: 但星霖
|
||||
* @Version: v1.0
|
||||
* @Description: 任务用户app Service接口
|
||||
*/
|
||||
public interface PlayletUserTaskAppService {
|
||||
|
||||
/**
|
||||
* 查询短剧用户任务
|
||||
*
|
||||
* @param id 短剧用户任务主键
|
||||
* @return 短剧用户任务
|
||||
*/
|
||||
PlayletUserTask selectPlayletUserTaskById(Long id);
|
||||
|
||||
/**
|
||||
* 查询短剧用户任务列表
|
||||
*
|
||||
* @param playletUserTask 短剧用户任务
|
||||
* @return 短剧用户任务集合
|
||||
*/
|
||||
List<PlayletUserTask> selectPlayletUserTaskList(PlayletUserTask playletUserTask);
|
||||
|
||||
/**
|
||||
* 新增短剧用户任务
|
||||
*
|
||||
* @param playletUserTask 短剧用户任务
|
||||
* @return 结果
|
||||
*/
|
||||
int insertPlayletUserTask(PlayletUserTask playletUserTask);
|
||||
|
||||
/**
|
||||
* 修改短剧用户任务
|
||||
*
|
||||
* @param playletUserTask 短剧用户任务
|
||||
* @return 结果
|
||||
*/
|
||||
int updatePlayletUserTask(PlayletUserTask playletUserTask);
|
||||
|
||||
/**
|
||||
* 批量删除短剧用户任务
|
||||
*
|
||||
* @param ids 需要删除的短剧用户任务主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayletUserTaskByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除短剧用户任务信息
|
||||
*
|
||||
* @param id 短剧用户任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayletUserTaskById(Long id);
|
||||
}
|
||||
|
|
@ -1,19 +1,115 @@
|
|||
package com.playlet.web.service.app.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.playlet.common.core.text.Convert;
|
||||
import com.playlet.common.utils.DateUtils;
|
||||
import com.playlet.system.domain.PlayletItem;
|
||||
import com.playlet.system.domain.PlayletItemType;
|
||||
import com.playlet.system.domain.PlayletRevenueRecord;
|
||||
import com.playlet.system.domain.PlayletTask;
|
||||
import com.playlet.system.mapper.PlayletTaskMapper;
|
||||
import com.playlet.web.service.app.PlayletTaskAppService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Date: 2024-03-22 00:02
|
||||
* @Author: 但星霖
|
||||
* @Version: v1.0
|
||||
* @Description:
|
||||
* @Description: 任务app Service接口实现
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class PlayletTaskAppServiceImpl implements PlayletTaskAppService {
|
||||
|
||||
private final PlayletTaskMapper playletTaskMapper;
|
||||
|
||||
@Override
|
||||
public PageInfo<PlayletTask> getItemPage(PlayletTask playletTask, Integer pageSize, Integer pageNum) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<PlayletTask> revenueRecordList = playletTaskMapper.selectPlayletTaskList(playletTask);
|
||||
return PageInfo.of(revenueRecordList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<PlayletTask> getItemPageByUser(PlayletTask playletTask, Integer pageSize, Integer pageNum) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<PlayletTask> revenueRecordList = playletTaskMapper.selectPlayletTaskListByUser(playletTask);
|
||||
return PageInfo.of(revenueRecordList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询任务
|
||||
*
|
||||
* @param id 任务主键
|
||||
* @return 任务
|
||||
*/
|
||||
@Override
|
||||
public PlayletTask selectPlayletTaskById(Long id) {
|
||||
return playletTaskMapper.selectPlayletTaskById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询任务列表
|
||||
*
|
||||
* @param playletTask 任务
|
||||
* @return 任务
|
||||
*/
|
||||
@Override
|
||||
public List<PlayletTask> selectPlayletTaskList(PlayletTask playletTask) {
|
||||
return playletTaskMapper.selectPlayletTaskList(playletTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增任务
|
||||
*
|
||||
* @param playletTask 任务
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertPlayletTask(PlayletTask playletTask) {
|
||||
playletTask.setCreateTime(DateUtils.getNowDate());
|
||||
return playletTaskMapper.insertPlayletTask(playletTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改任务
|
||||
*
|
||||
* @param playletTask 任务
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updatePlayletTask(PlayletTask playletTask) {
|
||||
playletTask.setUpdateTime(DateUtils.getNowDate());
|
||||
return playletTaskMapper.updatePlayletTask(playletTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除任务
|
||||
*
|
||||
* @param ids 需要删除的任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayletTaskByIds(String ids) {
|
||||
return playletTaskMapper.deletePlayletTaskByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务信息
|
||||
*
|
||||
* @param id 任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayletTaskById(Long id) {
|
||||
return playletTaskMapper.deletePlayletTaskById(id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,96 @@
|
|||
package com.playlet.web.service.app.impl;
|
||||
|
||||
|
||||
import com.playlet.common.core.text.Convert;
|
||||
import com.playlet.common.utils.DateUtils;
|
||||
import com.playlet.system.domain.PlayletUserTask;
|
||||
import com.playlet.system.mapper.PlayletUserTaskMapper;
|
||||
import com.playlet.web.service.app.PlayletUserTaskAppService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Date: 2024-03-22 12:13
|
||||
* @Author: 但星霖
|
||||
* @Version: v1.0
|
||||
* @Description: 任务用户app Service接口实现
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class PlayletUserTaskAppServiceImpl implements PlayletUserTaskAppService {
|
||||
|
||||
private final PlayletUserTaskMapper playletUserTaskMapper;
|
||||
|
||||
/**
|
||||
* 查询短剧用户任务
|
||||
*
|
||||
* @param id 短剧用户任务主键
|
||||
* @return 短剧用户任务
|
||||
*/
|
||||
@Override
|
||||
public PlayletUserTask selectPlayletUserTaskById(Long id) {
|
||||
return playletUserTaskMapper.selectPlayletUserTaskById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询短剧用户任务列表
|
||||
*
|
||||
* @param playletUserTask 短剧用户任务
|
||||
* @return 短剧用户任务
|
||||
*/
|
||||
@Override
|
||||
public List<PlayletUserTask> selectPlayletUserTaskList(PlayletUserTask playletUserTask) {
|
||||
return playletUserTaskMapper.selectPlayletUserTaskList(playletUserTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增短剧用户任务
|
||||
*
|
||||
* @param playletUserTask 短剧用户任务
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertPlayletUserTask(PlayletUserTask playletUserTask) {
|
||||
playletUserTask.setCreateTime(DateUtils.getNowDate());
|
||||
return playletUserTaskMapper.insertPlayletUserTask(playletUserTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改短剧用户任务
|
||||
*
|
||||
* @param playletUserTask 短剧用户任务
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updatePlayletUserTask(PlayletUserTask playletUserTask) {
|
||||
playletUserTask.setUpdateTime(DateUtils.getNowDate());
|
||||
return playletUserTaskMapper.updatePlayletUserTask(playletUserTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除短剧用户任务
|
||||
*
|
||||
* @param ids 需要删除的短剧用户任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayletUserTaskByIds(String ids) {
|
||||
return playletUserTaskMapper.deletePlayletUserTaskByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除短剧用户任务信息
|
||||
*
|
||||
* @param id 短剧用户任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayletUserTaskById(Long id) {
|
||||
return playletUserTaskMapper.deletePlayletUserTaskById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
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.ApiModelProperty;
|
||||
|
|
@ -111,4 +112,9 @@ public class PlayletTask extends BaseEntity {
|
|||
@ApiModelProperty(value = "任务状态 0 未开始 1 已开始 2 已结束 3 已失效 4 已完成")
|
||||
private Long state;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "用户id")
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public interface PlayletTaskMapper extends BaseMapper<PlayletTask> {
|
|||
* @param id 任务主键
|
||||
* @return 任务
|
||||
*/
|
||||
public PlayletTask selectPlayletTaskById(Long id);
|
||||
PlayletTask selectPlayletTaskById(Long id);
|
||||
|
||||
/**
|
||||
* 查询任务列表
|
||||
|
|
@ -26,7 +26,15 @@ public interface PlayletTaskMapper extends BaseMapper<PlayletTask> {
|
|||
* @param playletTask 任务
|
||||
* @return 任务集合
|
||||
*/
|
||||
public List<PlayletTask> selectPlayletTaskList(PlayletTask playletTask);
|
||||
List<PlayletTask> selectPlayletTaskList(PlayletTask playletTask);
|
||||
|
||||
/**
|
||||
* 查询任务列表 根据用户查询
|
||||
*
|
||||
* @param playletTask 任务
|
||||
* @return 任务集合
|
||||
*/
|
||||
List<PlayletTask> selectPlayletTaskListByUser(PlayletTask playletTask);
|
||||
|
||||
/**
|
||||
* 新增任务
|
||||
|
|
@ -34,7 +42,7 @@ public interface PlayletTaskMapper extends BaseMapper<PlayletTask> {
|
|||
* @param playletTask 任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPlayletTask(PlayletTask playletTask);
|
||||
int insertPlayletTask(PlayletTask playletTask);
|
||||
|
||||
/**
|
||||
* 修改任务
|
||||
|
|
@ -42,7 +50,7 @@ public interface PlayletTaskMapper extends BaseMapper<PlayletTask> {
|
|||
* @param playletTask 任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePlayletTask(PlayletTask playletTask);
|
||||
int updatePlayletTask(PlayletTask playletTask);
|
||||
|
||||
/**
|
||||
* 删除任务
|
||||
|
|
@ -50,7 +58,7 @@ public interface PlayletTaskMapper extends BaseMapper<PlayletTask> {
|
|||
* @param id 任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePlayletTaskById(Long id);
|
||||
int deletePlayletTaskById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除任务
|
||||
|
|
@ -58,5 +66,5 @@ public interface PlayletTaskMapper extends BaseMapper<PlayletTask> {
|
|||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePlayletTaskByIds(String[] ids);
|
||||
int deletePlayletTaskByIds(String[] ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
* @Description: 短剧用户任务Service接口
|
||||
*/
|
||||
public interface IPlayletUserTaskService extends IService<PlayletUserTask> {
|
||||
|
||||
/**
|
||||
* 查询短剧用户任务
|
||||
*
|
||||
|
|
|
|||
|
|
@ -65,6 +65,43 @@
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPlayletTaskListByUser" parameterType="PlayletTask" resultMap="PlayletTaskResult">
|
||||
select
|
||||
playlet_task.`id`,
|
||||
playlet_task.`task_id`,
|
||||
playlet_task.`start_time`,
|
||||
playlet_task.`end_time`,
|
||||
playlet_task.`platform_type`,
|
||||
playlet_task.`rule`,
|
||||
playlet_task.`contribute_start_time`,
|
||||
playlet_task.`contribute_end_time`,
|
||||
playlet_task.`ask_for`,
|
||||
playlet_task.`total_bonus`,
|
||||
playlet_task.`award_describe`,
|
||||
playlet_task.`state`,
|
||||
playlet_task.`create_time`,
|
||||
playlet_task.`update_time`,
|
||||
playlet_task.`create_by`,
|
||||
playlet_task.`update_by`,
|
||||
playlet_task.`remark`
|
||||
from playlet_task right join playlet_user_task on playlet_task.`id` = playlet_user_task.`task_id`
|
||||
<where>
|
||||
playlet_user_task.`user_id` = #{userId}
|
||||
<if test="taskId != null and taskId != ''">and playlet_task.`task_id` = #{taskId}</if>
|
||||
<if test="name != null and name != ''">and playlet_task.`name` like concat('%', #{name}, '%')</if>
|
||||
<if test="startTime != null ">and playlet_task.`start_time` = #{startTime}</if>
|
||||
<if test="endTime != null ">and playlet_task.`end_time` = #{endTime}</if>
|
||||
<if test="platformType != null ">and playlet_task.`platform_type` = #{platformType}</if>
|
||||
<if test="rule != null and rule != ''">and playlet_task.`rule` = #{rule}</if>
|
||||
<if test="contributeStartTime != null ">and playlet_task.`contribute_start_time` = #{contributeStartTime}</if>
|
||||
<if test="contributeEndTime != null ">and playlet_task.`contribute_end_time` = #{contributeEndTime}</if>
|
||||
<if test="askFor != null and askFor != ''">and playlet_task.`ask_for` = #{askFor}</if>
|
||||
<if test="totalBonus != null ">and playlet_task.`total_bonus` = #{totalBonus}</if>
|
||||
<if test="awardDescribe != null and awardDescribe != ''">and playlet_task.`award_describe` = #{awardDescribe}</if>
|
||||
<if test="state != null ">and playlet_task.`state` = #{state}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPlayletTaskById" parameterType="Long" resultMap="PlayletTaskResult">
|
||||
<include refid="selectPlayletTaskVo"/>
|
||||
where id = #{id}
|
||||
|
|
|
|||
Loading…
Reference in New Issue