<select id="selectLatestTemplateByVolume" parameterType="String" resultMap="ccpAsyncJobResultMap">
<bind name="jobCmdInfo" value="'volumeId":"'+_parameter+'"'" /><!-- volumeId":_parameter" -->
SELECT * FROM cloud.async_job
where instance_type='Template'
and job_cmd='org.apache.cloudstack.api.command.user.template.CreateTemplateCmd'
<![CDATA[ and instr(job_cmd_info,#{jobCmdInfo})>0 ]]>
order by id desc
limit 1
</select>
如果傳入是個map ( accountId=1, volumeUuid="123123123")
寫法又不太一樣
<select id="selectLatestTemplateByVolume" parameterType="Map" resultMap="ccpAsyncJobResultMap">
<bind name="jobCmdInfo" value="'volumeId":"'+volumeUuid+'"'" /><!-- volumeId":#{volumeUuid}" -->
SELECT * FROM cloud.async_job
where instance_type='Template'
and job_cmd='org.apache.cloudstack.api.command.user.template.CreateTemplateCmd'
<![CDATA[ and instr(job_cmd_info,#{jobCmdInfo})>0 ]]>
order by id desc
limit 1
</select>
2018年9月7日
2018年6月1日
[JAVA] 利用POI 建立excel的簡單範例
public void createWorkBook() throws IOException {
//建excel活頁簿
XSSFWorkbook workBook = new XSSFWorkbook();
//建第一個sheet,命名為 new sheet
XSSFSheet sheet = workBook.createSheet("first sheet");
// 建一row,在sheet上
Row row = sheet.createRow(0);
// 在row上建一個cell
Cell cell = row.createCell(0);
//設cell裡的值
cell.setCellValue("第一個cell");
// Or do it on one line.
row.createCell(1).setCellValue("第一列的第2個cell");
row.createCell(2).setCellValue(new Date());
row.createCell(3).setCellValue(true);
row.createCell(4).setCellValue(2);
//file命名為myExcekbook.xlsx
FileOutputStream fileOut = new FileOutputStream("d:/myExcekbook.xlsx");
// 把workBook寫進FileOutputStream
workBook.write(fileOut);
//關閉FileOutputStream
fileOut.close();
}
2018年5月17日
XCODE 快速鍵
command+= xcode幫調大小 (ex變更label字型後要自動調)
ommand+w 關掉模擬器
ommand+← /→ 模擬時把device往左或往右轉
control+k 刪除游標後的一整行
command+delete 刪除游標前的一整行
option+delete 刪除一個單字(游標前)
option+command+← 縮合並反白一整個method (游標在method內的任一處都可)
control+i 排版程式碼
control+space 程式碼提示
ommand+w 關掉模擬器
ommand+← /→ 模擬時把device往左或往右轉
control+k 刪除游標後的一整行
command+delete 刪除游標前的一整行
option+delete 刪除一個單字(游標前)
option+command+← 縮合並反白一整個method (游標在method內的任一處都可)
control+i 排版程式碼
control+space 程式碼提示
2018年5月3日
更方便用postman測api
postman 有環境參設的設定很方便
但 如果是要先取token的api 每次複製貼上還是覺得有點煩
原來有更方便的方法
在Tests的地方 可以加入設定
ex 有個取token的api 回傳的token 會是在「access_token」欄位裡
那就在 Tests的地方 輸入下面:
這樣以後只要 就先run 取token的api 直接再run其他要token的api就好了
不用去複製貼上了 oya
但 如果是要先取token的api 每次複製貼上還是覺得有點煩
原來有更方便的方法
在Tests的地方 可以加入設定
ex 有個取token的api 回傳的token 會是在「access_token」欄位裡
那就在 Tests的地方 輸入下面:
var data = JSON.parse(responseBody);
postman.setEnvironmentVariable("token",data.access_token);
這樣以後只要 就先run 取token的api 直接再run其他要token的api就好了
不用去複製貼上了 oya
[Quartz]刪除quartz的trigger 在mysql裡的設定
1.QRTZ_CRON_TRIGGERS
2.QRTZ_TRIGGERS
3.QRTZ_JOB_DETAILS
2和3相反會刪不掉,因為有constraints的問題
資料來源:
https://mritd.me/2016/06/07/Quartz-%E4%BB%BB%E5%8A%A1%E5%BC%BA%E5%88%B6%E5%88%A0%E9%99%A4/
2.QRTZ_TRIGGERS
3.QRTZ_JOB_DETAILS
2和3相反會刪不掉,因為有constraints的問題
資料來源:
https://mritd.me/2016/06/07/Quartz-%E4%BB%BB%E5%8A%A1%E5%BC%BA%E5%88%B6%E5%88%A0%E9%99%A4/
2018年4月11日
2018年4月3日
[JAVA]用JEXL處理算式
/**
* @author Querida
http://solnone.blogspot.tw/2010/06/apache-commons-jexl.html
*/
package testQ;
import org.apache.commons.jexl3.JexlContext;
import org.apache.commons.jexl3.JexlEngine;
import org.apache.commons.jexl3.JexlExpression;
import org.apache.commons.jexl3.MapContext;
import org.apache.commons.jexl3.internal.Engine;
public class TestJEXL {
public static void main(String[] args) {
// Create or retrieve a JexlEngine
JexlEngine jexl = new Engine();
// Create an expression object
String fomula = "quanty * price * 100";
JexlExpression jexlExpression = jexl.createExpression(fomula);
// Create a context and add data
JexlContext jexlContext = new MapContext();
jexlContext.set("quanty", 2);
jexlContext.set("price", 3);
// Now evaluate the expression, getting the result
Object o = jexlExpression.evaluate(jexlContext);
System.out.println(o);
}
}
[JAVA]DATE 的一些處理(joda time)
Date nowDate= new Date();
//java DATE TO joda time
new DateTime(nowDate);
//今天是一個月裡的第幾天
new DateTime(nowDate).getDayOfMonth();
//這個月有幾天
new DateTime(nowDate).dayOfMonth().getMaximumValue();
//上個月有幾天
DateTime dayOfPeriousMonth = new DateTime(nowDate).minusMonths (1);
System.out.println(dayOfPeriousMonth);
int daysInPeriousMonth=dayOfPeriousMonth.dayOfMonth().getMaximumValue();
System.out.println(daysInPeriousMonth);
//取出上個月的12號DateTime periousM12=dayOfPeriousMonth.withDayOfMonth(12);
System.out.println(periousM12 );
//joda time to java Date
new DateTime().toDate();
//本月第一天
DateTime firstDayOfMonth = new DateTime().dayOfMonth().withMinimumValue();
//某個時間是否是在今天內
if( new DateTime( someDateTime).isAfter( DateTime.now().minusDays(1) )){
System.out.println(someDateTime+" is in 24 hours");
}else {
System.out.println("not in!");
}
訂閱:
文章 (Atom)