Skip to content

Instantly share code, notes, and snippets.

@jarod-chan
jarod-chan / CheckToken.java
Last active May 24, 2017 02:31
spring aop 处理重复提交
package cn.fyg.pa.interfaces.module.shared.token.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*校验token是否有效
@jarod-chan
jarod-chan / ApplicationSetup.java
Created January 8, 2014 02:40
java 日志处理
package cn.fyg.am.infrastructure;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import org.slf4j.bridge.SLF4JBridgeHandler;
import com.google.inject.Guice;
@jarod-chan
jarod-chan / mysql存储过程.sql
Last active March 17, 2018 10:37
mysql存储过程
/*
2013年绩效考核结果
mysql 临时表不能在一次查询中连续引用两次
select a.id,b.id from rpt a,rpt b where a.id=b.id会出错
*/
drop procedure if exists yearchk2013;
create procedure yearchk2013 (in i_year bigint(20))
begin
@jarod-chan
jarod-chan / MonthChkRepositoryJpa.java
Created December 12, 2012 08:22
MonthChkRepositoryJpa.java
@Override
public List<MonthChkItem> getMonthChkItems(Long year, Person person) {
CriteriaBuilder builder=entityManager.getCriteriaBuilder();
CriteriaQuery<MonthChkItem> query=builder.createQuery(MonthChkItem.class);
Root<MonthChkItem> monthChkItem=query.from(MonthChkItem.class);
Join<MonthChkItem,MonthChk> monthChk = monthChkItem.join("monthChk",JoinType.LEFT);
List<Predicate> criteria=new ArrayList<Predicate>();
if(year!=null){
criteria.add(builder.equal(monthChk.get("year"), year));
}
@jarod-chan
jarod-chan / LeaveController.java
Created July 26, 2012 02:39
LeaveController.java
/**
* 启动请假流程
* @param leave
*/
@RequestMapping(value = "start", method = RequestMethod.POST)
public String startWorkflow(Leave leave, RedirectAttributes redirectAttributes, HttpSession session) {
try {
User user = UserUtil.getUserFromSession(session);
leave.setUserId(user.getId());
Map<String, Object> variables = new HashMap<String, Object>();
@jarod-chan
jarod-chan / gist:3143985
Last active October 7, 2015 09:37
java 持久化
java程序的持久化很难处理,用什么可以解决持久化问题?
@jarod-chan
jarod-chan / UserValidator.java
Created July 17, 2012 03:19
UserValidator.java
package cn.fyg.user.domain.model;
import java.util.List;
import cn.fyg.user.service.UserException;
import net.sf.oval.ConstraintViolation;
import net.sf.oval.Validator;