自增id问题
This commit is contained in:
@@ -41,7 +41,6 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService
|
|||||||
@Override
|
@Override
|
||||||
public int insertGenTableColumn(GenTableColumn genTableColumn)
|
public int insertGenTableColumn(GenTableColumn genTableColumn)
|
||||||
{
|
{
|
||||||
genTableColumn.setColumnId(IdUtil.getSnowflakeNextId());
|
|
||||||
return genTableColumnMapper.insertGenTableColumn(genTableColumn);
|
return genTableColumnMapper.insertGenTableColumn(genTableColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -178,7 +178,6 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
{
|
{
|
||||||
String tableName = table.getTableName();
|
String tableName = table.getTableName();
|
||||||
GenUtils.initTable(table, operName);
|
GenUtils.initTable(table, operName);
|
||||||
table.setTableId(IdUtil.getSnowflake().nextId());
|
|
||||||
int row = genTableMapper.insertGenTable(table);
|
int row = genTableMapper.insertGenTable(table);
|
||||||
if (row > 0)
|
if (row > 0)
|
||||||
{
|
{
|
||||||
@@ -187,7 +186,6 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
for (GenTableColumn column : genTableColumns)
|
for (GenTableColumn column : genTableColumns)
|
||||||
{
|
{
|
||||||
GenUtils.initColumnField(column, table);
|
GenUtils.initColumnField(column, table);
|
||||||
column.setColumnId(IdUtil.getSnowflake().nextId());
|
|
||||||
genTableColumnMapper.insertGenTableColumn(column);
|
genTableColumnMapper.insertGenTableColumn(column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -334,7 +332,6 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
column.setColumnId(IdUtil.getSnowflakeNextId());
|
|
||||||
genTableColumnMapper.insertGenTableColumn(column);
|
genTableColumnMapper.insertGenTableColumn(column);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
c.column_id
|
c.column_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertGenTableColumn" parameterType="GenTableColumn" >
|
<insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId">
|
||||||
insert into gen_table_column (
|
insert into gen_table_column (
|
||||||
<if test="columnId != null ">column_id,</if>
|
<if test="columnId != null ">column_id,</if>
|
||||||
<if test="tableId != null and tableId != ''">table_id,</if>
|
<if test="tableId != null and tableId != ''">table_id,</if>
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
order by c.sort
|
order by c.sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertGenTable" parameterType="GenTable" >
|
<insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId" >
|
||||||
insert into gen_table (
|
insert into gen_table (
|
||||||
<if test="tableId != null">table_id,</if>
|
<if test="tableId != null">table_id,</if>
|
||||||
<if test="tableName != null">table_name,</if>
|
<if test="tableName != null">table_name,</if>
|
||||||
|
|||||||
@@ -204,7 +204,6 @@ public class SysJobServiceImpl implements ISysJobService
|
|||||||
public int insertJob(SysJob job) throws SchedulerException, TaskException
|
public int insertJob(SysJob job) throws SchedulerException, TaskException
|
||||||
{
|
{
|
||||||
job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
|
job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
|
||||||
job.setJobId(IdUtil.getSnowflakeNextId());
|
|
||||||
int rows = jobMapper.insertJob(job);
|
int rows = jobMapper.insertJob(job);
|
||||||
if (rows > 0)
|
if (rows > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where job_id = #{jobId}
|
where job_id = #{jobId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<insert id="insertJob" parameterType="SysJob" >
|
<insert id="insertJob" parameterType="SysJob" useGeneratedKeys="true" keyProperty="jobId" >
|
||||||
insert into sys_job(
|
insert into sys_job(
|
||||||
<if test="jobId != null and jobId != 0">job_id,</if>
|
<if test="jobId != null and jobId != 0">job_id,</if>
|
||||||
<if test="jobName != null and jobName != ''">job_name,</if>
|
<if test="jobName != null and jobName != ''">job_name,</if>
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ public class SysConfigServiceImpl implements ISysConfigService
|
|||||||
@Override
|
@Override
|
||||||
public int insertConfig(SysConfig config)
|
public int insertConfig(SysConfig config)
|
||||||
{
|
{
|
||||||
config.setConfigId(IdUtil.getSnowflakeNextId());
|
|
||||||
int row = configMapper.insertConfig(config);
|
int row = configMapper.insertConfig(config);
|
||||||
if (row > 0)
|
if (row > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -220,7 +220,6 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||||||
throw new ServiceException("部门停用,不允许新增");
|
throw new ServiceException("部门停用,不允许新增");
|
||||||
}
|
}
|
||||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||||
dept.setDeptId(IdUtil.getSnowflakeNextId());
|
|
||||||
return deptMapper.insertDept(dept);
|
return deptMapper.insertDept(dept);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ public class SysDictDataServiceImpl implements ISysDictDataService
|
|||||||
@Override
|
@Override
|
||||||
public int insertDictData(SysDictData data)
|
public int insertDictData(SysDictData data)
|
||||||
{
|
{
|
||||||
data.setDictCode(IdUtil.getSnowflakeNextId());
|
|
||||||
int row = dictDataMapper.insertDictData(data);
|
int row = dictDataMapper.insertDictData(data);
|
||||||
if (row > 0)
|
if (row > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -176,7 +176,6 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
|||||||
@Override
|
@Override
|
||||||
public int insertDictType(SysDictType dict)
|
public int insertDictType(SysDictType dict)
|
||||||
{
|
{
|
||||||
dict.setDictId(IdUtil.getSnowflakeNextId());
|
|
||||||
int row = dictTypeMapper.insertDictType(dict);
|
int row = dictTypeMapper.insertDictType(dict);
|
||||||
if (row > 0)
|
if (row > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ public class SysLogininforServiceImpl implements ISysLogininforService
|
|||||||
@Override
|
@Override
|
||||||
public void insertLogininfor(SysLogininfor logininfor)
|
public void insertLogininfor(SysLogininfor logininfor)
|
||||||
{
|
{
|
||||||
logininfor.setInfoId(IdUtil.getSnowflakeNextId());
|
|
||||||
logininforMapper.insertLogininfor(logininfor);
|
logininforMapper.insertLogininfor(logininfor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -303,7 +303,6 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
@Override
|
@Override
|
||||||
public int insertMenu(SysMenu menu)
|
public int insertMenu(SysMenu menu)
|
||||||
{
|
{
|
||||||
menu.setMenuId(IdUtil.getSnowflakeNextId());
|
|
||||||
return menuMapper.insertMenu(menu);
|
return menuMapper.insertMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|||||||
@Override
|
@Override
|
||||||
public int insertNotice(SysNotice notice)
|
public int insertNotice(SysNotice notice)
|
||||||
{
|
{
|
||||||
notice.setNoticeId(IdUtil.getSnowflakeNextId());
|
|
||||||
return noticeMapper.insertNotice(notice);
|
return noticeMapper.insertNotice(notice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ public class SysOperLogServiceImpl implements ISysOperLogService
|
|||||||
@Override
|
@Override
|
||||||
public void insertOperlog(SysOperLog operLog)
|
public void insertOperlog(SysOperLog operLog)
|
||||||
{
|
{
|
||||||
operLog.setOperId(IdUtil.getSnowflakeNextId());
|
|
||||||
operLogMapper.insertOperlog(operLog);
|
operLogMapper.insertOperlog(operLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -163,7 +163,6 @@ public class SysPostServiceImpl implements ISysPostService
|
|||||||
@Override
|
@Override
|
||||||
public int insertPost(SysPost post)
|
public int insertPost(SysPost post)
|
||||||
{
|
{
|
||||||
post.setPostId(IdUtil.getSnowflake().nextId());
|
|
||||||
return postMapper.insertPost(post);
|
return postMapper.insertPost(post);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -236,7 +236,6 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||||||
@Transactional
|
@Transactional
|
||||||
public int insertRole(SysRole role)
|
public int insertRole(SysRole role)
|
||||||
{
|
{
|
||||||
role.setRoleId(IdUtil.getSnowflakeNextId());
|
|
||||||
// 新增角色信息
|
// 新增角色信息
|
||||||
roleMapper.insertRole(role);
|
roleMapper.insertRole(role);
|
||||||
return insertRoleMenu(role);
|
return insertRoleMenu(role);
|
||||||
|
|||||||
@@ -262,7 +262,6 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
@Transactional
|
@Transactional
|
||||||
public int insertUser(SysUser user)
|
public int insertUser(SysUser user)
|
||||||
{
|
{
|
||||||
user.setUserId(IdUtil.getSnowflakeNextId());
|
|
||||||
// 新增用户信息
|
// 新增用户信息
|
||||||
int rows = userMapper.insertUser(user);
|
int rows = userMapper.insertUser(user);
|
||||||
// 新增用户岗位关联
|
// 新增用户岗位关联
|
||||||
@@ -281,7 +280,6 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
@Override
|
@Override
|
||||||
public boolean registerUser(SysUser user)
|
public boolean registerUser(SysUser user)
|
||||||
{
|
{
|
||||||
user.setUserId(IdUtil.getSnowflakeNextId());
|
|
||||||
return userMapper.insertUser(user) > 0;
|
return userMapper.insertUser(user) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -510,7 +508,6 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
String password = configService.selectConfigByKey("sys.user.initPassword");
|
String password = configService.selectConfigByKey("sys.user.initPassword");
|
||||||
user.setPassword(SecurityUtils.encryptPassword(password));
|
user.setPassword(SecurityUtils.encryptPassword(password));
|
||||||
user.setCreateBy(operName);
|
user.setCreateBy(operName);
|
||||||
user.setUserId(IdUtil.getSnowflakeNextId());
|
|
||||||
userMapper.insertUser(user);
|
userMapper.insertUser(user);
|
||||||
successNum++;
|
successNum++;
|
||||||
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
|
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where post_id = #{postId}
|
where post_id = #{postId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<insert id="insertPost" parameterType="SysPost" >
|
<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
|
||||||
insert into sys_post(
|
insert into sys_post(
|
||||||
<if test="postId != null and postId != 0">post_id,</if>
|
<if test="postId != null and postId != 0">post_id,</if>
|
||||||
<if test="postCode != null and postCode != ''">post_code,</if>
|
<if test="postCode != null and postCode != ''">post_code,</if>
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where r.role_key=#{roleKey} and r.del_flag = '0'
|
where r.role_key=#{roleKey} and r.del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertRole" parameterType="SysRole" >
|
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId" >
|
||||||
insert into sys_role(
|
insert into sys_role(
|
||||||
<if test="roleId != null and roleId != 0">role_id,</if>
|
<if test="roleId != null and roleId != 0">role_id,</if>
|
||||||
<if test="roleName != null and roleName != ''">role_name,</if>
|
<if test="roleName != null and roleName != ''">role_name,</if>
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
select top 1 user_id, email from sys_user where email = #{email} and del_flag = '0'
|
select top 1 user_id, email from sys_user where email = #{email} and del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertUser" parameterType="SysUser" >
|
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId" >
|
||||||
insert into sys_user(
|
insert into sys_user(
|
||||||
<if test="userId != null and userId != 0">user_id,</if>
|
<if test="userId != null and userId != 0">user_id,</if>
|
||||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user