Browse Source

修正:证书管理分页和权限

zhongwei
ty 5 months ago
parent
commit
f33c67cb3b
  1. 13
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.java
  2. 55
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.xml
  3. 22
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/impl/PresonManagementServiceImpl.java

13
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.java

@ -19,20 +19,23 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface PersonManagemetMapper extends UserDataScopeBaseMapper<PersonManagemetEntity> { public interface PersonManagemetMapper extends UserDataScopeBaseMapper<PersonManagemetEntity> {
@UserDataAuth
List<PersonManagemetVo> getPersonManagemetEntity( List<PersonManagemetVo> getPersonManagemetEntity(
@Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime, @Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime,
@Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job, @Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job,
@Param(value = "academicTitle")String academicTitle, @Param(value = "status")Integer status, @Param(value = "current")Integer current, @Param(value = "size")Integer size) ; @Param(value = "academicTitle")String academicTitle, @Param(value = "status")Integer status, @Param(value = "depetIds")List<Long> depetIds,
@Param(value = "current")Integer current, @Param(value = "size")Integer size) ;
Integer getCountByPersonManagemetEntity( Integer getCountByPersonManagemetEntity(
@Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime, @Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime,
@Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job, @Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job,
@Param(value = "academicTitle")String academicTitle, @Param(value = "status")Integer status, @Param(value = "current")Integer current, @Param(value = "size")Integer size) ; @Param(value = "academicTitle")String academicTitle, @Param(value = "status")Integer status, @Param(value = "depetIds")List<Long> depetIds,
@UserDataAuth @Param(value = "current")Integer current, @Param(value = "size")Integer size) ;
List<PersonManagemetExportVo> exportPersonManagemet( List<PersonManagemetExportVo> exportPersonManagemet(
@Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime, @Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime,
@Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job, @Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job,
@Param(value = "academicTitle")String academicTitle, @Param(value = "status")Integer status) ; @Param(value = "academicTitle")String academicTitle, @Param(value = "status")Integer status, @Param(value = "depetIds")List<Long> depetIds) ;
} }

55
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.xml

@ -23,26 +23,15 @@
<result property="isDead" column="isDead" /> <result property="isDead" column="isDead" />
</collection> </collection>
</resultMap> </resultMap>
<!--嵌套查询-->
<select id="getPersonManagemetEntity" resultMap="PersonManagemetMap"> <select id="getPersonManagemetEntity" resultMap="PersonManagemetMap">
select a.id ,a.name,a.unit_name ,a.sex,a.job ,a.academic_title,a.phone ,a.CREATE_TIME, select c.id ,c.name,c.unit_name ,c.sex,c.job ,c.academic_title,c.phone ,c.CREATE_TIME,c.create_dept as create_dept,
b.id as certificatetId,b.person_id,b.type,b.dead_time,b.pic,b.CREATE_TIME as BCREATE_TIME,b.status,b.create_dept, b.id as certificatetId,b.person_id,b.type,b.dead_time,b.pic,b.CREATE_TIME as BCREATE_TIME,b.status,
case when b.dead_time is null then null case when b.dead_time is null then null
when b.dead_time &lt; NOW() then "过期" else "未过期" end as isDead when b.dead_time &lt; NOW() then "过期" else "未过期" end as isDead
from(
select a.id ,a.name,a.unit_name ,a.sex,a.job ,a.academic_title,a.phone ,a.CREATE_TIME,a.create_dept as create_dept,a.is_deleted
from hzims_person_managemet as a from hzims_person_managemet as a
left join hzims_certificatet as b
on a.id=b.person_id and b.is_deleted = 0
where a.is_deleted = 0 where a.is_deleted = 0
<if test="type != null and type != ''">
and b.type = #{type}
</if>
<if test="deadStartTime != null and type != ''">
and b.dead_time &gt;= #{deadStartTime}
</if>
<if test="deadTime != null and type != ''">
and b.dead_time &lt;= #{deadTime}
</if>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and a.name like CONCAT('%',#{name},'%') and a.name like CONCAT('%',#{name},'%')
</if> </if>
@ -55,15 +44,35 @@
<if test="job != null and job != ''"> <if test="job != null and job != ''">
and a.job like CONCAT('%',#{job},'%') and a.job like CONCAT('%',#{job},'%')
</if> </if>
<if test="depetIds != null">
and a.create_dept in
<foreach collection="depetIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="academicTitle != null and academicTitle != ''"> <if test="academicTitle != null and academicTitle != ''">
and a.academic_title like CONCAT('%',#{academic_title},'%') and a.academic_title like CONCAT('%',#{academic_title},'%')
</if> </if>
ORDER BY a.CREATE_TIME,BCREATE_TIME DESC ORDER BY a.CREATE_TIME
LIMIT #{current}, #{size} LIMIT #{current}, #{size}
) as c
left join hzims_certificatet as b
on c.id=b.person_id and c.is_deleted = 0
where c.is_deleted = 0
<if test="type != null and type != ''">
and b.type = #{type}
</if>
<if test="deadStartTime != null and type != ''">
and b.dead_time &gt;= #{deadStartTime}
</if>
<if test="deadTime != null and type != ''">
and b.dead_time &lt;= #{deadTime}
</if>
ORDER BY c.CREATE_TIME,BCREATE_TIME DESC
</select> </select>
<!--嵌套查询--> <!--嵌套查询-->
<select id="getCountByPersonManagemetEntity" resultType="Integer"> <select id="getCountByPersonManagemetEntity" resultType="Integer">
select count(*) select count(DISTINCT(a.id))
from hzims_person_managemet as a from hzims_person_managemet as a
left join hzims_certificatet as b left join hzims_certificatet as b
on a.id=b.person_id and b.is_deleted = 0 on a.id=b.person_id and b.is_deleted = 0
@ -92,6 +101,12 @@
<if test="academicTitle != null and academicTitle != ''"> <if test="academicTitle != null and academicTitle != ''">
and a.academic_title like CONCAT('%',#{academic_title},'%') and a.academic_title like CONCAT('%',#{academic_title},'%')
</if> </if>
<if test="depetIds != null">
and a.create_dept in
<foreach collection="depetIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
and b.status =#{status} and b.status =#{status}
</if> </if>
@ -131,6 +146,12 @@
<if test="academicTitle != null and academicTitle != ''"> <if test="academicTitle != null and academicTitle != ''">
and a.academic_title like CONCAT('%',#{academic_title},'%') and a.academic_title like CONCAT('%',#{academic_title},'%')
</if> </if>
<if test="depetIds != null">
and a.create_dept in
<foreach collection="depetIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
and b.status =#{status} and b.status =#{status}
</if> </if>

22
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/impl/PresonManagementServiceImpl.java

@ -2,6 +2,7 @@ package com.hnac.hzims.basic.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.basic.entity.CertificatetEntity; import com.hnac.hzims.basic.entity.CertificatetEntity;
@ -15,13 +16,16 @@ import com.hnac.hzims.basic.vo.PersonManagemetVo;
import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.common.logs.utils.StringUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -49,12 +53,19 @@ public class PresonManagementServiceImpl extends BaseServiceImpl<PersonManagemet
@Override @Override
public IPage<PersonManagemetVo> getPersonManagemetEntity(PersonManagemetVo personManagemetVo, Query query) { public IPage<PersonManagemetVo> getPersonManagemetEntity(PersonManagemetVo personManagemetVo, Query query) {
R<List<Dept>> deptByCurrentUserR = sysClient.getDeptByCurrentUser();
if (!deptByCurrentUserR.isSuccess()&& CollectionUtils.isEmpty(deptByCurrentUserR.getData())){
throw new ServiceException("用户登录失效,请重试!");
}
List<Long> depetIds = deptByCurrentUserR.getData().stream().map(Dept::getId).collect(Collectors.toList());
List<PersonManagemetVo> personManagemetEntity = baseMapper.getPersonManagemetEntity(personManagemetVo.getType(), personManagemetVo.getDeadStartTime(), personManagemetVo.getDeadTime(), List<PersonManagemetVo> personManagemetEntity = baseMapper.getPersonManagemetEntity(personManagemetVo.getType(), personManagemetVo.getDeadStartTime(), personManagemetVo.getDeadTime(),
personManagemetVo.getName(), personManagemetVo.getUnitName(), personManagemetVo.getSex(), personManagemetVo.getJob(), personManagemetVo.getName(), personManagemetVo.getUnitName(), personManagemetVo.getSex(), personManagemetVo.getJob(),
personManagemetVo.getAcademicTitle(), personManagemetVo.getStatus(), (query.getCurrent()-1)*query.getSize(), query.getSize()); personManagemetVo.getAcademicTitle(), personManagemetVo.getStatus(), depetIds,
(query.getCurrent()-1)*query.getSize(), query.getSize());
Integer count = baseMapper.getCountByPersonManagemetEntity(personManagemetVo.getType(), personManagemetVo.getDeadStartTime(), personManagemetVo.getDeadTime(), Integer count = baseMapper.getCountByPersonManagemetEntity(personManagemetVo.getType(), personManagemetVo.getDeadStartTime(), personManagemetVo.getDeadTime(),
personManagemetVo.getName(), personManagemetVo.getUnitName(), personManagemetVo.getSex(), personManagemetVo.getJob(), personManagemetVo.getName(), personManagemetVo.getUnitName(), personManagemetVo.getSex(), personManagemetVo.getJob(),
personManagemetVo.getAcademicTitle(), personManagemetVo.getStatus(), (query.getCurrent()-1)*query.getSize(), query.getSize()); personManagemetVo.getAcademicTitle(), personManagemetVo.getStatus(), depetIds,
(query.getCurrent()-1)*query.getSize(), query.getSize());
IPage<PersonManagemetVo> res = new Page<>(); IPage<PersonManagemetVo> res = new Page<>();
res.setCurrent(query.getCurrent()); res.setCurrent(query.getCurrent());
res.setSize(query.getSize()); res.setSize(query.getSize());
@ -135,9 +146,14 @@ public class PresonManagementServiceImpl extends BaseServiceImpl<PersonManagemet
@Override @Override
public List<PersonManagemetExportVo> exportPersonManagemet(PersonManagemetVo personManagemetVo) { public List<PersonManagemetExportVo> exportPersonManagemet(PersonManagemetVo personManagemetVo) {
R<List<Dept>> deptByCurrentUserR = sysClient.getDeptByCurrentUser();
if (!deptByCurrentUserR.isSuccess()&& CollectionUtils.isEmpty(deptByCurrentUserR.getData())){
throw new ServiceException("用户登录失效,请重试!");
}
List<Long> depetIds = deptByCurrentUserR.getData().stream().map(Dept::getId).collect(Collectors.toList());
List<PersonManagemetExportVo> list = baseMapper.exportPersonManagemet(personManagemetVo.getType(), personManagemetVo.getDeadStartTime(), personManagemetVo.getDeadTime(), List<PersonManagemetExportVo> list = baseMapper.exportPersonManagemet(personManagemetVo.getType(), personManagemetVo.getDeadStartTime(), personManagemetVo.getDeadTime(),
personManagemetVo.getName(), personManagemetVo.getUnitName(), personManagemetVo.getSex(), personManagemetVo.getJob(), personManagemetVo.getName(), personManagemetVo.getUnitName(), personManagemetVo.getSex(), personManagemetVo.getJob(),
personManagemetVo.getAcademicTitle(), personManagemetVo.getStatus()); personManagemetVo.getAcademicTitle(), personManagemetVo.getStatus(),depetIds);
list = list.stream().map(s -> { list = list.stream().map(s -> {
CertificatetType[] types = CertificatetType.values(); CertificatetType[] types = CertificatetType.values();
for (int i = 0; i < types.length; i++) { for (int i = 0; i < types.length; i++) {

Loading…
Cancel
Save