mybatis
weixin_41462238
这个作者很懒,什么都没留下…
展开
-
如果有更新没有新增 ON DUPLICATE KEY UPDATE
单个更新<insert id="updateUser" useGeneratedKeys="true" keyProperty="id"> INSERT INTO lock_user_name <trim prefix="(" suffix=")" suffixOverrides=","> user_name, phone, <if test="id原创 2020-12-31 09:32:23 · 126 阅读 · 0 评论 -
mybatis 用cast when 批量更新
xml中书写的方式<update id="batchUpdate" parameterType="list"> update songs <trim prefix="set" suffixOverrides=","> <trim prefix="path =case" suffix="end,"> <foreach collection="list原创 2020-12-30 16:53:37 · 499 阅读 · 0 评论 -
mybatis-plus 修改可以为null的数据
companyService.lambdaUpdate(new CompanyEntity(),Wrappers.lambdaUpdate().set(CompanyEntity::getStatus, cCompany.getStatus()).set(CompanyEntity::getAccountTypeId, cCompany.getAccountTypeId()).set(CompanyEntity::getLogoId, cCompany.getLogoId()).set(Comp原创 2020-12-30 16:53:01 · 1169 阅读 · 1 评论 -
mybatis-plus 分页
@RequestMapping("/list") public R list(@RequestParam HashMap map){ PageUtils page = deviceService.queryList(map); return R.ok(page); } /** * 查询设备列表 */ PageUtils queryList(HashMap map); @Override publi.原创 2020-12-30 16:52:14 · 162 阅读 · 0 评论 -
mybatis-plus 删除指定的条件
删除一个deviceAttrService.remove(new QueryWrapper<DeviceAttrEntity>().eq("device_id",id));删除多个deviceAttrService.remove(new QueryWrapper<DeviceAttrEntity>().in("device_id",ids));原创 2020-12-30 16:51:44 · 5307 阅读 · 4 评论 -
mybatis 一对一
第一种<resultMap type="com.juncdt.mips.device.entity.DeviceEntity" id="deviceMap2"> <id property="id" column="id"/> <result property="name" column="name"/> <result property="account" column="account"/>原创 2020-12-30 16:51:10 · 624 阅读 · 0 评论 -
mybatis 多表查询
<resultMap type="com.juncdt.mips.content.entity.PlaylistEntity" id="playlistMap2"> <result property="id" column="id"/> <result property="createTime" column="create_time"/> <result property="updateTime" column=".原创 2020-12-30 16:50:34 · 77 阅读 · 0 评论 -
mybatis 一条数据 重复封装成list
domainprivate List locklist;property 是domain的lists ofType 是属性xml<collection property="locklist" ofType="LockMiddleUser"> <result property="deviceNumber" column="device_number"/> <result property="userId" column="原创 2020-12-30 16:50:03 · 284 阅读 · 0 评论