@ -139,11 +139,18 @@ public class BaseAlarmTypeController extends BaseController
* 选择传感器报警类型树
*/
@GetMapping(value = { "/selectAlarmTypeTree/{objId}", "/selectAlarmTypeTree/" })
public String selectAlarmTypeTree(@PathVariable(value = "objId", required = false) Long objId, ModelMap mmap)
public String selectAlarmTypeTree(@PathVariable(value = "objId", required = false) String objId, ModelMap mmap)
{
if (StringUtils.isNotNull(objId))
mmap.put("baseAlarmType", baseAlarmTypeService.selectBaseAlarmTypeByObjId(objId));
BaseAlarmType baseAlarmType = new BaseAlarmType();
baseAlarmType.setAlarmtypeId(objId);
List<BaseAlarmType> baseAlarmTypes = baseAlarmTypeService.selectBaseAlarmTypeList(baseAlarmType);
if(baseAlarmTypes.size() > 0){
mmap.put("baseAlarmType", baseAlarmTypeService.selectBaseAlarmTypeByObjId(baseAlarmTypes.get(0).getObjId()));
}
return prefix + "/tree";
@ -33,9 +33,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectBaseAlarmTypeByObjId" parameterType="Long" resultMap="BaseAlarmTypeResult">
select t.ObjId, t.alarmType_Id, t.alarmType_Name, t.parent_Id, t.Enable_Flag, t.Create_By, t.Create_Time, t.Update_By, t.Update_Time, p.alarmType_Name as parent_name
select t.ObjId, t.alarmType_Id, t.alarmType_Name, t.parent_Id,p.alarmType_Name as parent_name, t.Enable_Flag, t.Create_By, t.Create_Time, t.Update_By, t.Update_Time, p.alarmType_Name as parent_name
from base_alarm_type t
left join base_alarm_type p on p.ObjId = t.parent_Id
left join base_alarm_type p on p.alarmType_Id = t.parent_Id
where t.ObjId = #{objId}