Commit d9a4e3ba authored by 宋源硕's avatar 宋源硕

Merge branch 'dev' into 'master'

2024/11/29修改接口

See merge request !472
parents 03acdbd5 dcc494a0
......@@ -63,4 +63,7 @@ public class AutomobileEnterprise extends BaseEntity
@Excel(name = "企业类型")
@ApiModelProperty("企业类型")
private String enterpriseType;
@ApiModelProperty("部门id")
private Long deptId;
}
......@@ -181,4 +181,7 @@ public class CarReviewTask implements Serializable {
@ApiModelProperty("版本")
private String version;
@ApiModelProperty("部门id")
private Long deptId;
}
......@@ -126,4 +126,7 @@ public class ModelTestTask {
@ApiModelProperty("试验方案ID")
private String testSchemeId;
@ApiModelProperty("部门id")
private Long deptId;
}
......@@ -96,4 +96,7 @@ public class Sample extends BaseEntity
private String enterpriseName;
private List<SampleTaskVo> taskSampleRelation;
@ApiModelProperty("部门id")
private Long deptId;
}
......@@ -185,4 +185,7 @@ public class SystemReviewTask {
@ApiModelProperty("版本")
private String version;
@ApiModelProperty("部门id")
private Long deptId;
}
......@@ -191,6 +191,9 @@ public class Task {
@ApiModelProperty("企业名称")
private String enterpriseName;
@ApiModelProperty("部门id")
private Long deptId;
/**
* 返回当前节点的下一个节点
*/
......
package com.ruoyi.domain.vo;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -14,7 +15,7 @@ import java.math.BigDecimal;
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "首页数量统计")
public class QuantityStatisticsVO {
public class QuantityStatisticsVO extends BaseEntity {
@ApiModelProperty("支持标准数量")
private Long standardQuantity;
......
package com.ruoyi.mapper;
import com.ruoyi.domain.Book;
import com.ruoyi.domain.Sample;
import com.ruoyi.domain.Task;
import com.ruoyi.domain.vo.*;
import org.springframework.stereotype.Repository;
......@@ -11,15 +14,15 @@ public interface StatisticsHomeMapper {
public QuantityStatisticsVO selectQuantityStatistics(QuantityStatisticsVO quantityStatisticsHome);
// 标准类别统计
public List<StandardCategoryStatisticsVO> selectStandardCategoryStatistics();
public List<StandardCategoryStatisticsVO> selectStandardCategoryStatistics(Sample t1);
// 任务保密等级统计
public List<ConfidentialityLevelProportionVO> selectConfidentialityLevelStatistics();
// 体系审查任务通过数量
public InspectionItemPassedNumVO selectInspectionItemPassedNum();
public InspectionItemPassedNumVO selectInspectionItemPassedNum(Sample s);
// 参与任务情况统计
public List<TaskParticipationStatisticsVO> selectTaskParticipationStatistics();
public List<TaskParticipationStatisticsVO> selectTaskParticipationStatistics(Sample s);
}
package com.ruoyi.service;
import com.ruoyi.domain.Sample;
import com.ruoyi.domain.vo.*;
import java.util.List;
......@@ -9,14 +10,14 @@ public interface StatisticsHomeService {
public QuantityStatisticsVO selectQuantityStatistics(QuantityStatisticsVO quantityStatisticsHome);
// 标准类别统计
public List<StandardCategoryStatisticsVO> selectStandardCategoryStatistics();
public List<StandardCategoryStatisticsVO> selectStandardCategoryStatistics(Sample s );
// 任务保密等级统计
public List<ConfidentialityLevelProportionVO> selectConfidentialityLevelStatistics();
//平均检验通过率
public List<AverageInspectionRateVO> selectAverageInspectionRate();
public List<AverageInspectionRateVO> selectAverageInspectionRate(Sample s);
// 参与任务情况统计
public List<TaskParticipationStatisticsVO> selectTaskParticipationStatistics();
public List<TaskParticipationStatisticsVO> selectTaskParticipationStatistics(Sample s);
}
......@@ -4,6 +4,8 @@ import java.util.List;
import cn.hutool.core.util.ObjUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
......@@ -47,6 +49,7 @@ public class AutomobileEnterpriseServiceImpl extends ServiceImpl<AutomobileEnter
* @return 车企信息
*/
@Override
@DataScope(deptAlias = "d")
public List<AutomobileEnterprise> selectAutomobileEnterpriseList(AutomobileEnterpriseListRequest request)
{
return automobileEnterpriseMapper.selectAutomobileEnterpriseList(request);
......@@ -61,6 +64,10 @@ public class AutomobileEnterpriseServiceImpl extends ServiceImpl<AutomobileEnter
@Override
public int insertAutomobileEnterprise(AutomobileEnterprise automobileEnterprise)
{
//获取当前用户的部门id 部门id用来实现不同部门间的数据隔离
LoginUser user = SecurityUtils.getLoginUser();
Long deptId = user.getDeptId();
// 判断企业名称是否重复
if (lambdaQuery()
.eq(AutomobileEnterprise::getEnterpriseName, automobileEnterprise.getEnterpriseName())
......@@ -69,6 +76,7 @@ public class AutomobileEnterpriseServiceImpl extends ServiceImpl<AutomobileEnter
) {
throw new ServiceException("企业名称已存在");
}
automobileEnterprise.setDeptId(deptId);
automobileEnterprise.setCreateTime(DateUtils.getNowDate());
automobileEnterprise.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
return automobileEnterpriseMapper.insert(automobileEnterprise);
......@@ -83,6 +91,9 @@ public class AutomobileEnterpriseServiceImpl extends ServiceImpl<AutomobileEnter
@Override
public int updateAutomobileEnterprise(AutomobileEnterprise automobileEnterprise)
{
//获取当前用户的部门id 部门id用来实现不同部门间的数据隔离
LoginUser user = SecurityUtils.getLoginUser();
Long deptId = user.getDeptId();
// 判断企业名称是否重复
if (lambdaQuery()
.eq(AutomobileEnterprise::getEnterpriseName, automobileEnterprise.getEnterpriseName())
......@@ -91,6 +102,7 @@ public class AutomobileEnterpriseServiceImpl extends ServiceImpl<AutomobileEnter
) {
throw new ServiceException("企业名称已存在");
}
automobileEnterprise.setDeptId(deptId);
automobileEnterprise.setUpdateTime(DateUtils.getNowDate());
automobileEnterprise.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
return automobileEnterpriseMapper.updateAutomobileEnterprise(automobileEnterprise);
......
......@@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
......@@ -52,6 +54,7 @@ public class SampleManagementServiceImpl extends ServiceImpl<SampleManagementMap
* @return 样品管理
*/
@Override
@DataScope(deptAlias = "d")
public List<Sample> selectSampleManagementList(SampleManagementRequest sampleManagementRequest)
{
List<Sample> list = sampleManagementMapper.selectSampleManagementList(sampleManagementRequest);
......@@ -70,6 +73,10 @@ public class SampleManagementServiceImpl extends ServiceImpl<SampleManagementMap
@Override
public int insertSampleManagement(Sample sampleManagement)
{
//添加了deptId字段用于实现部门数据隔离功能
LoginUser user = SecurityUtils.getLoginUser();
Long deptId = user.getDeptId();
sampleManagement.setDeptId(deptId);
// 判断车辆识别码是否重复
if(Sample.SAMPLE_FLAG_CAR.equals(sampleManagement.getFlag())){
int dentificationCode = sampleManagementMapper.selectIdentificationCodeCount(sampleManagement);
......@@ -96,6 +103,10 @@ public class SampleManagementServiceImpl extends ServiceImpl<SampleManagementMap
@Override
public int updateSampleManagement(Sample sampleManagement)
{
//添加了deptId字段用于实现部门数据隔离功能
LoginUser user = SecurityUtils.getLoginUser();
Long deptId = user.getDeptId();
sampleManagement.setDeptId(deptId);
// 判断车辆识别码是否重复
if(Sample.SAMPLE_FLAG_CAR.equals(sampleManagement.getFlag())){
int dentificationCode = sampleManagementMapper.selectIdentificationCodeCount(sampleManagement);
......@@ -117,6 +128,7 @@ public class SampleManagementServiceImpl extends ServiceImpl<SampleManagementMap
* 根据车辆识别码和样品编号查询样品信息
* */
@Override
@DataScope(deptAlias = "d")
public List<Sample> selectSampleList(SampleManagementRequest sampleManagementRequest){
return sampleManagementMapper.selectSampleList(sampleManagementRequest);
}
......
package com.ruoyi.service.impl;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.Book;
import com.ruoyi.domain.Sample;
import com.ruoyi.domain.Standard;
import com.ruoyi.domain.Task;
import com.ruoyi.domain.vo.*;
import com.ruoyi.mapper.StandardMapper;
import com.ruoyi.mapper.StatisticsHomeMapper;
......@@ -22,6 +28,7 @@ public class StatisticsHomeServiceImpl implements StatisticsHomeService {
private StandardMapper standardMapper;
@Override
@DataScope(deptAlias = "d")
public QuantityStatisticsVO selectQuantityStatistics(QuantityStatisticsVO quantityStatisticsHome){
QuantityStatisticsVO quantityStatisticsVO = statisticsHomeMapper.selectQuantityStatistics(quantityStatisticsHome);
......@@ -31,8 +38,9 @@ public class StatisticsHomeServiceImpl implements StatisticsHomeService {
}
@Override
public List<StandardCategoryStatisticsVO> selectStandardCategoryStatistics(){
return statisticsHomeMapper.selectStandardCategoryStatistics();
@DataScope(deptAlias = "d")
public List<StandardCategoryStatisticsVO> selectStandardCategoryStatistics(Sample s ){
return statisticsHomeMapper.selectStandardCategoryStatistics(s);
}
@Override
......@@ -41,13 +49,14 @@ public class StatisticsHomeServiceImpl implements StatisticsHomeService {
}
@Override
public List<AverageInspectionRateVO> selectAverageInspectionRate(){
@DataScope(deptAlias = "d")
public List<AverageInspectionRateVO> selectAverageInspectionRate(Sample s){
List<Standard> standards = standardMapper.selectListAll();
String standardNo = null;
if(!standards.isEmpty()){
standardNo = standards.get(0).getStandardNo();
}
InspectionItemPassedNumVO inspectionItemPassedNumVO = statisticsHomeMapper.selectInspectionItemPassedNum();
InspectionItemPassedNumVO inspectionItemPassedNumVO = statisticsHomeMapper.selectInspectionItemPassedNum(s);
List<AverageInspectionRateVO> list = new ArrayList<>();
AverageInspectionRateVO averageInspectionRateOne = new AverageInspectionRateVO();
averageInspectionRateOne.setInspectionItems("汽车信息安全管理体系要求");
......@@ -68,8 +77,9 @@ public class StatisticsHomeServiceImpl implements StatisticsHomeService {
}
@Override
public List<TaskParticipationStatisticsVO> selectTaskParticipationStatistics(){
return statisticsHomeMapper.selectTaskParticipationStatistics();
@DataScope(deptAlias = "d")
public List<TaskParticipationStatisticsVO> selectTaskParticipationStatistics(Sample s){
return statisticsHomeMapper.selectTaskParticipationStatistics(s);
}
// 计算两个数各占比
......
......@@ -8,6 +8,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
......@@ -156,7 +157,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 构建任务创建者
LoginUser loginUser = SecurityUtils.getLoginUser();
//获取任务创建这的deptId用来实现部门数据隔离
Long deptId = loginUser.getDeptId();
//根据Id查询当前用户是否拥有暂存任务
TaskGetInfoResponse temporaryStorageTask = taskService.getByUserId(loginUser.getUserId());
if(temporaryStorageTask != null) {
......@@ -211,6 +213,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 构建并保存任务信息
// 总任务
Task task = new Task();
//添加deptId字段用来实现部门数据隔离
task.setDeptId(deptId);
task.setTaskInitiatorId(loginUser.getUserId());
task.setTaskInitiator(initiator.getNickName());
if (initiator.getDept() != null) {
......@@ -307,6 +312,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
* @return
*/
@Override
@DataScope(deptAlias = "d")
public List<Task> findFinish(TaskFindFinishRequest request) {
List<Task> taskList = taskMapper.findFinish(request);
......@@ -1649,6 +1655,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
public Long saveSystemReview(TaskCreateRequest request,SysUser initiator,Standard standard,TaskUserRelation leader) {
//添加了dept_id字段用于进行部门数据过滤
LoginUser user = SecurityUtils.getLoginUser();
Long deptId = user.getDeptId();
// 构建并保存任务信息
SystemReviewTask task = new SystemReviewTask()
.setTaskNo(request.getTaskNo())
......@@ -1660,7 +1670,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
.setStandardId(standard.getId())
.setName(standard.getName())
.setStandardNo(standard.getStandardNo())
.setFile(standard.getFile());
.setFile(standard.getFile())
.setDeptId(deptId);
if (initiator.getDept() != null) {
task.setTaskInitiatorDept(initiator.getDept().getDeptName());
......@@ -1673,6 +1684,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
public Long saveCarReview(TaskCreateRequest request,SysUser initiator,Standard standard,TaskUserRelation leader) {
List<String> taskList = request.getTaskList();
//添加了dept_id字段用于进行部门数据过滤
LoginUser user = SecurityUtils.getLoginUser();
Long deptId = user.getDeptId();
// 构建并保存任务信息
CarReviewTask task = new CarReviewTask()
......@@ -1685,7 +1699,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
.setStandardId(standard.getId())
.setName(standard.getName())
.setStandardNo(standard.getStandardNo())
.setFile(standard.getFile());
.setFile(standard.getFile())
.setDeptId(deptId);
if (initiator.getDept() != null) {
task.setTaskInitiatorDept(initiator.getDept().getDeptName());
......@@ -1705,6 +1720,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
*/
public Long saveModelTest(TaskCreateRequest request,SysUser initiator,Standard standard,TaskUserRelation leader) {
//添加了dept_id字段用于进行部门数据过滤
LoginUser user = SecurityUtils.getLoginUser();
Long deptId = user.getDeptId();
// 构建并保存任务信息
ModelTestTask modelTestTask = ModelTestTask.builder()
.taskNo(request.getTaskNo())
......@@ -1716,6 +1735,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
.standardId(standard.getId())
.name(standard.getName())
.standardNo(standard.getStandardNo())
.deptId(deptId)
.build();
if (initiator.getDept() != null) {
......
package com.ruoyi.web;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.domain.Sample;
import com.ruoyi.domain.vo.*;
import com.ruoyi.service.StatisticsHomeService;
import io.swagger.annotations.Api;
......@@ -29,7 +30,8 @@ public class StatisticsHomeController {
@ApiOperation("首页标准分类占比")
@PostMapping("/standardCategory")
public R<List<StandardCategoryStatisticsVO>> selectStandardCategoryStatistics(){
return R.ok(statisticsHomeService.selectStandardCategoryStatistics());
Sample s = new Sample();
return R.ok(statisticsHomeService.selectStandardCategoryStatistics(s));
}
@ApiOperation("首页任务保密等级占比")
@PostMapping("/confidentialityLevel")
......@@ -39,11 +41,13 @@ public class StatisticsHomeController {
@ApiOperation("首页平均检验通过率")
@PostMapping("/averageInspectionRate")
public R<List<AverageInspectionRateVO>> selectAverageInspectionRate(){
return R.ok(statisticsHomeService.selectAverageInspectionRate());
Sample s = new Sample();
return R.ok(statisticsHomeService.selectAverageInspectionRate(s));
}
@ApiOperation("首页任务情况安排")
@PostMapping("/taskParticipation")
public R<List<TaskParticipationStatisticsVO>> selectTaskParticipationStatistics(){
return R.ok(statisticsHomeService.selectTaskParticipationStatistics());
Sample s = new Sample();
return R.ok(statisticsHomeService.selectTaskParticipationStatistics(s));
}
}
......@@ -129,4 +129,6 @@ public class TaskFindResponse {
@ApiModelProperty("企业id")
private Long enterpriseId;
@ApiModelProperty("部门id")
private Long deptId;
}
......@@ -49,12 +49,15 @@
ae.enterprise_type
from t_automobile_enterprise ae
left join sys_user su on ae.create_by = su.user_id
left join sys_dept d on ae.dept_id = d.dept_id
</sql>
<select id="selectAutomobileEnterpriseList" parameterType="com.ruoyi.domain.AutomobileEnterprise"
resultMap="AutomobileEnterpriseResult">
<include refid="selectAutomobileEnterpriseListSQL"/>
<where>
${params.dataScope}
AND
ae.deleted = 0
<if test="enterpriseName != null and enterpriseName != ''">and ae.enterprise_name like concat('%',
#{enterpriseName}, '%')
......@@ -117,6 +120,7 @@
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="enterpriseType != null">enterprise_Type = #{enterpriseType}</if>
<if test="deptId != null">dept_id = #{deptId}</if>
</trim>
where id = #{id}
</update>
......
......@@ -49,11 +49,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
tae.enterprise_name as enterpriseName
from t_sample sm
left join t_automobile_enterprise tae on tae.id = sm.manufacturing_enterprise_id and tae.deleted = 0
left join sys_dept d on d.dept_id = sm.dept_id
</sql>
<select id="selectSampleManagementList" parameterType="com.ruoyi.domain.Sample" resultMap="SampleManagementResult">
<include refid="selectTSampleManagementVo"/>
<where>
${params.dataScope}
AND
sm.deleted = 0
<if test="identificationCode != null and identificationCode != ''"> and sm.identification_code like concat('%', #{identificationCode}, '%')</if>
<if test="sampleNumber != null and sampleNumber != ''"> and sm.sample_number like concat('%', #{sampleNumber}, '%')</if>
......@@ -89,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="trademark != null">trademark,</if>
<if test="samplePhotos != null">sample_photos,</if>
<if test="deleted != null">deleted,</if>
<if test="deptId != null">dept_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="identificationCode != null">#{identificationCode},</if>
......@@ -109,6 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="trademark != null">#{trademark},</if>
<if test="samplePhotos != null">#{samplePhotos},</if>
<if test="deleted != null">#{deleted},</if>
<if test="deptId != null">#{deptId},</if>
</trim>
</insert>
......@@ -132,6 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark = #{remark},</if>
<if test="trademark != null">trademark = #{trademark},</if>
<if test="samplePhotos != null">sample_photos = #{samplePhotos},</if>
<if test="deptId != null">dept_id = #{deptId}</if>
</trim>
where id = #{id}
</update>
......@@ -164,6 +170,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sampleNumber != null and sampleNumber != ''"> and sm.sample_number = #{sampleNumber}</if>
<if test="flag != null and flag != ''"> and sm.flag = #{flag} </if>
<if test="manufacturingEnterpriseId != null"> and sm.manufacturing_enterprise_id = #{manufacturingEnterpriseId} </if>
${params.dataScope}
</where>
</select>
......
......@@ -8,22 +8,62 @@
<select id="selectQuantityStatistics" resultType="com.ruoyi.domain.vo.QuantityStatisticsVO" parameterType="com.ruoyi.domain.vo.QuantityStatisticsVO">
SELECT
( SELECT count( id ) FROM t_standard ) AS standardQuantity,
( SELECT count( id ) FROM t_task WHERE task_status != 'TEMPORARILY' ) AS numberTasks,
( SELECT count( id ) FROM t_automobile_enterprise WHERE deleted = 0 ) AS numberCompanies,
( SELECT count( id ) FROM t_task t
LEFT JOIN sys_dept d ON d.dept_id = t.dept_id
WHERE
task_status != 'TEMPORARILY'
${params.dataScope}
) AS numberTasks,
( SELECT count( id ) FROM t_automobile_enterprise ae
LEFT JOIN sys_dept d ON d.dept_id = ae.dept_id
WHERE
deleted = 0
AND 'A'='A'
${params.dataScope}
) AS numberCompanies,
(
SELECT
count( su.user_id )
FROM
sys_user su
LEFT JOIN sys_user_role sur ON sur.user_id = su.user_id
LEFT JOIN sys_dept d ON d.dept_id = su.dept_id
WHERE
sur.role_id = 106
AND 'A'='A'
${params.dataScope}
) AS numberInspectors,
( SELECT count( id ) FROM t_sample WHERE flag = '0' AND deleted = 0 ) AS numberVehicleSamples,
( SELECT count( id ) FROM t_sample WHERE flag = '1' AND deleted = 0 ) AS numberComponentSamples,
( SELECT count( id ) FROM t_task WHERE vehicle_information_url IS NOT NULL ) AS numberReports,
( SELECT count( id ) FROM t_task WHERE task_status = 'FINISH' ) AS completedTaskNumber,
( SELECT count( id ) FROM t_task WHERE task_status = 'NEW' OR task_status = 'PENDING' OR task_status = 'SIGNED') AS executeTasksNumber
( SELECT count( id )
FROM t_sample ts
LEFT JOIN sys_dept d ON d.dept_id = ts.dept_id
WHERE flag = '0' AND deleted = 0
AND 'A'='A'
${params.dataScope}
) AS numberVehicleSamples,
( SELECT count( id )
FROM t_sample ts
LEFT JOIN sys_dept d ON d.dept_id = ts.dept_id
WHERE flag = '1' AND deleted = 0
AND 'A'='A'
${params.dataScope} ) AS numberComponentSamples,
( SELECT count( id )
FROM t_task t
LEFT JOIN sys_dept d ON d.dept_id = t.dept_id
WHERE vehicle_information_url IS NOT NULL
AND 'A'='A'
${params.dataScope}) AS numberReports,
( SELECT count( id )
FROM t_task t
LEFT JOIN sys_dept d ON d.dept_id = t.dept_id
WHERE task_status = 'FINISH'
${params.dataScope}) AS completedTaskNumber,
( SELECT count( id )
FROM t_task t
LEFT JOIN sys_dept d ON d.dept_id = t.dept_id
WHERE (task_status = 'PENDING' OR task_status = 'NEW' OR task_status = 'SINGED')
and 'a' = 'a'
${params.dataScope}
) AS executeTasksNumber
</select>
<select id="selectStandardCategoryStatistics" resultType="com.ruoyi.domain.vo.StandardCategoryStatisticsVO">
......@@ -33,6 +73,8 @@
FROM
t_task ta
LEFT JOIN t_standard st ON ta.standard_id = st.id
LEFT JOIN sys_dept d ON ta.dept_id = d.dept_id
WHERE 'a' = 'a' ${params.dataScope}
GROUP BY
st.standard_type
</select>
......@@ -51,12 +93,36 @@
<select id="selectInspectionItemPassedNum" resultType="com.ruoyi.domain.vo.InspectionItemPassedNumVO">
SELECT
( SELECT COUNT( id ) FROM t_system_review_task WHERE task_status = 'FINISH' ) AS sysReviewcompletedNum,
( SELECT COUNT( id ) FROM t_system_review_task WHERE task_status = 'FINISH' AND task_result = 'PASS' ) AS sysReviewPassedNum,
( SELECT COUNT( id ) FROM t_car_review_task WHERE task_status = 'FINISH' ) AS carReviewcompletedNum,
( SELECT COUNT( id ) FROM t_car_review_task WHERE task_status = 'FINISH' AND task_result = 'PASS' ) AS carReviewPassedNum,
( SELECT COUNT( id ) FROM t_model_test_task WHERE task_status = 'FINISH' ) AS modelTestCompletedNum,
( SELECT COUNT( id ) FROM t_model_test_task WHERE task_status = 'FINISH' AND task_result = 'PASS' ) AS modelTestPassedNum
( SELECT COUNT( id )
FROM t_system_review_task tsrt
LEFT JOIN sys_dept d ON d.dept_id = tsrt.dept_id
WHERE task_status = 'FINISH'
${params.dataScope}) AS sysReviewcompletedNum,
( SELECT COUNT( id )
FROM t_system_review_task tsrt
LEFT JOIN sys_dept d ON d.dept_id = tsrt.dept_id
WHERE task_status = 'FINISH' AND task_result = 'PASS'
${params.dataScope}) AS sysReviewPassedNum,
( SELECT COUNT( id )
FROM t_car_review_task tcrt
LEFT JOIN sys_dept d ON d.dept_id = tcrt.dept_id
WHERE task_status = 'FINISH'
${params.dataScope}) AS carReviewcompletedNum,
( SELECT COUNT( id )
FROM t_car_review_task tcrt
LEFT JOIN sys_dept d ON d.dept_id = tcrt.dept_id
WHERE task_status = 'FINISH' AND task_result = 'PASS'
${params.dataScope}) AS carReviewPassedNum,
( SELECT COUNT( id )
FROM t_model_test_task tmtt
LEFT JOIN sys_dept d ON d.dept_id = tmtt.dept_id
WHERE task_status = 'FINISH'
${params.dataScope}) AS modelTestCompletedNum,
( SELECT COUNT( id )
FROM t_model_test_task tmtt
LEFT JOIN sys_dept d ON d.dept_id = tmtt.dept_id
WHERE task_status = 'FINISH' AND task_result = 'PASS'
${params.dataScope}) AS modelTestPassedNum
</select>
<select id="selectTaskParticipationStatistics" resultType="com.ruoyi.domain.vo.TaskParticipationStatisticsVO">
......@@ -67,6 +133,10 @@
FROM
t_task_user_relation tur
LEFT JOIN sys_user su ON su.user_id = tur.user_id
LEFT JOIN sys_dept d ON d.dept_id = su.dept_id
WHERE
'A' = 'A'
${params.dataScope}
GROUP BY
tur.user_id
</select>
......
......@@ -145,7 +145,10 @@
t.leader_id,t.leader,
t.task_begin_time,t.task_end_time
FROM t_task t
LEFT JOIN sys_dept d ON t.dept_id = d.dept_id
<where>
${params.dataScope}
AND
t.task_status IN ("FINISH")
<if test="standardId != null and standardId != ''">
and t.standard_id = #{standardId}
......
......@@ -6,6 +6,7 @@ import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import com.baomidou.mybatisplus.annotation.TableName;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.domain.BaseEntity;
......@@ -15,6 +16,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
*
* @author ruoyi
*/
@TableName(value = "sys_dept")
public class SysDept extends BaseEntity
{
private static final long serialVersionUID = 1L;
......
package com.ruoyi.common.core.page;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -10,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
* @author ruoyi
*/
@ApiModel
public class PageDomain
public class PageDomain extends BaseEntity
{
/** 当前记录起始索引 */
@ApiModelProperty("当前记录起始索引")
......
......@@ -50,6 +50,11 @@ public class DataScopeAspect
*/
public static final String DATA_SCOPE_SELF = "5";
/**
* 本部门与父部门下的其他部门数据权限
*/
public static final String DATA_SCOPE_OTHER = "6";
/**
* 数据权限过滤关键字
*/
......@@ -138,6 +143,16 @@ public class DataScopeAspect
// 数据权限为仅本人且没有userAlias别名不查询任何数据
sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias));
}
}else if (DATA_SCOPE_OTHER.equals(dataScope)) {
sqlString.append(StringUtils.format(
" OR {}.dept_id IN (" +
"SELECT dept_id FROM sys_dept WHERE find_in_set({}, ancestors) " +
"OR dept_id = {} " + // 包含当前部门
"OR find_in_set((SELECT parent_id FROM sys_dept WHERE dept_id = {}), ancestors)" + // 父部门的子部门
")",
deptAlias, user.getDeptId(), user.getDeptId(), user.getDeptId()
));
}
conditions.add(dataScope);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment