<?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.lframework.xingyun.template.gen.mappers.GenCustomSelectorCategoryMapper">

  <resultMap id="GenCustomSelectorCategory" type="com.lframework.xingyun.template.gen.entity.GenCustomSelectorCategory">
    <id column="id" property="id"/>
    <result column="code" property="code"/>
    <result column="name" property="name"/>
    <result column="create_by" property="createBy"/>
    <result column="create_time" property="createTime"/>
    <result column="update_by" property="updateBy"/>
    <result column="update_time" property="updateTime"/>
  </resultMap>

  <sql id="GenCustomSelectorCategory_sql">
      SELECT
        tb.id,
        tb.code,
        tb.name,
        tb.create_by,
        tb.create_time,
        tb.update_by,
        tb.update_time
      FROM gen_custom_selector_category AS tb
    </sql>

  <select id="query" resultMap="GenCustomSelectorCategory">
    <include refid="GenCustomSelectorCategory_sql"/>
    ORDER BY tb.code ASC
  </select>

  <select id="selector" resultMap="GenCustomSelectorCategory">
    <include refid="GenCustomSelectorCategory_sql"/>
    <where>
      <if test="vo != null">
        <if test="vo.code != null and vo.code != ''">
          AND tb.code = #{vo.code}
        </if>
        <if test="vo.name != null and vo.name != ''">
          AND tb.name LIKE CONCAT('%', #{vo.name}, '%')
        </if>
      </if>
    </where>
    ORDER BY tb.code ASC
  </select>
</mapper>
