1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 15:01:23 +08:00

Modifying search function bugs in work management

This commit is contained in:
ggb
2023-06-08 18:34:35 +08:00
parent 8b51888ad8
commit cfa67cf608
4 changed files with 23 additions and 13 deletions

View File

@@ -31,10 +31,13 @@ public class WorkController {
@GetMapping @GetMapping
@PreAuthorize("hasAuthority('work:manage:get')") @PreAuthorize("hasAuthority('work:manage:get')")
public ResponseResult<List<Work>> getAll(String content) { public ResponseResult<List<Work>> getAll(String content) {
if (content != null) { System.out.println(content);
if (content != null && content.length() != 0) {
System.out.println("test1");
List<Work> workList = workService.getWorkByContent(content); List<Work> workList = workService.getWorkByContent(content);
return ResponseResult.databaseSelectSuccess(workList); return ResponseResult.databaseSelectSuccess(workList);
} else { } else {
System.out.println("test2");
return ResponseResult.databaseSelectSuccess(workService.getAll()); return ResponseResult.databaseSelectSuccess(workService.getAll());
} }
} }

View File

@@ -18,7 +18,3 @@ mybatis-plus:
type-aliases-package: com.cfive.pinnacle.entity type-aliases-package: com.cfive.pinnacle.entity
configuration: configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
logging:
level:
root: debug

View File

@@ -76,14 +76,18 @@
tuw.user_id worker_id, tuw.user_id worker_id,
tu.username worker_name, tu.username worker_name,
tuw.status status, tuw.status status,
tuw.complete_time completeTime tuw.complete_time completeTime,
first_name,
last_name
from t_work w from t_work w
left join (select * from t_user where deleted = 0) as u on w.publisher_id = u.id left join (select * from t_user where deleted = 0) as u on w.publisher_id = u.id
left join (select * from t_user_work where deleted = 0) as tuw on w.id = tuw.work_id left join (select * from t_user_work where deleted = 0) as tuw on w.id = tuw.work_id
left join (select * from t_user where deleted = 0) as tu on tuw.user_id = tu.id left join (select * from t_user where deleted = 0) as tu on tuw.user_id = tu.id
left join (select * from t_staff where deleted = 0) as ts on tuw.user_id = ts.user_id
where w.content like '%${content}%' where w.content like '%${content}%'
and w.deleted = 0 and w.deleted = 0
and w.old = 0; and w.old = 0
order by w.id desc;
</select> </select>
<select id="getTodo" parameterType="long" resultMap="workMap"> <select id="getTodo" parameterType="long" resultMap="workMap">
select w.id, select w.id,

View File

@@ -11,7 +11,12 @@
</el-col> </el-col>
<el-col :span="1" /> <el-col :span="1" />
<el-col :span="3"> <el-col :span="3">
<el-button size="default" type="primary" @click="searchByContent">搜索</el-button> <el-button
size="default"
type="primary"
@click="searchByContent(this.searchContent.trim())"
>搜索</el-button
>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
<el-button size="default" @click="addVisible = true">添加</el-button> <el-button size="default" @click="addVisible = true">添加</el-button>
@@ -112,6 +117,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import _ from 'lodash'
import request from '@/services' import request from '@/services'
import EditWork from '@/components/work/EditWork.vue' import EditWork from '@/components/work/EditWork.vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
@@ -131,7 +137,7 @@ export default {
addVisible: false, addVisible: false,
editVisible: false, editVisible: false,
loading: true, loading: true,
searchContent: '', searchContent: null,
workers: [] workers: []
} }
}, },
@@ -150,7 +156,7 @@ export default {
request.get('/work').then((res) => { request.get('/work').then((res) => {
const response = res.data const response = res.data
if (response.code === DATABASE_SELECT_OK) { if (response.code === DATABASE_SELECT_OK) {
this.tableData = response.data this.tableData = _.cloneDeep(response.data)
if (this.tableData) { if (this.tableData) {
this.loading = false this.loading = false
} }
@@ -219,11 +225,12 @@ export default {
formatDate(time) { formatDate(time) {
return new Date(time).toLocaleString() return new Date(time).toLocaleString()
}, },
searchByContent() { searchByContent(content) {
request.get('/work', { content: this.searchContent.trim() }).then((res) => { request.get('/work', { content }).then((res) => {
const response = res.data const response = res.data
if (response.code === DATABASE_SELECT_OK) { if (response.code === DATABASE_SELECT_OK) {
this.tableData = response.data this.tableData = _.cloneDeep(response.data)
console.log(this.tableData)
if (this.tableData) { if (this.tableData) {
this.loading = false this.loading = false
} }