Commit 3a1726f3 by 周海峰

no message

parent 4f916bff
......@@ -50,4 +50,17 @@ VALUES ('1', '系统公告', 'menu_announcement', 1, 1),
('6', '网上培训', 'menu_wangshang', 6, 1),
('7', '廉政文化', 'menu_lianzheng', 7, 1),
('8', '员工天地', 'menu_yuangong', 8, 1),
('9', '常用表格', 'menu_biaoge', 9, 1);
\ No newline at end of file
('9', '常用表格', 'menu_biaoge', 9, 1);
-- 如果是新建表,添加字段
ALTER TABLE platform_applications ADD COLUMN wechat_num VARCHAR(50) DEFAULT NULL COMMENT '组内排序编号';
-- 如果是更新已有数据,将现有数据的 wechat_num 初始化为当前排序
UPDATE platform_applications
SET wechat_num = (
SELECT t.num FROM (
SELECT id, ROW_NUMBER() OVER (ORDER BY addtime, id) AS num
FROM platform_applications
) t WHERE t.id = platform_applications.id
);
......@@ -67,6 +67,21 @@ public class PlatformApplicationsController {
}
}
/**
* 批量更新组内应用排序(wechatNum 字段)
* @param list 包含 id 与 wechatNum 字段的应用列表
* @return 操作结果
*/
@PostMapping("/platformapplications/updateWechatNum")
public ResultJson updateWechatNum(@RequestBody List<PlatformApplications> list) {
int count = platformApplicationsService.updateWechatNum(list);
if (count >= 0) {
return ResultJson.ok();
} else {
return ResultJson.failure(ResultCode.RESPONSE_ERROR);
}
}
@GetMapping("/platformapplications/listbyrole/{roleid}")
public ResultJson listbyrole(@PathVariable String roleid){
List<PlatformApplications> list = platformApplicationsService.getPlatformApplicationsListByRole(roleid);
......
......@@ -110,6 +110,19 @@ public class PlatformApplications implements Serializable {
*/
private String num;
/**
* 组内排序编号
*/
private String wechatNum;
public String getWechatNum() {
return wechatNum;
}
public void setWechatNum(String wechatNum) {
this.wechatNum = wechatNum;
}
public String getNum() {
return num;
}
......
......@@ -98,7 +98,7 @@
</sql>
<sql id="Base_Column_List">
id, title, img, href, addtime, tishi, databasename, databasepassword, databasecon, qyflag, appid, secret,
openmail, mailtype, group_code, wechat_url, num
openmail, mailtype, group_code, wechat_url, num, wechat_num
</sql>
<select id="selectByExample" parameterType="com.metro.auth.platform.domain.auth.PlatformApplicationsExample"
resultMap="BaseResultMap">
......@@ -302,7 +302,9 @@
<if test="num != null">
num = #{num,jdbcType=VARCHAR},
</if>
<if test="wechatNum != null">
wechat_num = #{wechatNum,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
......
......@@ -23,4 +23,11 @@ public interface PlatformApplicationsService {
* @return 更新数量
*/
int updateOrder(List<PlatformApplications> list);
/**
* 批量更新组内应用排序(wechatNum 字段)
* @param list 包含 id 与 wechatNum 的应用列表
* @return 更新数量
*/
int updateWechatNum(List<PlatformApplications> list);
}
......@@ -105,6 +105,23 @@ public class PlatformApplicationsServiceImpl implements PlatformApplicationsServ
}
@Override
public int updateWechatNum(List<PlatformApplications> list) {
int updated = 0;
if (list == null || list.isEmpty()) {
return updated;
}
for (PlatformApplications item : list) {
if (item.getId() != null) {
PlatformApplications record = new PlatformApplications();
record.setId(item.getId());
record.setWechatNum(item.getWechatNum());
updated += platformApplicationsMapper.updateByPrimaryKeySelective(record);
}
}
return updated;
}
@Override
public List<PlatformApplications> getPlatformApplicationsListByUserid(String userid) {
// 1. 查询所有启用的应用
PlatformApplicationsExample example = new PlatformApplicationsExample();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论