首页修改

This commit is contained in:
zhanghan11 2024-06-26 17:57:06 +08:00
parent af585370c0
commit 1b937b5905
5 changed files with 262 additions and 139 deletions

View File

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.patrol.mapper.PatrolTaskWorkorderMapper">
<resultMap type="PatrolTaskWorkorder" id="PatrolTaskWorkorderResult">
<result property="id" column="id" />
<result property="workorderCode" column="workorder_code" />
@ -43,8 +43,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from patrol_task_workorder a
left join patrol_task b on a.task_id=b.id
left join ehms_eam_equipments_infomation c on a.equip_id=c.id
<where>
<where>
<if test="params.beginWorkorderCode != null and params.beginWorkorderCode != '' and params.endWorkorderCode != null and params.endWorkorderCode != ''"> and workorder_code between #{params.beginWorkorderCode} and #{params.endWorkorderCode}</if>
<if test="workorderCode != null and workorderCode != ''"> and a.workorder_code like concat('%', #{workorderCode}, '%')</if>
<if test="workorderStatus != null and workorderStatus != ''"> and a.workorder_status like concat('%', #{workorderStatus}, '%')</if>
<if test="workorderType != null and workorderType != ''"> and a.workorder_type like concat('%', #{workorderType}, '%')</if>
<if test="equipName != null and equipName != ''"> and c.equip_name like concat('%', #{equipName}, '%')</if>
@ -64,7 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by a.dispatch_time desc
</select>
<select id="selectPatrolTaskWorkorderById" parameterType="String" resultMap="PatrolTaskWorkorderResult">
<include refid="selectPatrolTaskWorkorderVo"/>
where id = #{id}
@ -79,7 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join patrol_task b on a.task_id=b.id
where a.id = #{id}
</select>
<insert id="insertPatrolTaskWorkorder" parameterType="PatrolTaskWorkorder">
insert into patrol_task_workorder
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -156,7 +157,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deletePatrolTaskWorkorderByIds" parameterType="String">
delete from patrol_task_workorder where id in
delete from patrol_task_workorder where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
@ -177,4 +178,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
patrol_task_workorder
</select>
</mapper>
</mapper>

View File

@ -94,4 +94,8 @@ public interface EhmsEamEquipmentsInfomationMapper
* @return
*/
List<EhmsEamEquipmentsInfomation> getNoDataTermInfo();
List<Map<String, Object>> getPatrol();
List<Map<String, Object>> getClassList();
List<Map<String, Object>> getFileList();
List<Map<String, Object>> getLocationList();
}

View File

@ -95,5 +95,5 @@ public interface IEhmsEamEquipmentsInfomationService
* 获取首页charts统计数据
* @return
*/
public Map<String,List<String>> loadChartsData();
public Map<String,Object> loadChartsData();
}

View File

@ -23,15 +23,17 @@ import javax.validation.Validator;
import java.beans.Transient;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author zhangjunwen
* @create 2022/11/2
*/
@Service
public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipmentsInfomationService
{
public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipmentsInfomationService {
@Resource
private EhmsEamEquipmentsInfomationMapper ehmsEamEquipmentsInfomationMapper;
@ -54,10 +56,9 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
* @return 资产管理系统设备信息
*/
@Override
public EhmsEamEquipmentsInfomation selectEhmsEamEquipmentsInfomationById(String id)
{
public EhmsEamEquipmentsInfomation selectEhmsEamEquipmentsInfomationById(String id) {
EhmsEamEquipmentsInfomation result = ehmsEamEquipmentsInfomationMapper.selectEhmsEamEquipmentsInfomationById(id);
if (result.getId() != null){
if (result.getId() != null) {
SysDept dept = sysDeptMapper.selectDeptById(result.getEquipLocationId());
result.setEquipLocation(dept.getDeptName());
}
@ -71,10 +72,9 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
* @return 资产管理系统设备信息
*/
@Override
public List<EhmsEamEquipmentsInfomation> selectEhmsEamEquipmentsInfomationList(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation)
{
public List<EhmsEamEquipmentsInfomation> selectEhmsEamEquipmentsInfomationList(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation) {
List<EhmsEamEquipmentsInfomation> resultList = ehmsEamEquipmentsInfomationMapper.selectEhmsEamEquipmentsInfomationList(ehmsEamEquipmentsInfomation);
if(resultList.size() != 0){
if (resultList.size() != 0) {
for (EhmsEamEquipmentsInfomation eamEquipmentsInfomation : resultList) {
SysDept dept = sysDeptMapper.selectDeptById(eamEquipmentsInfomation.getEquipLocationId());
eamEquipmentsInfomation.setEquipLocation(dept.getDeptName());
@ -91,8 +91,7 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
* @return 资产管理系统设备信息
*/
@Override
public List<EhmsEamEquipmentsInfomation> selectLifeList(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation)
{
public List<EhmsEamEquipmentsInfomation> selectLifeList(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation) {
List<EhmsEamEquipmentsInfomation> resultList = ehmsEamEquipmentsInfomationMapper.selectLifeList(ehmsEamEquipmentsInfomation);
return resultList;
@ -100,14 +99,14 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
/**
* 根据时间查询设备信息
*
* @return
*/
@Override
public List<EhmsEamEquipmentsInfomation> selectEhmsEamEquipmentsInfomationListByDate(String startDate,String endDate)
{
public List<EhmsEamEquipmentsInfomation> selectEhmsEamEquipmentsInfomationListByDate(String startDate, String endDate) {
//TODO 对查询出来的设备组织id查询器组织名再赋值
List<EhmsEamEquipmentsInfomation> resultList = ehmsEamEquipmentsInfomationMapper.selectEhmsEamEquipmentsInfomationListByDate(startDate,endDate);
if(resultList.size() != 0){
List<EhmsEamEquipmentsInfomation> resultList = ehmsEamEquipmentsInfomationMapper.selectEhmsEamEquipmentsInfomationListByDate(startDate, endDate);
if (resultList.size() != 0) {
for (EhmsEamEquipmentsInfomation eamEquipmentsInfomation : resultList) {
SysDept dept = sysDeptMapper.selectDeptById(eamEquipmentsInfomation.getEquipLocationId());
eamEquipmentsInfomation.setEquipLocation(dept.getDeptName());
@ -119,12 +118,12 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
/**
* 导入数据
*
* @param facilityList 设备信息
* @param facilityList 设备信息
* @param isUpdateSupport 是否更新支持如果已存在则进行更新数据
* @return 结果
*/
@Override
public String importEamEquipmentsInfomation(List<EhmsEamEquipmentsInfomation> facilityList, Boolean isUpdateSupport){
public String importEamEquipmentsInfomation(List<EhmsEamEquipmentsInfomation> facilityList, Boolean isUpdateSupport) {
if (StringUtils.isNull(facilityList) || facilityList.size() == 0) {
throw new ServiceException("导入数据不能为空!");
}
@ -144,7 +143,7 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
deptSelect.setDeptName(ehmsEamEquipmentsInfomation.getEquipLocation());
System.err.println(deptSelect);
List<SysDept> deptList = sysDeptMapper.selectDeptList(deptSelect);
if(deptList.size() > 1 || deptList.size() == 0){
if (deptList.size() > 1 || deptList.size() == 0) {
throw new Exception("组织不存在请重新填写");
}
ehmsEamEquipmentsInfomation.setEquipLocationId(deptList.get(0).getDeptId());
@ -183,24 +182,23 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
*/
@Override
@Transient
public int insertEhmsEamEquipmentsInfomation(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation)
{
public int insertEhmsEamEquipmentsInfomation(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation) {
ehmsEamEquipmentsInfomation.setId(GetUUID.getUUID());
ehmsEamEquipmentsInfomation.setParentEquipId("0");
EhmsEamEquipmentsClass findClass = new EhmsEamEquipmentsClass();
findClass.setClassName(ehmsEamEquipmentsInfomation.getEquipClass());
List<EhmsEamEquipmentsClass> findClassList = ehmsEamEquipmentsClassMapper.selectEhmsEamEquipmentsClassList(findClass);
if (findClassList.size() == 0){
if (findClassList.size() == 0) {
ehmsEamEquipmentsInfomation.setEquipClassId(null);
}
ehmsEamEquipmentsInfomation.setEquipClassId(findClassList.get(0).getId());
if(ehmsEamEquipmentsInfomation.getEquipStatus() == 1){
if (ehmsEamEquipmentsInfomation.getEquipStatus() == 1) {
ehmsEamEquipmentsInfomation.setIsRunning("1");
}
//如果闲置状态就插入闲置设备表
if(ehmsEamEquipmentsInfomation.getEquipStatus() == 2){
if (ehmsEamEquipmentsInfomation.getEquipStatus() == 2) {
EhmsEamEquipIdleRecord idleRecord = new EhmsEamEquipIdleRecord();
idleRecord.setId(GetUUID.getUUID());
idleRecord.setEquipInfoId(ehmsEamEquipmentsInfomation.getId());
@ -220,10 +218,9 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
*/
@Override
@Transient
public int updateEhmsEamEquipmentsInfomation(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation)
{
System.err.println("是否变化;"+ehmsEamEquipmentsInfomation.getIsChange());
if("".equals(ehmsEamEquipmentsInfomation.getIsChange()) && ehmsEamEquipmentsInfomation.getEquipStatus() == 2){
public int updateEhmsEamEquipmentsInfomation(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation) {
System.err.println("是否变化;" + ehmsEamEquipmentsInfomation.getIsChange());
if ("".equals(ehmsEamEquipmentsInfomation.getIsChange()) && ehmsEamEquipmentsInfomation.getEquipStatus() == 2) {
//插入闲置
EhmsEamEquipIdleRecord idleRecord = new EhmsEamEquipIdleRecord();
idleRecord.setId(GetUUID.getUUID());
@ -233,12 +230,12 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
idleRecord.setIdleStartDate(sdf.format(new Date()));
ehmsEamEquipIdleRecordMapper.insertEhmsEamEquipIdleRecord(idleRecord);
}
if("改变".equals(ehmsEamEquipmentsInfomation.getIsChange())){
if ("改变".equals(ehmsEamEquipmentsInfomation.getIsChange())) {
EhmsEamEquipIdleRecord record = new EhmsEamEquipIdleRecord();
record.setEquipInfoId(ehmsEamEquipmentsInfomation.getId());
//通过设备信息id查询闲置设备id
List<EhmsEamEquipIdleRecord> recordList = ehmsEamEquipIdleRecordMapper.selectEhmsEamEquipIdleRecordList(record);
if(recordList.size() == 0 || recordList.size() >1){
if (recordList.size() == 0 || recordList.size() > 1) {
return 0;
}
EhmsEamEquipIdleRecord idleRecord = recordList.get(0);
@ -250,7 +247,7 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
EhmsEamEquipmentsClass findClass = new EhmsEamEquipmentsClass();
findClass.setClassName(ehmsEamEquipmentsInfomation.getEquipClass());
List<EhmsEamEquipmentsClass> findClassList = ehmsEamEquipmentsClassMapper.selectEhmsEamEquipmentsClassList(findClass);
if (findClassList.size() == 0){
if (findClassList.size() == 0) {
ehmsEamEquipmentsInfomation.setEquipClassId(null);
}
ehmsEamEquipmentsInfomation.setEquipClassId(findClassList.get(0).getId());
@ -264,8 +261,7 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
* @return 结果
*/
@Override
public int deleteEhmsEamEquipmentsInfomationByIds(String[] ids)
{
public int deleteEhmsEamEquipmentsInfomationByIds(String[] ids) {
return ehmsEamEquipmentsInfomationMapper.deleteEhmsEamEquipmentsInfomationByIds(ids);
}
@ -276,74 +272,89 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
* @return 结果
*/
@Override
public int deleteEhmsEamEquipmentsInfomationById(String id)
{
public int deleteEhmsEamEquipmentsInfomationById(String id) {
return ehmsEamEquipmentsInfomationMapper.deleteEhmsEamEquipmentsInfomationById(id);
}
/**
* 获取首页设备统计数据
*
* @return
*/
@Override
public Map<String,String> getEqNum() {
Map<String,String> rs = new HashMap<>();
List<Map<String,Object>> l = ehmsEamEquipmentsInfomationMapper.getEqNum();
public Map<String, String> getEqNum() {
Map<String, String> rs = new HashMap<>();
List<Map<String, Object>> l = ehmsEamEquipmentsInfomationMapper.getEqNum();
int total = 0;
int run = 0;
int notRun = 0;
if(null != l && l.size()>0){
for(Map<String,Object> i : l){
if(i.get("isRunning").equals("1")){
if (null != l && l.size() > 0) {
for (Map<String, Object> i : l) {
if (i.get("isRunning").equals("1")) {
run += Integer.parseInt(i.get("num").toString());
}else if(i.get("isRunning").equals("0")){
} else if (i.get("isRunning").equals("0")) {
notRun += Integer.parseInt(i.get("num").toString());
}
total += Integer.parseInt(i.get("num").toString());
}
}
rs.put("total",String.valueOf(total));
rs.put("run",String.valueOf(run));
rs.put("notRun",String.valueOf(notRun));
rs.put("total", String.valueOf(total));
rs.put("run", String.valueOf(run));
rs.put("notRun", String.valueOf(notRun));
return rs;
}
/**
* 获取首页charts统计数据
*
* @return
*/
@Override
public Map<String, List<String>> loadChartsData() {
Map<String, List<String>> rs = new HashMap<>();
List dateList = new ArrayList();
List runTimeList = new ArrayList();
List shutdownRateList = new ArrayList();
List<Map<String,Object>> l = ehmsEamEquipmentsInfomationMapper.getEqNum();
int num = 0;
for(int i=0; i<l.size(); i++){
num += Integer.parseInt(l.get(i).get("num").toString());
public Map<String, Object> loadChartsData() {
Map<String, Object> rs = new HashMap<>();
// 获取前三个月份
List<Integer> monthList = new ArrayList<>();
List<Integer> dailyList = new ArrayList<>();
List<Integer> meterReadingList = new ArrayList<>();
List<Integer> professionalList = new ArrayList<>();
LocalDate currentDate = LocalDate.now();
for (int i = 0; i < 3; i++) {
monthList.add(Integer.parseInt(currentDate.format(DateTimeFormatter.ofPattern("MM"))));
currentDate = currentDate.minusMonths(1);
dailyList.add(0);
meterReadingList.add(0);
professionalList.add(0);
}
String startDate = DateUtils.parseDateToStr("YYYY-MM-dd",DateUtils.getAfterTime(DateUtils.getNowDate(),-20));
List<Map<String, Object>> runTime = ehmsEamEquipmentsInfomationMapper.getRunTime(startDate);
Map<String, Object> runTimeMap = new HashMap<>();
for(int i=0;i<runTime.size();i++){
runTimeMap.put(runTime.get(i).get("date").toString(),runTime.get(i).get("time"));
}
for(int i=-20 ;i<0 ;i++){
Date d = DateUtils.getAfterTime(DateUtils.getNowDate(),i);
dateList.add(DateUtils.parseDateToStr("MM-dd",d));
String key = DateUtils.parseDateToStr("YYYY-MM-dd",d);
if(runTimeMap.containsKey(key)){
runTimeList.add(Long.parseLong(runTimeMap.get(key).toString())/60);
shutdownRateList.add(100-(Long.parseLong(runTimeMap.get(key).toString())*10000/(24*60*60*num))/100.0);
}else{
runTimeList.add(0);
shutdownRateList.add(100);
Collections.reverse(monthList);
// 巡检柱状图数据
List<Map<String, Object>> patrolList = ehmsEamEquipmentsInfomationMapper.getPatrol();
for(Map<String, Object> pmap : patrolList){
if("日常巡检".equals(pmap.get("name").toString())){
dailyList.set(monthList.indexOf(Integer.parseInt(pmap.get("month").toString())),Integer.parseInt(pmap.get("num").toString()));
}
if("抄表巡检".equals(pmap.get("name").toString())){
meterReadingList.set(monthList.indexOf(Integer.parseInt(pmap.get("month").toString())),Integer.parseInt(pmap.get("num").toString()));
}
if("专业巡检".equals(pmap.get("name").toString())){
professionalList.set(monthList.indexOf(Integer.parseInt(pmap.get("month").toString())),Integer.parseInt(pmap.get("num").toString()));
}
}
rs.put("dateList",dateList);
rs.put("runTimeList",runTimeList);
rs.put("shutdownRateList",shutdownRateList);
rs.put("monthList",monthList);
rs.put("dailyList", dailyList);
rs.put("meterReadingList", meterReadingList);
rs.put("professionalList", professionalList);
// 分类饼图数据
List<Map<String, Object>> classList = ehmsEamEquipmentsInfomationMapper.getClassList();
rs.put("classList", classList);
// 文件饼图数据
List<Map<String, Object>> fileList = ehmsEamEquipmentsInfomationMapper.getFileList();
rs.put("fileList", fileList);
// 设备分布饼图数据
List<Map<String, Object>> locationList = ehmsEamEquipmentsInfomationMapper.getLocationList();
rs.put("locationList", locationList);
return rs;
}
}

View File

@ -5,21 +5,21 @@
<mapper namespace="com.inspur.eam.mapper.EhmsEamEquipmentsInfomationMapper">
<resultMap type="EhmsEamEquipmentsInfomation" id="EhmsEamEquipmentsInfomationResult">
<result property="id" column="id" />
<result property="equipId" column="equip_id" />
<result property="equipName" column="equip_name" />
<result property="equipSpecifications" column="equip_specifications" />
<result property="equipClass" column="equip_class" />
<result property="equipSerialNum" column="equip_serial_num" />
<result property="equipManufacturer" column="equip_manufacturer" />
<result property="equipProductionDate" column="equip_production_date" />
<result property="equipStatus" column="equip_status" />
<result property="equipLocationId" column="equip_location_id" />
<result property="fixedAssetsNum" column="fixed_assets_num" />
<result property="parentEquipId" column="parent_equip_id"/>
<result property="equipManagerId" column="equip_manager_id"/>
<result property="isRunning" column="is_running"/>
<result property="areaName" column="area_name"/>
<result property="id" column="id"/>
<result property="equipId" column="equip_id"/>
<result property="equipName" column="equip_name"/>
<result property="equipSpecifications" column="equip_specifications"/>
<result property="equipClass" column="equip_class"/>
<result property="equipSerialNum" column="equip_serial_num"/>
<result property="equipManufacturer" column="equip_manufacturer"/>
<result property="equipProductionDate" column="equip_production_date"/>
<result property="equipStatus" column="equip_status"/>
<result property="equipLocationId" column="equip_location_id"/>
<result property="fixedAssetsNum" column="fixed_assets_num"/>
<result property="parentEquipId" column="parent_equip_id"/>
<result property="equipManagerId" column="equip_manager_id"/>
<result property="isRunning" column="is_running"/>
<result property="areaName" column="area_name"/>
<result property="equipClassId" column="equip_class_id`"/>
<result property="theoryLife" column="theory_life"/>
<result property="runTime" column="run_time"/>
@ -28,31 +28,57 @@
</resultMap>
<sql id="selectEhmsEamEquipmentsInfomationVo">
select a.id, equip_id, equip_name, equip_specifications, equip_class, equip_serial_num, equip_manufacturer, equip_production_date, equip_status,area_name, equip_location_id, fixed_assets_num, parent_equip_id,equip_manager_id,u.user_name as equipManager,is_running,equip_class_id from ehms_eam_equipments_infomation a
left join sys_user u on u.user_id = a.equip_manager_id
select a.id,
equip_id,
equip_name,
equip_specifications,
equip_class,
equip_serial_num,
equip_manufacturer,
equip_production_date,
equip_status,
area_name,
equip_location_id,
fixed_assets_num,
parent_equip_id,
equip_manager_id,
u.user_name as equipManager,
is_running,
equip_class_id
from ehms_eam_equipments_infomation a
left join sys_user u on u.user_id = a.equip_manager_id
</sql>
<select id="selectEhmsEamEquipmentsInfomationList" parameterType="EhmsEamEquipmentsInfomation" resultMap="EhmsEamEquipmentsInfomationResult">
<select id="selectEhmsEamEquipmentsInfomationList" parameterType="EhmsEamEquipmentsInfomation"
resultMap="EhmsEamEquipmentsInfomationResult">
<include refid="selectEhmsEamEquipmentsInfomationVo"/>
<where>
<if test="id != null and equipId != ''"> and id = #{id}</if>
<if test="equipId != null and equipId != ''"> and equip_id = #{equipId}</if>
<if test="equipName != null and equipName != ''"> and equip_name like concat('%', #{equipName}, '%')</if>
<if test="equipSpecifications != null and equipSpecifications != ''"> and equip_specifications = #{equipSpecifications}</if>
<if test="equipClass != null and equipClass != ''"> and equip_class = #{equipClass}</if>
<if test="equipSerialNum != null and equipSerialNum != ''"> and equip_serial_num = #{equipSerialNum}</if>
<if test="equipManufacturer != null and equipManufacturer != ''"> and equip_manufacturer = #{equipManufacturer}</if>
<if test="equipProductionDate != null and equipProductionDate != ''"> and equip_production_date = #{equipProductionDate}</if>
<if test="equipStatus != null "> and equip_status = #{equipStatus}</if>
<if test="equipLocationId != null and equipLocationId != ''"> and equip_location_id = #{equipLocationId}</if>
<if test="fixedAssetsNum != null and fixedAssetsNum != ''"> and fixed_assets_num = #{fixedAssetsNum}</if>
<if test="parentEquipId != null and parentEquipId != ''"> and parent_equip_id = #{parentEquipId}</if>
<if test="equipManagerId != null and equipManagerId != ''"> and equip_manager_id = #{equipManagerId}</if>
<if test="areaName != null and areaName != ''"> and area_name = #{areaName}</if>
<if test="equipClassId != null and equipClassId != ''"> and equip_class_id = #{equipClassId}</if>
<if test="id != null and equipId != ''">and id = #{id}</if>
<if test="equipId != null and equipId != ''">and equip_id = #{equipId}</if>
<if test="equipName != null and equipName != ''">and equip_name like concat('%', #{equipName}, '%')</if>
<if test="equipSpecifications != null and equipSpecifications != ''">and equip_specifications =
#{equipSpecifications}
</if>
<if test="equipClass != null and equipClass != ''">and equip_class = #{equipClass}</if>
<if test="equipSerialNum != null and equipSerialNum != ''">and equip_serial_num = #{equipSerialNum}</if>
<if test="equipManufacturer != null and equipManufacturer != ''">and equip_manufacturer =
#{equipManufacturer}
</if>
<if test="equipProductionDate != null and equipProductionDate != ''">and equip_production_date =
#{equipProductionDate}
</if>
<if test="equipStatus != null ">and equip_status = #{equipStatus}</if>
<if test="equipLocationId != null and equipLocationId != ''">and equip_location_id = #{equipLocationId}
</if>
<if test="fixedAssetsNum != null and fixedAssetsNum != ''">and fixed_assets_num = #{fixedAssetsNum}</if>
<if test="parentEquipId != null and parentEquipId != ''">and parent_equip_id = #{parentEquipId}</if>
<if test="equipManagerId != null and equipManagerId != ''">and equip_manager_id = #{equipManagerId}</if>
<if test="areaName != null and areaName != ''">and area_name = #{areaName}</if>
<if test="equipClassId != null and equipClassId != ''">and equip_class_id = #{equipClassId}</if>
</where>
</select>
<select id="selectLifeList" parameterType="EhmsEamEquipmentsInfomation" resultMap="EhmsEamEquipmentsInfomationResult">
<select id="selectLifeList" parameterType="EhmsEamEquipmentsInfomation"
resultMap="EhmsEamEquipmentsInfomationResult">
select temp.*,(temp.theory_life - temp.run_time - temp.consume_time) left_time from(
SELECT
a.id,
@ -73,37 +99,47 @@
a.equip_class_id,
a.theory_life,
ROUND( TIMESTAMPDIFF( HOUR, a.equip_production_date, now())* 0.7 ) run_time,
( SELECT count( 1 )* 180 FROM ehms_maintenance_work_order t WHERE t.equ_number = a.equip_id )+a.time consume_time
( SELECT count( 1 )* 180 FROM ehms_maintenance_work_order t WHERE t.equ_number = a.equip_id )+a.time
consume_time
FROM
ehms_eam_equipments_infomation a ) as temp
<where>
<if test="id != null and equipId != ''"> and id = #{id}</if>
<if test="equipId != null and equipId != ''"> and equip_id = #{equipId}</if>
<if test="equipName != null and equipName != ''"> and equip_name like concat('%', #{equipName}, '%')</if>
<if test="equipSpecifications != null and equipSpecifications != ''"> and equip_specifications = #{equipSpecifications}</if>
<if test="equipClass != null and equipClass != ''"> and equip_class = #{equipClass}</if>
<if test="equipSerialNum != null and equipSerialNum != ''"> and equip_serial_num = #{equipSerialNum}</if>
<if test="equipManufacturer != null and equipManufacturer != ''"> and equip_manufacturer = #{equipManufacturer}</if>
<if test="equipProductionDate != null and equipProductionDate != ''"> and equip_production_date = #{equipProductionDate}</if>
<if test="equipStatus != null "> and equip_status = #{equipStatus}</if>
<if test="equipLocationId != null and equipLocationId != ''"> and equip_location_id = #{equipLocationId}</if>
<if test="fixedAssetsNum != null and fixedAssetsNum != ''"> and fixed_assets_num = #{fixedAssetsNum}</if>
<if test="parentEquipId != null and parentEquipId != ''"> and parent_equip_id = #{parentEquipId}</if>
<if test="equipManagerId != null and equipManagerId != ''"> and equip_manager_id = #{equipManagerId}</if>
<if test="areaName != null and areaName != ''"> and area_name = #{areaName}</if>
<if test="equipClassId != null and equipClassId != ''"> and equip_class_id = #{equipClassId}</if>
<if test="id != null and equipId != ''">and id = #{id}</if>
<if test="equipId != null and equipId != ''">and equip_id = #{equipId}</if>
<if test="equipName != null and equipName != ''">and equip_name like concat('%', #{equipName}, '%')</if>
<if test="equipSpecifications != null and equipSpecifications != ''">and equip_specifications =
#{equipSpecifications}
</if>
<if test="equipClass != null and equipClass != ''">and equip_class = #{equipClass}</if>
<if test="equipSerialNum != null and equipSerialNum != ''">and equip_serial_num = #{equipSerialNum}</if>
<if test="equipManufacturer != null and equipManufacturer != ''">and equip_manufacturer =
#{equipManufacturer}
</if>
<if test="equipProductionDate != null and equipProductionDate != ''">and equip_production_date =
#{equipProductionDate}
</if>
<if test="equipStatus != null ">and equip_status = #{equipStatus}</if>
<if test="equipLocationId != null and equipLocationId != ''">and equip_location_id = #{equipLocationId}
</if>
<if test="fixedAssetsNum != null and fixedAssetsNum != ''">and fixed_assets_num = #{fixedAssetsNum}</if>
<if test="parentEquipId != null and parentEquipId != ''">and parent_equip_id = #{parentEquipId}</if>
<if test="equipManagerId != null and equipManagerId != ''">and equip_manager_id = #{equipManagerId}</if>
<if test="areaName != null and areaName != ''">and area_name = #{areaName}</if>
<if test="equipClassId != null and equipClassId != ''">and equip_class_id = #{equipClassId}</if>
</where>
order by equip_class
</select>
<select id="selectEhmsEamEquipmentsInfomationById" parameterType="String" resultMap="EhmsEamEquipmentsInfomationResult">
<select id="selectEhmsEamEquipmentsInfomationById" parameterType="String"
resultMap="EhmsEamEquipmentsInfomationResult">
<include refid="selectEhmsEamEquipmentsInfomationVo"/>
where a.id = #{id}
</select>
<!-- public List<EhmsEamEquipmentsInfomation> selectEhmsEamEquipmentsInfomationListByDate(@Param("startDate")String startDate,-->
<!-- 通过时间查询设备信息-->
<select id="selectEhmsEamEquipmentsInfomationListByDate" parameterType="String" resultMap="EhmsEamEquipmentsInfomationResult">
<!-- public List<EhmsEamEquipmentsInfomation> selectEhmsEamEquipmentsInfomationListByDate(@Param("startDate")String startDate,-->
<!-- 通过时间查询设备信息-->
<select id="selectEhmsEamEquipmentsInfomationListByDate" parameterType="String"
resultMap="EhmsEamEquipmentsInfomationResult">
<include refid="selectEhmsEamEquipmentsInfomationVo"/>
where equip_production_date &gt;= #{startDate}
AND equip_production_date &lt;= #{endDate}
@ -172,7 +208,9 @@
</update>
<delete id="deleteEhmsEamEquipmentsInfomationById" parameterType="String">
delete from ehms_eam_equipments_infomation where id = #{id}
delete
from ehms_eam_equipments_infomation
where id = #{id}
</delete>
<delete id="deleteEhmsEamEquipmentsInfomationByIds" parameterType="String">
@ -183,18 +221,87 @@
</delete>
<select id="getEqNum" resultType="map">
select is_running isRunning,count(1) num from ehms_eam_equipments_infomation where equip_status ='1' group by is_running
select is_running isRunning, count(1) num
from ehms_eam_equipments_infomation
where equip_status = '1'
group by is_running
</select>
<select id="getRunTime" resultType="map">
select sum(run_time) time,create_date date from ehms_equ_run_hour where create_date >= #{startDate} GROUP BY create_date
select sum(run_time) time,create_date date
from ehms_equ_run_hour
where create_date >= #{startDate}
GROUP BY create_date
</select>
<!--List<EhmsEamEquipmentsInfomation> getNoDataTermInfo() 获取无终端的设备-->
<select id="getNoDataTermInfo" resultMap="EhmsEamEquipmentsInfomationResult">
select a.id from ehms_eam_equipments_infomation a
LEFT JOIN ehms_eam_data_terminal b
ON b.data_term_belong_equip_id = a.id
select a.id
from ehms_eam_equipments_infomation a
LEFT JOIN ehms_eam_data_terminal b
ON b.data_term_belong_equip_id = a.id
WHERE b.data_term_belong_equip_id IS null;
</select>
</mapper>
<select id="getPatrol" resultType="map">
SELECT MONTH (patrol_time) "month",
CASE record_type
WHEN 'daily' THEN
'日常巡检'
WHEN 'meter_reading' THEN
'抄表巡检'
WHEN 'professional' THEN
'专业巡检'
ELSE
''
END
"name"
, IFNULL(COUNT(*),0) num
FROM patrol_record
WHERE
EXTRACT(YEAR_MONTH FROM patrol_time) BETWEEN
EXTRACT(YEAR_MONTH FROM DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH)) AND
EXTRACT(YEAR_MONTH FROM CURRENT_DATE)
GROUP BY EXTRACT(YEAR_MONTH FROM patrol_time),record_type
ORDER BY EXTRACT(YEAR_MONTH FROM patrol_time)
</select>
<select id="getClassList" resultType="map">
SELECT a.class_name "name",
IFNULL(b.num, 0) "value"
FROM `ehms_eam_equipments_class` a
LEFT JOIN (SELECT equip_class_id, count(0) num
FROM `ehms_eam_equipments_infomation`
GROUP BY equip_class_id) b ON a.id = b.equip_class_id
</select>
<select id="getFileList" resultType="map">
SELECT CASE
upload_type
WHEN 'huiyi' THEN
'会议纪要'
WHEN 'jishu' THEN
'技术协议'
WHEN 'peixun' THEN
'培训资料'
ELSE ''
END "name",
count(0)
"value"
FROM `ehms_upload_file`
GROUP BY upload_type
</select>
<select id="getLocationList" resultType="map">
SELECT a.dept_name "name",
IFNULL(b.num, 0) "value"
FROM (
SELECT dept_id,
dept_name
FROM `sys_dept` d
WHERE del_flag = '0'
AND (SELECT count(0) FROM sys_dept WHERE parent_id = d.dept_id) = 0
) a
LEFT JOIN (SELECT equip_location_id, count(0) num
FROM `ehms_eam_equipments_infomation`
GROUP BY equip_location_id) b ON a.dept_id = b.equip_location_id
</select>
</mapper>