Skip to content

Commit

Permalink
fix:deviceId的错误
Browse files Browse the repository at this point in the history
  • Loading branch information
oddfar committed Aug 5, 2023
1 parent 372ec14 commit fe41aea
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;

/**
* I茅台用户Controller
*
Expand Down Expand Up @@ -151,6 +149,6 @@ public R edit(@RequestBody IUser iUser) {
@PreAuthorize("@ss.resourceAuth()")
@DeleteMapping(value = "/{mobiles}", name = "删除I茅台用户")
public R remove(@PathVariable Long[] mobiles) {
return R.ok(iUserMapper.deleteBatchIds(Arrays.asList(mobiles)));
return R.ok(iUserMapper.deleteIUser(mobiles));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public IUser(Long mobile, String deviceId, JSONObject jsonObject) {
this.mobile = mobile;
this.token = data.getString("token");
this.cookie = data.getString("cookie");
this.deviceId = deviceId.toUpperCase();
this.deviceId = deviceId.toLowerCase();
this.jsonResult = StringUtils.substring(jsonObject.toJSONString(), 0, 2000);

if (StringUtils.isEmpty(this.remark)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ default List<IUser> selectReservationUserByMinute(int minute) {
@Select("UPDATE i_user SET `minute` = (SELECT FLOOR(RAND() * 59 + 1)) WHERE random_minute = \"0\"")
void updateUserMinuteBatch();

int deleteIUser(Long[] iUserId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ public interface IUserService {
* @param iUserId id
* @return
*/
int deleteIUser(Long iUserId);
int deleteIUser(Long[] iUserId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public PageResult<IUser> page(IUser iUser) {
public int insertIUser(Long mobile, String deviceId, JSONObject jsonObject) {
JSONObject data = jsonObject.getJSONObject("data");
if (StringUtils.isEmpty(deviceId)) {
deviceId = UUID.randomUUID().toString().toUpperCase();
deviceId = UUID.randomUUID().toString().toLowerCase();
}
IUser user = iUserMapper.selectById(mobile);

Expand Down Expand Up @@ -73,7 +73,7 @@ public int insertIUser(IUser iUser) {
}

if (StringUtils.isEmpty(iUser.getDeviceId())) {
iUser.setDeviceId(UUID.randomUUID().toString().toUpperCase());
iUser.setDeviceId(UUID.randomUUID().toString().toLowerCase());
}
iUser.setCreateUser(SecurityUtils.getUserId());
return iUserMapper.insert(iUser);
Expand All @@ -94,7 +94,7 @@ public void updateUserMinuteBatch() {
}

@Override
public int deleteIUser(Long iUserId) {
return iUserMapper.deleteById(iUserId);
public int deleteIUser(Long[] iUserId) {
return iUserMapper.deleteIUser(iUserId);
}
}
6 changes: 6 additions & 0 deletions campus-modular/src/main/resources/mapper/IUserMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.oddfar.campus.business.mapper.IUserMapper">

<delete id="deleteIUser" parameterType="Long">
delete from i_user where mobile in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

0 comments on commit fe41aea

Please sign in to comment.