Mybatis 数据类型对应
Java 类型 | jdbcType |
---|---|
String | VARCHAR |
Integer | INTEGER |
Date | TIMESTAMP |
Long | BIGINT |
通用字段,不推荐使用 SELECT * FROM
pai_id, create_date, modify_date, area_name, up_area_id, floor, last_floor, remark,
area_code, area_index, name_en, name_jm, post_code, district_number, sort_name, sel_tag,
ass_key, ass_date, area_name_sync_cus
通用条件查询 commonSql
and user_status = #{userStatus, jdbcType=INTEGER}
modify_time = #{modifyTime,jdbcType=TIMESTAMP}
and user_phone like '%${userPhone}%'
and user_phone like CONCAT('%',#{userPhone,jdbcType=VARCHAR},'%')
and ( real_name like '%${searchVal}%' or name like '%${searchVal}%' )
and create_time= #{createTime, jdbcType=TIMESTAMP}
and DATE_FORMAT(create_time,'%Y-%m-%d') = ]]> #{createTimeStart, jdbcType=VARCHAR}
and DATE_FORMAT(create_time,'%Y-%m-%d') #{createTimeEnd, jdbcType=VARCHAR}
通用多表查询 commonFromWhere
FROM
msc_base_feedback mbf
left JOIN msc_server_info msi ON mbf.server_id = msi.id
left JOIN msc_business_info mbi ON mbf.business_id = mbi.business_id
主键查询
接口:
public UscUserInfoBo selectUserInfo(@Param("id") String id);
配置文件:
service:
UserInfoBo info = userInfoDao.selectUserInfo(userInfoBo.getId());
根据状态统计查询
查询数据是否以存在
批量操作
update ap_perform_role
state = #{state,jdbcType=INTEGER},
where
1=1
and id in
#{id}
查询表中的二级项
查询表中否有子机构的所有机构 ( parent_id = id )
关联查询