parent
9f423749d4
commit
4f5a50b4f2
|
|
@ -24,3 +24,10 @@ export function delCopyWriting(id) {
|
|||
method: 'delete'
|
||||
})
|
||||
}
|
||||
// 删除重复文案信息
|
||||
export function delRepeatCopyWriting() {
|
||||
return request({
|
||||
url: '/openapi/copyWriting/Repeat/',
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,10 +48,6 @@
|
|||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
|
|
@ -60,7 +56,7 @@
|
|||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['openapi:copywriting:remove']"
|
||||
v-hasPermi="['openapi:copywriting:delete']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
|
|
@ -73,6 +69,17 @@
|
|||
v-hasPermi="['openapi:copywriting:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
@click="delRepeatCopyWriting"
|
||||
v-hasPermi="['openapi:copywriting:delete']"
|
||||
>删除重复文案</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
|
|
@ -102,7 +109,7 @@
|
|||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['openapi:copywriting:remove']"
|
||||
v-hasPermi="['openapi:copywriting:delete']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
|
@ -134,7 +141,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { listCopyWriting, getCopyWriting, delCopyWriting } from "@/api/business/openapi/copywriting";
|
||||
import { listCopyWriting, getCopyWriting,delRepeatCopyWriting, delCopyWriting } from "@/api/business/openapi/copywriting";
|
||||
|
||||
export default {
|
||||
name: "CopyWriting",
|
||||
|
|
@ -187,6 +194,13 @@ export default {
|
|||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
//删除重复文案
|
||||
delRepeatCopyWriting() {
|
||||
delRepeatCopyWriting().then(res =>{
|
||||
this.$modal.msgSuccess("删除"+res.data+"条");
|
||||
})
|
||||
},
|
||||
|
||||
/** 详细按钮操作 */
|
||||
handleView(row) {
|
||||
this.open = true;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
|||
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* @author xiejs
|
||||
|
|
@ -15,6 +16,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableRyFeignClients
|
||||
//这个服务开启boot内置定时任务
|
||||
@EnableScheduling
|
||||
public class XjsOpenApiApp {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(XjsOpenApiApp.class, args);
|
||||
|
|
|
|||
|
|
@ -67,6 +67,16 @@ public class CopyWritingController extends BaseController {
|
|||
return R.ok(copyWriting);
|
||||
}
|
||||
|
||||
@DeleteMapping("Repeat")
|
||||
@ApiOperation("删除重复文案内容")
|
||||
@RequiresPermissions("openapi:copywriting:delete")
|
||||
@Log(title = "删除重复文案", businessType = BusinessType.DELETE)
|
||||
public AjaxResult deleteRepeatData() {
|
||||
int count = copyWritingService.deleteRepeatData();
|
||||
return AjaxResult.success(count);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 封装随机调用api
|
||||
*
|
||||
|
|
|
|||
|
|
@ -24,6 +24,13 @@ public interface CopyWritingMapper extends BaseMapper<CopyWriting> {
|
|||
CopyWriting getOneToRandom();
|
||||
|
||||
|
||||
/**
|
||||
* 删除重复文案数据
|
||||
* @return int 删除条数
|
||||
*/
|
||||
int deleteRepeatData();
|
||||
|
||||
|
||||
//---------------------代码自动生成-------------------------
|
||||
/**
|
||||
* 查询文案api,通过api获取文案信息
|
||||
|
|
|
|||
|
|
@ -24,6 +24,12 @@ public interface CopyWritingService extends IService<CopyWriting> {
|
|||
*/
|
||||
CopyWriting getOneToRandom();
|
||||
|
||||
/**
|
||||
* 删除重复文案数据
|
||||
* @return int 删除条数
|
||||
*/
|
||||
int deleteRepeatData();
|
||||
|
||||
|
||||
//-------------------------代码自动生成----------------------------------
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ public class CopyWritingServiceImpl extends ServiceImpl<CopyWritingMapper, CopyW
|
|||
return copyWritingMapper.getOneToRandom();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteRepeatData() {
|
||||
return copyWritingMapper.deleteRepeatData();
|
||||
}
|
||||
|
||||
|
||||
//----------------------代码自动生成------------------------------------
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
package com.xjs.copywriting.task;
|
||||
|
||||
import com.xjs.copywriting.service.CopyWritingService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author xiejs
|
||||
* @desc 删除重复文案数据
|
||||
* @create 2022-01-06
|
||||
*/
|
||||
@Component
|
||||
@Log4j2
|
||||
public class DeleteRepeatTask {
|
||||
@Resource
|
||||
private CopyWritingService copyWritingService;
|
||||
|
||||
/**
|
||||
* 2022-01-07 07:00:00
|
||||
* 2022-01-07 08:00:00
|
||||
* 2022-01-07 09:00:00
|
||||
* 2022-01-07 10:00:00
|
||||
*/
|
||||
@Scheduled(cron = "0 0 7-23 * * ? ")
|
||||
public void execute() {
|
||||
int count = copyWritingService.deleteRepeatData();
|
||||
log.info("thread id:{},定时清除文案重复数据,重复数:{}", Thread.currentThread().getId(),count);
|
||||
}
|
||||
}
|
||||
|
|
@ -66,5 +66,14 @@
|
|||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRepeatData">
|
||||
DELETE
|
||||
FROM
|
||||
api_copywriting
|
||||
WHERE
|
||||
content IN ( SELECT t.content FROM ( SELECT content FROM api_copywriting GROUP BY content HAVING count( content ) > 1 ) t )
|
||||
AND id NOT IN ( SELECT c.id FROM ( SELECT max( id ) id FROM api_copywriting GROUP BY content HAVING count( content )> 1 ) c )
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue