Mybatis中Mysql choose条件选择

1:定义model

Model.java

public class Page {

    private int page = 1;

    private int count = 0;

    private Map sorting = Maps.newHashMap();

}

2:定义mapper接口

Mapper.java

public interfaceMemberInfoMapper {

    ListgetByOrgId(Page page);

}

3:编写mapper.xml

sql语句

select * from user_hospital uh

where 1 = 1


    ${orderField} ${orderDirection}

    order by ${orderField} ${orderDirection}

    order by last_time desc

你可能感兴趣的:(Mybatis中Mysql choose条件选择)