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

    <!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="io.renren.modules.app.entity.GwhxxEntity" id="gwhxxMap">
                    <result property="id" column="id"/>
                    <result property="gwhbm" column="gwhbm"/>
                    <result property="gwhmc" column="gwhmc"/>
                    <result property="dz" column="dz"/>
                    <result property="code" column="code"/>
                    <result property="lxr" column="lxr"/>
                    <result property="lxdh" column="lxdh"/>
                    <result property="pzwh" column="pzwh"/>
                    <result property="pzsj" column="pzsj"/>
                    <result property="ghmj" column="ghmj"/>
                    <result property="ghfs" column="ghfs"/>
                    <result property="ghds" column="ghds"/>
                    <result property="khyx" column="khyx"/>
                    <result property="yhzh" column="yhzh"/>
                    <result property="gzdbm" column="gzdbm"/>
                    <result property="gwhxx" column="gwhxx"/>
            </resultMap>

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

        select * from gwhxx where 1=1

                    <if test=" id!=null and id!='' ">
                and id like CONCAT(#{id},"%")
            </if>
                    <if test=" gwhbm!=null and gwhbm!='' ">
                and gwhbm like CONCAT(#{gwhbm},"%")
            </if>
                    <if test=" gwhmc!=null and gwhmc!='' ">
                and gwhmc like CONCAT(#{gwhmc},"%")
            </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=" pzwh!=null and pzwh!='' ">
                and pzwh like CONCAT(#{pzwh},"%")
            </if>
                    <if test=" pzsj!=null and pzsj!='' ">
                and pzsj like CONCAT(#{pzsj},"%")
            </if>
                    <if test=" ghmj!=null and ghmj!='' ">
                and ghmj like CONCAT(#{ghmj},"%")
            </if>
                    <if test=" ghfs!=null and ghfs!='' ">
                and ghfs like CONCAT(#{ghfs},"%")
            </if>
                    <if test=" ghds!=null and ghds!='' ">
                and ghds like CONCAT(#{ghds},"%")
            </if>
                    <if test=" khyx!=null and khyx!='' ">
                and khyx like CONCAT(#{khyx},"%")
            </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>
                    <if test=" gwhxx!=null and gwhxx!='' ">
                and gwhxx like CONCAT(#{gwhxx},"%")
            </if>
        order by gwhbm desc
    </select>
    
    <select id="querygwhbm"  resultType="string">
    SELECT gwhbm FROM  gwhxx WHERE LENGTH(gwhbm)>=8 ORDER BY gwhbm  DESC LIMIT 1
    </select>


</mapper>