<?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.mapper.BizInspectionInstructionMapper">

    <resultMap type="cn.ezhizao.project.business.domain.BizInspectionInstruction" id="BizInspectionInstructionResult">
        <id column="id" property="id"/>
    </resultMap>

    <select id="getList" resultMap="BizInspectionInstructionResult" parameterType="cn.ezhizao.project.business.domain.BizInspectionInstruction">
        SELECT t1.*
        FROM biz_inspection_instruction t1
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="type != null and type != 0"> AND type = #{type}</if>
            <if test="categoryId != null and categoryId != '0'"> AND category_id = #{categoryId}</if>
            <if test="standard != null and standard != ''"> AND standard LIKE CONCAT('%', #{standard}, '%')</if>
            <if test="keyword != null and keyword != ''"> AND standard LIKE CONCAT('%', #{keyword}, '%')</if>

        </trim>

    </select>

    <delete id="physicalDelete">
        DELETE FROM biz_inspection_instruction WHERE deleted = 0
        <if test="id != null">
            AND id = #{id}
        </if>
    </delete>
</mapper>
