Commit be9aff95 by 周海峰

no message

parent 41cc9554
......@@ -52,6 +52,21 @@ public class PlatformApplicationsController {
return ResultJson.ok(list);
}
/**
* 批量更新应用排序
* @param list 包含 id 与 num 字段的应用列表
* @return 操作结果
*/
@PostMapping("/platformapplications/updateOrder")
public ResultJson updateOrder(@RequestBody List<PlatformApplications> list) {
int count = platformApplicationsService.updateOrder(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);
......
......@@ -21,10 +21,6 @@
<select id="selectListByMailType" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List"/>
from platform_applications
......@@ -38,10 +34,6 @@
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
......@@ -120,9 +112,10 @@
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause} + 0
</if>
<!-- <if test="orderByClause != null">-->
<!-- order by ${orderByClause}-->
<!-- </if>-->
order by num + 0
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
......@@ -315,6 +308,9 @@
<if test="tishi != null">
tishi = #{tishi,jdbcType=INTEGER},
</if>
<if test="num != null">
num = #{num,jdbcType=VARCHAR},
</if>
<if test="appEnable != null">
app_enable = #{appEnable,jdbcType=VARCHAR},
</if>
......@@ -338,13 +334,9 @@
<select id="getPlatformApplicationsList" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select *,id value,title label
from platform_applications
order by num + 0
</select>
<select id="getPlatformApplicationsListByRole" parameterType="java.lang.String" resultMap="BaseResultMap">
......
......@@ -16,4 +16,11 @@ public interface PlatformApplicationsService {
List<PlatformApplications> getPlatformApplicationsList();
List<PlatformApplications> getPlatformApplicationsListByUserid(String userid);
List<PlatformApplications> getPlatformApplicationsListByRole(String id);
/**
* 批量更新应用排序(num 字段)
* @param list 包含 id 与 num 的应用列表
* @return 更新数量
*/
int updateOrder(List<PlatformApplications> list);
}
......@@ -88,6 +88,23 @@ public class PlatformApplicationsServiceImpl implements PlatformApplicationsServ
}
@Override
public int updateOrder(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.setNum(item.getNum());
updated += platformApplicationsMapper.updateByPrimaryKeySelective(record);
}
}
return updated;
}
@Override
public List<PlatformApplications> getPlatformApplicationsListByUserid(String userid) {
// 1. 查询所有启用的应用
PlatformApplicationsExample example = new PlatformApplicationsExample();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论