使用˜q™ä¸ªæ–ÒŽ(gu¨©)³•需è¦å¼•用batic相关的包åQŒmaven pomæ–‡äšg如下åQ?br />
æ–ÒŽ(gu¨©)³•2: 在sessionä¸ä¿®æ”?
alter session set NLS_SORT='SCHINESE_RADICAL_M'
æ–ÒŽ(gu¨©)³•3: 直接使用NLSSORT函数 (推è)
select name,id from t
order by NLSSORT(name,'NLS_SORT = SCHINESE_STROKE_M')
讄¡½®NLS_SORTå€?
SCHINESE_RADICAL_M 按照部首åQˆç¬¬ä¸€™åºåºåQ‰ã€ç¬”划(½W¬äºŒ™åºåºåQ‰æŽ’åº?nbsp;
SCHINESE_STROKE_M 按照½W”划åQˆç¬¬ä¸€™åºåºåQ‰ã€éƒ¨é¦–(½W¬äºŒ™åºåºåQ‰æŽ’åº?nbsp;
SCHINESE_PINYIN_M 按照拼音排åº
1. ž®†mybatis-oscache-1.0.1-bundle.zip䏿¶‰åŠåˆ°çš„jar包放入到classpath路径ä¸?nbsp;
maven下å¯ä»¥è¿™æ ·é…¾|?br /> <dependencies>
...
<dependency>
<groupId>org.mybatis.caches</groupId>
<artifactId>mybatis-oscache</artifactId>
<version>1.0.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>oscache</artifactId>
<version>2.4</version>
<exclusions>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
...
</dependencies>
2. 在mapperæ–‡äšgä¸çš„é…置如下åQ?/span>
<mapper namespace="org.test.AuthMapper" >
<cache type="org.mybatis.caches.oscache.OSCache"/>
</mapper>
注æ„下é¢ä¸¤ç‚¹
(a)åœ?/span><select id="getAuth" parameterType="Map" resultType="Auth" useCache="false">ä¸ä‹É用useCache="false"或useCache="true"æ¥å†³å®šæ˜¯å¦ä‹É用二¾U§ç¼“å˜ã€?nbsp;
(b)åœ¨å¢žåˆ æ”¹ä¸?lt;insert id="insertAuth" parameterType="Auth" flushCache="true">使用flushCache="true"或flushCache="flase"æ¥å†³å®šå¯¹˜q™äº›˜q›è¡Œæ“ä½œåŽæ¸…½Iø™¯¥xmlæ–‡äšg䏿‰€æœ‰æŸ¥è¯¢è¯å¥çš„二çñ”¾~“å˜ã€?/font>
3. 在src目录下创å»ÞZ¸€ä¸ªoscache.properties的属性文ä»Óž¼Œåœ¨é‡Œé¢æŒ‡å®šç¼“å˜çš„å„ç§å±žæ€§çš„讄¡½®åQ?br /> cache.memory=true
cache.path=c:\\myapp\\cache
cache.persistence.class=com.opensymphony.oscache.plugins.diskpersistence.DiskPersistenceListener
cache.persistence.overflow.only=true
cache.capacity=100000
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Document;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
public class CellEvents {
/**
* @param args
*/
public static void main(String[] args) {
Object[] objArr = new Object[]{100,20,300};
Document document = new Document(PageSize.A4.rotate(),50,50,50,50);
try{
//bfSongti = BaseFont.createFont("/simsun.ttc,1", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
Font songtiSFivefont = new Font(BaseFont.createFont("/simsun.ttc,1", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED), 9f);//宋体ž®äº”å·å—
//讄¡½®å˜æ”¾ä½ç½®
PdfWriter.getInstance(document, new FileOutputStream("D:/test.pdf"));
document.open();
PdfPTable table = new PdfPTable(5);
table.setSpacingBefore(10f);
table.getDefaultCell().setPadding(5);
//HowbuyBorderPdfPTableEvent event = new HowbuyBorderPdfPTableEvent();
//table.setTableEvent(event);
//table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPCell cellTitle = new PdfPCell(new Phrase("总资产\nåQˆä¸‡å…ƒï¼‰",songtiSFivefont));
cellTitle.setBorderWidth(2f);
cellTitle.setBackgroundColor(new BaseColor(new Color(153, 51, 0)));
cellTitle.setBorderColor(new BaseColor(new Color(153, 51, 0)));
cellTitle.setHorizontalAlignment(Element.ALIGN_CENTER);
cellTitle.setVerticalAlignment(Element.ALIGN_MIDDLE);
cellTitle.setMinimumHeight(25);
table.addCell(cellTitle);
cellTitle = new PdfPCell(new Phrase(""));
cellTitle.setBorder(Rectangle.NO_BORDER);
cellTitle.setHorizontalAlignment(Element.ALIGN_CENTER);
cellTitle.setVerticalAlignment(Element.ALIGN_MIDDLE);
table.addCell(cellTitle);
cellTitle = new PdfPCell(new Phrase("当剿”¶ç›Š\nåQˆä¸‡å…ƒï¼‰",songtiSFivefont));
cellTitle.setBorderWidth(2f);
cellTitle.setBackgroundColor(new BaseColor(new Color(153, 51, 0)));
cellTitle.setBorderColor(new BaseColor(new Color(153, 51, 0)));
cellTitle.setHorizontalAlignment(Element.ALIGN_CENTER);
cellTitle.setVerticalAlignment(Element.ALIGN_MIDDLE);
table.addCell(cellTitle);
cellTitle = new PdfPCell(new Phrase("",songtiSFivefont));
cellTitle.setBorder(Rectangle.NO_BORDER);
cellTitle.setHorizontalAlignment(Element.ALIGN_CENTER);
cellTitle.setVerticalAlignment(Element.ALIGN_MIDDLE);
table.addCell(cellTitle);
cellTitle = new PdfPCell(new Phrase("累计收益\nåQˆä¸‡å…ƒï¼‰",songtiSFivefont));
cellTitle.setBorderWidth(2f);
cellTitle.setBackgroundColor(new BaseColor(new Color(153, 51, 0)));
cellTitle.setBorderColor(new BaseColor(new Color(153, 51, 0)));
cellTitle.setHorizontalAlignment(Element.ALIGN_CENTER);
cellTitle.setVerticalAlignment(Element.ALIGN_MIDDLE);
table.addCell(cellTitle);
float[] widths2 = { 24.5f, 12.25f,24.5f,12.25f,24.5f};
table.setWidths(widths2);
table.setHorizontalAlignment(Element.ALIGN_LEFT);//
table.setWidthPercentage(70);
double zzc = objArr[0]==null ? 0:Double.parseDouble(objArr[0].toString());
double dqsy = objArr[1]==null ? 0:Double.parseDouble(objArr[1].toString());
double ljsy = objArr[2]==null ? 0:Double.parseDouble(objArr[2].toString());
PdfPCell cell1 = new PdfPCell(new Phrase(String.valueOf(zzc),songtiSFivefont));
cell1.setBorderWidth(2f);
cell1.setBorderColor(new BaseColor(new Color(153, 51, 0)));
cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
cell1.setVerticalAlignment(Element.ALIGN_MIDDLE);
cell1.setMinimumHeight(20);
table.addCell(cell1);
cell1 = new PdfPCell(new Phrase("",songtiSFivefont));
cell1.setBorder(Rectangle.NO_BORDER);
cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
cell1.setVerticalAlignment(Element.ALIGN_MIDDLE);
table.addCell(cell1);
cell1 = new PdfPCell(new Phrase(String.valueOf(dqsy),songtiSFivefont));
cell1.setBorderWidth(2f);
cell1.setBorderColor(new BaseColor(new Color(153, 51, 0)));
cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
cell1.setVerticalAlignment(Element.ALIGN_MIDDLE);
table.addCell(cell1);
cell1 = new PdfPCell(new Phrase("",songtiSFivefont));
cell1.setBorder(Rectangle.NO_BORDER);
cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
cell1.setVerticalAlignment(Element.ALIGN_MIDDLE);
table.addCell(cell1);
cell1 = new PdfPCell(new Phrase(String.valueOf(ljsy),songtiSFivefont));
cell1.setBorderWidth(2f);
cell1.setBorderColor(new BaseColor(new Color(153, 51, 0)));
cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
cell1.setVerticalAlignment(Element.ALIGN_MIDDLE);
table.addCell(cell1);
document.add(table);
}catch(Exception ex){
ex.printStackTrace();
}
document.close();
}
}