<?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.crm.manager.dao.mapper.CustomGroupTypeMapper">

    <select id="countList" resultType="integer"
            parameterType="com.crm.rely.backend.core.entity.custom.group.type.CustomGroupTypeSearchEntity">

        select count(*) from custom_group_type
        <where>
            <if test="name!=null and name!=''">
                and `name`=#{name}
            </if>
            <if test="enName!=null and enName!=''">
                and `en_name`=#{enName}
            </if>
        </where>

    </select>

    <select id="pageList" resultType="com.crm.rely.backend.core.pojo.table.CustomGroupTypeTable"
            parameterType="com.crm.rely.backend.core.entity.custom.group.type.CustomGroupTypeSearchEntity">

        select * from custom_group_type
        <where>
            <if test="name!=null and name!=''">
                and `name`=#{name}
            </if>
            <if test="enName!=null and enName!=''">
                and `en_name`=#{enName}
            </if>
        </where>
        order by add_time desc
        limit #{page.offset},#{page.row}
    </select>


</mapper>