| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.PositionMapUserMapper; |
| | | import com.whyc.pojo.PositionMapUser; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.sql.SQLIntegrityConstraintViolationException; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | return new Response().set(0, "添加失败"); |
| | | } |
| | | }catch (Exception e){ |
| | | mapper.update(entity,null); |
| | | UpdateWrapper<PositionMapUser> updateWrapper = Wrappers.update(); |
| | | updateWrapper |
| | | .set("map_longitude",entity.getMap_longitude()) |
| | | .set("map_latitude",entity.getMap_latitude()) |
| | | .set("map_level",entity.getMap_level()) |
| | | .eq("uid",entity.getUid()); |
| | | mapper.update(null,updateWrapper); |
| | | return new Response().set(1,"更新成功"); |
| | | } |
| | | } |
| | | |
| | | public Response getListByUserId(int userId){ |
| | | QueryWrapper<PositionMapUser> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("uid",userId); |
| | | List<PositionMapUser> list = mapper.selectList(queryWrapper); |
| | | List<PositionMapUser> list = mapper.getListByUserId(userId); |
| | | return new Response().set(1,list,"查询成功"); |
| | | } |
| | | |