Skip to content

Commit

Permalink
perf: 重命名表名,统一 ds 前缀
Browse files Browse the repository at this point in the history
  • Loading branch information
baiwumm committed Jun 17, 2024
1 parent 9338437 commit d7d2763
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
>
<template #default="{ row }">
<div class="py-2.5">
<el-badge :value="row.websites.length" :max="99" :hidden="!row.websites.length">
<el-badge :value="row.ds_websites.length" :max="99" :hidden="!row.ds_websites.length">
<el-tag type="primary">{{ row.name }}</el-tag>
</el-badge>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/admin/_components/categorys/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="flex flex-col gap-4">
<el-space wrap>
<el-input v-model="name" style="width: 240px" placeholder="输入关键词搜索" />
<el-input v-model="name" style="width: 240px" placeholder="输入分类名称搜索" />
<el-button type="primary" :loading="pending" @click="handleSearch"> 查询 </el-button>
<el-button type="primary" @click="handleAdd"> 新增 </el-button>
</el-space>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
min-width="100"
>
<template #default="{ row }">
<el-tag type="success">{{ row.categorys.name }}</el-tag>
<el-tag type="success">{{ row.ds_categorys.name }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="sort" label="排序" align="center" sortable min-width="100" />
Expand Down
2 changes: 1 addition & 1 deletion src/pages/admin/_components/websites/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<el-space wrap>
<el-form :model="form" inline class="searchForm">
<el-form-item prop="name">
<el-input v-model="form.name" style="width: 240px" placeholder="输入关键词搜索" />
<el-input v-model="form.name" style="width: 240px" placeholder="输入站点名称搜索" />
</el-form-item>
<el-form-item prop="category_id">
<el-select
Expand Down
4 changes: 2 additions & 2 deletions src/server/api/categorys/index.delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: 白雾茫茫丶<baiwumm.com>
* @Date: 2024-06-13 13:39:14
* @LastEditors: 白雾茫茫丶<baiwumm.com>
* @LastEditTime: 2024-06-17 10:35:31
* @LastEditTime: 2024-06-17 17:41:43
* @Description: 删除网站分类
*/
import type { Response, CategoryEdit, CategoryList } from '~/types'
Expand All @@ -22,7 +22,7 @@ export default defineEventHandler(async (event): Promise<Response<CategoryList[]
}

// 删除数据
const { error } = await client.from('categorys').delete().eq('id', id)
const { error } = await client.from('ds_categorys').delete().eq('id', id)

// 判断请求结果
if (error) {
Expand Down
6 changes: 3 additions & 3 deletions src/server/api/categorys/index.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: 白雾茫茫丶<baiwumm.com>
* @Date: 2024-05-29 14:39:50
* @LastEditors: 白雾茫茫丶<baiwumm.com>
* @LastEditTime: 2024-06-17 14:21:07
* @LastEditTime: 2024-06-17 17:45:24
* @Description: 获取分类列表
*/
import type { Response, PageResponse, CategoryList, CategoryParams } from '~/types'
Expand All @@ -24,8 +24,8 @@ export default defineEventHandler(async (event): Promise<Response<PageResponse<C

// 查询 sql
let sqlQuery = client
.from('categorys')
.select('*,websites(*)', { count: 'exact' })
.from('ds_categorys')
.select('*,ds_websites(*)', { count: 'exact' })
.range(start, end)
.order('sort', {
ascending: false
Expand Down
2 changes: 1 addition & 1 deletion src/server/api/categorys/index.post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default defineEventHandler(async (event): Promise<Response<CategoryList[]

// 插入数据
const { data, error } = await client
.from('categorys')
.from('ds_categorys')
.insert({ ...body, email: user?.email })
.select()

Expand Down
2 changes: 1 addition & 1 deletion src/server/api/categorys/index.put.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default defineEventHandler(async (event): Promise<Response<CategoryList[]

// 插入数据
const { data, error } = await client
.from('categorys')
.from('ds_categorys')
.update({ ...body, updated_at: new Date() })
.eq('id', id)
.select()
Expand Down
4 changes: 2 additions & 2 deletions src/server/api/websites/index.delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: 白雾茫茫丶<baiwumm.com>
* @Date: 2024-06-13 13:39:14
* @LastEditors: 白雾茫茫丶<baiwumm.com>
* @LastEditTime: 2024-06-13 13:43:03
* @LastEditTime: 2024-06-17 17:42:48
* @Description: 删除站点
*/
import type { Response, WebsiteEdit, WebsiteList } from '~/types'
Expand All @@ -22,7 +22,7 @@ export default defineEventHandler(async (event): Promise<Response<WebsiteList[]>
}

// 删除数据
const { error } = await client.from('websites').delete().eq('id', id)
const { error } = await client.from('ds_websites').delete().eq('id', id)

// 判断请求结果
if (error) {
Expand Down
4 changes: 2 additions & 2 deletions src/server/api/websites/index.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export default defineEventHandler(async (event): Promise<Response<PageResponse<W

// 查询 sql
let sqlQuery = client
.from('websites')
.select('*,categorys(*)', { count: 'exact' })
.from('ds_websites')
.select('*,ds_categorys(*)', { count: 'exact' })
.range(start, end)
.order('sort', {
ascending: false
Expand Down
2 changes: 1 addition & 1 deletion src/server/api/websites/index.post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default defineEventHandler(async (event): Promise<Response<WebsiteList[]>

// 插入数据
const { data, error } = await client
.from('websites')
.from('ds_websites')
.insert({ ...body, email: user?.email })
.select()

Expand Down
4 changes: 2 additions & 2 deletions src/server/api/websites/index.put.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: 白雾茫茫丶<baiwumm.com>
* @Date: 2024-06-12 17:45:42
* @LastEditors: 白雾茫茫丶<baiwumm.com>
* @LastEditTime: 2024-06-14 15:28:54
* @LastEditTime: 2024-06-17 17:43:27
* @Description: 更新站点列表
*/
import type { Response, WebsiteEdit, WebsiteList } from '~/types'
Expand All @@ -23,7 +23,7 @@ export default defineEventHandler(async (event): Promise<Response<WebsiteList[]>

// 插入数据
const { data, error } = await client
.from('websites')
.from('ds_websites')
.update({ ...body, updated_at: new Date() })
.eq('id', id)
.select()
Expand Down

0 comments on commit d7d2763

Please sign in to comment.