1. 程式人生 > >多層級聯,在底層接收外部傳入的引數方法

多層級聯,在底層接收外部傳入的引數方法

**** 多層級聯,在底層接收外部傳入的引數方法:在外層查出來,在傳入裡層

 

(可能看起來很蠢,但是這是我能想到的唯一辦法了大哭

 

<resultMaptype="com.statistic.entity"id="userProject">

      <id property="id"column="id"/>

      <result property="name"column="name" />

      <collection property="basicAttributes"javaType="java.util.List"  column="

{id=id,user_id=user_id,year=year,month=month}"

         ofType="com..statistic.entity."select="selectBasicAttribute" >

      </collection>

   </resultMap>

  

   <select id="selectProject"

resultMap="userProject">

      SELECTdistinct pp.id id ,pp.`name` ,ti.user_iduser_id,YEAR(ti.modified_time) year,MONTH(ti.modified_time) month  FROM p_task_info  ti

 

 

 

***  可以吧變數放進引數查出來

select nc.*,#{loginUser_id} loginUser_id

       ,uu.nicknamenickname, uui.head_pic_path headPic,count(nl.id) likeNum

 

 

*** Delete語句中使用select語句

    delete news_comment FROM news_comment

       join (SELECT id fromnews_comment  where 1=1

           <includerefid="conds" />) t

       on news_comment.parent_id=t.id

 

 

*** 加入自己下載下來的jar

 

<!-- 正則表示式 -->

       <dependency>

        <groupId>com.woun.product</groupId>

        <artifactId>jakarta-oro</artifactId>

        <version>1.0</version>

        </dependency>

 

 

*** 阿里雲Maven倉庫地址http://maven.aliyun.com/nexus/#view-repositories;public~browsestorage

mavensettings.xml 檔案裡配置mirrors的子節點,新增如下mirror

<mirror>

    <id>nexus-aliyun</id>

    <mirrorOf>*</mirrorOf>

    <name>Nexus aliyun</name>

    <url>http://maven.aliyun.com/nexus/content/groups/public</url>

</mirror> 

 

 

***注入引數寫法

 

task_ids:[1,2,3]

@RequestParam("task_ids")List<Long> taskIds

 

idsabc,cde,def”  

@RequestParam("ids")String ids

 

public Result updateAuditors(String data) {
         //data="{'task_ids':[1,2,3],'auditor_id':5,'auditor_hierarchy':2,'auditor_type':'2','auditor_name':'餘家輝'}";
        AuditorsVo auditorsVo = JSON.parseObject(data, AuditorsVo.class);

***統計sql語句

 

SELECT IFNULL((SELECT remaining_sum fromu_wallet_info WHERE user_id=#{user_id}),0) AS sumMoney,

      IFNULL((SELECT SUM(freeze_price) fromu_freeze_record WHERE user_id=#{user_id}),0) as freezeMoney,

      sum( CASE WHEN trade_type='1' THENtrade_price ELSE 0 END) as rechargeMoney,

      sum( CASE WHEN trade_type='2' THENtrade_price ELSE 0 END) as withdrawMoney,

      sum( CASE WHEN trade_type='4' ORtrade_type='6' OR trade_type='10' OR trade_type='8' THEN trade_price ELSE 0END) as incomeMoney,

      sum(CASE WHEN trade_type='5' OR trade_type='7' OR trade_type='11' ORtrade_type='9'THEN trade_price ELSE 0 END) as payMoney

      FROM u_trade_record

      WHERE user_id=#{user_id}