<?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.huatek.busi.mapper.BusiFaultMapper">
	<select id="faultTypesList"
		resultType="com.huatek.busi.vo.FaultTypesVo">
		SELECT
			ft.id,
			ft.fault_name as faultName,
			ft.insdate
		FROM fault_types ft
		ORDER BY ft.id ASC
	</select>
	<select id="faultSubtypesList"
		resultType="com.huatek.busi.vo.FaultSubtypesVo">
		SELECT
			fs.id,
			fs.master_id as masterId,
			fs.fault_sub_name as faultSubName,
			fs.insdate
		FROM fault_subtypes fs
		where fs.master_id = #{masterId}
		ORDER BY fs.id ASC
	</select>
	<select id="faultShowsList"
		resultType="com.huatek.busi.vo.FaultShowsVo">
		SELECT
		  fs.id,
		  fs.master_id as masterId,
		  fs.sub_id as subId,
		  fs.showmsg,
		  fs.insdate
		FROM fault_shows fs WHERE fs.sub_id = #{subId}
		ORDER BY fs.id ASC
	</select>
	<select id="faultCauseList"
		resultType="com.huatek.busi.vo.FaultCauseVo">
		SELECT
			fc.id,
			fc.master_id as masterId,
			fc.sub_id as subId,
			fc.mode_id as modeId,
			fc.cause,
			fc.check_meth as checkMeth,
			fc.measures,
			fc.insdate
		FROM fault_cause fc
		WHERE fc.master_id = #{masterId}
		AND fc.sub_id = #{subId}
		AND fc.mode_id = #{modeId}
		ORDER BY fc.id ASC
	</select>

	<!-- 查询缺陷类别 -->
    <select id="findFaultCategory" resultType="com.huatek.busi.entity.FaultCategory">
	      SELECT 
	          id as id,
	          category_name as categoryName,
	          insdate as insdate
	      FROM fault_category
   </select>
   
   <!-- 查询缺陷系数 -->
    <select id="findFaultCoefficient" resultType="com.huatek.busi.entity.FaultCoefficient">
	      SELECT 
	          id as id,
	          coefficient_name as coefficientName,
	          insdate as insdate
	      FROM fault_coefficient
   </select>
</mapper>