| | |
| | | |
| | | import com.nanometer.smartlab.entity.SysAlarm; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.dao.DataAccessException; |
| | | |
| | | public interface SysAlarmDao { |
| | | |
| | | public void insertSysAlarm(SysAlarm sysAlarm) throws DataAccessException; |
| | | |
| | | |
| | | public List<SysAlarm> getSysAlarmList(Map params); |
| | | |
| | | |
| | | public int getSysAlarmTotalCount(Map params); |
| | | |
| | | |
| | | int selectOne(@Param("containerCode") String containerCode, |
| | | @Param("controllerCode") String controllerCode, |
| | | @Param("warningId") String warningId, |
| | | @Param("warningTime")Timestamp warningTime); |
| | | } |
| | |
| | | insert into sys_alarm(container_code, warning_id, warning_time, warning_level, controller_code) |
| | | values (#{containerCode}, #{warningId}, #{warningTime}, #{warningLevel}, #{controllerCode}) |
| | | </insert> |
| | | |
| | | |
| | | <select id="getSysAlarmList" parameterType="java.util.Map" resultMap="SysAlarm"> |
| | | select sw.*,bm2.meta_value as type,sl.name as typeName,bm.meta_value as warningName from sys_alarm as sw |
| | | select sw.*,bm2.meta_value as type,sl.name as typeName,bm.meta_value as warningName from sys_alarm as sw |
| | | left join sys_laboratory_container as slc on sw.container_code = slc.container_code |
| | | left join sys_laboratory as sl on slc.laboratory_id = sl.id |
| | | left join base_meta as bm on sw.warning_id = bm.id |
| | |
| | | select count(1) from sys_alarm |
| | | <include refid="queryWhereSql"/> |
| | | </select> |
| | | <select id="selectOne" resultType="java.lang.Integer"> |
| | | select count(0) |
| | | from sys_alarm |
| | | where container_code = #{containerCode} |
| | | and warning_id = #{warningId} |
| | | and controller_code =#{controllerCode} |
| | | and warning_time = #{warningTime} |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | } catch (ParseException e) { |
| | | throw new ApiException(ApiStatus.PARAM_ERR); |
| | | } |
| | | |
| | | //判断是否重复 |
| | | if (sysAlarmDao.selectOne(containerCode, controllerCode, sysAlarm.getWarningId(), sysAlarm.getWarningTime()) > 0) { |
| | | continue; |
| | | } |
| | | sysAlarmDao.insertSysAlarm(sysAlarm); |
| | | |
| | | try { |
| | | if (enable && "01".equals(warningId)) { |
| | | SysLaboratory sysLaboratory = sysLaboratoryService.getSysLaboratory(LaboratoryContainer.getLaboratoryId()); |