mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 23:11:24 +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.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,6 +55,13 @@ public class AffairController {
|
|||||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", affairService.list(wrapper));
|
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")
|
@GetMapping("/not_approved")
|
||||||
@PreAuthorize("hasAuthority('affair:manage:get')")
|
@PreAuthorize("hasAuthority('affair:manage:get')")
|
||||||
public ResponseResult<List<Affair>> selectNotApproved() {
|
public ResponseResult<List<Affair>> selectNotApproved() {
|
||||||
@@ -75,7 +84,6 @@ public class AffairController {
|
|||||||
@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) {
|
||||||
System.out.println(affair);
|
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", affairService.updateAffairYes(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 com.cfive.pinnacle.entity.permission.User;
|
||||||
import org.apache.ibatis.annotations.*;
|
import org.apache.ibatis.annotations.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,6 +40,9 @@ public interface AffairMapper extends BaseMapper<Affair> {
|
|||||||
|
|
||||||
List<User> getSameDepartmentUser(@Param("id") long id);
|
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 ")
|
// @Select("SELECT t_affair.applicant_id,t_affair.inspector_id,t_user.id,t_user.username from t_affair,t_user ")
|
||||||
// @ResultType(Affair.class)
|
// @ResultType(Affair.class)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.cfive.pinnacle.entity.Affair;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.cfive.pinnacle.entity.permission.User;
|
import com.cfive.pinnacle.entity.permission.User;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,6 +24,7 @@ public interface IAffairService extends IService<Affair> {
|
|||||||
|
|
||||||
// int deleteAffair_ApprovedByID(Affair affair);
|
// int deleteAffair_ApprovedByID(Affair affair);
|
||||||
List<User> getSameDepartmentUser (long id);
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,4 +38,15 @@ public class AffairServiceImpl extends ServiceImpl<AffairMapper, Affair> impleme
|
|||||||
List<User> user = affairMapper.getSameDepartmentUser(id);
|
List<User> user = affairMapper.getSameDepartmentUser(id);
|
||||||
return user;
|
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;
|
t_user.deleted = 0;
|
||||||
</select>
|
</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">
|
<resultMap id="userMap" type="user">
|
||||||
<id property="id" column="user_id"/>
|
<id property="id" column="user_id"/>
|
||||||
<result property="username" column="user_username"/>
|
<result property="username" column="user_username"/>
|
||||||
@@ -36,4 +66,11 @@
|
|||||||
</association>
|
</association>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="affairMap" type="affair" autoMapping="true">
|
||||||
|
<id property="id" column="id"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="申请者" prop="applicantId">
|
<el-table-column label="审批者" prop="applicantId">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{
|
{{
|
||||||
scope.row.applicantId === 1
|
scope.row.applicantId === 1
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
<el-table-column label="审批结果" width="90" prop="status">
|
<el-table-column label="审批结果" width="90" prop="status">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ scope.row.status === 1 ? '同意' : '驳回' }}
|
{{ scope.row.status === 1 ? '同意' : scope.row.status === 2 ? '驳回' : '未审批' }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -91,8 +91,6 @@
|
|||||||
<div class="block">
|
<div class="block">
|
||||||
<el-pagination
|
<el-pagination
|
||||||
style="color: #888888"
|
style="color: #888888"
|
||||||
@size-change="handleSizeChange"
|
|
||||||
@current-change="handleCurrentChange"
|
|
||||||
:page-size="100"
|
:page-size="100"
|
||||||
layout="prev, pager, next, jumper"
|
layout="prev, pager, next, jumper"
|
||||||
:total="1000"
|
:total="1000"
|
||||||
@@ -118,6 +116,7 @@ export default {
|
|||||||
status: '',
|
status: '',
|
||||||
applicantId: '',
|
applicantId: '',
|
||||||
inspectorId: '',
|
inspectorId: '',
|
||||||
|
inspectorName: '',
|
||||||
createTime: new Date(),
|
createTime: new Date(),
|
||||||
inspectTime: new Date(),
|
inspectTime: new Date(),
|
||||||
priority: '',
|
priority: '',
|
||||||
@@ -126,7 +125,19 @@ export default {
|
|||||||
old: '',
|
old: '',
|
||||||
deleted: '',
|
deleted: '',
|
||||||
version: ''
|
version: ''
|
||||||
|
},
|
||||||
|
grantUsers: [
|
||||||
|
{
|
||||||
|
id: '',
|
||||||
|
username: ''
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
inspectorUsers: [
|
||||||
|
{
|
||||||
|
id: '',
|
||||||
|
username: ''
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -135,20 +146,31 @@ export default {
|
|||||||
request
|
request
|
||||||
.delete('/affair/' + row.id)
|
.delete('/affair/' + row.id)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response.data)
|
|
||||||
this.getApproved()
|
this.getApproved()
|
||||||
})
|
})
|
||||||
.catch((reportError) => {
|
.catch((reportError) => {
|
||||||
console.log(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() {
|
getApproved() {
|
||||||
request
|
request
|
||||||
.get('/affair/personal_affairs')
|
.get('/affair/personal_affairs')
|
||||||
@@ -174,7 +196,8 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.getApproved()
|
this.getApproved()
|
||||||
this.dialogFalse()
|
this.dialogFalse()
|
||||||
console.log(this.tableData)
|
this.getGrantUser()
|
||||||
|
// this.getInspectorName()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user