("DISTINCT username"); // 执行查询操作 List<Map<String, Object>> resultMap = userService.listMaps(queryWrapper); // 处理查询结果 List<String> usernames = resultMap.stream() .map(map -> (String) map.get("username")) .collect(Collectors.toList()); return user...
private String name; private String password; private Integer age; private String tel; private Integer age2; } 1. 2. 3. 4. 5. 6. 7. 8. 9. 方案二:新建一个模型类,让其继承User类,并在其中添加age2属性,UserQuery在用有User属性后同时添加age2属性 @Data public class User { private Long i...
public boolean updateWaitSignWarnFlag(String acptracctName) { BusBillWaitsign bw = new BusBillWaitsign(); bw.setWarnflag("1"); bw.setUpdateBy("job"); List<String> list = new ArrayList<>(); list.add("0"); list.add("2"); int num = billWaitsignMapper.update(bw,new QueryWrapper<...
@Data @TableName("tbl_user") public class User { /* id为Long类型,因为数据库中id为bigint类型, 并且mybatis有自己的一套id生成方案,生成出来的id必须是Long类型 */ private Long id; private String name; @TableField(value = "pwd",select = false) private String password; private Integer age; ...
// 如果有一个字段没有设置selectColumns,则直接返回空,表示查询全部列 for (BindEntityDescription fieldAnnotation : fieldAnnotations) { if (fieldAnnotation.getSelectColumns().isEmpty()) { return new String[0]; } } List<String> columns = fieldAnnotations.stream() .map(BindEntityDescription::getSelect...
mybais-plus版本:3.1.1 1,排除某些字段,可以同时排除多个字段 排除多个字段写法: .setEntity(new User()) .select(c -> !Objects.equals(c.getProperty(), "secretKey") &&!Objects.equals(c.getProperty(), "password")) 如果写多个select 则只有最后一个select生效 ...
一.XML方法 1.parameterType parameterType可以是单个参数,也可以是实体对象 mapper方法参数(Integer id) 2.@Param传参 mapper方法参数(@Param(“id”) Integer id,@Param(“sex”) String sex) 3.Map参数 Map<String,Objec...mybatisplus日期范围查询 1 . PageRequest 2. AdvertListQuery 3. AdvertController...