<?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="cn.ezhizao.project.business.processErrorStatistics.mapper.BizProcessDocumentsErrorStatisticsMapper">

    <resultMap type="cn.ezhizao.project.business.processErrorStatistics.domain.BizProcessDocumentsErrorStatistics" id="BizProcessDocumentsErrorStatisticsResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizProcessDocumentsErrorStatistics" resultMap="BizProcessDocumentsErrorStatisticsResult">
        SELECT * FROM biz_process_documents_error_statistics
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="transactionCode != null  and transactionCode != ''"> AND transaction_code = #{transactionCode}</if>
            <if test="type != null "> AND type = #{type}</if>
            <if test="companyAlias != null  and companyAlias != ''"> AND company_alias = #{companyAlias}</if>
            <if test="specification != null  and specification != ''"> AND specification = #{specification}</if>
            <if test="drawingNumber != null  and drawingNumber != ''"> AND drawing_number = #{drawingNumber}</if>
            <if test="errorQuantity != null "> AND error_quantity = #{errorQuantity}</if>
            <if test="quarterTarget != null "> AND quarter_target = #{quarterTarget}</if>
            <if test="complaintContent != null  and complaintContent != ''"> AND complaint_content = #{complaintContent}</if>
            <if test="status != null "> AND status = #{status}</if>
            <if test="startYear != null "> AND year &gt;= #{startYear}</if>
            <if test="endYear != null "> AND year &lt;= #{endYear}</if>
            <if test="quarter != null  and quarter != ''"> AND quarter = #{quarter}</if>
            <if test="date != null "> AND date = #{date}</if>
        </trim>
        order by year desc , quarter desc
    </select>

    <delete id="physicalDelete">
        DELETE FROM biz_process_documents_error_statistics
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            <if test="id != null">
                id = #{id} AND
            </if>
       <!-- 删除条件为其他外键可以在这里加 -->
        </trim>
    </delete>
</mapper>
