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

Fuzzy query optimized

This commit is contained in:
assina045
2023-06-08 17:54:47 +08:00
parent 640c3bca34
commit 3d04abc08a
9 changed files with 142 additions and 78 deletions

View File

@@ -72,6 +72,12 @@ public class AffairController {
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", affairService.list(wrapper));
}
@GetMapping("/not_approved_FuzzyQueries")
@PreAuthorize("hasAuthority('affair:manage:get')")
public ResponseResult<List<Affair>> selectNotApprovedByFuzzyQueries(String title,Long typeId,Integer status,Long applicantId) {
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK,"success",affairService.getNotApprovedByFuzzyQueries(title,typeId,status,applicantId));
}
@GetMapping("/approved")
@PreAuthorize("hasAuthority('affair:manage:get')")

View File

@@ -43,6 +43,8 @@ public interface AffairMapper extends BaseMapper<Affair> {
List<Affair> getFuzzyQueriesByAffairTitle(String title, Long typeId, Integer status,Long applicantId);
List<Affair> getNotApprovedByFuzzyQueries(String title, Long typeId, Integer status,Long applicantId);
//
// @Select("SELECT t_affair.applicant_id,t_affair.inspector_id,t_user.id,t_user.username from t_affair,t_user ")
// @ResultType(Affair.class)

View File

@@ -26,5 +26,7 @@ public interface IAffairService extends IService<Affair> {
List<User> getSameDepartmentUser (long id);
List<Affair> getFuzzyQueriesByAffairTitle(String title,Long typeId,Integer status,Long applicantId);
List<Affair> getNotApprovedByFuzzyQueries(String title,Long typeId,Integer status,Long applicantId);
}

View File

@@ -44,4 +44,9 @@ public class AffairServiceImpl extends ServiceImpl<AffairMapper, Affair> impleme
List<Affair> affairList = affairMapper.getFuzzyQueriesByAffairTitle(title,typeId,status,applicantId);
return affairList;
}
public List<Affair> getNotApprovedByFuzzyQueries(String title, Long typeId, Integer status, Long applicantId) {
return null;
}
}

View File

@@ -66,6 +66,35 @@
</resultMap>
<select id="getNotApprovedByFuzzyQueries" resultMap="affairMap2">
select
*
from t_affair
<where>
<if test=" applicantId !=null">
applicant_id = #{applicantId}
</if>
<if test=" title!=null and title!='' ">
and instr(title,#{title})&gt;0
</if>
<if test=" typeId!=null ">
and instr(type_id,#{typeId})>0
</if>
<if test="status!=null ">
and instr(status,#{status})>0
</if>
</where>
order by create_time desc
</select>
<resultMap id="affairMap2" type="affair" autoMapping="true">
<id property="id" column="id"/>
</resultMap>
</mapper>

View File

@@ -1,20 +1,4 @@
<template>
<el-col :span="16">
<div class="mt-4">
<el-input placeholder="查询事务" class="input-with-select">
<template #prepend>
<el-select placeholder="查询方式">
<el-option label="事务编号" value="1" />
<el-option label="事务名称" value="2" />
<el-option label="日期" value="3" />
</el-select>
</template>
<template #append>
<el-button>查询</el-button>
</template>
</el-input>
</div>
</el-col>
<el-table :data="tableData" style="width: 100%">
<el-table-column label="事务编号" prop="id" />
@@ -214,6 +198,12 @@ export default {
this.getApproved()
this.dialogFalse()
this.getUser()
},
props: ['DataToRouterView'],
watch: {
DataToRouterView: function (val) {
this.tableData = val
}
}
}
</script>

View File

@@ -1,20 +1,4 @@
<template>
<el-col :span="16">
<div class="mt-4">
<el-input placeholder="查询事务" class="input-with-select">
<template #prepend>
<el-select placeholder="查询方式">
<el-option label="事务编号" value="1" />
<el-option label="事务名称" value="2" />
<el-option label="日期" value="3" />
</el-select>
</template>
<template #append>
<el-button>查询</el-button>
</template>
</el-input>
</div>
</el-col>
<el-table :data="tableData" style="width: 100%">
<el-table-column label="事务编号" prop="id" />
@@ -199,7 +183,13 @@ export default {
console.log('not approved created')
this.getApproved()
this.dialogFalse()
} // 获取事务信息
}, // 获取事务信息
props: ['DataToRouterView'],
watch: {
DataToRouterView: function (val) {
this.tableData = val
}
}
}
</script>
<style></style>

View File

@@ -192,13 +192,6 @@ export default {
dialogFalse() {
this.dialogVisible = false
}
// forRouter() {
// setInterval(() => {
// if (this.DataToRouterView !== '') {
// this.tableData = this.DataToRouterView
// }
// }, 500)
// }
},
created() {
this.getApproved()

View File

@@ -1,50 +1,97 @@
<template>
<el-row :span="24">
<el-col :span="18">
<div class="mt-4">
<el-input placeholder="查询事务" class="input-with-select">
<template #prepend>
<el-select placeholder="查询方式">
<el-option label="事务编号" value="1" />
<el-option label="事务名称" value="2" />
<el-option label="日期" value="3" />
</el-select>
</template>
<template #append>
<el-button>查询</el-button>
</template>
</el-input>
</div>
</el-col>
<el-container>
<el-header>
<el-col :span="24">
<el-menu
:default-active="$route.path"
class="el-menu-demo"
mode="horizontal"
router
background-color="white"
>
<el-menu-item index="/affair/manage/toApprove"> 待审批 </el-menu-item>
<el-menu-item index="/affair/manage/Approved"> 已审批 </el-menu-item>
</el-menu>
</el-col>
</el-header>
<el-col :span="6">
<el-menu
:default-active="$route.path"
class="el-menu-demo"
mode="horizontal"
router
background-color="white"
>
<el-menu-item index="/affair/manage/toApprove">
<el-button type="warning" round>待审批</el-button>
</el-menu-item>
<el-menu-item index="/affair/manage/Approved">
<el-button type="success" round>已审批</el-button>
</el-menu-item>
</el-menu>
</el-col>
<router-view></router-view>
</el-row>
<el-main>
<el-col :span="24">
<el-form :model="formData">
<el-row :span="24">
<el-col :span="5">
<el-form-item label="事务标题:"
><el-input v-model="formData.title"></el-input>
</el-form-item>
</el-col>
<el-col :span="1"></el-col>
<el-col :span="4">
<el-form-item label="事务类型:"
><el-select v-model="formData.typeId">
<el-option label="事假" name="type1" value="1"></el-option>
<el-option label="病假" name="type2" value="2"></el-option>
<el-option label="财务报销" name="type3" value="3"></el-option>
<el-option label="调休" name="type4" value="4"></el-option>
</el-select> </el-form-item
></el-col>
<el-col :span="1"></el-col>
<el-col :span="4"
><el-form-item label="审批进度:">
<el-select v-model="formData.status">
<el-option label="未审批" value="0"></el-option>
<el-option label="同意" value="1"></el-option>
<el-option label="驳回" value="2"></el-option>
</el-select> </el-form-item
></el-col>
<el-col :span="1"></el-col>
<el-col :span="3">
<el-button type="primary" @click="onSubmit">查询</el-button>
<el-button type="primary" @click="resetForm">重置</el-button>
</el-col>
</el-row>
</el-form>
</el-col>
<router-view :DataToRouterView="DataToRouterView"></router-view>
</el-main>
</el-container>
</template>
<script lang="ts">
import { COLOR_BACKGROUND } from '@/constants/Common.constants'
import request from '@/services'
export default {
name: 'AffairManage',
data() {
return {
formView: true,
formData: {
title: '',
typeId: '',
status: ''
},
DataToRouterView: {}
}
},
methods: {
COLOR_BACKGROUND() {
return COLOR_BACKGROUND
turnFormViewFalse() {
this.formView = false
},
turnFormViewTrue() {
this.formView = true
},
onSubmit() {
request
.get('/affair/personal_affairs_fuzzy_queries', this.formData)
.then((response) => {
this.DataToRouterView = response.data.data
console.log(response.data)
})
.catch((reportError) => {
console.log(reportError)
})
},
resetForm() {
this.$router.go()
}
}
}