概述
1,进行了MyBatis Plus 的了解 ,了解了
QueryWrapper<Object> objectQueryWrapper = new QueryWrapper<>();
CriteriaQuery<Object> criteriaQuery = new CriteriaQuery<>();
学习了MP的 CriteriaQuery对象sql语句的写法
CriteriaQuery.select("member.member_id AS memberId,"
+ "member.address AS address,"
+ "member.mobile AS mobile,"
+ "member.update_user AS updateUser,"
+ "member.update_time AS updateTime,"
+ "member.card_no AS cardNo,"
+ "member.org_id AS orgId,"
+ "member.ca_no AS caNo,"
+ "member.area_id AS areaId,"
+ "member.create_time AS createTime,"
+ "member.name AS name,"
+ "member.create_user AS createUser,"
+ "member.status AS status,"
+ "area.area_name AS areaName");
CriteriaQuery.createAlias(BaseArea.class);
其中 BaseArea.class 是需要关联查询的副类,即
@TableAlias("area")
@TableName("base_area")
@ApiModel(value="BaseArea对象", description="行政区划")
public class BaseArea extends AbstractEntity {
private static final long serialVersionUID=1L;
@ApiModelProperty(value = "区划ID")
@TableId(value = "area_id", type = IdType.AUTO)
private Long areaId;
@ApiModelProperty(value = "区划名称")
private String areaName;
@ApiModelProperty(value = "上级id")
private Long parentId;
@ApiModelProperty(value = "小区标记 1是0否")
private Integer villageMark;
@ApiModelProperty(value = "上级ids")
private String parentIds;
}
还学习了使用 CriteriaQuery.apply 方法进行sql语句查询
CriteriaQuery.apply(ToolUtil.isNotEmpty(area_id), " (member.area_id = " + area_id.toString() + " or find_in_set(" + area_id.toString() + ",area.parent_ids))");
还有sql语句的优化
为解决问题, CriteriaQuery.apply() 方法的含义,并且对应的菜单树的写法有待解决。
最后
以上就是鲤鱼巨人为你收集整理的2020/1/13工作日志的全部内容,希望文章能够帮你解决2020/1/13工作日志所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复