Mybatis xml 写法

阅读更多

"http://mybatis.org/dtd/mybatis-3-mapper.dtd">

 

 

 

c.customerId,c.LoginName,c.Uimage,c.Pwd,c.NikeName,c.Mobile,c.qq,c.MaxOnline,date_format(c.regtime,'%Y-%m-%d %H:%i:%s') regtimestr,c.RegFrom,c.Email,c.GroupId,g.GroupName,c.account,c.tranche,c.custBution,

c.fromCus,c.orgCode,c.customerKey,date_format(c.expiryDate,'%Y-%m-%d') expiryDateStr,dateInterval,effDay

 

c.customerId,g.GroupName,c.account,c.tranche,c.custBution

 

   

and c.orgCode = #{orgCode}

   

and c.LoginName like CONCAT("%",#{loginName},"%")

and c.NikeName like CONCAT("%",#{nikeName},"%")

and c.Mobile like CONCAT("%",#{mobile},"%")

and c.qq like CONCAT("%",#{qq},"%")

and c.wx like CONCAT("%",#{wx},"%")

 

  and Date(c.RegTime) >= #{regBeginDate}

]]>

 

  and Date(c.RegTime) <= #{regEndDate}

 ]]>

 

   and c.GroupId=#{groupId}

   and g.GroupType=#{type}

 

   and LOWER(c.RegFrom)=#{regFrom}

and c.account like CONCAT("%",#{account},"%")

and c.tranche like CONCAT("%",#{tranche},"%")

and c.custBution like CONCAT("%",#{custBution},"%")

and c.State=1

 

 

 

and c.orgCode =#{orgCode}

and c.customerId like CONCAT("%",#{customerId},"%")

and c.account like CONCAT("%",#{account},"%")

and c.tranche like CONCAT("%",#{tranche},"%")

and c.custBution like CONCAT("%",#{custBution},"%")

and c.State=1  and g.GroupType=1

 

 

 

 

 

 

 

 

 

insert into

cus_customer(LoginName,Pwd,Mobile,GroupId,NikeName,qq,RegTime,Email,MaxOnline,

State,Uimage,RegFrom,CreateId,CreateTime,account,tranche,custBution,fromCus,orgCode,customerKey)

values(#{loginName},#{pwd},#{mobile},#{groupId},#{nikeName},#{qq},#{regTime},#{email},#{maxOnline},

#{state},#{uImage},#{regFrom},#{createId},#{createTime},

#{account},#{tranche},#{custBution},#{fromCus},#{orgCode},#{customerKey})

 

update cus_customer set GroupId=#{groupId},Uimage=#{uImage},Pwd=#{pwd},NikeName=#{nikeName},

qq=#{qq},Email=#{email},Mobile=#{mobile},MaxOnline=#{maxOnline},account=#{account},tranche=#{tranche},custBution=#{custBution},

expiryDate=#{expiryDate},dateInterval=#{dateInterval},effDay=#{effDay}

where customerId=#{customerId}

 

 

 update cus_customer set GroupId=#{groupId} where customerId in

 

           #{item}

       

 

   update cus_customer set State=#{state} where customerId in

         

             #{item}

         

 

   update cus_customer set tranche=#{tranche},custBution=#{custBution} where customerId=#{customerId}

 

 

 

 

   

       delete from tmp_customer;

   

    

 

    insert into tmp_customer(LoginName,Pwd,Uimage,NikeName,Mobile,Email,RegTime,GroupId,RegFrom,MaxOnline,State,CreateId,CreateTime,Money)

    values  

     

       (#{obj.loginName},#{obj.pwd},#{obj.uImage},#{obj.nikeName},#{obj.mobile},#{obj.email},#{obj.regTime},#{obj.groupId},#{obj.regFrom},#{obj.maxOnline},

        #{obj.state},#{obj.createId},#{obj.createTime},#{obj.money})

   

     

    

   

   

    insert into cus_customer(LoginName,Pwd,Uimage,NikeName,Mobile,Email,RegTime,GroupId,RegFrom,MaxOnline,State,CreateId,CreateTime,Money)

select * from tmp_customer t 

where NOT EXISTS 

(SELECT 1 from  cus_customer c where c.LoginName=t.LoginName or c.Mobile=t.Mobile)

   

    

     

     insert into cus_costomer_up_history(CustomerId,SgroupId,EgroupId,ChangeDate,CreateId,CreateTime) 

select c.customerId,0,c.GroupId,NOW(),c.CreateId,NOW() from cus_customer c

     where c.customerId =#{customerId}

   

    

   

     

     insert into cus_costomer_up_history(CustomerId,SgroupId,EgroupId,ChangeDate,CreateId,CreateTime) 

select c.customerId,c.GroupId,#{groupId},NOW(),#{userId},NOW() from cus_customer c

     where c.customerId =#{customerId}

   

     

   

   

     insert into cus_costomer_up_history(CustomerId,SgroupId,EgroupId,ChangeDate,CreateId,CreateTime) 

select c.customerId,c.GroupId,#{groupId},NOW(),#{userId},NOW() from cus_customer c

     where c.customerId in

 

           #{item}

       

     and c.GroupId!=#{groupId}

   

    

   

   

    

   

   

    

   

   

    

   

   

    update cus_customer c set expiryDate=NULL,dateInterval=NULL,effDay=NULL,GroupId=(

SELECT g.GroupId from cus_group g 

where c.orgCode=g.OrgCode 

and g.groupname='注册用户'

)  where expiryDate is not null and datediff(expiryDate,now())=0

   

    

   

   

    

update cus_customer set LoginName=#{loginName},Pwd=#{pwd},Uimage=#{uImage},NikeName=#{nikeName},qq=#{qq},Email=#{email},

Mobile=#{mobile},GroupId=#{groupId},RegFrom=#{regFrom},MaxOnline=#{maxOnline},account=#{account},tranche=#{tranche},custBution=#{custBution},CreateId=#{createId},

expiryDate=#{expiryDate},dateInterval=#{dateInterval},effDay=#{effDay}

where customerId=#{customerId}

 

   

   

    update cus_customer set expiryDate=NULL,dateInterval=NULL,effDay=NULL,GroupId=#{groupId} where customerId in

 

           #{item}

       

   

   

   

   

update cus_customer set GroupId=#{groupId},Uimage=#{uImage},Pwd=#{pwd},NikeName=#{nikeName},

qq=#{qq},Email=#{email},Mobile=#{mobile},MaxOnline=#{maxOnline},account=#{account},tranche=#{tranche},custBution=#{custBution},

expiryDate=NULL,dateInterval=NULL,effDay=NULL

where customerId=#{customerId}

   

    

 

 

 

一个牛人的博客

 

https://github.com/abel533/Mapper

 

你可能感兴趣的:(mybatis)