MD5加盐和UUid,Mybatis XXXmapper.xml事例

MD5加盐和UUid

public class SeckillUtil {
	
	private final  String slat = "skdjffji###!!&^&%GTWH@";
	private final  String slatString = "skdjffji#@!#!!&^&%@#@D5@";
	
	public  String getMD5(long seckillId) {
		String base = slat + seckillId + "/" ;
		String md5 = DigestUtils.md5DigestAsHex(base.getBytes());
		return md5;
	}
	
	public  String getPasswodMD5(String password) {
		String base = slatString + password + "/" ;
		String md5 = DigestUtils.md5DigestAsHex(base.getBytes());
		return md5;
	}
	
	public  String createUuid(){
		UUID uuid = UUID.randomUUID();
		return uuid.toString();
	}
	
}

Mybatis XXXmapper.xml





	
	
	
		insert into SUSER(USER_ID,USER_NAME,
				USER_PASSWORD,	USER_EMAIL,
				USER_PHONE,USER_TOKEN,
				USER_DESC)
		values (#{userId},#{userName},
				#{userPassword},#{userEmail},
				#{userPhone},#{userToken},
				#{userDesc})
	
	
	
	
		
		update SUSER
		
			
	    	USER_PASSWORD = #{userPassword},
			
	    	USER_EMAIL = #{userEmail},
			
	    	USER_PHONE = #{userPhone},
			
	    	USER_TOKEN = #{userToken},	
			
	    	USER_DESC = #{userDesc},			
		
			
				and USER_NAME = #{userName}
			
	
	
	
	
	
	
	
	
	
	USER_ID,USER_NAME,USER_PASSWORD,USER_EMAIL,USER_PHONE,USER_TOKEN,CREATE_TIME,USER_DESC
	



























你可能感兴趣的:(md5,uuid,mybatis,mapper.xml)