提交 dc139f21 作者: 张小凤

CodeUtil(update)

上级 adc05e79
......@@ -30,8 +30,17 @@ public class CodeUtil {
return "DELETE" + CodeUtil.getRandomNum(15);
}
public static String createRoleNo() {
String s = "A" + System.currentTimeMillis();
return s;
public static String createRoleNo(String roleNo) {
return getNewEquipmentNo("A", roleNo);
}
public static String getNewEquipmentNo(String equipmentType, String equipmentNo) {
String newEquipmentNo = "A" + "0001";
if (equipmentNo != null && !equipmentNo.isEmpty()) {
int newEquipment = Integer.parseInt(equipmentNo.substring(1)) + 1;
newEquipmentNo = String.format(equipmentType + "%04d", newEquipment);
}
return newEquipmentNo;
}
}
......@@ -34,6 +34,6 @@ public interface RoleDao {
Integer countNotDelUserAccountByRole(Integer id);
String findList();
}
......@@ -35,7 +35,7 @@ public class RoleServiceImpl implements RoleService {
}
RoleInfoDO rd = new RoleInfoDO(roleInfo);
rd.setUserAccountId(userLoginInfoFromRedis.getUserAccountId());
rd.setRoleNo(CodeUtil.createRoleNo());
rd.setRoleNo(CodeUtil.createRoleNo(roleDao.findList()));
roleDao.insertRoleInfo(rd);
return ResultBody.success();
}
......
......@@ -155,5 +155,12 @@
AND ua.is_deleted = 0
</select>
<select id="findList" resultType="java.lang.String">
SELECT role_no
FROM role_info
where is_deleted = 0
ORDER BY id DESC LIMIT 1;
</select>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论