<?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.WygsxxDao">

    <!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="io.renren.modules.app.entity.WygsxxEntity" id="wygsxxMap">
                    <result property="id" column="id"/>
                    <result property="wygsbm" column="wygsbm"/>
                    <result property="wygsmc" column="wygsmc"/>
                    <result property="dz" column="dz"/>
                    <result property="code" column="code"/>
                    <result property="lxr" column="lxr"/>
                    <result property="lxdh" column="lxdh"/>
                    <result property="frdb" column="frdb"/>
                    <result property="zzdj" column="zzdj"/>
                    <result property="zzzs" column="zzzs"/>
                    <result property="kfyh" column="kfyh"/>
                    <result property="yhzh" column="yhzh"/>
                    <result property="gzdbm" column="gzdbm"/>
            </resultMap>

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

        select * from wygsxx where 1=1

                    <if test=" id!=null and id!='' ">
                and id like CONCAT(#{id},"%")
            </if>
                    <if test=" wygsbm!=null and wygsbm!='' ">
                and wygsbm like CONCAT(#{wygsbm},"%")
            </if>
                    <if test=" wygsmc!=null and wygsmc!='' ">
                and wygsmc like CONCAT(#{wygsmc},"%")
            </if>
                    <if test=" dz!=null and dz!='' ">
                and dz like CONCAT(#{dz},"%")
            </if>
                    <if test=" code!=null and code!='' ">
                and code like CONCAT(#{code},"%")
            </if>
                    <if test=" lxr!=null and lxr!='' ">
                and lxr like CONCAT(#{lxr},"%")
            </if>
                    <if test=" lxdh!=null and lxdh!='' ">
                and lxdh like CONCAT(#{lxdh},"%")
            </if>
                    <if test=" frdb!=null and frdb!='' ">
                and frdb like CONCAT(#{frdb},"%")
            </if>
                    <if test=" zzdj!=null and zzdj!='' ">
                and zzdj like CONCAT(#{zzdj},"%")
            </if>
                    <if test=" zzzs!=null and zzzs!='' ">
                and zzzs like CONCAT(#{zzzs},"%")
            </if>
                    <if test=" kfyh!=null and kfyh!='' ">
                and kfyh like CONCAT(#{kfyh},"%")
            </if>
                    <if test=" yhzh!=null and yhzh!='' ">
                and yhzh like CONCAT(#{yhzh},"%")
            </if>
                    <if test=" gzdbm!=null and gzdbm!='' ">
                and gzdbm like CONCAT(#{gzdbm},"%")
            </if>
        order by wygsbm desc
    </select>
    
    <select id="querywygsbm"  resultType="string">
    SELECT wygsbm FROM  wygsxx WHERE LENGTH(wygsbm)>=8 ORDER BY wygsbm  DESC LIMIT 1
    </select>


</mapper>