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

    <!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="io.renren.modules.app.entity.CbwdEntity" id="cbwdMap">
                    <result property="id" column="id"/>
                    <result property="cbwdbm" column="cbwdbm"/>
                    <result property="cbwdmc" column="cbwdmc"/>
                    <result property="lxr" column="lxr"/>
                    <result property="lxdh" column="lxdh"/>
                    <result property="dz" column="dz"/>
                    <result property="sfdb" column="sfdb"/>
                    <result property="yhbm" column="yhbm"/>
                    <result property="gzdbm" column="gzdbm"/>
            </resultMap>

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

        select * from cbwd where 1=1

                    <if test=" id!=null and id!='' ">
                and id like CONCAT(#{id},"%")
            </if>
                    <if test=" cbwdbm!=null and cbwdbm!='' ">
                and cbwdbm like CONCAT(#{cbwdbm},"%")
            </if>
                    <if test=" cbwdmc!=null and cbwdmc!='' ">
                and cbwdmc like CONCAT(#{cbwdmc},"%")
            </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=" dz!=null and dz!='' ">
                and dz like CONCAT(#{dz},"%")
            </if>
                    <if test=" sfdb!=null and sfdb!='' ">
                and sfdb like CONCAT(#{sfdb},"%")
            </if>
                    <if test=" yhbm!=null and yhbm!='' ">
                and yhbm like CONCAT(#{yhbm},"%")
            </if>
                    <if test=" gzdbm!=null and gzdbm!='' ">
                and gzdbm like CONCAT(#{gzdbm},"%")
            </if>
        order by cbwdbm desc
    </select>
    
    <select id="selectyhxx" resultType="io.renren.modules.app.entity.XlkEntity">
		select yhbm,yhmc from yhxx where 1=1
	</select>
	
	<select id="querycbwdbm"  resultType="string">
    SELECT cbwdbm FROM cbwd WHERE LENGTH(cbwdbm)>=8 ORDER BY cbwdbm  DESC LIMIT 1
    </select>


</mapper>