mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 15:01:23 +08:00
The backend provides an interface for fuzzy queries
This commit is contained in:
@@ -10,6 +10,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -53,6 +55,13 @@ public class AffairController {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", affairService.list(wrapper));
|
||||
}
|
||||
|
||||
@GetMapping("/personal_affairs_title")
|
||||
@PreAuthorize("hasAuthority('affair:self:get')")
|
||||
public ResponseResult getPersonalAffairsByTitle(String title,Integer typeId,Integer status,Integer inspectorId,String startTime,String endTime) {
|
||||
System.out.println(title);
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK,"success",affairService.getFuzzyQueriesByAffairTitle(title,typeId,status,inspectorId,startTime,endTime));
|
||||
}
|
||||
|
||||
@GetMapping("/not_approved")
|
||||
@PreAuthorize("hasAuthority('affair:manage:get')")
|
||||
public ResponseResult<List<Affair>> selectNotApproved() {
|
||||
@@ -75,7 +84,6 @@ public class AffairController {
|
||||
@PutMapping("/yes")
|
||||
@PreAuthorize("hasAuthority('affair:manage:modify')")
|
||||
public ResponseResult<Integer> updateAffairYes(@RequestBody Affair affair) {
|
||||
System.out.println(affair);
|
||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", affairService.updateAffairYes(affair));
|
||||
//审批同意
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.cfive.pinnacle.entity.permission.User;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -39,6 +40,9 @@ public interface AffairMapper extends BaseMapper<Affair> {
|
||||
|
||||
List<User> getSameDepartmentUser(@Param("id") long id);
|
||||
|
||||
|
||||
List<Affair> getFuzzyQueriesByAffairTitle(String title, Integer typeId, Integer status, Integer inspectorId,LocalDateTime start,LocalDateTime end );
|
||||
|
||||
//
|
||||
// @Select("SELECT t_affair.applicant_id,t_affair.inspector_id,t_user.id,t_user.username from t_affair,t_user ")
|
||||
// @ResultType(Affair.class)
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.cfive.pinnacle.entity.Affair;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.cfive.pinnacle.entity.permission.User;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -23,6 +24,7 @@ public interface IAffairService extends IService<Affair> {
|
||||
|
||||
// int deleteAffair_ApprovedByID(Affair affair);
|
||||
List<User> getSameDepartmentUser (long id);
|
||||
List<Affair> getFuzzyQueriesByAffairTitle(String title,Integer typeId,Integer status,Integer inspectorId,String startTime,String endTime);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -36,4 +38,15 @@ public class AffairServiceImpl extends ServiceImpl<AffairMapper, Affair> impleme
|
||||
List<User> user = affairMapper.getSameDepartmentUser(id);
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
public List<Affair> getFuzzyQueriesByAffairTitle(String title ,Integer typeId,Integer status,Integer inspectorId,String startTime, String endTime) {
|
||||
LocalDateTime start=null,end=null;
|
||||
if (startTime!=""&&endTime!=""){
|
||||
start= LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
end = LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
List<Affair> affairList = affairMapper.getFuzzyQueriesByAffairTitle(title,typeId,status,inspectorId,start,end);
|
||||
return affairList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,36 @@
|
||||
t_user.deleted = 0;
|
||||
</select>
|
||||
|
||||
<select id="getFuzzyQueriesByAffairTitle" resultMap="affairMap">
|
||||
select
|
||||
*
|
||||
from t_affair
|
||||
<where>
|
||||
<if test=" title!=null and title!='' ">
|
||||
instr(title,#{title})>0
|
||||
</if>
|
||||
<if test=" typeId!=null ">
|
||||
and instr(type_id,#{typeId})>0
|
||||
</if>
|
||||
<if test="status!=null ">
|
||||
and instr(status,#{status})>0
|
||||
</if>
|
||||
<if test="inspectorId!=null">
|
||||
and instr(inspector_id,#{inspectorId})>0
|
||||
</if>
|
||||
<if test="createTime!=null">
|
||||
and create_time >= #{start}
|
||||
</if>
|
||||
<if test="endTime!=null">
|
||||
and create_time < #{end}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<resultMap id="userMap" type="user">
|
||||
<id property="id" column="user_id"/>
|
||||
<result property="username" column="user_username"/>
|
||||
@@ -36,4 +66,11 @@
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="affairMap" type="affair" autoMapping="true">
|
||||
<id property="id" column="id"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="申请者" prop="applicantId">
|
||||
<el-table-column label="审批者" prop="applicantId">
|
||||
<template #default="scope">
|
||||
{{
|
||||
scope.row.applicantId === 1
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
<el-table-column label="审批结果" width="90" prop="status">
|
||||
<template #default="scope">
|
||||
{{ scope.row.status === 1 ? '同意' : '驳回' }}
|
||||
{{ scope.row.status === 1 ? '同意' : scope.row.status === 2 ? '驳回' : '未审批' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -91,8 +91,6 @@
|
||||
<div class="block">
|
||||
<el-pagination
|
||||
style="color: #888888"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:page-size="100"
|
||||
layout="prev, pager, next, jumper"
|
||||
:total="1000"
|
||||
@@ -118,6 +116,7 @@ export default {
|
||||
status: '',
|
||||
applicantId: '',
|
||||
inspectorId: '',
|
||||
inspectorName: '',
|
||||
createTime: new Date(),
|
||||
inspectTime: new Date(),
|
||||
priority: '',
|
||||
@@ -126,7 +125,19 @@ export default {
|
||||
old: '',
|
||||
deleted: '',
|
||||
version: ''
|
||||
}
|
||||
},
|
||||
grantUsers: [
|
||||
{
|
||||
id: '',
|
||||
username: ''
|
||||
}
|
||||
],
|
||||
inspectorUsers: [
|
||||
{
|
||||
id: '',
|
||||
username: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -135,20 +146,31 @@ export default {
|
||||
request
|
||||
.delete('/affair/' + row.id)
|
||||
.then((response) => {
|
||||
console.log(response.data)
|
||||
this.getApproved()
|
||||
})
|
||||
.catch((reportError) => {
|
||||
console.log(reportError)
|
||||
})
|
||||
},
|
||||
getGrantUser() {
|
||||
request
|
||||
.get('/user/affair')
|
||||
.then((response) => {
|
||||
this.grantUsers = response.data.data
|
||||
})
|
||||
.catch((reportError) => {
|
||||
console.log(reportError)
|
||||
}) // 获取有权限用户
|
||||
},
|
||||
// getInspectorName() {
|
||||
// for (let i = 0; i < this.grantUsers.length; i++) {
|
||||
// if (this.grantUsers[i].id === this.tableData[i].inspectorId) {
|
||||
// this.inspectorUsers[i].id = this.tableData[i].inspectorId
|
||||
// this.inspectorUsers[i].username = this.grantUsers[i].username
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
|
||||
handleSizeChange(val) {
|
||||
console.log(`每页 ${val} 条`)
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
console.log(`当前页: ${val}`)
|
||||
},
|
||||
getApproved() {
|
||||
request
|
||||
.get('/affair/personal_affairs')
|
||||
@@ -174,7 +196,8 @@ export default {
|
||||
created() {
|
||||
this.getApproved()
|
||||
this.dialogFalse()
|
||||
console.log(this.tableData)
|
||||
this.getGrantUser()
|
||||
// this.getInspectorName()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user