Ibatis sql语句1

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">

<!-- ========================================================== -->
<!-- Configuration for ibatis sqlmap mapping. -->
<!-- ========================================================== -->

<!-- ============================================================================= -->
<!-- This file is generated by <tt>borncrm-dalgen</tt>, a DAL (Data Access Layer) -->
<!-- code generation utility specially developed for <tt>rent</tt> project. -->
<!-- -->
<!-- PLEASE DO NOT MODIFY THIS FILE MANUALLY, or else your modification may be -->
<!-- OVERWRITTEN by someone else. To modify the file, you should go to directory -->
<!-- <tt>(project-home)/biz/dal/src/conf/dalgen</tt>, and find the corresponding -->
<!-- configuration files. Modify those files according to your needs, then run -->
<!-- <tt>borncrm-dalgen</tt> to generate this file. -->
<!-- -->
<!-- @author peigen -->
<!-- ============================================================================= -->

<sqlMap namespace="borncrm">
<!-- ============================================= -->
<!-- RESULT MAPS -->
<!-- ============================================= -->

<!-- result maps for database table user_info -->
<resultMap id="RM-USER-INFO" class="com.yjf.borncrm.dal.dataobject.UserInfoDO">
<result property="id" column="id" javaType="java.lang.String" jdbcType="VARCHAR" nullValue="0"/>
<result property="role" column="role" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="userName" column="user_name" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="realName" column="real_name" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="password" column="password" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="landline" column="landline" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="mobile" column="mobile" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="mail" column="mail" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="rowAddTime" column="row_add_time" javaType="java.util.Date" jdbcType="TIMESTAMP"/>
<result property="rowUpdateTime" column="row_update_time" javaType="java.util.Date" jdbcType="TIMESTAMP"/>
<result property="parentId" column="parent_id" javaType="long" jdbcType="BIGINT" nullValue="0"/>

</resultMap>


<!-- ============================================= -->
<!-- mapped statements for IbatisUserInfoDAO -->
<!-- ============================================= -->
<!-- mapped statement for IbatisUserInfoDAO.insert -->
<insert id="MS-USER-INFO-INSERT">
INSERT /*MS-BORNCRM-USER-INFO-INSERT*/ INTO user_info(id,role,user_name,real_name,password,landline,mobile,mail,row_add_time,row_update_time,parent_id)
VALUES (#id#,#role#,#userName#,#realName#,#password#,#landline#,#mobile#,#mail#,#rowAddTime#,#rowUpdateTime#,#parentId#)
</insert>

<!-- mapped statement for IbatisUserInfoDAO.update -->
<update id="MS-USER-INFO-UPDATE">
<![CDATA[
update /*MS-BORNCRM-USER-INFO-UPDATE*/ user_info set role=#role#, user_name=#userName#, real_name=#realName#, password=#password#, landline=#landline#, mobile=#mobile#, mail=#mail#, row_add_time=#rowAddTime#, row_update_time=#rowUpdateTime#, parent_id=#parentId# where (id = #id#)
]]>
</update>

<!-- mapped statement for IbatisUserInfoDAO.updatePassword -->
<update id="MS-USER-INFO-UPDATE-PASSWORD">
<![CDATA[
update /*MS-BORNCRM-USER-INFO-UPDATE-PASSWORD*/ user_info set password=#password# where (id = #id#)
]]>
</update>

<!-- mapped statement for IbatisUserInfoDAO.deleteById -->
<delete id="MS-USER-INFO-DELETE-BY-ID">
<![CDATA[
delete /*MS-BORNCRM-USER-INFO-DELETE-BY-ID*/ from user_info where (id = #value#)
]]>
</delete>

<!-- mapped statement for IbatisUserInfoDAO.findById -->
<select id="MS-USER-INFO-FIND-BY-ID" resultMap="RM-USER-INFO">
<![CDATA[
select /*MS-BORNCRM-USER-INFO-FIND-BY-ID*/ id, role, user_name, real_name, password, landline, mobile, mail, row_add_time, row_update_time, parent_id from user_info where status='1' and (id = #value#)
]]>
</select>

<!-- mapped statement for IbatisUserInfoDAO.findByLoginName -->
<select id="MS-USER-INFO-FIND-BY-LOGIN-NAME" resultMap="RM-USER-INFO">
<![CDATA[
select /*MS-BORNCRM-USER-INFO-FIND-BY-LOGIN-NAME*/ id, role, user_name, real_name, password, landline, mobile, mail, row_add_time, row_update_time, parent_id from user_info where status='1' and (user_name = #value#)
]]>
</select>

<!-- mapped statement for IbatisUserInfoDAO.findRealName -->
<select id="MS-USER-INFO-FIND-REAL-NAME" resultMap="RM-USER-INFO">
<![CDATA[
select /*MS-BORNCRM-USER-INFO-FIND-REAL-NAME*/ id, role, user_name, real_name, password, landline, mobile, mail, row_add_time, row_update_time, parent_id from user_info where status='1' and (real_name = #value#)
]]>
</select>

<!-- mapped statement for IbatisUserInfoDAO.searchDataCount -->
<select id="MS-USER-INFO-SEARCH-DATA-COUNT" resultClass="long">
SELECT /*MS-BORNCRM-USER-INFO-SEARCH-DATA-COUNT*/ count(id) FROM user_info
<dynamic prepend="where">
<isNotEmpty property="status" prepend=" and ">
status='1'
</isNotEmpty>
<isNotEmpty property="role" prepend=" and " >
role = #role#
</isNotEmpty>
<isNotEmpty property="userName" prepend=" and " >
user_name = #userName#
</isNotEmpty>
<isNotEmpty property="realName" prepend=" and ">
real_name = #realName#
</isNotEmpty>
<isNotEmpty property="landline" prepend=" and ">
landline = #landline#
</isNotEmpty>
<isNotEmpty property="mobile" prepend=" and ">
mobile = #mobile#
</isNotEmpty>
<isNotEmpty property="mail" prepend=" and ">
mail = #mail#
</isNotEmpty>

</dynamic>
</select>

<!-- mapped statement for IbatisUserInfoDAO.loadData -->
<select id="MS-USER-INFO-LOAD-DATA" resultMap="RM-USER-INFO">
SELECT /*MS-BORNCRM-USER-INFO-LOAD-DATA*/ id ,role ,user_name ,real_name ,password ,landline ,mobile ,mail ,row_add_time ,row_update_time ,parent_id FROM user_info

<dynamic prepend="where">
<isNotEmpty property="userInfo.status" prepend=" and ">
status = 1
</isNotEmpty>
<isNotEmpty property="userInfo.role" prepend=" and " >
role = #userInfo.role#
</isNotEmpty>
<isNotEmpty property="userInfo.userName" prepend=" and " >
user_name = #userInfo.userName#
</isNotEmpty>
<isNotEmpty property="userInfo.realName" prepend=" and ">
real_name = #userInfo.realName#
</isNotEmpty>
<isNotEmpty property="userInfo.landline" prepend=" and ">
landline = #userInfo.landline#
</isNotEmpty>
<isNotEmpty property="userInfo.mobile" prepend=" and ">
mobile = #userInfo.mobile#
</isNotEmpty>
<isNotEmpty property="userInfo.mail" prepend=" and ">
mail = #userInfo.mail#
</isNotEmpty>

</dynamic>
order by row_add_time DESC
LIMIT #limitStart#,#pageSize#;
</select>


<!-- mapped statement for IbatisUserInfoDAO.loadData -->
<select id="MS-USER-INFO-FIND-BY-ROLE" resultMap="RM-USER-INFO">
SELECT /*MS-USER-INFO-FIND-BY-ROLE*/ id, role, user_name, real_name, password, landline, mobile, mail, row_add_time, row_update_time, parent_id FROM user_info where status=1 and (role = #value#)
</select>
</sqlMap>

posted @ 2015-03-26 09:14  萧雪痕  阅读(199)  评论(0编辑  收藏  举报