Commit 118b306a by 周海峰

分组

parent 0c051ab4
-- 添加分组菜单
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
...@@ -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>-->
<!-- &lt;!&ndash; 是否覆盖,true表示会替换生成的JAVA文件,false则不覆盖 &ndash;&gt;-->
<!-- <overwrite>false</overwrite>-->
<!-- </configuration>-->
<!-- <dependencies>-->
<!-- &lt;!&ndash;mysql驱动包&ndash;&gt;-->
<!-- <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.45</version> <version>8.0.15</version>
</dependency> </dependency>
</dependencies> </dependencies>
</plugin> </plugin>
......
...@@ -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();
......
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);
}
}
}
...@@ -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;
......
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
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
<?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
...@@ -6,14 +6,15 @@ ...@@ -6,14 +6,15 @@
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
<id column="id" jdbcType="INTEGER" property="id" /> <id column="id" jdbcType="INTEGER" property="id"/>
<result column="title" jdbcType="VARCHAR" property="title" /> <result column="title" jdbcType="VARCHAR" property="title"/>
<result column="img" jdbcType="VARCHAR" property="img" /> <result column="img" jdbcType="VARCHAR" property="img"/>
<result column="href" jdbcType="VARCHAR" property="href" /> <result column="href" jdbcType="VARCHAR" property="href"/>
<result column="addtime" jdbcType="VARCHAR" property="addtime" /> <result column="addtime" jdbcType="VARCHAR" property="addtime"/>
<result column="tishi" jdbcType="INTEGER" property="tishi" /> <result column="tishi" jdbcType="INTEGER" property="tishi"/>
<result column="openmail" jdbcType="INTEGER" property="openmail" /> <result column="openmail" jdbcType="INTEGER" property="openmail"/>
<result column="mailtype" jdbcType="VARCHAR" property="mailtype" /> <result column="mailtype" jdbcType="VARCHAR" property="mailtype"/>
<result column="group_code" jdbcType="VARCHAR" property="groupCode"/>
</resultMap> </resultMap>
...@@ -23,7 +24,7 @@ ...@@ -23,7 +24,7 @@
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from platform_applications from platform_applications
where where
mailtype = #{param1 ,jdbcType=VARCHAR} mailtype = #{param1 ,jdbcType=VARCHAR}
...@@ -56,7 +57,8 @@ ...@@ -56,7 +57,8 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
...@@ -89,7 +91,8 @@ ...@@ -89,7 +91,8 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
...@@ -105,9 +108,11 @@ ...@@ -105,9 +108,11 @@
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
id, title, img, href, addtime, tishi, databasename, databasepassword, databasecon, qyflag, appid, secret, openmail, mailtype id, title, img, href, addtime, tishi, databasename, databasepassword, databasecon, qyflag, appid, secret,
openmail, mailtype, group_code
</sql> </sql>
<select id="selectByExample" parameterType="com.metro.auth.platform.domain.auth.PlatformApplicationsExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.metro.auth.platform.domain.auth.PlatformApplicationsExample"
resultMap="BaseResultMap">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
...@@ -116,10 +121,10 @@ ...@@ -116,10 +121,10 @@
<if test="distinct"> <if test="distinct">
distinct distinct
</if> </if>
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from platform_applications from platform_applications
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause"/>
</if> </if>
<if test="orderByClause != null"> <if test="orderByClause != null">
order by ${orderByClause} order by ${orderByClause}
...@@ -131,7 +136,7 @@ ...@@ -131,7 +136,7 @@
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from platform_applications from platform_applications
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
...@@ -150,27 +155,22 @@ ...@@ -150,27 +155,22 @@
--> -->
delete from platform_applications delete from platform_applications
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause"/>
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.metro.auth.platform.domain.auth.PlatformApplications"> <insert id="insert" parameterType="com.metro.auth.platform.domain.auth.PlatformApplications">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into platform_applications (id, title, img, insert into platform_applications (id, title, img,
href, addtime, tishi,databasename,databasepassword,databasecon,qyflag,appid,secret,openmail,mailtype href, addtime, tishi,databasename,databasepassword,databasecon,qyflag,appid,secret,openmail,mailtype,group_code
) )
values (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{img,jdbcType=VARCHAR}, values (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{img,jdbcType=VARCHAR},
#{href,jdbcType=VARCHAR}, #{addtime,jdbcType=VARCHAR}, #{tishi,jdbcType=INTEGER}, #{href,jdbcType=VARCHAR}, #{addtime,jdbcType=VARCHAR}, #{tishi,jdbcType=INTEGER},
#{databasename,jdbcType=VARCHAR}, #{databasepassword,jdbcType=VARCHAR}, #{databasecon,jdbcType=VARCHAR}, #{qyflag,jdbcType=VARCHAR}, #{appid,jdbcType=VARCHAR},#{secret,jdbcType=VARCHAR},#{openmail,jdbcType=INTEGER},#{mailtype,jdbcType=VARCHAR} #{databasename,jdbcType=VARCHAR}, #{databasepassword,jdbcType=VARCHAR}, #{databasecon,jdbcType=VARCHAR},
#{qyflag,jdbcType=VARCHAR},
#{appid,jdbcType=VARCHAR},#{secret,jdbcType=VARCHAR},#{openmail,jdbcType=INTEGER},
#{mailtype,jdbcType=VARCHAR},#{groupCode,jdbcType=VARCHAR}
) )
</insert> </insert>
<insert id="insertSelective" parameterType="com.metro.auth.platform.domain.auth.PlatformApplications"> <insert id="insertSelective" parameterType="com.metro.auth.platform.domain.auth.PlatformApplications">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into platform_applications insert into platform_applications
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
...@@ -213,14 +213,15 @@ ...@@ -213,14 +213,15 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.metro.auth.platform.domain.auth.PlatformApplicationsExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.metro.auth.platform.domain.auth.PlatformApplicationsExample"
resultType="java.lang.Long">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
select count(*) from platform_applications select count(*) from platform_applications
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause"/>
</if> </if>
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
...@@ -256,7 +257,7 @@ ...@@ -256,7 +257,7 @@
</if> </if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause"/>
</if> </if>
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
...@@ -278,9 +279,11 @@ ...@@ -278,9 +279,11 @@
databasecon = #{record.databasecon,jdbcType=VARCHAR}, databasecon = #{record.databasecon,jdbcType=VARCHAR},
qyflag = #{record.qyflag,jdbcType=VARCHAR}, qyflag = #{record.qyflag,jdbcType=VARCHAR},
openmail = #{record.openmail,jdbcType=INTEGER}, openmail = #{record.openmail,jdbcType=INTEGER},
mailtype = #{record.mailtype,jdbcType=VARCHAR} mailtype = #{record.mailtype,jdbcType=VARCHAR},
group_code = #{record.groupCode,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause"/>
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="com.metro.auth.platform.domain.auth.PlatformApplications"> <update id="updateByPrimaryKeySelective" parameterType="com.metro.auth.platform.domain.auth.PlatformApplications">
......
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);
}
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);
}
}
...@@ -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";
......
...@@ -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&amp;characterEncoding=UTF-8" connectionURL="jdbc:mysql://localhost:3306/platform_auth?serverTimezone=GMT&amp;nullCatalogMeansCurrent=true&amp;useUnicode=true&amp;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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论