<?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="com.ruoyi.project.zt.mapper.JswaMapper">

	<select id="getList" resultType="com.ruoyi.project.zt.domain.Jswa">
		select jh, rq, nvl(js,0) js, nvl(rjc,0) rjc,nvl(sg,0) sg, nvl(xl,0)xl,nvl(zrtg,0) zrtg, nvl(zztg,0)zztg,nvl(fzqk,0) fzqk,brzygz  from JSWA where  1=1

		<if test="jh!=null and jh!=''">
			and jh =#{jh}
		</if>
		<if test="ksjs!=null ">
			and js > #{ksjs}
		</if>
		<if test="js!=null ">
			and js &lt;= #{js}
		</if>
		<if test="ksrq!=null and ksrq!=''">
			and to_char(RQ,'YYYY-MM-DD')>=#{ksrq}
		</if>
		<if test="jsrq!=null  and jsrq!=''">
			and to_char(RQ,'YYYY-MM-DD')&lt;=#{jsrq}
		</if>
		order by rq
	</select>
	<select id="selectMd" resultType="com.ruoyi.project.zt.domain.Jswa">
		select * from (
						  select * from JSwA where RJC>0 and jh=#{jh} and js=#{js} ) aa where ROWNUM=1
	</select>
	<select id="selectZwsj" resultType="com.ruoyi.project.zt.domain.Jswa">
		select *from (
		select * from JSwA where 1=1
		<if test="jh!=null and jh!=''">
			and jh =#{jh}
		</if>
		<if test="ksrq!=null and ksrq!=''">
			and to_char(RQ,'YYYY-MM-DD')>=#{ksrq}
		</if>
		<if test="jsrq!=null  and jsrq!=''">
			and to_char(RQ,'YYYY-MM-DD')&lt;=#{jsrq}
		</if>
		<if test="js!=null ">
			and js = #{js}
		</if>
		) aa where ROWNUM =1
	</select>

</mapper>