Browse Source

fix: 演练管理添加数据权限

zhongwei
liwen 7 months ago
parent
commit
c4fa414b8f
  1. 10
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.java
  2. 11
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.xml
  3. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.java
  4. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.xml
  5. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java
  6. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java

10
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.java

@ -1,6 +1,5 @@
package com.hnac.hzims.safeproduct.mapper; package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.dto.AnalysisYearDTO; import com.hnac.hzims.safeproduct.dto.AnalysisYearDTO;
import com.hnac.hzims.safeproduct.dto.RehearsalExportDTO; import com.hnac.hzims.safeproduct.dto.RehearsalExportDTO;
@ -9,6 +8,8 @@ import com.hnac.hzims.safeproduct.vo.RehearsalMonthVO;
import com.hnac.hzims.safeproduct.vo.RehearsalYearVO; import com.hnac.hzims.safeproduct.vo.RehearsalYearVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.annotation.UserDataAuth;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List; import java.util.List;
@ -19,7 +20,7 @@ import java.util.List;
* @date 2023-12-27 * @date 2023-12-27
*/ */
@Mapper @Mapper
public interface RehearsalPlanMapper extends BaseMapper<RehearsalPlanEntity> { public interface RehearsalPlanMapper extends UserDataScopeBaseMapper<RehearsalPlanEntity> {
/** /**
* 查询当月各单位的演练总数 * 查询当月各单位的演练总数
@ -28,6 +29,7 @@ public interface RehearsalPlanMapper extends BaseMapper<RehearsalPlanEntity> {
* @param month 月份 * @param month 月份
* @return 当月的演练总数据 * @return 当月的演练总数据
*/ */
@UserDataAuth
IPage<RehearsalMonthVO> selectByMonth(IPage<RehearsalMonthVO> page, String unit, String month); IPage<RehearsalMonthVO> selectByMonth(IPage<RehearsalMonthVO> page, String unit, String month);
/** /**
@ -37,6 +39,7 @@ public interface RehearsalPlanMapper extends BaseMapper<RehearsalPlanEntity> {
* @param month 月份 * @param month 月份
* @return 当月的已完成数据 * @return 当月的已完成数据
*/ */
@UserDataAuth
IPage<RehearsalMonthVO> selectFinishedDataByMonth(IPage<RehearsalMonthVO> page, String unit, String month); IPage<RehearsalMonthVO> selectFinishedDataByMonth(IPage<RehearsalMonthVO> page, String unit, String month);
/** /**
@ -46,6 +49,7 @@ public interface RehearsalPlanMapper extends BaseMapper<RehearsalPlanEntity> {
* @param year 年份 * @param year 年份
* @return 年度单位数据 * @return 年度单位数据
*/ */
@UserDataAuth
IPage<RehearsalYearVO> selectUnitByYear(IPage<RehearsalYearVO> page, String unit, @Param("year") String year); IPage<RehearsalYearVO> selectUnitByYear(IPage<RehearsalYearVO> page, String unit, @Param("year") String year);
/** /**
@ -54,6 +58,7 @@ public interface RehearsalPlanMapper extends BaseMapper<RehearsalPlanEntity> {
* @param year 年份 * @param year 年份
* @return 单位各月的数据列表 * @return 单位各月的数据列表
*/ */
@UserDataAuth
List<AnalysisYearDTO> selectFinishedDataByUnit(@Param("unitList") List<String> unitList, @Param("year") String year); List<AnalysisYearDTO> selectFinishedDataByUnit(@Param("unitList") List<String> unitList, @Param("year") String year);
/** /**
@ -63,5 +68,6 @@ public interface RehearsalPlanMapper extends BaseMapper<RehearsalPlanEntity> {
* @param endTime 计划结束时间 * @param endTime 计划结束时间
* @return 演练数据列表 * @return 演练数据列表
*/ */
@UserDataAuth
List<RehearsalExportDTO> getRehearsalByUnitAndDate(String unit, String startTime, String endTime); List<RehearsalExportDTO> getRehearsalByUnitAndDate(String unit, String startTime, String endTime);
} }

11
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.xml

@ -4,7 +4,7 @@
<select id="selectByMonth" resultType="com.hnac.hzims.safeproduct.vo.RehearsalMonthVO"> <select id="selectByMonth" resultType="com.hnac.hzims.safeproduct.vo.RehearsalMonthVO">
SELECT SELECT
unit, count(1) as scheduled_task_num unit, count(1) as scheduled_task_num, create_user, create_dept
FROM FROM
hzims_rehearsal_plan hzims_rehearsal_plan
WHERE WHERE
@ -21,7 +21,7 @@
<select id="selectFinishedDataByMonth" resultType="com.hnac.hzims.safeproduct.vo.RehearsalMonthVO"> <select id="selectFinishedDataByMonth" resultType="com.hnac.hzims.safeproduct.vo.RehearsalMonthVO">
SELECT SELECT
unit, count(1) as finished_task_num unit, count(1) as finished_task_num, create_user, create_dept
FROM FROM
hzims_rehearsal_plan hzims_rehearsal_plan
WHERE WHERE
@ -39,7 +39,7 @@
<select id="selectUnitByYear" resultType="com.hnac.hzims.safeproduct.vo.RehearsalYearVO"> <select id="selectUnitByYear" resultType="com.hnac.hzims.safeproduct.vo.RehearsalYearVO">
SELECT SELECT
distinct unit distinct unit, create_user, create_dept
FROM FROM
hzims_rehearsal_plan hzims_rehearsal_plan
WHERE WHERE
@ -54,7 +54,7 @@
<select id="selectFinishedDataByUnit" resultType="com.hnac.hzims.safeproduct.dto.AnalysisYearDTO"> <select id="selectFinishedDataByUnit" resultType="com.hnac.hzims.safeproduct.dto.AnalysisYearDTO">
SELECT SELECT
unit, DATE_FORMAT(scheduled_end_time, '%m') as dateTime, count(1) as finished_num unit, DATE_FORMAT(scheduled_end_time, '%m') as dateTime, count(1) as finished_num, create_user, create_dept
FROM FROM
hzims_rehearsal_plan hzims_rehearsal_plan
WHERE WHERE
@ -73,7 +73,8 @@
<select id="getRehearsalByUnitAndDate" resultType="com.hnac.hzims.safeproduct.dto.RehearsalExportDTO"> <select id="getRehearsalByUnitAndDate" resultType="com.hnac.hzims.safeproduct.dto.RehearsalExportDTO">
SELECT SELECT
unit, subject, scheduled_start_time, scheduled_end_time, location, rehearsal_status, commander unit, subject, scheduled_start_time, scheduled_end_time, location, rehearsal_status, commander, create_user,
create_dept
FROM FROM
hzims_rehearsal_plan hzims_rehearsal_plan
WHERE WHERE

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.java

@ -1,11 +1,12 @@
package com.hnac.hzims.safeproduct.mapper; package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity; import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity;
import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO; import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springblade.core.datascope.annotation.UserDataAuth;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.Map; import java.util.Map;
@ -16,7 +17,7 @@ import java.util.Map;
* @date 2023-12-13 * @date 2023-12-13
*/ */
@Mapper @Mapper
public interface RehearsalRecordMapper extends BaseMapper<RehearsalRecordEntity> { public interface RehearsalRecordMapper extends UserDataScopeBaseMapper<RehearsalRecordEntity> {
/** /**
* 查询演练记录表详情 * 查询演练记录表详情
@ -31,5 +32,6 @@ public interface RehearsalRecordMapper extends BaseMapper<RehearsalRecordEntity>
* @param param 参数 * @param param 参数
* @return 演练记录分页 * @return 演练记录分页
*/ */
@UserDataAuth
IPage<RehearsalRecordlVO> getRehearsalRecordPage(IPage<RehearsalRecordlVO> page, Map<String, Object> param); IPage<RehearsalRecordlVO> getRehearsalRecordPage(IPage<RehearsalRecordlVO> page, Map<String, Object> param);
} }

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.xml

@ -17,7 +17,8 @@
<select id="getRehearsalRecordPage" resultType="com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO"> <select id="getRehearsalRecordPage" resultType="com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO">
SELECT SELECT
t1.id, t1.code, t2.unit, t2.subject, t2.scheduled_start_time, t2.scheduled_end_time, t1.people_name, t1.people_num, t1.id, t1.code, t2.unit, t2.subject, t2.scheduled_start_time, t2.scheduled_end_time, t1.people_name, t1.people_num,
t2.location, t1.actual_start_time, t1.actual_end_time, t2.rehearsal_status, t1.record, t1.comment t2.location, t1.actual_start_time, t1.actual_end_time, t2.rehearsal_status, t1.record, t1.comment, t1.create_user,
t1.create_dept
FROM FROM
hzims_rehearsal_record t1 hzims_rehearsal_record t1
LEFT JOIN hzims_rehearsal_plan t2 ON t1.rehearsal_plan_id = t2.id LEFT JOIN hzims_rehearsal_plan t2 ON t1.rehearsal_plan_id = t2.id

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.service.UserAuthDataService;
import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.safeproduct.dto.AnalysisYearDTO; import com.hnac.hzims.safeproduct.dto.AnalysisYearDTO;
import com.hnac.hzims.safeproduct.dto.RehearsalExportDTO; import com.hnac.hzims.safeproduct.dto.RehearsalExportDTO;
@ -51,6 +52,9 @@ public class RehearsalPlanServiceImpl extends ServiceImpl<RehearsalPlanMapper, R
@Autowired @Autowired
IRehearsalRecordService rehearsalRecordService; IRehearsalRecordService rehearsalRecordService;
@Autowired
UserAuthDataService userAuthDataService;
/** /**
* 删除演练计划 * 删除演练计划
*/ */

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.common.service.UserAuthDataService;
import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import com.hnac.hzims.safeproduct.constants.SafeProductConstant;
import com.hnac.hzims.safeproduct.entity.RehearsalPlanEntity; import com.hnac.hzims.safeproduct.entity.RehearsalPlanEntity;
import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity; import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity;
@ -22,6 +23,8 @@ import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO; import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -41,6 +44,9 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class RehearsalRecordServiceImpl extends ServiceImpl<RehearsalRecordMapper, RehearsalRecordEntity> implements IRehearsalRecordService { public class RehearsalRecordServiceImpl extends ServiceImpl<RehearsalRecordMapper, RehearsalRecordEntity> implements IRehearsalRecordService {
@Autowired
UserAuthDataService userAuthDataService;
@Resource @Resource
RehearsalPlanMapper rehearsalPlanMapper; RehearsalPlanMapper rehearsalPlanMapper;

Loading…
Cancel
Save