BusinessScopeDictMapper.xml 1.86 KB
<?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.subsidy.mapper.BusinessScopeDictMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.subsidy.model.BusinessScopeDictDO">
        <id column="id" property="id" />
        <result column="create_date" property="createDate" />
        <result column="update_date" property="updateDate" />
        <result column="delete_date" property="deleteDate" />
        <result column="parent_id" property="parentId" />
        <result column="company_id" property="companyId" />
        <result column="business_scope_name" property="businessScopeName" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_date,
        update_date,
        delete_date,
        id, parent_id, company_id, business_scope_name
    </sql>

    <select id="queryBusinessScopePage" resultType="com.subsidy.vo.businessScope.BusinessScopeDictVO">
        SELECT * FROM business_scope_dict
        <where>
            <if test="businessScopeName != null">
                AND business_scope_name LIKE concat('%', #{businessScopeName} ,'%')
            </if>
            <if test="companyId != null and companyId != ''">
                AND company_id = #{companyId}
            </if>
            <if test="companyId == null or companyId == ''">
                AND company_id IS NULL
            </if>
            AND parent_id = 0
            AND delete_date IS NULL
        </where>
    </select>

    <select id="queryBusinessScopeChildNode" resultType="com.subsidy.vo.businessScope.BusinessScopeDictVO">
        SELECT
            *
        FROM
            business_scope_dict
        WHERE
            parent_id != 0
          AND delete_date IS NULL
    </select>

</mapper>