<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.RiskLevelMapper">
	<!--统计-->
	<select id="countPageData" resultType="long">
		SELECT
		count(1) AS total_num
		FROM
		f_risk_level a
	<trim prefix="WHERE" prefixOverrides="AND ">
		<if test="evalModelId!=null"> and a.evaluation_model_id = #{evalModelId} </if>
	</trim>
	</select>
	<!--分页查询 -->
	<select id="queryRiskLevelPage" resultType="java.util.HashMap">
		SELECT
		a.id,
		a.level,
		a.top_limit as topLimit,
		a.down_limit as downLimit,
		a.evaluation_model_id as evaluationModelId,
		a.severity,
		a.name,
		a.color,
		a.create_by as createBy,
		a.manage_level manageLevel,
		a.create_date as createDate,
		a.remark,
		a.manage_level as manageLevel
		FROM
		f_risk_level a
		<trim prefix="WHERE" prefixOverrides="AND ">
			<if test="evalModelId!=null"> and a.evaluation_model_id = #{evalModelId} </if>
		</trim>
		order by a.id
		<choose>
	     <when test="pageSize==-1"></when>
	     <when test="pageSize!=-1">limit #{offset},#{pageSize}</when>  
	    </choose>
	</select>
	<!--统计重复数据-->
	<select id="countRepeatData" resultType="long">
		SELECT
		count(1) AS total_num
		FROM
		f_risk_level a
	<trim prefix="WHERE" prefixOverrides="AND ">
		<if test="id != null"> and a.id != #{id} </if>
		<if test="orgCode != null"> and a.org_code locate(#{orgCode},a.org_code)  <![CDATA[>]]> 0  </if>
		<if test="level != null"> and a.level = #{level} </if>
	</trim>
	</select>
	
</mapper>