src/main/java/org/springblade/common/config/BladeConfiguration.java
@@ -102,6 +102,7 @@ secureRegistry.excludePathPatterns("/collect/**"); secureRegistry.excludePathPatterns("/investigate/**"); secureRegistry.excludePathPatterns("/taskqd/**"); secureRegistry.excludePathPatterns("/taskfk/**"); return secureRegistry; } src/main/java/org/springblade/modules/taskfk/controller/TaskfkController.java
New file @@ -0,0 +1,122 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.taskfk.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; import org.springblade.modules.taskfk.entity.Taskfk; import org.springblade.modules.taskfk.mapper.TaskfkMapper; import org.springblade.modules.taskfk.service.impl.TaskfkServiceImpl; import org.springblade.modules.taskfk.vo.TaskfkVO; import org.springblade.modules.taskfk.wrapper.TaskfkWrapper; import org.springblade.modules.taskqd.entity.Taskqd; import org.springblade.modules.taskqd.service.impl.TaskqdServiceImpl; import org.springblade.modules.taskqd.vo.TaskqdVO; import org.springblade.modules.taskqd.wrapper.TaskqdWrapper; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; /** * 控制器 * * @author BladeX * @since 2020-08-06 */ @RestController @AllArgsConstructor @RequestMapping("/taskfk") @Api(value = "", tags = "接口") public class TaskfkController extends BladeController { private final TaskfkServiceImpl taskfkService; /** * 详情 */ @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入task") public R<TaskfkVO> detail(Taskfk taskfk) { Taskfk detail = taskfkService.getOne(Condition.getQueryWrapper(taskfk)); return R.data(TaskfkWrapper.build().entityVO(detail)); } /** * 分页 */ @GetMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入task") public R<IPage<TaskfkVO>> list(Taskfk taskfk, Query query) { IPage<Taskfk> pages = taskfkService.page(Condition.getPage(query), Condition.getQueryWrapper(taskfk)); return R.data(TaskfkWrapper.build().pageVO(pages)); } /** * 新增 */ @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入task") public R save(@Valid @RequestBody Taskfk taskfk) { return R.status(taskfkService.save(taskfk)); } /** * 修改 */ @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入task") public R update(@Valid @RequestBody Taskfk taskfk) { return R.status(taskfkService.updateById(taskfk)); } /** * 新增或修改 */ @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入task") public R submit(@Valid @RequestBody Taskfk taskfk) { return R.status(taskfkService.saveOrUpdate(taskfk)); } /** * 删除 */ @PostMapping("/remove") @ApiOperationSupport(order = 8) @ApiOperation(value = "删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(taskfkService.removeByIds(Func.toLongList(ids))); } } src/main/java/org/springblade/modules/taskfk/dto/TaskfkDTO.java
New file @@ -0,0 +1,35 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.taskfk.dto; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.modules.taskfk.entity.Taskfk; import org.springblade.modules.taskqd.entity.Taskqd; /** * 数据传输对象实体类 * * @author BladeX * @since 2020-08-06 */ @Data @EqualsAndHashCode(callSuper = true) public class TaskfkDTO extends Taskfk { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/modules/taskfk/entity/Taskfk.java
New file @@ -0,0 +1,81 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.taskfk.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; /** * 实体类 * * @author BladeX * @since 2020-08-06 */ @Data @TableName("sys_taskfk") @ApiModel(value = "taskfk对象", description = "taskfk对象") public class Taskfk implements Serializable { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.AUTO) private Integer id; /** * 活动id */ @ApiModelProperty(value = "活动id") private String hdid; /** * 用户id */ @ApiModelProperty(value = "用户id") private String serid; /** * 心得 */ @ApiModelProperty(value = "心得") private String content; /** * 意见 */ @ApiModelProperty(value = "意见") private String yj; /** * 图片 */ @ApiModelProperty(value = "图片") private String tpurl; /** * 视频 */ @ApiModelProperty(value = "视频") private String spurl; } src/main/java/org/springblade/modules/taskfk/mapper/TaskfkMapper.java
New file @@ -0,0 +1,34 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.taskfk.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.springblade.modules.taskfk.entity.Taskfk; import org.springblade.modules.taskqd.entity.Taskqd; import java.util.List; /** * Mapper 接口 * * @author BladeX * @since 2020-08-06 */ public interface TaskfkMapper extends BaseMapper<Taskfk> { int selectNum(String hdid,String serid); } src/main/java/org/springblade/modules/taskfk/mapper/TaskfkMapper.xml
New file @@ -0,0 +1,22 @@ <?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="org.springblade.modules.taskfk.mapper.TaskfkMapper"> <!-- 通用查询映射结果 --> <resultMap id="taskResultMap" type="org.springblade.modules.taskfk.entity.Taskfk"> <id column="id" property="id"/> <result column="hdid" property="hdid"/> <result column="serid" property="serid"/> <result column="content" property="content"/> <result column="yj" property="yj"/> <result column="tpurl" property="tpurl"/> <result column="spurl" property="spurl"/> </resultMap> <select id="selectNum" resultType="java.lang.Integer"> SELECT COUNT(*) as num FROM `sys_taskfk` WHERE hdid = #{hdid} AND serid = #{serid} </select> </mapper> src/main/java/org/springblade/modules/taskfk/service/ITaskfkService.java
New file @@ -0,0 +1,33 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.taskfk.service; import com.baomidou.mybatisplus.extension.service.IService; import org.springblade.modules.taskfk.entity.Taskfk; import org.springblade.modules.taskqd.entity.Taskqd; import java.util.List; /** * 服务类 * * @author BladeX * @since 2020-08-06 */ public interface ITaskfkService extends IService<Taskfk> { int selectNum(String hdid,String serid); } src/main/java/org/springblade/modules/taskfk/service/impl/TaskfkServiceImpl.java
New file @@ -0,0 +1,39 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.taskfk.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springblade.modules.taskfk.entity.Taskfk; import org.springblade.modules.taskfk.mapper.TaskfkMapper; import org.springblade.modules.taskfk.service.ITaskfkService; import org.springframework.stereotype.Service; /** * 服务实现类 * * @author BladeX * @since 2020-08-06 */ @Service public class TaskfkServiceImpl extends ServiceImpl<TaskfkMapper, Taskfk> implements ITaskfkService { @Override public int selectNum(String hdid, String serid) { return baseMapper.selectNum(hdid, serid); } } src/main/java/org/springblade/modules/taskfk/vo/TaskfkVO.java
New file @@ -0,0 +1,37 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.taskfk.vo; import io.swagger.annotations.ApiModel; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.modules.taskfk.entity.Taskfk; import org.springblade.modules.taskqd.entity.Taskqd; /** * 视图实体类 * * @author BladeX * @since 2020-08-06 */ @Data @EqualsAndHashCode(callSuper = true) @ApiModel(value = "TaskVO对象", description = "TaskVO对象") public class TaskfkVO extends Taskfk { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/modules/taskfk/wrapper/TaskfkWrapper.java
New file @@ -0,0 +1,46 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.taskfk.wrapper; import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.modules.taskfk.entity.Taskfk; import org.springblade.modules.taskfk.vo.TaskfkVO; import org.springblade.modules.taskqd.entity.Taskqd; import org.springblade.modules.taskqd.vo.TaskqdVO; import java.util.Objects; /** * 包装类,返回视图层所需的字段 * * @author BladeX * @since 2020-08-06 */ public class TaskfkWrapper extends BaseEntityWrapper<Taskfk, TaskfkVO> { public static TaskfkWrapper build() { return new TaskfkWrapper(); } @Override public TaskfkVO entityVO(Taskfk taskfk) { TaskfkVO taskfkVO = Objects.requireNonNull(BeanUtil.copy(taskfk, TaskfkVO.class)); return taskfkVO; } } src/main/java/org/springblade/modules/taskqd/controller/TaskqdController.java
@@ -181,6 +181,16 @@ */ @PostMapping("/selectLi") public R selectLi(String type,String serid) { return R.data(taskqdService.selectLi(type,serid)); List<TaskqdVO> list = taskqdService.selectLi(type, serid); for (int i=0;i<list.size();i++){ Integer nums = list.get(i).getNums(); if (nums==0){ list.get(i).setType("0"); } else { list.get(i).setType("1"); } } return R.data(list); } } src/main/java/org/springblade/modules/taskqd/mapper/TaskqdMapper.java
@@ -22,6 +22,7 @@ import org.springblade.modules.task.entity.Task; import org.springblade.modules.task.vo.TaskVO; import org.springblade.modules.taskqd.entity.Taskqd; import org.springblade.modules.taskqd.vo.TaskqdVO; import java.util.List; @@ -35,5 +36,5 @@ //抢单任务 void updatet(Integer id, Integer num, String serid); List<Taskqd> selectList(Integer id); List<Taskqd> selectLi(String type,String serid); List<TaskqdVO> selectLi(String type, String serid); } src/main/java/org/springblade/modules/taskqd/mapper/TaskqdMapper.xml
@@ -3,7 +3,7 @@ <mapper namespace="org.springblade.modules.taskqd.mapper.TaskqdMapper"> <!-- 通用查询映射结果 --> <resultMap id="taskResultMap" type="org.springblade.modules.taskqd.entity.Taskqd"> <resultMap id="taskResultMap" type="org.springblade.modules.taskqd.vo.TaskqdVO"> <id column="id" property="id"/> <result column="rname" property="rname"/> <result column="content" property="content"/> @@ -37,12 +37,15 @@ <select id="selectLi" resultMap="taskResultMap"> SELECT A.*,IFNULL(B.num,0) as nums FROM ( select * from sys_taskqd where 1=1 <if test="type==0"> and find_in_set(#{serid}, serid); and find_in_set(#{serid}, serid)) A LEFT JOIN (SELECT COUNT(*) as num,hdid,serid FROM sys_taskfk WHERE serid=#{serid} GROUP BY hdid,serid) B ON A.id=B.hdid </if> <if test="type==1"> and id NOT IN ( SELECT id FROM sys_taskqd WHERE find_in_set(#{serid}, serid ) ); and id NOT IN ( SELECT id FROM sys_taskqd WHERE find_in_set(#{serid}, serid ))) A LEFT JOIN (SELECT COUNT(*) as num,hdid,serid FROM sys_taskfk WHERE serid=#{serid} GROUP BY hdid,serid) B ON A.id=B.hdid </if> </select> </mapper> src/main/java/org/springblade/modules/taskqd/service/ITaskqdService.java
@@ -22,6 +22,7 @@ import org.springblade.modules.task.entity.Task; import org.springblade.modules.task.vo.TaskVO; import org.springblade.modules.taskqd.entity.Taskqd; import org.springblade.modules.taskqd.vo.TaskqdVO; import java.util.List; @@ -34,5 +35,5 @@ public interface ITaskqdService extends IService<Taskqd> { void updatet(Integer id, Integer num, String serid); List<Taskqd> selectList(Integer id); List<Taskqd> selectLi(String type,String serid); List<TaskqdVO> selectLi(String type, String serid); } src/main/java/org/springblade/modules/taskqd/service/impl/TaskqdServiceImpl.java
@@ -24,6 +24,7 @@ import org.springblade.modules.taskqd.entity.Taskqd; import org.springblade.modules.taskqd.mapper.TaskqdMapper; import org.springblade.modules.taskqd.service.ITaskqdService; import org.springblade.modules.taskqd.vo.TaskqdVO; import org.springframework.stereotype.Service; import java.util.List; @@ -49,7 +50,7 @@ } @Override public List<Taskqd> selectLi(String type, String serid) { public List<TaskqdVO> selectLi(String type, String serid) { return baseMapper.selectLi(type, serid); } } src/main/java/org/springblade/modules/taskqd/vo/TaskqdVO.java
@@ -34,4 +34,7 @@ public class TaskqdVO extends Taskqd { private static final long serialVersionUID = 1L; private String type; private Integer nums; }