`

ibatis sql

阅读更多


1----------------------------查询------------------------------------------------
<select id="getTableNme" parameterClass="com.isoftstone.telesales.sys.dto.TableCodeDTO"
        resultClass="java.lang.String">
        select C_NME_CN from t_prd_ins where c_insrnc_cde=#codeId# and c_nme_cn=#codeDescription#
</select> 


<select id="tbCode_selectProvList" resultClass="com.isoftstone.telesales.common.dto.TbCodeDTO">
        <![CDATA[
			select CODE as code,
			NAME as name 
			From t_code where kind = 'SYPVCLST'  and code like '%0000' order by CODE
        ]]>
</select>


<select id="tbCommCode1_queryTCommCode1" parameterClass="java.util.Hashtable" resultClass="com.isoftstone.telesales.common.dto.TbCommCode1DTO">
        <![CDATA[
        SELECT C_CDE AS cde,
        C_ENM AS enm,
        C_CNM AS cnm,
        C_PAR_CDE AS parCde
        FROM T_COMM_CODE1
        ]]>
        <dynamic prepend="WHERE">
            <isNotEmpty property="comboxId" prepend="and">
                <![CDATA[ N_COMBOX_ID = #comboxId# ]]>
            </isNotEmpty>
            <isNotEmpty property="parCde" prepend="and">
                <![CDATA[ C_PAR_CDE = #parCde# ]]>
            </isNotEmpty>
            <isEqual property="prodNo" prepend="and" compareValue="0331">
                <![CDATA[ C_CDE in('01','02','13','25')]]>
            </isEqual>
        </dynamic>
</select>



<select id="tbArea_selectAllProvice" parameterClass="java.lang.String"
        resultClass="com.isoftstone.telesales.common.dto.TbAreaDTO">
    	<![CDATA[
		SELECT  AREACODE AS areaCode, AREANAME As areaName 
		FROM Tb_Area  WHERE PARENTAREACODE='0001'         
		]]>
</select>


<select id="tbAgent_selectCmpnyAgtCdeList" parameterClass="java.util.Map"
        resultClass="com.isoftstone.telesales.common.dto.TbAgentDTO">
    	<![CDATA[
			SELECT C_CHA_CDE as chaCde,C_CHA_NME as chaNme FROM T_AGENT  WHERE C_FRONT_BACK_MRK='150001' AND C_CHA_CLS = #cChaCls# AND C_CHA_MRK <> '1' 
			AND (C_DPT_CDE ='' OR C_DPT_CDE ='00' OR C_DPT_CDE = #subDptCde# OR C_DPT_CDE = #cDptCde#) ORDER BY C_CHA_CDE     
		]]>
</select>
    


<select id="tbLockInfo_queryList" parameterClass="com.isoftstone.telesales.common.dto.TbLockInfoDTO"
        resultClass="com.isoftstone.telesales.common.dto.TbLockInfoDTO">
        <![CDATA[
        SELECT  
        C_LTI_ID as ltiId,
        C_TAB_NME as tabNme,
        C_LOCK_FIELD as lockField,
        C_LOCK_CONTENT as lockContent,
        C_LOCK_TYPE as lockType,
        C_CRT_CDE as crtCde
        FROM TB_LOCK_INFO 
        WHERE  1=1
        ]]>
        <isNotEmpty property="ltiId" prepend="and">
            <![CDATA[ C_LTI_ID = #ltiId# ]]>
        </isNotEmpty>
        <isNotEmpty property="tabNme" prepend="and">
            <![CDATA[ C_TAB_NME = #tabNme# ]]>
        </isNotEmpty>
        <isNotEmpty property="lockField" prepend="and">
            <![CDATA[ C_LOCK_FIELD = #lockField# ]]>
        </isNotEmpty>
        <isNotEmpty property="lockContent" prepend="and">
            <![CDATA[ C_LOCK_CONTENT = #lockContent# ]]>
        </isNotEmpty>
        <isNotEmpty property="lockType" prepend="and">
            <![CDATA[ C_LOCK_TYPE = #lockType# ]]>
        </isNotEmpty>
        <isNotEmpty property="crtCde" prepend="and">
            <![CDATA[ C_CRT_CDE = #crtCde# ]]>
        </isNotEmpty>
</select> 


<select id="query_contact_list_count" parameterClass="com.isoftstone.telesales.contact.dto.ContactRecDTO" resultClass="java.lang.Long">
        <![CDATA[
        select count(*)
          from TB_CONTACT_REC t1
          left join TB_INS_INFO t4 on (t1.C_TCR_ID = t4.C_CONTACT_ID and t4.c_del = '0'),
         TB_CST_INFO t2, TB_USER_INFO t5
         where t1.c_del = '0'
           and t2.c_del = '0'
           and t5.c_del = '0'
           and t1.C_TCI_ID = t2.C_TCI_ID
           and t1.C_USER_NAME = t5.C_NME
        ]]>
        <dynamic prepend="and">
            <isNotEmpty property="nme" prepend="and">
                <![CDATA[ t2.C_NME=#nme# ]]>
            </isNotEmpty>
            <isNotEmpty property="userName" prepend="and">
                <![CDATA[ t5.C_TRUE_NME = #userName# ]]>
            </isNotEmpty>
            <isNotEmpty property="custMobile" prepend="and">
                <![CDATA[ t2.C_MOBILE= #custMobile# ]]>
            </isNotEmpty>
            <isNotEmpty property="custProvince" prepend="and">
                <![CDATA[ t2.C_PROVINCE= #custProvince# ]]>
            </isNotEmpty>
            <isNotEmpty property="custCity" prepend="and">
                <![CDATA[ t2.C_CITY= #custCity# ]]>
            </isNotEmpty>
            <isNotEmpty property="vrm" prepend="and">
                <![CDATA[ t4.C_VRM = #vrm# ]]>
            </isNotEmpty>
            <isNotEmpty property="insType" prepend="and">
                <![CDATA[ t4.C_TYPE= #insType# ]]>
            </isNotEmpty>
            <isNotEmpty property="appNo" prepend="and">
                <![CDATA[ t4.C_APP_NO= #appNo# ]]>
            </isNotEmpty>
            <isNotEmpty property="plyNo" prepend="and">
                <![CDATA[ t4.C_PLY_NO= #plyNo# ]]>
            </isNotEmpty>
            <isNotEmpty property="contactBegDate" prepend="and">
                <![CDATA[ t1.T_CRT_DATE >= to_date(#contactBegDate# || ' 00:00:00', 'yyyy-MM-dd HH24:mi:ss') ]]>
            </isNotEmpty>
            <isNotEmpty property="contactEndDate" prepend="and">
                <![CDATA[ t1.T_CRT_DATE <= to_date(#contactEndDate# || ' 23:59:59', 'yyyy-MM-dd HH24:mi:ss') ]]>
            </isNotEmpty>
        </dynamic>
</select>



<select id="tagModel_query_forCount" parameterClass="com.isoftstone.telesales.developmodel.dto.TbInsInfoCustomDTO" resultClass="java.lang.Long">
        <![CDATA[
        SELECT COUNT(*) AS totalResults
        FROM TB_INS_INFO
        ]]>
        <dynamic prepend="WHERE">
            <isNotEmpty property="plyNo" prepend="and">
                <![CDATA[ C_PLY_NO = #plyNo# ]]>
            </isNotEmpty>
            <isNotEmpty property="appNo" prepend="and">
                <![CDATA[ C_APP_NO = #appNo# ]]>
            </isNotEmpty>
            <isNotEmpty property="type" prepend="and">
                <![CDATA[ C_TYPE = #type# ]]>
            </isNotEmpty>
            <isNotEmpty property="dptCde" prepend="and">
                <![CDATA[ C_DPT_CDE = #dptCde# ]]>
            </isNotEmpty>
            <isNotEmpty property="stDate" prepend="and">
                <![CDATA[ T_ST_DATE = #stDate# ]]>
            </isNotEmpty>
            <isNotEmpty property="endDate" prepend="and">
                <![CDATA[ T_END_DATE = #endDate# ]]>
            </isNotEmpty>
        </dynamic>
</select>




2----------------------------------------------insert------------------------------------------------

<insert id="tbLockInfo_insert" parameterClass="com.isoftstone.telesales.common.dto.TbLockInfoDTO">
   	 <![CDATA[
   	 	INSERT INTO TB_LOCK_INFO
		(C_LTI_ID, C_TAB_NME, C_LOCK_FIELD, C_CRT_CDE, T_CRT_DATE, C_UPD_CDE, T_UPD_DATE, C_LOCK_TYPE, C_LOCK_CONTENT)
		VALUES
		(#ltiId# , #tabNme#, #lockField#, #crtCde#, sysdate, #updCde#, #updDate#, #lockType#, #lockContent#)
   	  ]]>    	  
 </insert>



<insert id="insInfo_updateStateForCust" parameterClass="java.util.Map">
      <![CDATA[
        INSERT INTO TB_INS_INFO
	        (C_TII_ID, C_CST_ID, C_CONTACT_ID,C_VRM, C_PLY_NO, C_APP_NO, C_TYPE, T_APP_DATE, T_ST_DATE, T_END_DATE, C_TOTAL_FEE,
	        C_USER, C_STAT, C_NOTE, C_DELIVER_ID, C_DPT_CDE, C_DELIVER_STAT, T_DELIVER_DATE, T_DISPATCH_DATE, C_TASK_ID,
	        C_CRT_CDE, T_CRT_DATE, C_UPD_CDE, T_UPD_DATE, C_DEL, C_IS_ORPHAN, T_PRINT_DATE, C_IS_TELESALE_PLY, C_DISPATCH_USER,
	        C_DIS_LEVEL,C_FIN_STAT, C_CORE_CLNTAPPSN, C_CORE_CLNTSN,C_SMS_FLAG,C_SMS_ID,C_INSENTDATE_MD,C_CORE_CUSTNAME)
	    SELECT
	        #pkId#,C_CST_ID, C_CONTACT_ID,C_VRM,
        ]]>
        <isEmpty property="plyNo">
            <![CDATA[ C_PLY_NO, ]]>
        </isEmpty>
        <isNotEmpty property="plyNo">
            <![CDATA[ #plyNo#, ]]>
        </isNotEmpty>
        <![CDATA[ C_APP_NO, C_TYPE, T_APP_DATE, T_ST_DATE,  ]]>        
	    <isEmpty property="endDate">
            <![CDATA[ T_END_DATE, ]]>
        </isEmpty>        
        <isNotEmpty property="endDate">
            <![CDATA[ #endDate#, ]]>
        </isNotEmpty>	        
	    <![CDATA[ C_TOTAL_FEE,
	        C_USER, C_STAT, C_NOTE, C_DELIVER_ID, C_DPT_CDE, C_DELIVER_STAT, T_DELIVER_DATE, T_DISPATCH_DATE, C_TASK_ID,
	        C_CRT_CDE, T_CRT_DATE, #updCde#, SYSDATE, '0',  C_IS_ORPHAN, T_PRINT_DATE, C_IS_TELESALE_PLY, C_DISPATCH_USER,
	        C_DIS_LEVEL,
         ]]>
        <isEmpty property="finStat">
            <![CDATA[ C_FIN_STAT, ]]>
        </isEmpty>
        <isNotEmpty property="finStat">
            <![CDATA[ #finStat#,]]>
        </isNotEmpty>
        <![CDATA[        
        	C_CORE_CLNTAPPSN,C_CORE_CLNTSN ,C_SMS_FLAG,C_SMS_ID,C_INSENTDATE_MD,C_CORE_CUSTNAME       
        FROM TB_INS_INFO
        WHERE C_TII_ID = #tiiId#
        ]]>
    </insert>



   <insert id="tbTaskInfo_updateState" parameterClass="java.util.Map">
        <![CDATA[
        INSERT INTO TB_TASK_INFO
        (N_TTI_ID, C_TTI_ID, C_CST_ID, C_TEAM_ID, C_NME, T_ASSIGN_DATE, C_STRATUM, C_STAT,
        C_FOLLOW_RSN, C_RSN_NOTE, C_CANCEL_RSN, C_CANCEL_RSN_NOTE, C_NEXT_FOLLOW_CONTENT,
        C_NEXT_FOLLOW_DATE, T_CANCEL_DATE, C_CANCEL_TAG, C_RECYCLE_DATE, C_USERID,
        C_ASSIGN_TAG, C_TSK_TYPE, C_REMARK, C_CRT_CDE, T_CRT_DATE, C_UPD_CDE, T_UPD_DATE,
        C_DEL, C_TSK_INS_ID, C_TSK_ACTIVATION_FLAG,C_PUR_LEVEL,C_OUT_SUCESS_REASON,C_OUT_FAILURE_REASON,C_OTHER_REASON,C_IN_BUSINESS_REASON,C_IN_INFO_CHANGE,C_IN_IS_COMPLA,C_CST_PROVINCE,C_CST_CITY,C_CST_SOURCE)
        SELECT
        #pkId#, C_TTI_ID, C_CST_ID, C_TEAM_ID, C_NME, T_ASSIGN_DATE, C_STRATUM, #stat#,
        C_FOLLOW_RSN, C_RSN_NOTE, C_CANCEL_RSN, C_CANCEL_RSN_NOTE, C_NEXT_FOLLOW_CONTENT,
        C_NEXT_FOLLOW_DATE, T_CANCEL_DATE, C_CANCEL_TAG, C_RECYCLE_DATE, C_USERID,
        C_ASSIGN_TAG, C_TSK_TYPE, C_REMARK, C_CRT_CDE, SYSDATE, #updCde#, SYSDATE,
        '0', C_TSK_INS_ID, C_TSK_ACTIVATION_FLAG,C_PUR_LEVEL,C_OUT_SUCESS_REASON,C_OUT_FAILURE_REASON,C_OTHER_REASON,C_IN_BUSINESS_REASON,C_IN_INFO_CHANGE,C_IN_IS_COMPLA,C_CST_PROVINCE,C_CST_CITY,C_CST_SOURCE
        FROM TB_TASK_INFO
        WHERE N_TTI_ID = #nttiId#
        ]]>
    </insert>
 

3-----------------------------------------delete------------------------------------------------

 <delete id="tbLockInfo_delete" parameterClass="com.isoftstone.telesales.common.dto.TbLockInfoDTO" >
        <![CDATA[
        DELETE TB_LOCK_INFO 
        WHERE  1=1
        ]]>
        <isNotEmpty property="ltiId" prepend="and">
            <![CDATA[ C_LTI_ID = #ltiId# ]]>
        </isNotEmpty>
        <isNotEmpty property="tabNme" prepend="and">
            <![CDATA[ C_TAB_NME = #tabNme# ]]>
        </isNotEmpty>
        <isNotEmpty property="lockField" prepend="and">
            <![CDATA[ C_LOCK_FIELD = #lockField# ]]>
        </isNotEmpty>
        <isNotEmpty property="lockContent" prepend="and">
            <![CDATA[ C_LOCK_CONTENT = #lockContent# ]]>
        </isNotEmpty>
        <isNotEmpty property="lockType" prepend="and">
            <![CDATA[ C_LOCK_TYPE = #lockType# ]]>
        </isNotEmpty>
</delete> 



4 ---------------------------------------update---------------------------------------------

<update id="insInfo_deleteByAppNo" parameterClass="java.lang.String">
        update
        TB_INS_INFO
        set
        C_DEL = '1'
        where
        TB_INS_INFO.C_APP_NO=#appNo#
</update>


<update id="insInfo_updateData" parameterClass="com.isoftstone.telesales.common.dto.TbInsInfoDTO">
        update
        TB_INS_INFO
        set
        C_PLY_NO=#plyNo#,
        C_APP_NO=#appNo#,
        C_TYPE=#type#,
        T_ST_DATE=
        to_date(substr(#stDate#,1,10),'yy-MM-dd'),
        T_END_DATE= to_date(substr(#endDate#,1,10),'yy-MM-dd'),
        C_TOTAL_FEE=#totalFee#,
        C_CONTACT_ID=#contactId#,
        C_TASK_ID=#taskId#
        where C_TII_ID = #tiiId#
</update>
    

   




    
分享到:
评论

相关推荐

    ibatis sql生成工具

    Ibatis SQL生成工具是一款专为开发者设计的实用应用程序,它能够极大地提高开发效率,尤其是在处理大量数据库操作时。Ibatis,作为一个轻量级的持久层框架,与传统的ORM(对象关系映射)工具相比,提供了更为灵活的...

    ibatis sql 语句的编写

    ### ibatis SQL语句编写详解 #### 一、引言 在软件开发过程中,数据库操作是必不可少的一部分。Ibatis(现称为MyBatis)作为一款优秀的持久层框架,提供了非常灵活的方式来处理SQL语句,使得Java开发者能够更加...

    ibatis sql语句对条件中特殊字符% # 处理

    ### ibatis SQL语句对条件中特殊字符% # 处理 在开发过程中,经常会遇到SQL查询时需要处理字符串中的特殊字符的情况。特别是在使用类似`LIKE`这样的操作符时,如果用户输入的数据中含有`%`、`_`或`#`等特殊字符,...

    iBATIS SQL Maps 开发指南

    本文是《iBatis SQL Maps Developer Guide》的中文版,仅供读者参考,最权威的应以Clinton Begin的官方文档为准。如果中文翻译有错误,请通知译者(email:toleu@21cn.com,Blog:...

    iBATIS SQL Maps指导

    《iBATIS SQL Maps指导》是一份详细的文献,旨在引导读者了解如何使用iBATIS SQL Maps这一Java持久层框架。iBATIS是一个轻量级的数据访问框架,它允许开发者将SQL语句直接写在XML配置文件中,从而实现对象与数据库的...

    ibatis sqlserver代码自动生成

    在IT行业中,数据库操作是开发工作中的重要环节,而Ibatis作为一款优秀的持久层框架,为Java开发者提供了灵活的SQL映射功能,减轻了手动编写SQL和操作结果集的负担。SQLServer则是一款广泛使用的商业关系型数据库...

    iBatis SQL Maps开发指南.pdf

    ### iBatis SQL Maps开发指南知识点总结 #### 1. SQL Maps 概念与工作原理 - **概念**:iBatis SQL Maps 是一个开源框架,用于简化Java应用程序中的数据库操作。它通过XML配置文件来定义数据库操作逻辑,从而减少了...

    iBATIS SQL Maps 入门教程.rar

    iBATIS SQL Maps 是一款优秀的数据持久层框架,它为Java开发者提供了强大的SQL映射功能,使得数据库操作变得更加简单和灵活。本入门教程将引导您逐步掌握iBATIS的核心概念和使用方法,让数据库交互不再成为开发过程...

    iBATIS SQL Maps官方中文教程.rar

    iBATIS SQL Maps官方中文教程是一份非常宝贵的资源,它为初学者和进阶开发者提供了深入理解iBATIS SQL Maps的途径。iBATIS是一个Java框架,它将应用程序的业务逻辑与数据库操作分离,简化了数据访问层的开发。SQL ...

    ibatis SQL映射文件、DAO、model自动生成工具源码

    Ibatis 是一款轻量级的Java持久层框架,它提供了SQL映射文件和基于XML或注解的SQL语句配置,使得开发者可以更加灵活地控制SQL的编写,从而避免了传统的JDBC代码中的大量模板式代码。这个"ibatis SQL映射文件、DAO、...

    IBATIS SQL Maps开发指北

    **IBATIS SQL Maps开发指北** IBATIS(Integrated Business Applications With IT)是一个轻量级的Java数据访问框架,它允许开发者将SQL语句直接嵌入到Java代码中,从而实现了数据库操作与业务逻辑的分离。SQL Maps...

    iBATIS SQL Maps官方中文教程(PDF)

    iBATIS SQL Maps官方中文教程是一份详细的指南,旨在帮助开发者深入理解和熟练使用iBATIS框架中的SQL Maps API。这份教程涵盖了iBATIS的核心概念、功能以及如何在实际项目中应用这些技术。以下是对这份教程内容的...

    基于iBatis SQL Map的数据持久层实现应用研究.pdf

    在本文中,作者以物流系统开发为实例,介绍了基于iBatis SQL Map实现数据持久层的主要内容,这包括映射关系的建立、SQL Map配置文件的编写,以及SQL Map API的使用。 iBatis SQL Map的核心是基于XML配置文件的映射...

    ibatis SQL Map PPt

    **Ibatis SQL Map PPT 知识点详解** Ibatis,作为一个轻量级的Java持久层框架,以其灵活、易用的特点,在企业级应用中得到了广泛的应用。它将SQL语句与Java代码分离,提供了更直观的数据访问方式,极大地提高了开发...

    iBATIS SQL Maps入门教程.rar

    iBATIS SQL Maps入门教程是针对数据库操作的一个经典学习资源,尤其适合初学者。iBATIS是一个开源的Java框架,它允许程序员将SQL语句直接嵌入到Java代码中,以此来简化数据库访问层的开发。这个教程可能包含了以下几...

Global site tag (gtag.js) - Google Analytics