| 发表于:2008-01-16 14:50:151楼 得分:0 |
xml文件: <?xml version="1.0" encoding="utf-8" standalone="no"?> <!doctype sqlmap public "-//ibatis.com//dtd sql map 2.0//en" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <!-- the sql in these maps files has purposely been typed with more verbosity than is actually required. for example, many of the selects could have just used select * from... instead of listing all of the columns. this is to demonstrate that even complex sql can be handled and coded and formatted the way sql was meant to be (i.e. not a bunch of concatenated strings in a java class). --> <sqlmap namespace="company"> <typealias alias="company" type="com.yadcom.mbs.properties.bean.company"/> <typealias alias="qcompany" type="com.yadcom.mbs.agentadmin.action.bean.qcompany"/> <resultmap id="companyresult" class="company"> <result property="companyid" column="companyid"/> <result property="companyname" column="companyname"/> <result property="sms" column="sms"/> <result property="meeting" column="meeting"/> <result property="mobiledata" column="mobiledata"/> <result property="mobileoa" column="mobileoa"/> <result property="banlance" column="banlance"/> <result property="status" column="status"/> <result property="postcode" column="postcode"/> <result property="address" column="address"/> <result property="phone_number" column="phone_number"/> <result property="fax_number" column="fax_number"/> <result property="contact" column="contact"/> <result property="contact_number" column="contact_number"/> <result property="create_date" column="create_date"/> <result property="fee_date" column="fee_date"/> <result property="area" column="area"/> <result property="vocation" column="vocation"/> <result property="adminname" column="admin_name"/> <result property="overdraft" column="overdraft"/> <result property="agentid" column="agentid"/> <result property="monthfee" column="monthfee"/> <result property="marketer" column="marketer"/> </resultmap> <insert id="insertcompany" parameterclass="company"> insert into mb_company (companyid,companyname,sms,meeting,mobiledata,mobileoa,banlance,area,vocation,status,postcode,address,contact,contact_number,create_date,admin_name,overdraft,agentid,monthfee,marketer,phone_number) values (#companyid#,#companyname#,#sms#,#meeting#,#mobiledata#,#mobileoa#,#banlance#,#area#,#vocation#,#status#,#postcode#,#address#,#contact#,#contact_number#,to_date(#create_date#,'yyyy-mm-dd'),#adminname#,#overdraft#,#agentid#,#monthfee#,#marketer#,#phone_number#) </insert> <insert id="insertcompanyold" parameterclass="company"> insert into ei_company (company_id,company_name,area_name,status,postcode,address,contact,contact_mobile,create_date,admin_name,overdraft,memo) values (#companyid#,#companyname#,#area#,#status#,#postcode#,#address#,#contact#,#contact_number#,to_date(#create_date#,'yyyy-mm-dd'),#adminname#,#overdraft#,#memo#) </insert> <select id="getcompanylist" resultmap="companyresult"> select * from mb_company where (status=0 or status=2) </select> <select id="countcompanylist" resultclass="java.lang.string"> select count(*) from mb_company where (status=0 or status=2) </select> <select id="getcompanybycompanyid" resultmap="companyresult" parameterclass="java.lang.string"> select * from mb_company where companyid=#value# </select> <select id="getcompanybycompanyname" resultmap="companyresult" parameterclass="java.lang.string"> select * from mb_company where companyname=#value# and (status=0 or status=2) </select> <select id="querycompanylistbycompanyname" resultmap="companyresult" parameterclass="java.lang.string"> select * from mb_company where companyname like #value# and (status=0 or status=2) order by create_date desc </select> <select id="countcompanybysmsnumber" resultclass="java.lang.string" parameterclass="java.lang.string"> select count(*) from mb_company,ei_company where ei_company.sms_number = #value# and mb_company.companyid=ei_company.company_id </select> <select id="getcompanybysms" resultmap="companyresult" parameterclass="java.lang.string"> select * from mb_company,ei_company where ei_company.sms_number = #value# and mb_company.companyid=ei_company.company_id and (mb_company.status=0 or mb_company.status=2) and (ei_company.status=0 or ei_company.status=2) </select> <select id="countquerycompanylistbycompanyname" resultclass="java.lang.string" parameterclass="java.lang.string"> select count(*) from mb_company where companyname like #value# and (status=0 or status=2) </select> <update id="updatecompanybyid" parameterclass="company"> update mb_company set address=#address# ,contact=#contact#,contact_number=#contact_number#,overdraft=#overdraft#,banlance=#banlance#,sms=#sms#,meeting=#meeting#,mobiledata=#mobiledata#,mobileoa=#mobileoa#,area=#area#,status=#status#,postcode=#postcode#,vocation=#vocation#,agentid=#agentid#,monthfee=#monthfee#,marketer=#marketer#,phone_number=#phone_number# where companyid=#companyid# </update> <select id="querycompanylistbycompanynameagent" resultmap="companyresult" parameterclass="qcompany"> select * from mb_company where companyname like #var_string# and agentid=#agentid# and (status=0 or status=2) order by create_date desc </select> <!-- 新增 --> <select id="querycompanylistbymarketer" resultmap="companyresult" parameterclass="java.lang.string"> select * from mb_company where marketer=#value# and (status=0 or status=2) </select> <select id="countquerycompanylistbymarketer" resultclass="java.lang.string" parameterclass="java.lang.string"> select count(*) from mb_company where marketer=#value# and (status=0 or status=2) </select> <select id="querycompanylistbymarketername" resultmap="companyresult" parameterclass="java.util.map"> select * from mb_company where marketer=#marketer# and companyname like #companyname# and (status=0 or status=2) </select> <select id="countcompanylistbymarketname" resultclass="java.lang.string" parameterclass="java.util.map"> select count(*) from mb_company where marketer=#marketer# and companyname like #companyname# and (status=0 or status=2) </select> <!-- 20071120新增结束 --> <select id="countquerycompanylistbycompanynameagent" resultclass="java.lang.string" parameterclass="qcompany"> select count(*) from mb_company where companyname like #var_string# and agentid=#agentid# and (status=0 or status=2) </select> <select id="getcompanybycompanynameagent" resultmap="companyresult" parameterclass="qcompany"> select * from mb_company where companyname=#var_string# and agentid=#agentid# and (status=0 or status=2) </select> <update id="delcompanybyidofold" parameterclass="java.lang.string"> update ei_company set status=1 where company_id=#value# </update> <update id="delcompanybyid" parameterclass="java.lang.string"> update mb_company set status=1 , logoutdate=sysdate where companyid=#value# </update> <select id="getcompanylistbyagentid" resultmap="companyresult" parameterclass="java.lang.string"> select * from mb_company where agentid=#value# and (status=0 or status=2) </select> <select id="countcompanylistbyagentid" resultclass="java.lang.string" parameterclass="java.lang.string"> select count(*) from mb_company where agentid=#value# and (status=0 or status=2) </select> <update id="opensms" parameterclass="java.lang.string"> update ei_company set status=0 where company_id=#value# </update> <select id="countcompanyqlbycompanyid" resultclass="java.lang.string" parameterclass="java.lang.string"> select count(*) from ei_company where ei_company.company_id = #value# and ei_company.memo='ql' </select> </sqlmap> | | |
|