Commit 91c56285 authored by licc's avatar licc

修复事务2

parent 8b072d15
...@@ -19,5 +19,7 @@ public interface UserDataMapper extends BaseMapper<UserData> { ...@@ -19,5 +19,7 @@ public interface UserDataMapper extends BaseMapper<UserData> {
Long getMaxId(); Long getMaxId();
Long getBottomMaxId();
List<UserData> getBottom(@Param("startNo") Integer startNumber, @Param("endNo") Integer endNo); List<UserData> getBottom(@Param("startNo") Integer startNumber, @Param("endNo") Integer endNo);
} }
...@@ -105,6 +105,10 @@ ...@@ -105,6 +105,10 @@
</select> </select>
<select id="getMaxId" resultType="java.lang.Long"> <select id="getMaxId" resultType="java.lang.Long">
select user_id from user_data order by user_id desc limit 1
</select>
<select id="getBottomMaxId" resultType="java.lang.Long">
select user_id from user_data where bottom is null order by user_id limit 1 select user_id from user_data where bottom is null order by user_id limit 1
</select> </select>
......
...@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service; ...@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
* @author 86187 * @author 86187
*/ */
...@@ -28,7 +29,7 @@ public class BottomServiceImpl implements BottomService { ...@@ -28,7 +29,7 @@ public class BottomServiceImpl implements BottomService {
@Override @Override
public R<Boolean> getBottom(UserQueryVo queryVo) { public R<Boolean> getBottom(UserQueryVo queryVo) {
Long usersId = userDataMapper.getMaxId(); Long usersId = userDataMapper.getBottomMaxId();
log.info("开始计算用户id:" + usersId); log.info("开始计算用户id:" + usersId);
if (null == usersId) { if (null == usersId) {
usersId = 0L; usersId = 0L;
......
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.vo.UserQueryVo;
import cn.wisenergy.service.app.BottomService;
import cn.wisenergy.web.common.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @author 86187
*/
@Api(tags = "用户向下层级管理")
@RestController
@Slf4j
public class BottomController extends BaseController {
@Resource
private BottomService bottomService;
@ApiOperation(value = "向下最深层级层级数、伞下人员总和", notes = "向下最深层级层级数、伞下人员总和", httpMethod = "POST")
@ApiImplicitParam(name = "queryVo", value = "每次统计条数", dataType = "UserQueryVo")
@PostMapping(value = "/user/updateBatchUserData")
public R<Boolean> updateBatchUserData(@RequestBody UserQueryVo queryVo) {
return bottomService.getBottom(queryVo);
}
}
...@@ -25,9 +25,6 @@ public class UserDataController { ...@@ -25,9 +25,6 @@ public class UserDataController {
@Resource @Resource
private UserDataService userDataService; private UserDataService userDataService;
@Resource
private BottomService bottomService;
@ApiOperation(value = "获取token接口", notes = "获取token接口", httpMethod = "POST") @ApiOperation(value = "获取token接口", notes = "获取token接口", httpMethod = "POST")
@ApiImplicitParam(name = "queryVo", value = "每次统计条数", dataType = "UserQueryVo") @ApiImplicitParam(name = "queryVo", value = "每次统计条数", dataType = "UserQueryVo")
@PostMapping(value = "/user/saveBatchUserData") @PostMapping(value = "/user/saveBatchUserData")
...@@ -35,10 +32,4 @@ public class UserDataController { ...@@ -35,10 +32,4 @@ public class UserDataController {
return userDataService.addBatch(queryVo); return userDataService.addBatch(queryVo);
} }
@ApiOperation(value = "向下最深层级层级数、伞下人员总和", notes = "向下最深层级层级数、伞下人员总和", httpMethod = "POST")
@ApiImplicitParam(name = "queryVo", value = "每次统计条数", dataType = "UserQueryVo")
@PostMapping(value = "/user/updateBatchUserData")
public R<Boolean> updateBatchUserData(@RequestBody UserQueryVo queryVo) {
return bottomService.getBottom(queryVo);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment