Commit 71356ed1 authored by 耿迪迪's avatar 耿迪迪

隐患查询接口新增

parent 2a67cd8d
package com.zehong.web.controller.checktask;
import java.util.List;
import java.util.stream.Collectors;
import com.zehong.common.core.domain.entity.SysRole;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.SecurityUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.domain.entity.SysRole;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.TDanger;
import com.zehong.system.service.ITDangerService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
/**
* 安检隐患整改Controller
......@@ -144,4 +143,33 @@ public class TDangerController extends BaseController
return toAjax(tDangerService.dangerDataVisitorPermission(isVisitor,ids));
}
/**
* 根据隐患来源查询隐患
* @param tDanger
* @return
*/
@GetMapping("/selectTDangerListByType")
public TableDataInfo selectTDangerListByType(TDanger tDanger){
startPage();
SysUser user = SecurityUtils.getLoginUser().getUser();
//客服运营部
if(200 == user.getDeptId()){
tDanger.setAdminId(user.getUserId().intValue());
tDanger.setFlag(2);
}
//生产运营部
if(102 == user.getDeptId()){
tDanger.setAdminId(user.getUserId().intValue());
tDanger.setFlag(3);
}
//205 安全管理部
if(205 != user.getDeptId() && 200 != user.getDeptId() && 102 != user.getDeptId()){
tDanger.setAdminId(user.getUserId().intValue());
}
List<TDanger> list = tDangerService.selectTDangerListByType(tDanger);
return getDataTable(list);
}
}
......@@ -64,4 +64,11 @@ public interface TDangerMapper
public int deleteTDangerByInspectt(@Param("inspectId") Long inspectId , @Param("type")Integer type);
public int updateByInspect(@Param("inspectId") Long inspectId , @Param("type")Integer type);
/**
* 根据隐患来源查询隐患
* @param tDanger
* @return
*/
List<TDanger> selectTDangerListByType(TDanger tDanger);
}
......@@ -66,4 +66,11 @@ public interface ITDangerService
* @return
*/
int dangerDataVisitorPermission(String isVisitor,Long[] ids);
/**
* 根据隐患来源查询隐患
* @param tDanger
* @return
*/
List<TDanger> selectTDangerListByType(TDanger tDanger);
}
......@@ -175,4 +175,16 @@ public class TDangerServiceImpl implements ITDangerService
}
return num;
}
/**
* 根据隐患来源查询隐患
* @param tDanger
* @return
*/
@Override
public List<TDanger> selectTDangerListByType(TDanger tDanger)
{
return tDangerMapper.selectTDangerListByType(tDanger);
}
}
......@@ -312,4 +312,111 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and `type` &lt; 3
</if>
</update>
<select id="selectTDangerListByType" parameterType="TDanger" resultMap="TDangerResult">
SELECT
danger.id,
danger.task_id,
danger.inspect_id,
danger.type,
danger.receive_id,
danger.title,
danger.LEVEL,
danger.category,
danger.before_content,
danger.phone,
danger.address,
danger.longitude,
danger.latitude,
danger.before_img,
danger.before_video,
danger.flag,
danger.after_content,
danger.reform_id,
danger.after_img,
danger.reform_time,
danger.start_time,
danger.end_time,
danger.STATUS,
danger.admin_id,
(SELECT nick_name FROM sys_user where user_id = danger.admin_id) as adminName,
danger.create_time,
danger.remark,
danger.finish,
danger.check_id,
danger.check_time,
danger.check_remark,
danger.check_img,
danger.file_id,
danger.file_time,
danger.is_visitor,
danger.governance_standards,
danger.governance_method,
danger.funds_materials,
danger.safety_emergency_plan,
danger.deal_method,
(SELECT nick_name FROM sys_user where user_id = danger.file_id) as fileName,
(
case type
when '1' then tu.username
when '2' then (select username from t_business bu where bu.id = danger.receive_id)
when '3' then (select username from t_industry ind where ind.id = danger.receive_id)
when '6' then (select dev.device_name from t_device_info dev where dev.device_id = danger.receive_id)
when '5' then (select site.site_station_name from t_site_station_info site where site.site_station_id = danger.receive_id)
else '-'
end
) as receiveName,
(
case type
when '1' then (select tu.meternum from t_user tu where tu.id = danger.receive_id)
else '-'
end
) as meterNum,
(select nick_name from sys_user where user_id = danger.reform_id) as reformName,
us.nick_name as reportName,
(select nick_name from sys_user where user_id = danger.check_id) as checkName
FROM
t_danger danger
LEFT JOIN sys_user us ON us.user_id = danger.admin_id
<if test="type == '1'">
LEFT JOIN t_user tu ON tu.id = danger.receive_id
LEFT JOIN t_community com ON com.id = tu.village
</if>
<where>
<if test="taskId != null "> and danger.task_id = #{taskId}</if>
<if test="inspectId != null "> and danger.inspect_id = #{inspectId}</if>
<if test="category != null "> and danger.category = #{category}</if>
<if test="type != null "> and danger.type = #{type}</if>
<if test="receiveId != null "> and danger.receive_id = #{receiveId}</if>
<if test="title != null and title != ''"> and danger.title like concat('%',#{title},'%')</if>
<if test="level != null "> and danger.level = #{level}</if>
<if test="beforeContent != null and beforeContent != ''"> and danger.before_content = #{beforeContent}</if>
<if test="address != null and address != ''"> and danger.address = #{address}</if>
<if test="longitude != null "> and danger.longitude = #{longitude}</if>
<if test="phone != null and phone != ''"> and danger.phone = #{phone}</if>
<if test="latitude != null "> and danger.latitude = #{latitude}</if>
<if test="beforeImg != null and beforeImg != ''"> and danger.before_img = #{beforeImg}</if>
<if test="beforeVideo != null and beforeVideo != ''"> and danger.before_video = #{beforeVideo}</if>
<if test="flag != null and adminId == null"> and danger.flag = #{flag}</if>
<if test="afterContent != null and afterContent != ''"> and danger.after_content = #{afterContent}</if>
<if test="reformId != null "> and danger.reform_id = #{reformId}</if>
<if test="afterImg != null and afterImg != ''"> and danger.after_img = #{afterImg}</if>
<if test="startTime != null "> and danger.start_time = #{startTime}</if>
<if test="endTime != null "> and danger.end_time = #{endTime}</if>
<if test="status != null "> and danger.status = #{status}</if>
<if test="adminId != null and flag == null"> and danger.admin_id = #{adminId}</if>
<if test="finish != null "> and danger.finish = #{finish}</if>
<if test="status == null "> and danger.status not in (-1)</if>
<if test="flag != null and adminId != null"> and (danger.flag = #{flag} or danger.admin_id = #{adminId})</if>
<if test="isVisitor != null and isVisitor != ''"> and danger.is_visitor = #{isVisitor}</if>
<if test="dealMethod != null and dealMethod != ''"> and danger.deal_method = #{dealMethod}</if>
<if test="reportName != null and reportName != ''"> and us.nick_name like concat('%',#{reportName},'%')</if>
<if test="beginDate != null and endDate != null"> and danger.create_time BETWEEN #{beginDate} and #{endDate}</if>
<if test="type == '1' and userInfo != null ">
and (tu.username like concat('%',#{userInfo},'%') or tu.phone like concat('%',#{userInfo},'%') or tu.meternum like concat('%',#{userInfo},'%'))
</if>
<if test="type == '1' and village != null "> and com.id = #{village} </if>
</where>
ORDER BY create_time DESC
</select>
</mapper>
\ No newline at end of file
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