<?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.BizPackageResourceGroupMapper">

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


    <select id="getList" parameterType="BizPackageResourceGroup" resultMap="BizPackageResourceGroupResult">
        SELECT t1.*, t2.dept_name, t2.dept_code FROM biz_package_resource_group t1 left join sys_dept t2 on t2.dept_id = t1.dept_id
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            t1.deleted = 0
            <if test="packageLineNo != null "> AND t1.package_line_no = #{packageLineNo}</if>
            <if test="deptNo != null "> AND t1.dept_no = #{deptNo}</if>
            <if test="deptId != null "> AND t1.dept_id = #{deptId}</if>
            <if test="name != null  and name != ''"> AND t1.name like concat('%', #{name}, '%')</if>
            <if test="code != null  and code != ''"> AND t1.code = #{code}</if>
            <if test="year != null  and year != ''"> AND t1.year = #{year}</if>
            <if test="isDeactivate != null "> AND t1.is_deactivate = #{isDeactivate}</if>
        </trim>
    </select>

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