parent
7e58c9bf90
commit
c44c0c3ee5
@ -0,0 +1,26 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询英语一言列表
|
||||
export function listOneenglish(query) {
|
||||
return request({
|
||||
url: '/openapi/oneenglish/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询英语一言详细
|
||||
export function getOneenglish(id) {
|
||||
return request({
|
||||
url: '/openapi/oneenglish/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 删除英语一言
|
||||
export function delOneenglish(id) {
|
||||
return request({
|
||||
url: '/openapi/oneenglish/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="英文" prop="en">
|
||||
<el-input
|
||||
v-model="queryParams.en"
|
||||
placeholder="请输入英文"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="中文" prop="zh">
|
||||
<el-input
|
||||
v-model="queryParams.zh"
|
||||
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:oneenglish: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:oneenglish:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="oneenglishList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="英文" align="center" prop="en" />
|
||||
<el-table-column label="中文" align="center" prop="zh" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
circle
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['openapi:oneenglish: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"
|
||||
/>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listOneenglish, getOneenglish, delOneenglish } from "@/api/business/openapi/oneenglish";
|
||||
|
||||
export default {
|
||||
name: "Oneenglish",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 英语一言表格数据
|
||||
oneenglishList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
en: null,
|
||||
zh: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询英语一言列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listOneenglish(this.queryParams).then(response => {
|
||||
this.oneenglishList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
en: null,
|
||||
zh: 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 delOneenglish(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('openapi/oneenglish/export', {
|
||||
...this.queryParams
|
||||
}, `oneenglish_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -0,0 +1,75 @@
|
||||
package com.xjs.oneenglish.controller;
|
||||
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.xjs.oneenglish.domain.ApiEnglish;
|
||||
import com.xjs.oneenglish.service.IApiEnglishService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 英语一言Controller
|
||||
*
|
||||
* @author xjs
|
||||
* @date 2021-12-31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/oneenglish")
|
||||
public class ApiEnglishController extends BaseController {
|
||||
@Autowired
|
||||
private IApiEnglishService apiEnglishService;
|
||||
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* 查询英语一言列表
|
||||
*/
|
||||
@RequiresPermissions("openapi:oneenglish:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ApiEnglish apiEnglish) {
|
||||
startPage();
|
||||
List<ApiEnglish> list = apiEnglishService.selectApiEnglishList(apiEnglish);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出英语一言列表
|
||||
*/
|
||||
@RequiresPermissions("openapi:oneenglish:export")
|
||||
@Log(title = "英语一言", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ApiEnglish apiEnglish) {
|
||||
List<ApiEnglish> list = apiEnglishService.selectApiEnglishList(apiEnglish);
|
||||
ExcelUtil<ApiEnglish> util = new ExcelUtil<ApiEnglish>(ApiEnglish.class);
|
||||
util.exportExcel(response, list, "英语一言数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取英语一言详细信息
|
||||
*/
|
||||
@RequiresPermissions("openapi:oneenglish:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(apiEnglishService.selectApiEnglishById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除英语一言
|
||||
*/
|
||||
@RequiresPermissions("openapi:oneenglish:remove")
|
||||
@Log(title = "英语一言", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(apiEnglishService.deleteApiEnglishByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.xjs.oneenglish.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 英语一言对象 api_english
|
||||
*
|
||||
* @author xjs
|
||||
* @date 2021-12-31
|
||||
*/
|
||||
@Data
|
||||
public class ApiEnglish implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 英文
|
||||
*/
|
||||
@Excel(name = "英文")
|
||||
private String en;
|
||||
|
||||
/**
|
||||
* 中文
|
||||
*/
|
||||
@Excel(name = "中文")
|
||||
private String zh;
|
||||
|
||||
|
||||
@Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.xjs.oneenglish.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author xiejs
|
||||
* @desc 通用请求参数
|
||||
* @create 2021-12-31
|
||||
*/
|
||||
@Data
|
||||
public class RequestBody {
|
||||
|
||||
private String key;
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.xjs.oneenglish.factory;
|
||||
|
||||
import com.xjs.oneenglish.domain.ApiEnglish;
|
||||
import com.xjs.oneenglish.domain.RequestBody;
|
||||
|
||||
/**
|
||||
* @author xiejs
|
||||
* @desc 英语一言工厂
|
||||
* @create 2021-12-31
|
||||
*/
|
||||
public interface OneEnglishFactory {
|
||||
|
||||
/**
|
||||
* 一言英语 工厂方法
|
||||
* @param requestBody 请求参数
|
||||
* @return ApiEnglish
|
||||
*/
|
||||
ApiEnglish getOneEnglish(RequestBody requestBody);
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.xjs.oneenglish.factory;
|
||||
|
||||
import com.xjs.oneenglish.domain.ApiEnglish;
|
||||
import com.xjs.oneenglish.domain.RequestBody;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author xiejs
|
||||
* @desc 一言英语工厂实现
|
||||
* @create 2021-12-31
|
||||
*/
|
||||
@Component
|
||||
public class TianXingOneEnglishFactory implements OneEnglishFactory{
|
||||
|
||||
@Override
|
||||
public ApiEnglish getOneEnglish(RequestBody requestBody) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package com.xjs.oneenglish.mapper;
|
||||
|
||||
import com.xjs.oneenglish.domain.ApiEnglish;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 英语一言Mapper接口
|
||||
*
|
||||
* @author xjs
|
||||
* @date 2021-12-31
|
||||
*/
|
||||
public interface ApiEnglishMapper {
|
||||
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
||||
/**
|
||||
* 查询英语一言
|
||||
*
|
||||
* @param id 英语一言主键
|
||||
* @return 英语一言
|
||||
*/
|
||||
public ApiEnglish selectApiEnglishById(Long id);
|
||||
|
||||
/**
|
||||
* 查询英语一言列表
|
||||
*
|
||||
* @param apiEnglish 英语一言
|
||||
* @return 英语一言集合
|
||||
*/
|
||||
public List<ApiEnglish> selectApiEnglishList(ApiEnglish apiEnglish);
|
||||
|
||||
|
||||
/**
|
||||
* 删除英语一言
|
||||
*
|
||||
* @param id 英语一言主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteApiEnglishById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除英语一言
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteApiEnglishByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.xjs.oneenglish.service;
|
||||
|
||||
import com.xjs.oneenglish.domain.ApiEnglish;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 英语一言Service接口
|
||||
*
|
||||
* @author xjs
|
||||
* @date 2021-12-31
|
||||
*/
|
||||
public interface IApiEnglishService {
|
||||
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
||||
/**
|
||||
* 查询英语一言
|
||||
*
|
||||
* @param id 英语一言主键
|
||||
* @return 英语一言
|
||||
*/
|
||||
public ApiEnglish selectApiEnglishById(Long id);
|
||||
|
||||
/**
|
||||
* 查询英语一言列表
|
||||
*
|
||||
* @param apiEnglish 英语一言
|
||||
* @return 英语一言集合
|
||||
*/
|
||||
public List<ApiEnglish> selectApiEnglishList(ApiEnglish apiEnglish);
|
||||
|
||||
/**
|
||||
* 批量删除英语一言
|
||||
*
|
||||
* @param ids 需要删除的英语一言主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteApiEnglishByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除英语一言信息
|
||||
*
|
||||
* @param id 英语一言主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteApiEnglishById(Long id);
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.xjs.oneenglish.service.impl;
|
||||
|
||||
import com.xjs.oneenglish.domain.ApiEnglish;
|
||||
import com.xjs.oneenglish.mapper.ApiEnglishMapper;
|
||||
import com.xjs.oneenglish.service.IApiEnglishService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 英语一言Service业务层处理
|
||||
*
|
||||
* @author xjs
|
||||
* @date 2021-12-31
|
||||
*/
|
||||
@Service
|
||||
public class ApiEnglishServiceImpl implements IApiEnglishService {
|
||||
@Autowired
|
||||
private ApiEnglishMapper apiEnglishMapper;
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
||||
/**
|
||||
* 查询英语一言
|
||||
*
|
||||
* @param id 英语一言主键
|
||||
* @return 英语一言
|
||||
*/
|
||||
@Override
|
||||
public ApiEnglish selectApiEnglishById(Long id) {
|
||||
return apiEnglishMapper.selectApiEnglishById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询英语一言列表
|
||||
*
|
||||
* @param apiEnglish 英语一言
|
||||
* @return 英语一言
|
||||
*/
|
||||
@Override
|
||||
public List<ApiEnglish> selectApiEnglishList(ApiEnglish apiEnglish) {
|
||||
return apiEnglishMapper.selectApiEnglishList(apiEnglish);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除英语一言
|
||||
*
|
||||
* @param ids 需要删除的英语一言主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteApiEnglishByIds(Long[] ids) {
|
||||
return apiEnglishMapper.deleteApiEnglishByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除英语一言信息
|
||||
*
|
||||
* @param id 英语一言主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteApiEnglishById(Long id) {
|
||||
return apiEnglishMapper.deleteApiEnglishById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
<?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.oneenglish.mapper.ApiEnglishMapper">
|
||||
|
||||
<resultMap type="com.xjs.oneenglish.domain.ApiEnglish" id="ApiEnglishResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="en" column="en" />
|
||||
<result property="zh" column="zh" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectApiEnglishVo">
|
||||
select id, en, zh, create_time from api_english
|
||||
</sql>
|
||||
|
||||
<select id="selectApiEnglishList" parameterType="com.xjs.oneenglish.domain.ApiEnglish" resultMap="ApiEnglishResult">
|
||||
<include refid="selectApiEnglishVo"/>
|
||||
<where>
|
||||
<if test="en != null and en != ''"> and en = #{en}</if>
|
||||
<if test="zh != null and zh != ''"> and zh = #{zh}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectApiEnglishById" parameterType="Long" resultMap="ApiEnglishResult">
|
||||
<include refid="selectApiEnglishVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<delete id="deleteApiEnglishById" parameterType="Long">
|
||||
delete from api_english where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteApiEnglishByIds" parameterType="String">
|
||||
delete from api_english where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in new issue