Commit 691059d5 by 周海峰

应用分组管理

parent 118b306a
-- 添加分组菜单 -- 添加分组菜单
INSERT INTO `platform_auth`.`platform_sys_menu` (`id`, `parentId`, `path`, `icon`, `title`, `name`, `leftMemu`, INSERT INTO `platform_auth`.`platform_sys_menu` (`id`, `parentId`, `path`, `icon`, `title`, `name`, `leftMemu`,
`functionCode`, `isLock`, `sort`, `webtype`) `functionCode`, `isLock`, `sort`, `webtype`)
VALUES ('1482f54ad33a4266a3528cc2b7924a25', '7', '/platformapplicationsGroup', 'group', '应用分组', VALUES ('0452516c476b497d9fa0efd615e1434e', '7', '/platformapplicationsGroupManager', 'group_work', '应用分组管理',
'platformapplicationsGroup', 'true', 'platformapplicationsGroup', NULL, '1', NULL); 'groupManager', 'true', 'platformapplicationsGroupManager', NULL, '111', NULL);
ALTER TABLE `platform_auth`.`platform_applications`
ADD COLUMN `group_code` varchar(20) NULL COMMENT '分组编码' AFTER `mailtype`;
ALTER TABLE `platform_auth`.`platform_applications` ALTER TABLE `platform_auth`.`platform_applications`
ADD COLUMN `group_code` varchar(20) NULL COMMENT '分组编码' AFTER `mailtype`; ADD COLUMN `wechat_url` varchar(255) NULL COMMENT '企业微信入口' AFTER `group_code`;
\ No newline at end of file \ No newline at end of file
...@@ -57,4 +57,16 @@ public class PlatformApplicationsGroupController { ...@@ -57,4 +57,16 @@ public class PlatformApplicationsGroupController {
return ResultJson.failure(ResultCode.RESPONSE_ERROR); return ResultJson.failure(ResultCode.RESPONSE_ERROR);
} }
} }
@PostMapping("/updateSortIndex")
public ResultJson updateSortIndex(@RequestBody List<PlatformApplicationsGroup> list) {
int count = platformApplicationsGroupService.batchUpdateByPrimaryKey(list);
if (count > 0) {
return ResultJson.ok();
} else {
return ResultJson.failure(ResultCode.RESPONSE_ERROR);
}
}
} }
...@@ -20,7 +20,8 @@ public enum ResultCode { ...@@ -20,7 +20,8 @@ public enum ResultCode {
OPERATE_ERROR(405, "操作失败,请求操作的资源不存在"), OPERATE_ERROR(405, "操作失败,请求操作的资源不存在"),
TIME_OUT(408, "请求超时"), TIME_OUT(408, "请求超时"),
SERVER_ERROR(500, "服务器内部错误"), SERVER_ERROR(500, "服务器内部错误"),
RESPONSE_ERROR(0, "网络原因操作失败!") RESPONSE_ERROR(0, "网络原因操作失败!"),
BUSINESS_ERROR(409, "业务验证失败!")
; ;
private final int code; private final int code;
......
...@@ -102,6 +102,18 @@ public class PlatformApplications implements Serializable { ...@@ -102,6 +102,18 @@ public class PlatformApplications implements Serializable {
private String mailtype; private String mailtype;
private String groupCode; private String groupCode;
/**
* 企业微信入口
*/
private String wechatUrl;
public String getWechatUrl() {
return wechatUrl;
}
public void setWechatUrl(String wechatUrl) {
this.wechatUrl = wechatUrl;
}
public String getGroupCode() { public String getGroupCode() {
return groupCode; return groupCode;
......
...@@ -55,4 +55,6 @@ public interface PlatformApplicationsGroupMapper { ...@@ -55,4 +55,6 @@ public interface PlatformApplicationsGroupMapper {
* @mbggenerated * @mbggenerated
*/ */
int updateByPrimaryKey(PlatformApplicationsGroup record); int updateByPrimaryKey(PlatformApplicationsGroup record);
int batchUpdateByPrimaryKey(List<PlatformApplicationsGroup> list);
} }
\ No newline at end of file
...@@ -140,4 +140,21 @@ ...@@ -140,4 +140,21 @@
update_by = #{updateBy,jdbcType=VARCHAR} update_by = #{updateBy,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<!-- 批量更新-->
<update id="batchUpdateByPrimaryKey" parameterType="java.util.List">
UPDATE platform_applications_group
SET
sort_index = CASE id
<foreach collection="list" item="item" index="index">
WHEN #{item.id} THEN #{item.sortIndex}
</foreach>
END
WHERE
id IN
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.id}
</foreach>
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<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"/> <result column="group_code" jdbcType="VARCHAR" property="groupCode"/>
<result column="wechat_url" jdbcType="VARCHAR" property="wechatUrl"/>
</resultMap> </resultMap>
...@@ -109,7 +110,7 @@ ...@@ -109,7 +110,7 @@
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, id, title, img, href, addtime, tishi, databasename, databasepassword, databasecon, qyflag, appid, secret,
openmail, mailtype, group_code openmail, mailtype, group_code, wechat_url
</sql> </sql>
<select id="selectByExample" parameterType="com.metro.auth.platform.domain.auth.PlatformApplicationsExample" <select id="selectByExample" parameterType="com.metro.auth.platform.domain.auth.PlatformApplicationsExample"
resultMap="BaseResultMap"> resultMap="BaseResultMap">
...@@ -160,14 +161,16 @@ ...@@ -160,14 +161,16 @@
</delete> </delete>
<insert id="insert" parameterType="com.metro.auth.platform.domain.auth.PlatformApplications"> <insert id="insert" parameterType="com.metro.auth.platform.domain.auth.PlatformApplications">
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,group_code href, addtime, tishi,databasename,databasepassword,
databasecon,qyflag,appid,secret,openmail,mailtype,
group_code, wechat_url
) )
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}, #{databasename,jdbcType=VARCHAR}, #{databasepassword,jdbcType=VARCHAR}, #{databasecon,jdbcType=VARCHAR},
#{qyflag,jdbcType=VARCHAR}, #{qyflag,jdbcType=VARCHAR},
#{appid,jdbcType=VARCHAR},#{secret,jdbcType=VARCHAR},#{openmail,jdbcType=INTEGER}, #{appid,jdbcType=VARCHAR},#{secret,jdbcType=VARCHAR},#{openmail,jdbcType=INTEGER},
#{mailtype,jdbcType=VARCHAR},#{groupCode,jdbcType=VARCHAR} #{mailtype,jdbcType=VARCHAR},#{groupCode,jdbcType=VARCHAR}, #{wechatUrl,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">
...@@ -280,7 +283,8 @@ ...@@ -280,7 +283,8 @@
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} group_code = #{record.groupCode,jdbcType=VARCHAR},
wechat_url = #{record.wechatUrl,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/> <include refid="Update_By_Example_Where_Clause"/>
......
...@@ -57,4 +57,7 @@ public interface PlatformApplicationsGroupService { ...@@ -57,4 +57,7 @@ public interface PlatformApplicationsGroupService {
* @mbggenerated * @mbggenerated
*/ */
int updateByPrimaryKey(PlatformApplicationsGroup record); int updateByPrimaryKey(PlatformApplicationsGroup record);
int batchUpdateByPrimaryKey(List<PlatformApplicationsGroup> list);
} }
package com.metro.auth.platform.service; package com.metro.auth.platform.service;
import com.metro.auth.platform.domain.ResultCode;
import com.metro.auth.platform.domain.ResultJson;
import com.metro.auth.platform.domain.auth.PlatformApplications; import com.metro.auth.platform.domain.auth.PlatformApplications;
import com.metro.auth.platform.domain.auth.PlatformApplicationsGroup; import com.metro.auth.platform.domain.auth.PlatformApplicationsGroup;
import com.metro.auth.platform.exception.CustomException;
import com.metro.auth.platform.mapper.PlatformApplicationsGroupMapper; import com.metro.auth.platform.mapper.PlatformApplicationsGroupMapper;
import com.metro.auth.platform.mapper.PlatformApplicationsMapper; import com.metro.auth.platform.mapper.PlatformApplicationsMapper;
import com.metro.auth.platform.utils.DateUtil; import com.metro.auth.platform.utils.DateUtil;
...@@ -27,7 +30,7 @@ public class PlatformApplicationsGroupServiceImpl implements PlatformApplication ...@@ -27,7 +30,7 @@ public class PlatformApplicationsGroupServiceImpl implements PlatformApplication
List<PlatformApplications> platformApplicationsList = platformApplicationsMapper.getPlatformApplicationsList(); List<PlatformApplications> platformApplicationsList = platformApplicationsMapper.getPlatformApplicationsList();
if (!CollectionUtils.isEmpty(platformApplicationsList) && if (!CollectionUtils.isEmpty(platformApplicationsList) &&
platformApplicationsList.stream().anyMatch(app -> platformApplicationsGroup.getGroupCode().equals(app.getGroupCode()))) { platformApplicationsList.stream().anyMatch(app -> platformApplicationsGroup.getGroupCode().equals(app.getGroupCode()))) {
throw new RuntimeException("该分组下存在应用,不能删除!"); throw new CustomException(ResultJson.failure(ResultCode.BUSINESS_ERROR,"该分组下存在应用,不能删除!"));
} }
return platformApplicationsGroupMapper.deleteByPrimaryKey(id); return platformApplicationsGroupMapper.deleteByPrimaryKey(id);
} }
...@@ -75,4 +78,9 @@ public class PlatformApplicationsGroupServiceImpl implements PlatformApplication ...@@ -75,4 +78,9 @@ public class PlatformApplicationsGroupServiceImpl implements PlatformApplication
public int updateByPrimaryKey(PlatformApplicationsGroup record) { public int updateByPrimaryKey(PlatformApplicationsGroup record) {
return platformApplicationsGroupMapper.updateByPrimaryKey(record); return platformApplicationsGroupMapper.updateByPrimaryKey(record);
} }
@Override
public int batchUpdateByPrimaryKey(List<PlatformApplicationsGroup> list){
return platformApplicationsGroupMapper.batchUpdateByPrimaryKey(list);
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论