多层级联,在底层接收外部传入的参数方法

**** 多层级联,在底层接收外部传入的参数方法:在外层查出来,在传入里层

(可能看起来很蠢,但是这是我能想到的唯一办法了大哭

<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}

猜你喜欢

转载自blog.csdn.net/Amelia__Q/article/details/80234384