Commit be9aff95 by 周海峰

no message

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