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

	<!-- 可根据自己的需求，是否要使用 -->
	<resultMap type="io.renren.modules.app.entity.DyxxEntity" id="dyxxMap">
		<result property="dhbm" column="dhbm" />
		<result property="fwdybm" column="fwdybm" />
		<result property="dymc" column="dymc" />
		<result property="dyh" column="dyh" />
		<result property="hs" column="hs" />
		<result property="lcs" column="lcs" />
		<result property="bz" column="bz" />
		<result property="yjje" column="yjje" />
		<result property="sfdz" column="sfdz" />
	</resultMap>

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

		select * from dyxx where 1=1

		<if test=" dhbm!=null and dhbm!='' ">
			and dhbm like CONCAT(#{dhbm},"%")
		</if>
		<if test=" fwdybm!=null and fwdybm!='' ">
			and fwdybm like CONCAT(#{fwdybm},"%")
		</if>
		<if test=" dymc!=null and dymc!='' ">
			and dymc like CONCAT({#dymc},"%")
		</if>
		<if test=" dyh!=null and dyh!='' ">
			and dyh like CONCAT(#{dyh},"%")
		</if>
		<if test=" hs!=null and hs!='' ">
			and hs like CONCAT(#{hs},"%")
		</if>
		<if test=" lcs!=null and lcs!='' ">
			and lcs like CONCAT(#{lcs},"%")
		</if>
		<if test=" bz!=null and bz!='' ">
			and bz like CONCAT(#{bz},"%")
		</if>
		<if test=" yjje!=null and yjje!='' ">
			and yjje like CONCAT(#{yjje},"%")
		</if>
		<if test=" sfdz!=null and sfdz!='' ">
			and sfdz like CONCAT(#{sfdz},"%")
		</if>
		order by fwdybm desc
	</select>

	<select id="selectxlkxq" resultType="io.renren.modules.app.entity.XlkEntity">
		select xqmc,xqbm from xqxx where 1=1
	</select>

	<select id="selectxmbyxq" parameterType="java.lang.String"
		resultType="io.renren.modules.app.entity.XlkEntity">
		select xmmc,xmbm from xm where xqbm=#{bm}
	</select>

	<select id="selectlzbyxm" parameterType="java.lang.String"
		resultType="io.renren.modules.app.entity.XlkEntity">
		select z.dhbm,z.dhmc,z.lcs,z.drs,x.xmbm,x.xmmc from zhxx z,xm x where z.xmbm=x.xmbm and z.xmbm=#{bm}
	</select>

	<select id="selectdylcbylz" parameterType="java.lang.String"
		resultType="io.renren.modules.app.entity.XlkEntity">
		select lcs,drs from zhxx where dhbm=#{bm}
	</select>
	<select id="queryfwdybm" resultType="string">
		SELECT fwdybm FROM dyxx WHERE LENGTH(fwdybm)>=8 ORDER BY fwdybm DESC LIMIT 1
	</select>
    <select id="selectDybmList" resultType="io.renren.modules.app.entity.DyxxEntity">
		select dhbm,dymc,fwdybm from dyxx where dhbm in
		<foreach collection="dhbmList" item="item" index="index" separator="," open=" (" close=")">
			#{item}
		</foreach>
	</select>

</mapper>