|
@@ -35,34 +35,50 @@
|
|
|
where rule.del_flag='0'
|
|
|
<if test="enabled != null">and rule.enabled = #{enabled}</if>
|
|
|
<if test="id != null and id != ''">and rule.id = #{id}</if>
|
|
|
+ <if test="ruleName != null and ruleName != ''">and rule.name like concat('%',#{ruleName},'%')</if>
|
|
|
ORDER BY rule.create_time DESC
|
|
|
</select>
|
|
|
|
|
|
- <select id="modelList" parameterType="string" resultMap="ruleModelResult">
|
|
|
- select model.id as id,rm.rule_id as rule_id,model.`name` as model_name,model.code,model.description,model.del_flag
|
|
|
- from ax_beidou_warning_rule_model rm
|
|
|
- inner join ax_beidou_warning_model model on model.id = rm.model_id
|
|
|
- where model.del_flag='0' and rm.rule_id = #{id}
|
|
|
- </select>
|
|
|
+ <resultMap id="ruleModelResult1" type="warningModelResult">
|
|
|
+ <id property="id" column="id"/>
|
|
|
+ <result property="modelName" column="model_name"/>
|
|
|
+ <result property="code" column="code"/>
|
|
|
+ <result property="description" column="description"/>
|
|
|
+ <collection property="paramList" ofType="warningParamVo"
|
|
|
+ column="{modelId=id,ruleId=rule_id}">
|
|
|
+ <id property="id" column="param_id"/>
|
|
|
+ <result property="paramProperty" column="param_property"/>
|
|
|
+ <result property="paramName" column="param_name"/>
|
|
|
+ <result property="paramValue" column="param_value"/>
|
|
|
+ <result property="isMust" column="is_must"/>
|
|
|
+ <result property="dictId" column="dict_id"/>
|
|
|
+ <result property="recommend" column="recommend"/>
|
|
|
+ </collection>
|
|
|
|
|
|
- <select id="ruleParamList" resultMap="paramVo">
|
|
|
- select param.id as param_id,rp.param_value,param.recommend,
|
|
|
- param.is_must,param.del_flag as param_del_flag,
|
|
|
- dict.param_code as param_property,dict.param_name,dict.id as dict_id
|
|
|
- from ax_beidou_warning_model_param mp
|
|
|
- inner join ax_beidou_warning_rule_model_param rp on mp.param_id = rp.param_id
|
|
|
- left join ax_beidou_warning_param param on param.id = mp.param_id
|
|
|
+ <collection property="areaList" ofType="warningAreaVo"
|
|
|
+ column="{modelId=id,ruleId=rule_id}">
|
|
|
+ <id property="id" column="area_id"/>
|
|
|
+ <result property="name" column="area_name"/>
|
|
|
+ <result property="location" column="location"/>
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="modelList" resultMap="ruleModelResult1">
|
|
|
+ select model.id as id,rm.rule_id as rule_id,model.`name` as model_name,model.code,model.description,model.del_flag,
|
|
|
+ param.id as param_id,rp.param_value,param.recommend,param.is_must,param.del_flag as param_del_flag,
|
|
|
+ dict.param_code as param_property,dict.param_name,dict.id as dict_id,
|
|
|
+ area.id as area_id,area.`name` as area_name,area.location
|
|
|
+ from ax_beidou_warning_rule_model rm
|
|
|
+ inner join ax_beidou_warning_model model on model.id = rm.model_id and model.del_flag = '0'
|
|
|
+ left JOIN ax_beidou_warning_model_param mp on mp.model_id = model.id
|
|
|
+ left join ax_beidou_warning_rule_model_param rp on mp.param_id = rp.param_id and rp.model_id = rm.model_id and rp.rule_id = rm.rule_id
|
|
|
+ left join ax_beidou_warning_param param on param.id = mp.param_id and param.del_flag = '0'
|
|
|
left join ax_beidou_warning_param_dict dict on param.dict_id = dict.id
|
|
|
- where param.del_flag = '0' and mp.model_id = #{modelId} and rp.rule_id = #{ruleId}
|
|
|
+ left JOIN ax_beidou_warning_rule_model_area ma on ma.model_id = model.id and ma.rule_id = rm.rule_id
|
|
|
+ left join ax_beidou_warning_area area on area.id = ma.area_id and area.del_flag = '0'
|
|
|
+ where model.del_flag='0' and rm.rule_id = #{id}
|
|
|
</select>
|
|
|
|
|
|
- <select id="ruleAreaList" resultMap="areaVo">
|
|
|
- select area.id as area_id,area.`name` as area_name,area.location,
|
|
|
- area.del_flag as area_del_flag
|
|
|
- from ax_beidou_warning_rule_model_area ma
|
|
|
- left join ax_beidou_warning_area area on area.id = ma.area_id
|
|
|
- where area.del_flag = '0' and ma.model_id = #{modelId} and ma.rule_id = #{ruleId}
|
|
|
- </select>
|
|
|
<!--预警规则列表 end-->
|
|
|
|
|
|
|
|
@@ -99,6 +115,7 @@
|
|
|
from ax_beidou_warning_model model
|
|
|
where model.del_flag='0'
|
|
|
<if test="id != null and id != ''">and model.id = #{id}</if>
|
|
|
+ <if test="modelName != null and modelName != ''">and model.name like concat('%',#{modelName},'%')</if>
|
|
|
ORDER BY model.create_time DESC
|
|
|
</select>
|
|
|
|
|
@@ -429,16 +446,27 @@
|
|
|
</delete>
|
|
|
|
|
|
<select id="selectWarningModelByName" parameterType="string" resultType="integer">
|
|
|
- select count(*) from ax_beidou_warning_model where `name` = #{modelName}
|
|
|
+ select count(*) from ax_beidou_warning_model where del_flag = '0' and `name` = #{modelName}
|
|
|
<if test="id != null and id != ''">
|
|
|
and id != #{id}
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
<select id="selectWarningRuleByName" parameterType="string" resultType="integer">
|
|
|
- select count(*) from ax_beidou_warning_rule where `name` = #{ruleName}
|
|
|
+ select count(*) from ax_beidou_warning_rule where del_flag = '0' and `name` = #{ruleName}
|
|
|
<if test="id != null and id != ''">
|
|
|
and id != #{id}
|
|
|
</if>
|
|
|
</select>
|
|
|
+
|
|
|
+ <!--按勾选区域查询预警区域-->
|
|
|
+ <select id="findInId" parameterType="string" resultType="warningAreaVo">
|
|
|
+ select id,`name`,location from ax_beidou_warning_area
|
|
|
+ where del_flag = '0'
|
|
|
+ and id in
|
|
|
+ <foreach collection="array" index="index" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|