<?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="io.renren.modules.app.dao.JcbzDao">

    <!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="io.renren.modules.app.entity.JcbzEntity" id="jcbzMap">
                    <result property="id" column="id"/>
                    <result property="jcbzbm" column="jcbzbm"/>
                    <result property="pfmzj" column="pfmzj"/>
                    <result property="jjl" column="jjl"/>
                    <result property="jcbz" column="jcbz"/>
                    <result property="begdate" column="begdate"/>
                    <result property="enddate" column="enddate"/>
                    <result property="gzdbm" column="gzdbm"/>
                    <result property="jzlxmc" column="jzlxmc"/>
                    <result property="fwyt" column="fwyt"/>
                    <result property="isbz" column="isbz"/>
            </resultMap>

    <select id="queryByPage" parameterType="io.renren.modules.app.entity.JcbzEntity"
            resultType="io.renren.modules.app.entity.JcbzEntity">

        select * from jcbz where 1=1

                    <if test=" id!=null and id!='' ">
                and id like CONCAT(#{id},"%")
            </if>
                    <if test=" jcbzbm!=null and jcbzbm!='' ">
                and jcbzbm like CONCAT(#{jcbzbm},"%")
            </if>
                    <if test=" pfmzj!=null and pfmzj!='' ">
                and pfmzj like CONCAT(#{pfmzj},"%")
            </if>
                    <if test=" jjl!=null and jjl!='' ">
                and jjl like CONCAT(#{jjl},"%")
            </if>
                    <if test=" jcbz!=null and jcbz!='' ">
                and jcbz like CONCAT(#{jcbz},"%")
            </if>
                    <if test=" begdate!=null and begdate!='' ">
                and begdate like CONCAT(#{begdate},"%")
            </if>
                    <if test=" enddate!=null and enddate!='' ">
                and enddate like CONCAT(#{enddate},"%")
            </if>
                    <if test=" gzdbm!=null and gzdbm!='' ">
                and gzdbm like CONCAT(#{gzdbm},"%")
            </if>
                    <if test=" jzlxmc!=null and jzlxmc!='' ">
                and jzlxmc like CONCAT(#{jzlxmc},"%")
            </if>
                    <if test=" fwyt!=null and fwyt!='' ">
                and fwyt like CONCAT(#{fwyt},"%")
            </if>
                    <if test=" isbz!=null and isbz!='' ">
                and isbz like CONCAT(#{isbz},"%")
            </if>
        order by jcbzbm desc 
    </select>
    
    <select id="queryjcbzbm"  resultType="string">
    SELECT jcbzbm FROM jcbz WHERE LENGTH(jcbzbm)>=8 ORDER BY jcbzbm  DESC LIMIT 1
    </select>
    


</mapper>