<?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.nantian.cloud.jljc.mapper.CompanyTypeMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.nantian.cloud.jljc.entity.CompanyType">
        <id column="id" property="id" />
        <result column="num" property="num" />
        <result column="type_name" property="typeName" />
        <result column="min_unit" property="minUnit" />
        <result column="max_unit" property="maxUnit" />
        <result column="userid" property="userid"/>
        <result column="update_time" property="updateTime"/>
        <result column="del_flag" property="delFlag"/>
        <result column="dept_id" property="deptId"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, num, type_name, min_unit, max_unit, userid, update_time, del_flag, dept_id
    </sql>
    <select id="getPageScope" resultType="com.nantian.cloud.jljc.entity.CompanyType">
        select <include refid="Base_Column_List"></include>
        from company_type
        <trim prefix="where" prefixOverrides="and">
            <if test="query.typeName != null and query.typeName != ''">
                and type_name like concat("%",#{query.typeName},"%")
            </if>
            <if test="query.minUnit != null and query.minUnit != ''">
                and min_unit >=  #{query.minUnit}
            </if>
            <if test="query.maxUnit != null and query.maxUnit != ''">
                and #{query.maxUnit} >=  max_unit
            </if>
            <if test="query.delFlag != null and query.delFlag != ''">
                and del_flag = #{query.delFlag}
            </if>
        </trim>
    </select>

</mapper>
