不区分权限案件查询

This commit is contained in:
18792927508
2023-10-15 22:28:44 +08:00
parent 969a4f09f8
commit 41660a5056
2 changed files with 45 additions and 38 deletions
@@ -97,39 +97,47 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
* @param caseApplication * @param caseApplication
* @return * @return
*/ */
// @Override
// public List<CaseApplication> selectCaseApplicationList(CaseApplication caseApplication) {
// // 获取登录用户
// LoginUser loginUser = getLoginUser();
// SysUser user = loginUser.getUser();
// Long userId = user.getUserId();
// Long deptId = user.getDeptId();
// List<SysRole> roles = user.getRoles();
// // 查询登录人身份证号
// SysUser sysUser = sysUserMapper.selectUserById(userId);
// caseApplication.setIdCard(sysUser.getIdCard());
// caseApplication.setUserId(String.valueOf(userId));
// startPage();
// for (SysRole role : roles) {
// // 超级管理员和仲裁委(部门长)案件,可查看所有案件 √
// if(role.getRoleName().equals("超级管理员")
// ||role.getRoleName().equals("仲裁委")
// ||role.getRoleName().equals("部门长")){
// return caseApplicationMapper.selectAdminCaseApplicationList(caseApplication);
// }
// if(role.getRoleName().equals("法律顾问")){
// // 查询角色有关的用户部门
// List<Long> deptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
// caseApplication.setDeptIds(deptIds);
// }
// if(StrUtil.isEmpty(caseApplication.getNameId())&&role.getRoleName().equals("申请人")){
// // 查询角色有关的用户部门
// caseApplication.setNameId(String.valueOf(sysUser.getDeptId()));
// }
// }
//
//
// // 根据条件查询申请人,被申请人,仲裁员,法律顾问案件
// return caseApplicationMapper.selectCaseApplicationList(caseApplication);
//
// }
@Override @Override
public List<CaseApplication> selectCaseApplicationList(CaseApplication caseApplication) { public List<CaseApplication> selectCaseApplicationList(CaseApplication caseApplication) {
// 获取登录用户 return caseApplicationMapper.selectAdminCaseApplicationList(caseApplication);
LoginUser loginUser = getLoginUser();
SysUser user = loginUser.getUser();
Long userId = user.getUserId();
Long deptId = user.getDeptId();
List<SysRole> roles = user.getRoles();
// 查询登录人身份证号
SysUser sysUser = sysUserMapper.selectUserById(userId);
caseApplication.setIdCard(sysUser.getIdCard());
caseApplication.setUserId(String.valueOf(userId));
startPage();
for (SysRole role : roles) {
// 超级管理员和仲裁委(部门长)案件,可查看所有案件 √
if(role.getRoleName().equals("超级管理员")
||role.getRoleName().equals("仲裁委")
||role.getRoleName().equals("部门长")){
return caseApplicationMapper.selectAdminCaseApplicationList(caseApplication);
}
if(role.getRoleName().equals("法律顾问")){
// 查询角色有关的用户部门
List<Long> deptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
caseApplication.setDeptIds(deptIds);
}
}
// 根据条件查询申请人,被申请人,仲裁员,法律顾问案件
return caseApplicationMapper.selectCaseApplicationList(caseApplication);
} }
@Override @Override
@Transactional @Transactional
public int insertcaseApplication(CaseApplication caseApplication) { public int insertcaseApplication(CaseApplication caseApplication) {
@@ -37,9 +37,9 @@
<result property="filearbitraUrl" column="filearbitra_url" /> <result property="filearbitraUrl" column="filearbitra_url" />
</resultMap> </resultMap>
<select id="selectCaseApplicationList" parameterType="CaseApplication" resultMap="CaseApplicationResult"> <select id="selectCaseApplicationList" parameterType="CaseApplication" resultMap="CaseApplicationResult">
select t1.* from(
select t.* from(
select c.id ,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method , select c.id ,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method ,
CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理' CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
ELSE '无审理方式' ELSE '无审理方式'
@@ -56,7 +56,8 @@
c.hear_date ,c.arbitrat_claims , c.hear_date ,c.arbitrat_claims ,
c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable , c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable ,
c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time , c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time ,
c.update_by ,c.update_time , c.arbitrator_name,d.dept_name as applicantName,c.register_date,c.filearbitra_url c.update_by ,c.update_time , c.arbitrator_name,ca.name,ca.application_organ_id,ca.application_organ_name as applicantName,
c.arbitrator_id,ca.identity_num , ca.identity_type,c.filearbitra_url
from case_application c from case_application c
LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1 LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1
<where> <where>
@@ -73,11 +74,9 @@
</foreach> </foreach>
</if> </if>
</where> </where>
) t <where> ) t
<!--申请人--> <where>
<if test="nameId != null and nameId != ''">
or ( t.application_organ_id = #{nameId} AND t.identity_type=1 )
</if>
<!--被申请人--> <!--被申请人-->
<if test="idCard != null and idCard != ''"> <if test="idCard != null and idCard != ''">
or (t.identity_num=#{idCard} AND t.identity_type=2) or (t.identity_num=#{idCard} AND t.identity_type=2)
@@ -100,7 +99,7 @@
<where> <where>
<!--申请人--> <!--申请人-->
<if test="nameId != null and nameId != ''"> <if test="nameId != null and nameId != ''">
and ( t1.applicationOrganId = #{nameId} AND t1.identity_type=1 ) and ( t1.application_organ_id = #{nameId} AND t1.identity_type=1 )
</if> </if>
</where> </where>
order by t1.create_time desc,t1.case_num desc order by t1.create_time desc,t1.case_num desc