日期:2014-05-20 浏览次数:20991 次
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "/conf/dtd/sql-map-2.dtd"> <sqlMap namespace="com.devtek.sys.pb.pojo.Pblog_ipmodify"> <typeAlias alias="Pblog_ipmodify" type="com.devtek.sys.pb.pojo.Pblog_ipmodify" /> <resultMap id="Pblog_ipmodifyResult" class="Pblog_ipmodify"> <result column="id" property="id" javaType="java.lang.Integer" jdbcType="int" nullValue="0" /> <result column="service_code" property="service_code" javaType="java.lang.String" jdbcType="varchar" /> <result column="original_ip" property="original_ip" javaType="java.lang.String" jdbcType="varchar" /> <result column="modify_ip" property="modify_ip" javaType="java.lang.String" jdbcType="varchar" /> <result column="modify_time" property="modify_time" /> </resultMap> <resultMap id="Pblog_iprs" class="Pblog_ipmodify"> <result column="id" property="id" javaType="java.lang.Integer" jdbcType="int" nullValue="0" /> <result column="service_code" property="service_code" javaType="java.lang.String" jdbcType="varchar" /> <result column="service_name" property="service_name" javaType="java.lang.String" jdbcType="varchar" /> <result column="modify_ip" property="modify_ip" javaType="java.lang.String" jdbcType="varchar" /> <result column="original_ip" property="original_ip" javaType="java.lang.String" jdbcType="varchar" /> <result column="modify_time" property="modify_time" javaType="java.lang.String" jdbcType="varchar" /> <result column="cbs" property="countByServiceCode" javaType="java.lang.String" jdbcType="int" /> </resultMap> <resultMap id="getipModifyDetil" class="Pblog_ipmodify"> <result column="id" property="id" javaType="java.lang.Integer" jdbcType="int" nullValue="0" /> <result column="original_ip" property="original_ip" javaType="java.lang.String" jdbcType="varchar" /> <result column="modify_time" property="modify_time" javaType="java.lang.String" jdbcType="varchar" /> <result column="modify_ip" property="modify_ip" javaType="java.lang.String" jdbcType="varchar" /> </resultMap> <sql id="where"> <dynamic prepend="where"> <isNotNull property="id"> <isGreaterEqual prepend="and" property="id" compareValue="0"> id = #id:int# </isGreaterEqual> </isNotNull> <isNotNull property="service_code"> <isNotEmpty prepend="and" property="service_code"> service_code = #service_code:varchar# </isNotEmpty> </isNotNull> <isNotNull property="original_ip"> <isNotEmpty prepend="and" property="original_ip"> original_ip = #original_ip:varchar# </isNotEmpty> </isNotNull> <isNotNull property="modify_ip"> <isNotEmpty prepend="and" property="modify_ip"> modify_ip = #modify_ip:varchar# </isNotEmpty> </isNotNull> <isNotNull property="modify_time"> <isNotEmpty prepend="and" property="modify_time"> modify_time = #modify_time:datetime# </isNotEmpty> </isNotNull> <isNotNull property="service_name"> <isNotEmpty prepend="and" property="service_name"> a.service_name = #service_name:varchar# </isNotEmpty> </isNotNull> <isNotNull property="start_time"> <isNotEmpty prepend="and" property="start_time"> to_date(a.modify_time,'yyyy-MM-dd hh24:mi:ss') >= to_date('$start_time$ 00:00:00','yyyy-MM-dd hh24:mi:ss') </isNotEmpty> </isNotNull> <isNotNull property="end_time"> <isNotEmpty prepend="and" property="end_time"> <![CDATA[ to_date(a.modify_time,'yyyy-MM-dd hh24:mi:ss') <= to_date('$end_time$ 23:59:59','yyyy-MM-dd hh24:mi:ss')]]> </isNotEmpty> </isNotNull> </dynamic> </sql> <sql id="whereByLike"> <dynamic prepend="where"> <isNotNull prepend="and" property="service_code"> service_code like '%$service_code$%' </isNotNull> <isNotNull prepend="and" property="original_ip"> original_ip like '%$original_ip$%' </isNotNull> <isNotNull prepend="and" property="modify_ip"> modify_ip like '%$modify_ip$%' </isNotNull> </dynamic> </sql> <select id="select" resultMap="Pblog_iprs" parameterClass="Pblog_ipmodify"> select * from (select a.service_code,pi.service_name,b.modify_ip,b.original_ip,a.modify_time,a.cbs, b.id from(select p.service_code,count(*) cbs,max(p.modify_time) modify_time from pblog_ipmodify p where 1=1 group by p.service_code) a left join pblog_ipmodify b on b.service_code=a.service_code and a.modify_time=b.modify_time left join pb_isbnlist pi on pi.service_code=a.service_code) a <include refid="com.devtek.sys.pb.pojo.Pblog_ipmodify.where" /> </select> <select id="getIpModifyDetilByService" resultMap="getipModifyDetil" parameterClass="Pblog_ipmodify"> select id,modify_ip,original_ip,modify_time from pblog_ipmodify <include refid="com.devtek.sys.pb.pojo.Pblog_ipmodify.where" /> </select> <select id="selectCount" resultClass="int" parameterClass="Pblog_ipmodify"> select count(*) from (select a.service_code, pi.service_name, b.modify_ip, b.original_ip, a.modify_time, a.cbs from (select p.service_code, count(*) cbs, max(p.modify_time) modify_time from pblog_ipmodify p group by p.service_code) a left join pblog_ipmodify b on b.service_code = a.service_code and a.modify_time = b.modify_time left join pb_isbnlist pi on pi.service_code = a.service_code ) a <include refid="com.devtek.sys.pb.pojo.Pblog_ipmodify.where" /> </select> <select id="selectByLike" resultMap="Pblog_ipmodifyResult" parameterClass="Pblog_ipmodify"> select * from pblog_ipmodify <include refid="com.devtek.sys.pb.pojo.Pblog_ipmodify.whereByLike" /> </select> <select id="selectByMap" resultMap="Pblog_ipmodifyResult" parameterClass="java.util.Map"> select * from pblog_ipmodify </select> <select id="findLikeByMap" resultMap="Pblog_ipmodifyResult" parameterClass="java.util.Map"> select * from pblog_ipmodify <include refid="com.devtek.sys.pb.pojo.Pblog_ipmodify.whereByLike" /> </select> <select id="findByMap" resultMap="Pblog_ipmodifyResult" parameterClass="java.util.Map"> select * from pblog_ipmodify <include refid="com.devtek.sys.pb.pojo.Pblog_ipmodify.where" /> </select> </sqlMap>