动态sql $和#的使用

servicImpl层:

		SqlSession sqlSession = sqlSessionFactory.openSession();
		// 3.获取对应mapper
		TUserMapper mapper = sqlSession.getMapper(TUserMapper.class);
		
		String inCol = "id, user_name, real_name, sex, mobile, email, note";
		String tableName = "t_user";
		Byte sex = 1;
		String orderStr = "sex,user_name";
		
		List list = mapper.selectBySymbol(tableName, inCol, orderStr, sex);

mapper层:

 List selectBySymbol(@Param("tableName")String tableName,
    		                   @Param("inCol")String inCol,
    		                   @Param("orderStr")String orderStr,
    		                   @Param("sex")Byte sex);

xml层:


你可能感兴趣的:(动态sql,$,#,mybatis)