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

Fuzzy query debug

This commit is contained in:
assina045
2023-06-10 03:43:43 +08:00
parent 5d43ea9f55
commit b96b3a8cf6
9 changed files with 104 additions and 21 deletions

View File

@@ -73,8 +73,9 @@ public class AffairController {
@GetMapping("/not_approved_FuzzyQueries") @GetMapping("/not_approved_FuzzyQueries")
@PreAuthorize("hasAuthority('affair:manage:get')") @PreAuthorize("hasAuthority('affair:manage:get')")
public ResponseResult<List<Affair>> selectNotApprovedByFuzzyQueries(String title,Long typeId,Integer status,Long applicantId,LocalDateTime startTime,LocalDateTime endTime ) { public ResponseResult<List<Affair>> selectNotApprovedByFuzzyQueries(String title,Long typeId,Integer status,LocalDateTime startTime,LocalDateTime endTime ) {
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK,"success",affairService.getNotApprovedByFuzzyQueries(title,typeId,status,applicantId,startTime,endTime)); Long inspectorId= WebUtil.getLoginUser().getUser().getId();
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK,"success",affairService.getNotApprovedByFuzzyQueries(title,typeId,status,inspectorId,startTime,endTime));
} }
@@ -87,6 +88,13 @@ public class AffairController {
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", affairService.list(wrapper2)); return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", affairService.list(wrapper2));
} }
@GetMapping("/approved_FuzzyQueries")
@PreAuthorize("hasAuthority('affair:manage:get')")
public ResponseResult<List<Affair>> selectApprovedByFuzzyQueries(String title,Long typeId,Integer status,LocalDateTime startTime,LocalDateTime endTime ) {
Long inspectorId =WebUtil.getLoginUser().getUser().getId();
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK,"success",affairService.getApprovedByFuzzyQueries(title,typeId,status,inspectorId,startTime,endTime));
}
@PutMapping("/yes") @PutMapping("/yes")
@PreAuthorize("hasAuthority('affair:manage:modify')") @PreAuthorize("hasAuthority('affair:manage:modify')")
public ResponseResult<Integer> updateAffairYes(@RequestBody Affair affair) { public ResponseResult<Integer> updateAffairYes(@RequestBody Affair affair) {

View File

@@ -43,7 +43,9 @@ public interface AffairMapper extends BaseMapper<Affair> {
List<Affair> getFuzzyQueriesByAffairTitle(String title, Long typeId, Integer status,Long applicantId); List<Affair> getFuzzyQueriesByAffairTitle(String title, Long typeId, Integer status,Long applicantId);
List<Affair> getNotApprovedByFuzzyQueries(String title, Long typeId, Integer status,Long applicantId ,LocalDateTime startTime,LocalDateTime endTime); List<Affair> getNotApprovedByFuzzyQueries(String title, Long typeId, Integer status,Long inspectorId ,LocalDateTime startTime,LocalDateTime endTime);
List<Affair> getApprovedByFuzzyQueries(String title, Long typeId, Integer status,Long inspectorId ,LocalDateTime startTime,LocalDateTime endTime);
// //
// @Select("SELECT t_affair.applicant_id,t_affair.inspector_id,t_user.id,t_user.username from t_affair,t_user ") // @Select("SELECT t_affair.applicant_id,t_affair.inspector_id,t_user.id,t_user.username from t_affair,t_user ")

View File

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

View File

@@ -46,8 +46,14 @@ public class AffairServiceImpl extends ServiceImpl<AffairMapper, Affair> impleme
} }
public List<Affair> getNotApprovedByFuzzyQueries(String title, Long typeId, Integer status, Long applicantId, LocalDateTime startTime ,LocalDateTime endTime) { public List<Affair> getNotApprovedByFuzzyQueries(String title, Long typeId, Integer status, Long inspectorId, LocalDateTime startTime ,LocalDateTime endTime) {
List<Affair> affairList =affairMapper.getNotApprovedByFuzzyQueries(title,typeId,status,applicantId,startTime,endTime); List<Affair> affairList =affairMapper.getNotApprovedByFuzzyQueries(title,typeId,status,inspectorId,startTime,endTime);
return affairList;
}
public List<Affair> getApprovedByFuzzyQueries(String title, Long typeId, Integer status, Long inspectorId, LocalDateTime startTime, LocalDateTime endTime) {
List<Affair> affairList =affairMapper.getApprovedByFuzzyQueries(title,typeId,status,inspectorId,startTime,endTime);
return affairList; return affairList;
} }
} }

View File

@@ -38,6 +38,8 @@
<if test="status!=null "> <if test="status!=null ">
and instr(status,#{status})>0 and instr(status,#{status})>0
</if> </if>
and deleted = 0
and old = 0
</where> </where>
order by create_time desc order by create_time desc
</select> </select>
@@ -71,8 +73,9 @@
* *
from t_affair from t_affair
<where> <where>
<if test=" applicantId !=null"> <if test=" inspectorId !=null">
applicant_id = #{applicantId} inspector_id = #{inspectorId}
and status=0
</if> </if>
<if test=" title!=null and title!='' "> <if test=" title!=null and title!='' ">
@@ -84,14 +87,46 @@
<if test="status!=null "> <if test="status!=null ">
and instr(status,#{status})>0 and instr(status,#{status})>0
</if> </if>
and deleted = 0
and old = 0
</where> </where>
order by create_time desc order by create_time desc
</select> </select>
<select id="getApprovedByFuzzyQueries" resultMap="affairMap3">
select
*
from t_affair
<where>
<if test=" inspectorId !=null">
inspector_id = #{inspectorId}
and status!=0
</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>
and deleted = 0
and old = 0
</where>
order by inspect_time desc
</select>
<resultMap id="affairMap2" type="affair" autoMapping="true"> <resultMap id="affairMap2" type="affair" autoMapping="true">
<id property="id" column="id"/> <id property="id" column="id"/>
</resultMap> </resultMap>
<resultMap id="affairMap3" type="affair" autoMapping="true">
<id property="id" column="id"/>
</resultMap>

View File

@@ -21,17 +21,15 @@
<el-table-column label="申请者" prop="applicantId"> <el-table-column label="申请者" prop="applicantId">
<template #default="scope"> <template #default="scope">
{{ {{
scope.row.applicantId === 1652714496280469506 scope.row.applicantId === 1
? 'admin'
: scope.row.applicantId === 1652714496280469506
? 'cyb' ? 'cyb'
: scope.row.applicantId === 1654151146072145921 : scope.row.applicantId === 1654151146072145921
? 'syf' ? 'syf'
: scope.row.applicantId === 1654151877520973826 : scope.row.applicantId === 1654151877520973826
? 'gzw' ? 'gzw'
: scope.row.applicantId === 1654151930402746370 : 'yrm'
? 'yrm'
: scope.row.applicantId === 1
? 'admin'
: 'ggb'
}} }}
</template> </template>
</el-table-column> </el-table-column>

View File

@@ -22,7 +22,7 @@
<template #default="scope"> <template #default="scope">
{{ {{
scope.row.applicantId === 1 scope.row.applicantId === 1
? 'ggb' ? 'admin'
: scope.row.applicantId === 1652714496280469506 : scope.row.applicantId === 1652714496280469506
? 'cyb' ? 'cyb'
: scope.row.applicantId === 1654151146072145921 : scope.row.applicantId === 1654151146072145921

View File

@@ -22,7 +22,7 @@
<template #default="scope"> <template #default="scope">
{{ {{
scope.row.inspectorId === 1 scope.row.inspectorId === 1
? 'ggb' ? 'admin'
: scope.row.inspectorId === 1652714496280469506 : scope.row.inspectorId === 1652714496280469506
? 'cyb' ? 'cyb'
: scope.row.inspectorId === 1654151146072145921 : scope.row.inspectorId === 1654151146072145921

View File

@@ -9,8 +9,12 @@
router router
background-color="white" background-color="white"
> >
<el-menu-item index="/affair/manage/toApprove"> 待审批 </el-menu-item> <el-menu-item index="/affair/manage/toApprove" @click="turnToNotApproved">
<el-menu-item index="/affair/manage/Approved"> 已审批 </el-menu-item> 待审批
</el-menu-item>
<el-menu-item index="/affair/manage/Approved" @click="turnToApproved">
已审批
</el-menu-item>
</el-menu> </el-menu>
</el-col> </el-col>
</el-header> </el-header>
@@ -50,7 +54,12 @@
<!-- </el-col>--> <!-- </el-col>-->
<el-col :span="1"></el-col> <el-col :span="1"></el-col>
<el-col :span="3"> <el-col :span="3">
<el-button type="primary" @click="onSubmit">查询</el-button> <el-button type="primary" @click="onSubmit1" v-if="flagNotApproved"
>查询</el-button
>
<el-button type="primary" @click="onSubmit2" v-if="flagApproved"
>查询</el-button
>
<el-button type="primary" @click="resetForm">重置</el-button> <el-button type="primary" @click="resetForm">重置</el-button>
</el-col> </el-col>
</el-row> </el-row>
@@ -76,6 +85,9 @@ export default {
startTime: '', startTime: '',
endTime: '' endTime: ''
}, },
flagNotApproved: true,
flagApproved: false,
count: 0,
DataToRouterView: {} DataToRouterView: {}
} }
}, },
@@ -86,7 +98,7 @@ export default {
turnFormViewTrue() { turnFormViewTrue() {
this.formView = true this.formView = true
}, },
onSubmit() { onSubmit1() {
request request
.get('/affair/not_approved_FuzzyQueries', this.formData) .get('/affair/not_approved_FuzzyQueries', this.formData)
.then((response) => { .then((response) => {
@@ -97,11 +109,32 @@ export default {
console.log(reportError) console.log(reportError)
}) })
}, },
onSubmit2() {
request
.get('/affair/approved_FuzzyQueries', this.formData)
.then((response) => {
this.DataToRouterView = response.data.data
console.log(response.data)
})
.catch((reportError) => {
console.log(reportError)
})
},
turnToNotApproved() {
this.flagApproved = false
this.flagNotApproved = true
},
turnToApproved() {
this.flagNotApproved = false
this.flagApproved = true
},
resetForm() { resetForm() {
if (this.flagNotApproved) {
this.$router.go() this.$router.go()
} }
} }
} }
}
</script> </script>
<style scoped> <style scoped>