mashiguang

小马快跑

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  20 随笔 :: 0 文章 :: 60 评论 :: 0 Trackbacks

2011年2月17日 #

spring2.5-reference.pdf
http://m0.mail.sina.com.cn/apps/netdisk/download.php?id=d9d1668c0b162f26d115a49e0b308e4f


deerjet src.zip
http://m0.mail.sina.com.cn/apps/netdisk/download.php?id=c859c9a30c5f19e2732255e81a4f0c36

jQueryAPI-100214.chm
http://m0.mail.sina.com.cn/apps/netdisk/download.php?id=c64a572a16f169ac6db829a3122c4279

hibernate_annotations.pdf
http://m0.mail.sina.com.cn/apps/netdisk/download.php?id=88bd4e31848fda5ca2e65b6fc19df73f

hibernate_reference.pdf
http://m0.mail.sina.com.cn/apps/netdisk/download.php?id=603986150b7056ce617289370197ea9a

HQL与Criteria对照.pdf
http://m0.mail.sina.com.cn/apps/netdisk/download.php?id=c2805f9d49171f6165baa528a29774c7

oracle编程艺术.pdf
http://m0.mail.sina.com.cn/apps/netdisk/download.php?id=0c39f09f81f674ef67016482a224a025

精通oracle10g pl_sql编程.pdf
http://m0.mail.sina.com.cn/apps/netdisk/download.php?id=455bb7bbfeff510ee66acafe6c8f035b
posted @ 2011-08-11 23:05 mashiguang| 编辑 收藏

public PageModel<CrmWarning> query(PageModel<CrmWarning> pageModel)
            
throws Exception {
        Assert.notNull(pageModel);
        
        DetachedCriteria dc 
= DetachedCriteria.forClass(CrmWarning.class);
        
        
/*
         * 添加查询条件
         * 如:dc.add(Restrictions.like("key", "%"+pageModel.getCondition("key")+"%"));
         * 
         * 
*/
        
if (null != pageModel.getCondition("warnLevel")) {
            dc.add(Restrictions.eq(
"warnLevel", pageModel.getCondition("warnLevel")));
        }
        
if (StringUtils.isNotBlank((String)pageModel.getCondition("detail"))) {
            dc.add(Restrictions.like(
"detail""%"+pageModel.getCondition("detail")+"%"));
        }
        
if (StringUtils.isNotBlank((String)pageModel.getCondition("warnDate"))) {
            
/*
             * warnDate格式是yyyy-MM-dd,这里改成查询这一天的预警
             * Restrictions.sqlRestriction()允许写原生sql的方式完成特殊需求,如下
             * 
*/
            dc.add(Restrictions.sqlRestriction(
"to_char(time_start,'yyyy-MM-dd') = '" + pageModel.getCondition("warnDate"+ "'"));
        }
        
if (null != pageModel.getCondition("templateId")) {
            
/*
             * 这里的templateId是模板的主键id,查询时应该转换成模板对象
             * 
*/
            CrmWarnTemplate warnTemplate 
= new CrmWarnTemplate();
            warnTemplate.setTemplateId((Long)pageModel.getCondition(
"templateId"));
            dc.add(Restrictions.eq(
"crmWarnTemplate", warnTemplate));
        }
        
        dc.addOrder(Order.asc(
"crmWarnTemplate"));
        dc.addOrder(Order.desc(
"timeStart"));
        
        pageModel.setDateList(warningDao.query(dc, pageModel.getFirstNote(), pageModel.getNumInPage()));
        pageModel.setTotal(warningDao.count(dc));
        
        
return pageModel;
    }
posted @ 2011-08-11 22:50 mashiguang| 编辑 收藏

package com.jl.dao.bookplatform.impl;

import java.util.List;

import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.transform.Transformers;
import org.springframework.dao.DataAccessException;

import com.jl.dao.baseDao.GenericDao;
import com.jl.dao.bookplatform.ProductItemDao;
import com.jl.entity.bookplatform.CrmProduct;
import com.jl.entity.bookplatform.CrmProductItem;
import com.jl.entity.bookplatform.ProductItemConfig;

public class ProductItemDaoImpl extends GenericDao<CrmProductItem, Long> implements ProductItemDao {

    
    
public List<ProductItemConfig> getProductItemConfigs(Long productId, Long planetypeId) throws DataAccessException{
        String sql 
= "select chi.charge_item_id \"chargeItemId\"," +
                
" chi.charge_item \"chargeItem\"," +
                
" chi.charge_unit \"chargeUnit\"," +
                
" cpi.product_id \"productId\"," +
                
" cpi.product_item_id \"productItemId\"," +
                
" cpi.sale_planetype_id \"salePlanetypeId\"," +
                
" cpi.inland_price \"inlandPrice\"," +
                
" cpi.outland_price \"outlandPrice\"" +
                
" from (select * from crm_charge_item chi2 where chi2.if_regular = 1) chi left join crm_product_item cpi" +
                
" on cpi.charge_item_id = chi.charge_item_id " +
                
" and cpi.product_id = ?" +
                
" and cpi.sale_planetype_id = ?" +
                
" order by chi.charge_item_id";
        
        Session session 
= getSession();
        Query query 
= session.createSQLQuery(sql)
            .addScalar(
"chargeItemId", Hibernate.LONG)
            .addScalar(
"chargeItem",Hibernate.STRING)
            .addScalar(
"chargeUnit",Hibernate.STRING)
            .addScalar(
"productId",Hibernate.LONG)
            .addScalar(
"productItemId",Hibernate.LONG)
            .addScalar(
"salePlanetypeId",Hibernate.LONG)
            .addScalar(
"inlandPrice",Hibernate.DOUBLE)
            .addScalar(
"outlandPrice",Hibernate.DOUBLE)
            .setResultTransformer(Transformers.aliasToBean(ProductItemConfig.
class))
            .setParameter(
0, productId)
            .setParameter(
1, planetypeId);
        
        List
<ProductItemConfig> configs = query.list();
        
        
return configs;
    }

    
public List<CrmProductItem> getProductItem(CrmProduct product) throws DataAccessException {
        
        String hql 
= "from CrmProductItem cpi where cpi.crmProduct = ?";
        Session session 
= getSession();
        Query query 
= session.createSQLQuery(hql).setParameter(0, product);
        
        List
<CrmProductItem> items = query.list();
        
return items;
    }
    
    
public void copy(Long productId_dest,Long productId_orig,String createMan) throws DataAccessException {
        String sql 
= "insert into crm_product_item " +
                
" select hibernate_sequence.nextval," +
                
" ?," +
                
" cpi.charge_item_id," +
                
" cpi.sale_planetype_id," +
                
" cpi.inland_price," +
                
" cpi.outland_price," +
                
" ?," +
                
" sysdate" +
                
" from crm_product_item cpi" +
                
" where cpi.product_id = ?";
        
        Session session 
= getSession();
        Query sqlQuery 
= session.createSQLQuery(sql)
                        .setParameter(
0, productId_dest)
                        .setParameter(
1, createMan)
                        .setParameter(
2, productId_orig);
        sqlQuery.executeUpdate();
    }
    
    
}
posted @ 2011-08-11 22:25 mashiguang| 编辑 收藏

1,配置tomcat启动参数
直接在%tomcat_home%\bin下建立tomcat_debug.bat文件,内容如下:

cd %CATALINE_HOME%/bin
set JPDA_ADDRESS=8787
set JPDA_TRANSPORT=dt_socket
set CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787
startup

需要远程调试时从tomcat_debug.bat启动。

2,eclipse调试
选择菜单"Run>Debug...",弹出窗口里右键点击"Remote Java Application",选择"New",如图:


点击"Debug"按钮,开始远程调试,当程序运行到断点时,Eclipse会捕获到。


有关普通java app的远程调试可以参考http://blog.chenlb.com/2010/07/eclipse-remoting-debug-java-app.html
posted @ 2011-02-26 17:39 mashiguang 阅读(440) | 评论 (2)编辑 收藏

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 
<HEAD>
  
<TITLE> New Document </TITLE>
  
<META NAME="Generator" CONTENT="EditPlus">
  
<META NAME="Author" CONTENT="">
  
<META NAME="Keywords" CONTENT="">
  
<META NAME="Description" CONTENT="">
  
<script type="text/javascript" src="jquery-1.4.2.js"></script>
  
<script type="text/javascript" src="jquery.validate.js"></script>
  
<SCRIPT LANGUAGE="JavaScript">
  
<!--
    jQuery(
function(){        
        jQuery.validator.methods.compareDate 
= function(value, element, param) {
            
//var startDate = jQuery(param).val() + ":00";补全yyyy-MM-dd HH:mm:ss格式
            //value = value + ":00";
            
            
var startDate = jQuery(param).val();
            
            
var date1 = new Date(Date.parse(startDate.replace("-""/")));
            
var date2 = new Date(Date.parse(value.replace("-""/")));
            
return date1 < date2;
        };
        
        jQuery(
"#form1").validate({
            focusInvalid:
false,
            rules:{
                
"timeStart":{
                    required: 
true
                },
                
"timeEnd": {
                    required: 
true,
                    compareDate: 
"#timeStart"
                }
            },
            messages:{
                
"timeStart":{
                    required: 
"开始时间不能为空"
                },
                
"timeEnd":{
                    required: 
"结束时间不能为空",
                    compareDate: 
"结束日期必须大于开始日期!"
                }
            }
        });
    });
  
//-->
  </SCRIPT>
 
</HEAD>

 
<BODY>
 
<form id="form1" name="form1" method="post" action="demo.html">
   
<p>timeStart:
     
<input name="timeStart" type="text" id="timeStart" value="2011-02-17 10:00:00"> yyyy-MM-dd HH:mm:ss
   
</p>
   
<p>timeEnd:
     
<input name="timeEnd" type="text" id="timeEnd" value="2011-02-17 9:00:00"> yyyy-MM-dd HH:mm:ss
   
</p>
   
<p>
     
<input type="submit" name="Submit" value="提交">
   
</p>
 
</form>
  
 
</BODY>
</HTML>
posted @ 2011-02-17 10:34 mashiguang 阅读(11910) | 评论 (9)编辑 收藏