use of com.roy.shardingDemo.entity.Course in project code by lastwhispers.
the class ShardingJDBCTest method queryCourse.
@Test
public void queryCourse() {
// select * from course
QueryWrapper<Course> wrapper = new QueryWrapper<>();
wrapper.orderByDesc("cid");
// wrapper.eq("cid",730100102537940992L);
// wrapper.in("cid",730100102537940992L,730100102990925824L);
List<Course> courses = courseMapper.selectList(wrapper);
System.out.println("条数:" + courses.size());
for (Course course : courses) {
System.out.println("查询结果:" + course);
}
}
use of com.roy.shardingDemo.entity.Course in project code by lastwhispers.
the class ShardingJDBCTest method addCourse.
@Test
public void addCourse() {
for (int i = 0; i < 10; i++) {
Course c = new Course();
// c.setCid(Long.valueOf(i));
c.setCname("shardingsphere");
c.setUserId(Long.valueOf("" + (1000 + i)));
c.setCstatus("1");
courseMapper.insert(c);
}
}
use of com.roy.shardingDemo.entity.Course in project code by lastwhispers.
the class ShardingJDBCTest method queryCourseByHint.
@Test
public void queryCourseByHint() {
HintManager hintManager = HintManager.getInstance();
hintManager.addTableShardingValue("course", 2);
List<Course> courses = courseMapper.selectList(null);
courses.forEach(course -> System.out.println(course));
hintManager.close();
}
Aggregations