parent
9872f67cf6
commit
3fc23fd59e
@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询每日一句列表
|
||||
export function listAword(query) {
|
||||
return request({
|
||||
url: '/openapi/aword/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询每日一句详细
|
||||
export function getAword(id) {
|
||||
return request({
|
||||
url: '/openapi/aword/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 删除每日一句
|
||||
export function delAword(id) {
|
||||
return request({
|
||||
url: '/openapi/aword/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -0,0 +1,236 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="句子内容" prop="content">
|
||||
<el-input
|
||||
v-model="queryParams.content"
|
||||
placeholder="请输入句子内容"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="来源" prop="source">
|
||||
<el-input
|
||||
v-model="queryParams.source"
|
||||
placeholder="请输入来源"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="释义" prop="note">
|
||||
<el-input
|
||||
v-model="queryParams.note"
|
||||
placeholder="请输入释义"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['openapi:aword:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['openapi:aword:export']"
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="awordList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="数据ID" align="center" prop="dataId" width="100px"/>
|
||||
<el-table-column label="句子内容" align="center" prop="content"/>
|
||||
<el-table-column label="来源" align="center" prop="source" width="150px"/>
|
||||
<el-table-column label="释义" align="center" prop="note"/>
|
||||
<el-table-column label="音频地址" align="center" prop="tts"width="350px">
|
||||
<template slot-scope="scope">
|
||||
<audio :src="scope.row.tts" controls="controls">
|
||||
您的浏览器不支持 audio 标签。
|
||||
</audio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="图片地址" align="center" prop="imgurl">
|
||||
<template slot-scope="scope">
|
||||
<el-image
|
||||
style="width: 108px; height: 141px"
|
||||
:src="scope.row.imgurl"
|
||||
:preview-src-list="[scope.row.imgurl]">
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="句子产生时间" align="center" prop="date" width="150px">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.date, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100px">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
circle
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['openapi:aword:remove']"
|
||||
>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改每日一句对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listAword, getAword, delAword} from "@/api/business/openapi/aword";
|
||||
|
||||
export default {
|
||||
name: "Aword",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 每日一句表格数据
|
||||
awordList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
content: null,
|
||||
source: null,
|
||||
note: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询每日一句列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listAword(this.queryParams).then(response => {
|
||||
this.awordList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
dataId: null,
|
||||
content: null,
|
||||
source: null,
|
||||
note: null,
|
||||
tts: null,
|
||||
imgurl: null,
|
||||
date: null,
|
||||
createTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
|
||||
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除每日一句编号为"' + ids + '"的数据项?').then(function () {
|
||||
return delAword(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('openapi/aword/export', {
|
||||
...this.queryParams
|
||||
}, `aword_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -0,0 +1,49 @@
|
||||
package com.xjs.aword.service;
|
||||
|
||||
import com.xjs.aword.domain.ApiAWord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 每日一句service接口
|
||||
* @author xiejs
|
||||
* @since 2022-01-08
|
||||
*/
|
||||
public interface ApiAWordService {
|
||||
|
||||
|
||||
|
||||
//------------------代码生成--------------------------------
|
||||
|
||||
/**
|
||||
* 查询每日一句
|
||||
*
|
||||
* @param id 每日一句主键
|
||||
* @return 每日一句
|
||||
*/
|
||||
public ApiAWord selectApiAWordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询每日一句列表
|
||||
*
|
||||
* @param apiAWord 每日一句
|
||||
* @return 每日一句集合
|
||||
*/
|
||||
public List<ApiAWord> selectApiAWordList(ApiAWord apiAWord);
|
||||
|
||||
/**
|
||||
* 批量删除每日一句
|
||||
*
|
||||
* @param ids 需要删除的每日一句主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteApiAWordByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除每日一句信息
|
||||
*
|
||||
* @param id 每日一句主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteApiAWordById(Long id);
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.xjs.aword.service.impl;
|
||||
|
||||
import com.xjs.aword.domain.ApiAWord;
|
||||
import com.xjs.aword.mapper.ApiAWordMapper;
|
||||
import com.xjs.aword.service.ApiAWordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 每日一句service实现
|
||||
* @author xiejs
|
||||
* @since 2022-01-08
|
||||
*/
|
||||
@Service
|
||||
public class ApiAWordServiceImpl implements ApiAWordService {
|
||||
@Resource
|
||||
private ApiAWordMapper apiAWordMapper;
|
||||
|
||||
|
||||
//---------------------------代码生成-----------------------------
|
||||
|
||||
/**
|
||||
* 查询每日一句
|
||||
*
|
||||
* @param id 每日一句主键
|
||||
* @return 每日一句
|
||||
*/
|
||||
@Override
|
||||
public ApiAWord selectApiAWordById(Long id)
|
||||
{
|
||||
return apiAWordMapper.selectApiAWordById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询每日一句列表
|
||||
*
|
||||
* @param apiAWord 每日一句
|
||||
* @return 每日一句
|
||||
*/
|
||||
@Override
|
||||
public List<ApiAWord> selectApiAWordList(ApiAWord apiAWord)
|
||||
{
|
||||
return apiAWordMapper.selectApiAWordList(apiAWord);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除每日一句
|
||||
*
|
||||
* @param ids 需要删除的每日一句主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteApiAWordByIds(Long[] ids)
|
||||
{
|
||||
return apiAWordMapper.deleteApiAWordByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除每日一句信息
|
||||
*
|
||||
* @param id 每日一句主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteApiAWordById(Long id)
|
||||
{
|
||||
return apiAWordMapper.deleteApiAWordById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
<?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.xjs.aword.mapper.ApiAWordMapper">
|
||||
|
||||
<resultMap type="com.xjs.aword.domain.ApiAWord" id="ApiAWordResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="dataId" column="data_id"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="source" column="source"/>
|
||||
<result property="note" column="note"/>
|
||||
<result property="tts" column="tts"/>
|
||||
<result property="imgurl" column="imgurl"/>
|
||||
<result property="date" column="date"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectApiAWordVo">
|
||||
select id, data_id, content, source, note, tts, imgurl, date, create_time
|
||||
from api_a_word
|
||||
</sql>
|
||||
|
||||
<select id="selectApiAWordList" parameterType="com.xjs.aword.domain.ApiAWord" resultMap="ApiAWordResult">
|
||||
<include refid="selectApiAWordVo"/>
|
||||
<where>
|
||||
<if test="content != null and content != ''">and content like "%"#{content}"%"</if>
|
||||
<if test="source != null and source != ''">and source like "%"#{source}"%"</if>
|
||||
<if test="note != null and note != ''">and note like "%"#{note}"%"</if>
|
||||
</where>
|
||||
order by date desc
|
||||
</select>
|
||||
|
||||
<select id="selectApiAWordById" parameterType="Long" resultMap="ApiAWordResult">
|
||||
<include refid="selectApiAWordVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<delete id="deleteApiAWordById" parameterType="Long">
|
||||
delete
|
||||
from api_a_word
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteApiAWordByIds" parameterType="String">
|
||||
delete from api_a_word where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in new issue