select uid,name,password,email,phoneNumber,birthday from users where uid=#{uiddddd}
com.itheima.test.UserMapperTest
@Test
public void testFinaUserByUid() throws Exception {
SqlSession sqlSession = null;
try {
sqlSession = openSession();
UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
User user = userMapper.findUserByUid(1);
System.out.println(user);
}catch (Exception e){
throw new RuntimeException(e);
}finally{
sqlSession.close();
}
}
2.3查询多条记录 com.itheima.dao.UserMapper
/**
根据用户名和密码查询
@param name,password
@return */ User findUserByNamePassword(@Param("name") String name,@Param("password") String password);
//设置param别名,与xml中的代码相联系。
com/itheima/dao/UserMapper.xml
select uid,name,password,email,phoneNumber,birthday from users where name=#{name} and password=#{password}
com.itheima.test.UserMapperTest
@Test
public void testFinaUserByNamePassword() throws Exception {
SqlSession sqlSession = null;
try {
sqlSession = openSession();
UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
User user = userMapper.findUserByNamePassword("admin","sorry");
System.out.println(user);
}catch (Exception e){
throw new RuntimeException(e);
}finally{
sqlSession.close();
}
}
2.4根据POJO查询 com.itheima.dao.UserMapper
/**
* 根据用户名和密码查询
* @param userVo
* @return
*/
User findUserByNamePassword1(User userVo);
com/itheima/dao/UserMapper.xml
select uid,name,password,email,phoneNumber,birthday from users where name=#{name} and password=#{password}
com.itheima.test.UserMapperTest
@Test
public void testFinaUserByNamePassword1() throws Exception {
SqlSession sqlSession = null;
try {
sqlSession = openSession();
UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
User userVo = new User();
userVo.setName("admin");
userVo.setPassword("sorry");
User user = userMapper.findUserByNamePassword1(userVo);
System.out.println(user);
}catch (Exception e){
throw new RuntimeException(e);
}finally{
sqlSession.close();
}
}
2.5模糊查询 com.itheima.dao.UserMapper
01 List findUsersByName(String name);
02 List findUsersByName1(@Param("name") String name);
03 List findUsersByName2(String name);
com/itheima/dao/UserMapper.xml
01 select uid,name,password,email,phoneNumber,birthday from users where name like #{name}
02 select uid,name,password,email,phoneNumber,birthday from users where name like '%${name}%'
03 select uid,name,password,email,phoneNumber,birthday from users where name like concat('%',#{name},'%')
com.itheima.test.UserMapperTest
01 List users = userMapper.findUsersByName("%user%");
02 List users = userMapper.findUsersByName1("user");
03 List users = userMapper.findUsersByName2("user");
update users set name=#{name},password=#{password},email=#{email},phoneNumber=#{phoneNumber},birthday=#{birthday} where uid=#{uid}
delete from users where uid=#{uid}
1. aggregateByKey的运行机制
/**
* Aggregate the values of each key, using given combine functions and a neutral "zero value".
* This function can return a different result type
spark-sql是Spark bin目录下的一个可执行脚本,它的目的是通过这个脚本执行Hive的命令,即原来通过
hive>输入的指令可以通过spark-sql>输入的指令来完成。
spark-sql可以使用内置的Hive metadata-store,也可以使用已经独立安装的Hive的metadata store
关于Hive build into Spark
// Max value in Array
var arr = [1,2,3,5,3,2];Math.max.apply(null, arr); // 5
// Max value in Jaon Array
var arr = [{"x":"8/11/2009","y":0.026572007},{"x"
在使用XMlhttpRequest对象发送请求和响应之前,必须首先使用javaScript对象创建一个XMLHttpRquest对象。
var xmlhttp;
function getXMLHttpRequest(){
if(window.ActiveXObject){
xmlhttp:new ActiveXObject("Microsoft.XMLHTTP