Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
auth-master
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
吴超
auth-master
Commits
118b306a
Commit
118b306a
authored
Oct 31, 2025
by
周海峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分组
parent
0c051ab4
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
670 行增加
和
15 行删除
+670
-15
doc/sql/update.sql
+10
-0
pom.xml
+28
-5
src/main/java/com/metro/auth/platform/controller/PlatformApplicationsController.java
+0
-1
src/main/java/com/metro/auth/platform/controller/PlatformApplicationsGroupController.java
+60
-0
src/main/java/com/metro/auth/platform/domain/auth/PlatformApplications.java
+9
-0
src/main/java/com/metro/auth/platform/domain/auth/PlatformApplicationsGroup.java
+207
-0
src/main/java/com/metro/auth/platform/mapper/PlatformApplicationsGroupMapper.java
+59
-0
src/main/java/com/metro/auth/platform/mapper/PlatformApplicationsGroupMapper.xml
+144
-0
src/main/java/com/metro/auth/platform/mapper/PlatformApplicationsMapper.xml
+0
-0
src/main/java/com/metro/auth/platform/service/PlatformApplicationsGroupService.java
+60
-0
src/main/java/com/metro/auth/platform/service/PlatformApplicationsGroupServiceImpl.java
+78
-0
src/main/java/com/metro/auth/platform/utils/StrUtil.java
+8
-0
src/main/resources/generatorConfig.xml
+7
-9
没有找到文件。
doc/sql/update.sql
0 → 100644
View file @
118b306a
-- 添加分组菜单
INSERT
INTO
`platform_auth`
.
`platform_sys_menu`
(
`id`
,
`parentId`
,
`path`
,
`icon`
,
`title`
,
`name`
,
`leftMemu`
,
`functionCode`
,
`isLock`
,
`sort`
,
`webtype`
)
VALUES
(
'1482f54ad33a4266a3528cc2b7924a25'
,
'7'
,
'/platformapplicationsGroup'
,
'group'
,
'应用分组'
,
'platformapplicationsGroup'
,
'true'
,
'platformapplicationsGroup'
,
NULL
,
'1'
,
NULL
);
ALTER
TABLE
`platform_auth`
.
`platform_applications`
ADD
COLUMN
`group_code`
varchar
(
20
)
NULL
COMMENT
'分组编码'
AFTER
`mailtype`
;
\ No newline at end of file
pom.xml
View file @
118b306a
...
@@ -225,6 +225,11 @@
...
@@ -225,6 +225,11 @@
<artifactId>
log4j-core
</artifactId>
<artifactId>
log4j-core
</artifactId>
<version>
${log4j2.version}
</version>
<version>
${log4j2.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.mybatis.generator
</groupId>
<artifactId>
mybatis-generator-core
</artifactId>
<version>
1.3.2
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
@@ -234,20 +239,38 @@
...
@@ -234,20 +239,38 @@
<artifactId>
spring-boot-maven-plugin
</artifactId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugin>
<!--mybatis自动生成代码插件-->
<!--mybatis自动生成代码插件-->
<!-- <plugin>-->
<!-- <groupId>org.mybatis.generator</groupId>-->
<!-- <artifactId>mybatis-generator-maven-plugin</artifactId>-->
<!-- <version>1.3.6</version>-->
<!-- <configuration>-->
<!-- <!– 是否覆盖,true表示会替换生成的JAVA文件,false则不覆盖 –>-->
<!-- <overwrite>false</overwrite>-->
<!-- </configuration>-->
<!-- <dependencies>-->
<!-- <!–mysql驱动包–>-->
<!-- <dependency>-->
<!-- <groupId>mysql</groupId>-->
<!-- <artifactId>mysql-connector-java</artifactId>-->
<!-- <version>5.1.45</version>-->
<!-- </dependency>-->
<!-- </dependencies>-->
<!-- </plugin>-->
<plugin>
<plugin>
<groupId>
org.mybatis.generator
</groupId>
<groupId>
org.mybatis.generator
</groupId>
<artifactId>
mybatis-generator-maven-plugin
</artifactId>
<artifactId>
mybatis-generator-maven-plugin
</artifactId>
<version>
1.3.
6
</version>
<version>
1.3.
2
</version>
<configuration>
<configuration>
<!-- 是否覆盖,true表示会替换生成的JAVA文件,false则不覆盖 -->
<!-- mybatis用于生成代码的配置文件 -->
<overwrite>
false
</overwrite>
<configurationFile>
src/main/resources/generatorConfig.xml
</configurationFile>
<verbose>
true
</verbose>
<overwrite>
true
</overwrite>
</configuration>
</configuration>
<dependencies>
<dependencies>
<!--mysql驱动包-->
<dependency>
<dependency>
<groupId>
mysql
</groupId>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
5.1.4
5
</version>
<version>
8.0.1
5
</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
</plugin>
</plugin>
...
...
src/main/java/com/metro/auth/platform/controller/PlatformApplicationsController.java
View file @
118b306a
...
@@ -27,7 +27,6 @@ public class PlatformApplicationsController {
...
@@ -27,7 +27,6 @@ public class PlatformApplicationsController {
@PostMapping
(
"/save"
)
@PostMapping
(
"/save"
)
public
ResultJson
saveApp
(
@RequestBody
PlatformApplications
platformApplications
)
throws
Exception
{
public
ResultJson
saveApp
(
@RequestBody
PlatformApplications
platformApplications
)
throws
Exception
{
int
count
=
platformApplicationsService
.
savaApp
(
platformApplications
);
int
count
=
platformApplicationsService
.
savaApp
(
platformApplications
);
if
(
count
>
0
){
if
(
count
>
0
){
return
ResultJson
.
ok
();
return
ResultJson
.
ok
();
...
...
src/main/java/com/metro/auth/platform/controller/PlatformApplicationsGroupController.java
0 → 100644
View file @
118b306a
package
com
.
metro
.
auth
.
platform
.
controller
;
import
com.metro.auth.platform.domain.ResultCode
;
import
com.metro.auth.platform.domain.ResultJson
;
import
com.metro.auth.platform.domain.auth.PlatformApplicationsGroup
;
import
com.metro.auth.platform.service.PlatformApplicationsGroupService
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/applicationsGroup"
)
public
class
PlatformApplicationsGroupController
{
@Resource
PlatformApplicationsGroupService
platformApplicationsGroupService
;
/**
* 分组列表
*
* @param platformApplicationsGroup
* @return resultJson
*/
@GetMapping
(
"/list"
)
public
ResultJson
list
(
PlatformApplicationsGroup
platformApplicationsGroup
)
{
List
<
PlatformApplicationsGroup
>
list
=
platformApplicationsGroupService
.
selectList
(
platformApplicationsGroup
);
return
ResultJson
.
ok
(
list
);
}
@PostMapping
(
"/add"
)
public
ResultJson
add
(
@RequestBody
PlatformApplicationsGroup
platformApplicationsGroup
)
{
int
count
=
platformApplicationsGroupService
.
insert
(
platformApplicationsGroup
);
if
(
count
>
0
)
{
return
ResultJson
.
ok
();
}
else
{
return
ResultJson
.
failure
(
ResultCode
.
RESPONSE_ERROR
);
}
}
@PostMapping
(
"/update"
)
public
ResultJson
update
(
@RequestBody
PlatformApplicationsGroup
platformApplicationsGroup
)
{
int
count
=
platformApplicationsGroupService
.
updateByPrimaryKeySelective
(
platformApplicationsGroup
);
if
(
count
>
0
)
{
return
ResultJson
.
ok
();
}
else
{
return
ResultJson
.
failure
(
ResultCode
.
RESPONSE_ERROR
);
}
}
@PostMapping
(
"/delete"
)
public
ResultJson
delete
(
@RequestBody
PlatformApplicationsGroup
platformApplicationsGroup
)
{
int
count
=
platformApplicationsGroupService
.
deleteByPrimaryKey
(
platformApplicationsGroup
.
getId
());
if
(
count
>
0
)
{
return
ResultJson
.
ok
();
}
else
{
return
ResultJson
.
failure
(
ResultCode
.
RESPONSE_ERROR
);
}
}
}
src/main/java/com/metro/auth/platform/domain/auth/PlatformApplications.java
View file @
118b306a
...
@@ -101,6 +101,15 @@ public class PlatformApplications implements Serializable {
...
@@ -101,6 +101,15 @@ public class PlatformApplications implements Serializable {
private
String
mailtype
;
private
String
mailtype
;
private
String
groupCode
;
public
String
getGroupCode
()
{
return
groupCode
;
}
public
void
setGroupCode
(
String
groupCode
)
{
this
.
groupCode
=
groupCode
;
}
public
int
getOpenmail
()
{
public
int
getOpenmail
()
{
return
openmail
;
return
openmail
;
...
...
src/main/java/com/metro/auth/platform/domain/auth/PlatformApplicationsGroup.java
0 → 100644
View file @
118b306a
package
com
.
metro
.
auth
.
platform
.
domain
.
auth
;
import
java.io.Serializable
;
import
java.util.Date
;
public
class
PlatformApplicationsGroup
implements
Serializable
{
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column platform_applications_group.id
*
* @mbggenerated
*/
private
Integer
id
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column platform_applications_group.group_name
*
* @mbggenerated
*/
private
String
groupName
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column platform_applications_group.group_code
*
* @mbggenerated
*/
private
String
groupCode
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column platform_applications_group.sort_index
*
* @mbggenerated
*/
private
Integer
sortIndex
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column platform_applications_group.create_time
*
* @mbggenerated
*/
private
Date
createTime
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column platform_applications_group.update_by
*
* @mbggenerated
*/
private
String
updateBy
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table platform_applications_group
*
* @mbggenerated
*/
private
static
final
long
serialVersionUID
=
1L
;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column platform_applications_group.id
*
* @return the value of platform_applications_group.id
*
* @mbggenerated
*/
public
Integer
getId
()
{
return
id
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column platform_applications_group.id
*
* @param id the value for platform_applications_group.id
*
* @mbggenerated
*/
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column platform_applications_group.group_name
*
* @return the value of platform_applications_group.group_name
*
* @mbggenerated
*/
public
String
getGroupName
()
{
return
groupName
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column platform_applications_group.group_name
*
* @param groupName the value for platform_applications_group.group_name
*
* @mbggenerated
*/
public
void
setGroupName
(
String
groupName
)
{
this
.
groupName
=
groupName
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column platform_applications_group.group_code
*
* @return the value of platform_applications_group.group_code
*
* @mbggenerated
*/
public
String
getGroupCode
()
{
return
groupCode
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column platform_applications_group.group_code
*
* @param groupCode the value for platform_applications_group.group_code
*
* @mbggenerated
*/
public
void
setGroupCode
(
String
groupCode
)
{
this
.
groupCode
=
groupCode
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column platform_applications_group.sort_index
*
* @return the value of platform_applications_group.sort_index
*
* @mbggenerated
*/
public
Integer
getSortIndex
()
{
return
sortIndex
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column platform_applications_group.sort_index
*
* @param sortIndex the value for platform_applications_group.sort_index
*
* @mbggenerated
*/
public
void
setSortIndex
(
Integer
sortIndex
)
{
this
.
sortIndex
=
sortIndex
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column platform_applications_group.create_time
*
* @return the value of platform_applications_group.create_time
*
* @mbggenerated
*/
public
Date
getCreateTime
()
{
return
createTime
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column platform_applications_group.create_time
*
* @param createTime the value for platform_applications_group.create_time
*
* @mbggenerated
*/
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column platform_applications_group.update_by
*
* @return the value of platform_applications_group.update_by
*
* @mbggenerated
*/
public
String
getUpdateBy
()
{
return
updateBy
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column platform_applications_group.update_by
*
* @param updateBy the value for platform_applications_group.update_by
*
* @mbggenerated
*/
public
void
setUpdateBy
(
String
updateBy
)
{
this
.
updateBy
=
updateBy
;
}
}
\ No newline at end of file
src/main/java/com/metro/auth/platform/mapper/PlatformApplicationsGroupMapper.java
0 → 100644
View file @
118b306a
package
com
.
metro
.
auth
.
platform
.
mapper
;
import
com.metro.auth.platform.domain.auth.PlatformApplicationsGroup
;
import
java.util.List
;
public
interface
PlatformApplicationsGroupMapper
{
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table platform_applications_group
*
* @mbggenerated
*/
int
deleteByPrimaryKey
(
Integer
id
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table platform_applications_group
*
* @mbggenerated
*/
int
insert
(
PlatformApplicationsGroup
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table platform_applications_group
*
* @mbggenerated
*/
int
insertSelective
(
PlatformApplicationsGroup
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table platform_applications_group
*
* @mbggenerated
*/
PlatformApplicationsGroup
selectByPrimaryKey
(
Integer
id
);
List
<
PlatformApplicationsGroup
>
selectList
(
PlatformApplicationsGroup
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table platform_applications_group
*
* @mbggenerated
*/
int
updateByPrimaryKeySelective
(
PlatformApplicationsGroup
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table platform_applications_group
*
* @mbggenerated
*/
int
updateByPrimaryKey
(
PlatformApplicationsGroup
record
);
}
\ No newline at end of file
src/main/java/com/metro/auth/platform/mapper/PlatformApplicationsGroupMapper.xml
0 → 100644
View file @
118b306a
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.metro.auth.platform.mapper.PlatformApplicationsGroupMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.metro.auth.platform.domain.auth.PlatformApplicationsGroup"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"group_name"
property=
"groupName"
jdbcType=
"VARCHAR"
/>
<result
column=
"group_code"
property=
"groupCode"
jdbcType=
"VARCHAR"
/>
<result
column=
"sort_index"
property=
"sortIndex"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_by"
property=
"updateBy"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, group_name, group_code, sort_index, create_time, update_by
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include
refid=
"Base_Column_List"
/>
from platform_applications_group
where id = #{id,jdbcType=INTEGER}
</select>
<select
id=
"selectList"
resultMap=
"BaseResultMap"
parameterType=
"com.metro.auth.platform.domain.auth.PlatformApplicationsGroup"
>
select
<include
refid=
"Base_Column_List"
/>
from platform_applications_group
<where>
<if
test=
"groupName!=null and groupName!=''"
>
and group_name = #{groupName}
</if>
<if
test=
"groupCode!=null and groupCode!=''"
>
and group_code = #{groupCode}
</if>
</where>
order by sort_index asc
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from platform_applications_group
where id = #{id,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"com.metro.auth.platform.domain.auth.PlatformApplicationsGroup"
>
insert into platform_applications_group (id, group_name, group_code,
sort_index, create_time, update_by
)
values (#{id,jdbcType=INTEGER}, #{groupName,jdbcType=VARCHAR}, #{groupCode,jdbcType=VARCHAR},
#{sortIndex,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.metro.auth.platform.domain.auth.PlatformApplicationsGroup"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into platform_applications_group
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"groupName != null"
>
group_name,
</if>
<if
test=
"groupCode != null"
>
group_code,
</if>
<if
test=
"sortIndex != null"
>
sort_index,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
<if
test=
"groupName != null"
>
#{groupName,jdbcType=VARCHAR},
</if>
<if
test=
"groupCode != null"
>
#{groupCode,jdbcType=VARCHAR},
</if>
<if
test=
"sortIndex != null"
>
#{sortIndex,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateBy != null"
>
#{updateBy,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.metro.auth.platform.domain.auth.PlatformApplicationsGroup"
>
update platform_applications_group
<set>
<if
test=
"groupName != null"
>
group_name = #{groupName,jdbcType=VARCHAR},
</if>
<if
test=
"groupCode != null"
>
group_code = #{groupCode,jdbcType=VARCHAR},
</if>
<if
test=
"sortIndex != null"
>
sort_index = #{sortIndex,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.metro.auth.platform.domain.auth.PlatformApplicationsGroup"
>
update platform_applications_group
set group_name = #{groupName,jdbcType=VARCHAR},
group_code = #{groupCode,jdbcType=VARCHAR},
sort_index = #{sortIndex,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_by = #{updateBy,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
src/main/java/com/metro/auth/platform/mapper/PlatformApplicationsMapper.xml
View file @
118b306a
差异被折叠。
点击展开。
src/main/java/com/metro/auth/platform/service/PlatformApplicationsGroupService.java
0 → 100644
View file @
118b306a
package
com
.
metro
.
auth
.
platform
.
service
;
import
com.metro.auth.platform.domain.auth.PlatformApplicationsGroup
;
import
java.util.List
;
public
interface
PlatformApplicationsGroupService
{
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table platform_applications_group
*
* @mbggenerated
*/
int
deleteByPrimaryKey
(
Integer
id
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table platform_applications_group
*
* @mbggenerated
*/
int
insert
(
PlatformApplicationsGroup
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table platform_applications_group
*
* @mbggenerated
*/
int
insertSelective
(
PlatformApplicationsGroup
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table platform_applications_group
*
* @mbggenerated
*/
PlatformApplicationsGroup
selectByPrimaryKey
(
Integer
id
);
List
<
PlatformApplicationsGroup
>
selectList
(
PlatformApplicationsGroup
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table platform_applications_group
*
* @mbggenerated
*/
int
updateByPrimaryKeySelective
(
PlatformApplicationsGroup
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table platform_applications_group
*
* @mbggenerated
*/
int
updateByPrimaryKey
(
PlatformApplicationsGroup
record
);
}
src/main/java/com/metro/auth/platform/service/PlatformApplicationsGroupServiceImpl.java
0 → 100644
View file @
118b306a
package
com
.
metro
.
auth
.
platform
.
service
;
import
com.metro.auth.platform.domain.auth.PlatformApplications
;
import
com.metro.auth.platform.domain.auth.PlatformApplicationsGroup
;
import
com.metro.auth.platform.mapper.PlatformApplicationsGroupMapper
;
import
com.metro.auth.platform.mapper.PlatformApplicationsMapper
;
import
com.metro.auth.platform.utils.DateUtil
;
import
com.metro.auth.platform.utils.StrUtil
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.List
;
@Service
public
class
PlatformApplicationsGroupServiceImpl
implements
PlatformApplicationsGroupService
{
@Resource
private
PlatformApplicationsGroupMapper
platformApplicationsGroupMapper
;
@Resource
private
PlatformApplicationsMapper
platformApplicationsMapper
;
@Override
public
int
deleteByPrimaryKey
(
Integer
id
)
{
PlatformApplicationsGroup
platformApplicationsGroup
=
selectByPrimaryKey
(
id
);
List
<
PlatformApplications
>
platformApplicationsList
=
platformApplicationsMapper
.
getPlatformApplicationsList
();
if
(!
CollectionUtils
.
isEmpty
(
platformApplicationsList
)
&&
platformApplicationsList
.
stream
().
anyMatch
(
app
->
platformApplicationsGroup
.
getGroupCode
().
equals
(
app
.
getGroupCode
())))
{
throw
new
RuntimeException
(
"该分组下存在应用,不能删除!"
);
}
return
platformApplicationsGroupMapper
.
deleteByPrimaryKey
(
id
);
}
@Override
public
int
insert
(
PlatformApplicationsGroup
record
)
{
List
<
PlatformApplicationsGroup
>
platformApplicationsGroups
=
platformApplicationsGroupMapper
.
selectList
(
new
PlatformApplicationsGroup
());
String
newGroupCode
;
if
(
platformApplicationsGroups
.
isEmpty
())
{
newGroupCode
=
"GRP001"
;
record
.
setSortIndex
(
1
);
}
else
{
platformApplicationsGroups
.
sort
((
a
,
b
)
->
b
.
getGroupCode
().
compareTo
(
a
.
getGroupCode
()));
String
maxGroupCode
=
platformApplicationsGroups
.
get
(
0
).
getGroupCode
();
int
numericPart
=
Integer
.
parseInt
(
maxGroupCode
.
substring
(
3
));
newGroupCode
=
"GRP"
+
StrUtil
.
padLeftZeros
(
numericPart
+
1
,
3
);
record
.
setSortIndex
(
numericPart
+
1
);
}
record
.
setGroupCode
(
newGroupCode
);
record
.
setCreateTime
(
new
Date
());
return
platformApplicationsGroupMapper
.
insert
(
record
);
}
@Override
public
int
insertSelective
(
PlatformApplicationsGroup
record
)
{
return
platformApplicationsGroupMapper
.
insertSelective
(
record
);
}
@Override
public
PlatformApplicationsGroup
selectByPrimaryKey
(
Integer
id
)
{
return
platformApplicationsGroupMapper
.
selectByPrimaryKey
(
id
);
}
@Override
public
List
<
PlatformApplicationsGroup
>
selectList
(
PlatformApplicationsGroup
record
)
{
return
platformApplicationsGroupMapper
.
selectList
(
record
);
}
@Override
public
int
updateByPrimaryKeySelective
(
PlatformApplicationsGroup
record
)
{
return
platformApplicationsGroupMapper
.
updateByPrimaryKeySelective
(
record
);
}
@Override
public
int
updateByPrimaryKey
(
PlatformApplicationsGroup
record
)
{
return
platformApplicationsGroupMapper
.
updateByPrimaryKey
(
record
);
}
}
src/main/java/com/metro/auth/platform/utils/StrUtil.java
View file @
118b306a
...
@@ -149,6 +149,14 @@ public class StrUtil {
...
@@ -149,6 +149,14 @@ public class StrUtil {
}
}
public
static
String
padLeftZeros
(
int
i
,
int
i1
)
{
StringBuilder
str
=
new
StringBuilder
(
String
.
valueOf
(
i
));
while
(
str
.
length
()
<
i1
)
{
str
.
insert
(
0
,
"0"
);
}
return
str
.
toString
();
}
// public static void main(String[] args) {
// public static void main(String[] args) {
// String str1 = "9,72";
// String str1 = "9,72";
// String str2 = "72,9";
// String str2 = "72,9";
...
...
src/main/resources/generatorConfig.xml
View file @
118b306a
...
@@ -20,10 +20,10 @@
...
@@ -20,10 +20,10 @@
</commentGenerator>
</commentGenerator>
<!-- 数据库连接,直接通过${}读取application.properties里的配置 -->
<!-- 数据库连接,直接通过${}读取application.properties里的配置 -->
<jdbcConnection
<jdbcConnection
driverClass=
"com.mysql.jdbc.Driver"
driverClass=
"com.mysql.
cj.
jdbc.Driver"
connectionURL=
"jdbc:mysql://
36.138.62.89:33063/platform-auth?
useUnicode=true&characterEncoding=UTF-8"
connectionURL=
"jdbc:mysql://
localhost:3306/platform_auth?serverTimezone=GMT&nullCatalogMeansCurrent=true&
useUnicode=true&characterEncoding=UTF-8"
userId=
"root"
userId=
"root"
password=
"
!QAZ2wsx#EDC2022
"
/>
password=
"
Aa123456
"
/>
<!-- 生成POJO对象,并将类放到com.songguoliang.springboot.entity包下 -->
<!-- 生成POJO对象,并将类放到com.songguoliang.springboot.entity包下 -->
<javaModelGenerator
targetPackage=
"com.metro.auth.platform.domain.auth"
targetProject=
"src/main/java"
></javaModelGenerator>
<javaModelGenerator
targetPackage=
"com.metro.auth.platform.domain.auth"
targetProject=
"src/main/java"
></javaModelGenerator>
...
@@ -34,12 +34,10 @@
...
@@ -34,12 +34,10 @@
<javaClientGenerator
targetPackage=
"com.metro.auth.platform.mapper"
targetProject=
"src/main/java"
type=
"XMLMAPPER"
></javaClientGenerator>
<javaClientGenerator
targetPackage=
"com.metro.auth.platform.mapper"
targetProject=
"src/main/java"
type=
"XMLMAPPER"
></javaClientGenerator>
<!-- table标签可以有多个,至少一个,tableName指定表名,可以使用_和%通配符 -->
<!-- table标签可以有多个,至少一个,tableName指定表名,可以使用_和%通配符 -->
<table
tableName=
"history_today"
>
<table
tableName=
"platform_applications_group"
domainObjectName=
"platformApplicationsGroup"
<!-- 是否只生成POJO对象 -->
enableCountByExample=
"false"
enableUpdateByExample=
"false"
enableDeleteByExample=
"false"
<property
name=
"modelOnly"
value=
"false"
/>
enableSelectByExample=
"false"
selectByExampleQueryId=
"false"
>
<!-- 数据库中表名有时我们都会带个前缀,而实体又不想带前缀,这个配置可以把实体的前缀去掉 -->
<property
name=
"useActualColumnNames"
value=
"false"
/>
<domainObjectRenamingRule
searchString=
"^Platform"
replaceString=
"Platform"
/>
</table>
</table>
</context>
</context>
</generatorConfiguration>
</generatorConfiguration>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论