套餐排序,暂未测试
This commit is contained in:
parent
a44c907099
commit
49f1c50460
|
@ -114,21 +114,6 @@ public class SmUser extends BaseEntity
|
|||
@ApiModelProperty("最后登录时间")
|
||||
private Date loginDate;
|
||||
|
||||
/** 微信 */
|
||||
@Excel(name = "微信")
|
||||
@ApiModelProperty("微信")
|
||||
private String wechat;
|
||||
|
||||
/** 身份证号 */
|
||||
@ApiModelProperty("身份证号")
|
||||
@Sensitive(desensitizedType = DesensitizedType.ID_CARD)
|
||||
private String identityCard;
|
||||
|
||||
/** 用户地址 */
|
||||
@Excel(name = "用户地址")
|
||||
@ApiModelProperty("用户地址")
|
||||
private String address ;
|
||||
|
||||
@ApiModelProperty("微信openId")
|
||||
private String wxOpenId;
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.ruoyi.common.utils.collection;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -31,71 +32,62 @@ public class CollectionUtils extends org.springframework.util.CollectionUtils {
|
|||
return !isEmptyElement(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充列表中的元素
|
||||
* @param oldList 旧列表
|
||||
* @param startDate 起始日期
|
||||
* @param endDate 结束日期
|
||||
* @param clazz 填充元素的类
|
||||
*/
|
||||
public static List<? super FillAble> fillElement(List<? extends FillAble> oldList, Date startDate, Date endDate,Class<? extends FillAble> clazz ) throws InstantiationException, IllegalAccessException {
|
||||
List<FillAble> newList = new ArrayList<>();
|
||||
while (startDate.compareTo(endDate) <= 0) {
|
||||
Date finalI = startDate;
|
||||
FillAble fillable = oldList.stream().filter(item -> DateUtils.getYYYY_MM_DD(item.fillDate()).equals(DateUtils.getYYYY_MM_DD(finalI))).findFirst().orElse(null);
|
||||
if (fillable == null) {
|
||||
fillable = clazz.newInstance().fillElement(finalI);
|
||||
}
|
||||
newList.add(fillable);
|
||||
startDate = DateUtils.addDays(startDate,1);
|
||||
}
|
||||
return newList;
|
||||
public static boolean isNotEmpty(List<?> list) {
|
||||
return !isEmpty(list);
|
||||
}
|
||||
|
||||
|
||||
// TODO 未经验证
|
||||
/**
|
||||
* 补全列表中的日期数据,对于缺失的日期使用提供的工厂方法生成对象。
|
||||
*
|
||||
* @param dataList 原始数据列表,元素需有getDateMethod返回Date类型属性的方法
|
||||
* @param dateGetter 获取元素日期属性的方法引用
|
||||
* @param customFactory 当日期缺失时,用于生成对应元素的对象工厂方法
|
||||
* @param <T> 数据列表中元素的类型
|
||||
* @return 完整日期序列下的数据列表,缺失的日期已由customFactory填充
|
||||
* 判断分隔字符串中是否存在目标元素
|
||||
* @param str 分隔字符串
|
||||
* @param split 分隔符
|
||||
* @param target 目标元素
|
||||
* @param parseMapper 类型转换方法
|
||||
*/
|
||||
public static <T> List<T> completeMissingDates(List<T> dataList,
|
||||
Function<T, Date> dateGetter,
|
||||
Function<Date, T> customFactory) {
|
||||
if (dataList == null || dataList.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
public static <T> boolean splitContains(String str, String split, T target, Function<String, ? extends T> parseMapper) {
|
||||
if (!StringUtils.hasText(str)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<Date> dates = dataList.stream()
|
||||
.map(dateGetter)
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Date startDate = dates.get(0);
|
||||
Date endDate = dates.get(dates.size() - 1);
|
||||
|
||||
List<Date> fullDates = new ArrayList<>();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(startDate);
|
||||
|
||||
while (!calendar.getTime().after(endDate)) {
|
||||
fullDates.add(calendar.getTime());
|
||||
calendar.add(Calendar.DATE, 1);
|
||||
}
|
||||
|
||||
Map<Date, T> dateToObjectMap = dataList.stream()
|
||||
.collect(Collectors.toMap(dateGetter, Function.identity()));
|
||||
|
||||
return fullDates.stream()
|
||||
.map(date -> dateToObjectMap.getOrDefault(date, customFactory.apply(date)))
|
||||
.collect(Collectors.toList());
|
||||
return Arrays.stream(str.split(split)).map(parseMapper).collect(Collectors.toList()).contains(target);
|
||||
}
|
||||
|
||||
public static boolean isNotEmpty(List<?> deviceList) {
|
||||
return !isEmpty(deviceList);
|
||||
/**
|
||||
* 集合映射,去除空值、重复值
|
||||
*/
|
||||
public static <T, R> List<R> map(List<T> list, Function<? super T, ? extends R> keyMapper) {
|
||||
return list.stream().map(keyMapper).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 累加 BigDecimal
|
||||
*/
|
||||
public static <T> BigDecimal sumBigDecimal(List<? extends T> list, Function<T, BigDecimal> valueMapper) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return list.stream().filter(Objects::nonNull)
|
||||
.map(valueMapper)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
|
||||
/**
|
||||
* 累加 Integer
|
||||
*/
|
||||
public static <T> Integer sumInteger(List<? extends T> list, Function<T, Integer> valueMapper) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return 0;
|
||||
}
|
||||
return list.stream().filter(Objects::nonNull)
|
||||
.map(valueMapper)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(Integer::sum)
|
||||
.orElse(0);
|
||||
}
|
||||
|
||||
public static <T> void addNotNull(List<? super T> list, T obj) {
|
||||
if (obj == null) {
|
||||
return;
|
||||
}
|
||||
list.add(obj);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,10 +110,10 @@
|
|||
v-hasPermi="['${moduleName}:${businessName}:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="onSortChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
#foreach($column in $columns)
|
||||
#set($javaField=$column.javaField)
|
||||
|
@ -124,13 +124,9 @@
|
|||
#set($comment=$column.columnComment)
|
||||
#end
|
||||
#if($column.pk)
|
||||
<el-table-column label="${comment}" align="center" prop="${javaField}" />
|
||||
<el-table-column label="${comment}" align="center" prop="${javaField}" sortable="custom" :sort-orders="orderSorts"/>
|
||||
#elseif($column.list && $column.htmlType == "datetime")
|
||||
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180" sortable="custom" :sort-orders="orderSorts"/>
|
||||
#elseif($column.list && $column.htmlType == "imageUpload")
|
||||
<el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
|
||||
<template slot-scope="scope">
|
||||
|
@ -138,7 +134,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
#elseif($column.list && "" != $column.dictType)
|
||||
<el-table-column label="${comment}" align="center" prop="${javaField}">
|
||||
<el-table-column label="${comment}" align="center" prop="${javaField}" sortable="custom" :sort-orders="orderSorts">
|
||||
<template slot-scope="scope">
|
||||
#if($column.htmlType == "checkbox")
|
||||
<dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
|
||||
|
@ -148,7 +144,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
#elseif($column.list && "" != $javaField)
|
||||
<el-table-column label="${comment}" align="center" prop="${javaField}" />
|
||||
<el-table-column label="${comment}" align="center" prop="${javaField}" sortable="custom" :sort-orders="orderSorts"/>
|
||||
#end
|
||||
#end
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
|
@ -170,7 +166,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
|
@ -355,6 +351,12 @@
|
|||
<script>
|
||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
||||
|
||||
// 默认排序字段
|
||||
const defaultSort = {
|
||||
prop: "createTime",
|
||||
order: "descending"
|
||||
}
|
||||
|
||||
export default {
|
||||
name: "${BusinessName}",
|
||||
#if(${dicts} != '')
|
||||
|
@ -362,6 +364,15 @@ export default {
|
|||
#end
|
||||
data() {
|
||||
return {
|
||||
|
||||
#foreach($column in $columns)
|
||||
// 字段列表
|
||||
columns: [
|
||||
{key: '${column.javaField}', visible: true, label: '${column.columnComment}'},
|
||||
],
|
||||
#end
|
||||
// 排序方式
|
||||
orderSorts: ['ascending', 'descending', null],
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
|
@ -395,10 +406,13 @@ export default {
|
|||
daterange${AttrName}: [],
|
||||
#end
|
||||
#end
|
||||
defaultSort,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
orderByColumn: defaultSort.prop,
|
||||
isAsc: defaultSort.order,
|
||||
#foreach ($column in $columns)
|
||||
#if($column.query)
|
||||
$column.javaField: null#if($foreach.count != $columns.size()),#end
|
||||
|
@ -429,6 +443,17 @@ export default {
|
|||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 当排序按钮被点击时触发 **/
|
||||
onSortChange(column) {
|
||||
if (column.order == null) {
|
||||
this.queryParams.orderByColumn = defaultSort.prop;
|
||||
this.queryParams.isAsc = defaultSort.order;
|
||||
} else {
|
||||
this.queryParams.orderByColumn = column.prop;
|
||||
this.queryParams.isAsc = column.order;
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
/** 查询${functionName}列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
|
|
|
@ -80,4 +80,7 @@ public class Suit extends BaseEntity
|
|||
|
||||
@ApiModelProperty("用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("排序顺序,越小越靠前")
|
||||
private Integer sort;
|
||||
}
|
||||
|
|
|
@ -100,4 +100,9 @@ public interface SuitMapper
|
|||
* 批量新增
|
||||
*/
|
||||
int batchInsert(@Param("list") List<Suit> list);
|
||||
|
||||
/**
|
||||
* 批量修改排序
|
||||
*/
|
||||
int batchUpdateSort(@Param("list") List<? extends Suit> list);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ss.source_id,
|
||||
ss.time_unit,
|
||||
ss.user_id,
|
||||
ss.sort,
|
||||
sd.device_name as device_name,
|
||||
su.user_name as user_name,
|
||||
store.name as store_name
|
||||
|
@ -107,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="sourceId != null">source_id,</if>
|
||||
<if test="timeUnit != null">time_unit,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="sort != null">sort,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceId != null">#{deviceId},</if>
|
||||
|
@ -122,6 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="sourceId != null">#{sourceId},</if>
|
||||
<if test="timeUnit != null">#{timeUnit},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="sort != null">#{sort},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -139,7 +142,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
deleted,
|
||||
source_id,
|
||||
time_unit,
|
||||
user_id
|
||||
user_id,
|
||||
sort
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
|
@ -170,6 +174,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="i.timeUnit == null">default,</if>
|
||||
<if test="i.userId != null">#{i.userId},</if>
|
||||
<if test="i.userId == null">default,</if>
|
||||
<if test="i.sort != null">#{i.sort},</if>
|
||||
<if test="i.sort == null">default,</if>
|
||||
</trim>
|
||||
</foreach>
|
||||
|
||||
|
@ -194,6 +200,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="sourceId != null">source_id = #{sourceId},</if>
|
||||
<if test="timeUnit != null">time_unit = #{timeUnit},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="sort != null">sort = #{sort},</if>
|
||||
</sql>
|
||||
|
||||
<update id="logicDel">
|
||||
|
@ -225,6 +232,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where suit_id = #{suitId}
|
||||
</update>
|
||||
|
||||
<update id="batchUpdateSort">
|
||||
update sm_suit
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<foreach open="sort = CASE suit_id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.sort != null">
|
||||
WHEN #{item.suitId} THEN #{item.sort}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.suitId} THEN `sort`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
where suit_id in
|
||||
<foreach collection="list" open="(" close=")" item="i" separator=",">
|
||||
#{i}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<delete id="deleteSuitBySuitId" parameterType="Long">
|
||||
delete from sm_suit where suit_id = #{suitId}
|
||||
</delete>
|
||||
|
|
|
@ -119,4 +119,9 @@ public interface SuitService
|
|||
* 批量插入
|
||||
*/
|
||||
int batchInsert(List<Suit> list);
|
||||
|
||||
/**
|
||||
* 设置排序
|
||||
*/
|
||||
int setSort(List<? extends Suit> list);
|
||||
}
|
||||
|
|
|
@ -87,6 +87,14 @@ public class SuitServiceImpl implements SuitService
|
|||
return suitMapper.batchInsert(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setSort(List<? extends Suit> list) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return 0;
|
||||
}
|
||||
return suitMapper.batchUpdateSort(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入前操作
|
||||
*/
|
||||
|
|
|
@ -5,37 +5,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<mapper namespace="com.ruoyi.ss.user.mapper.SmUserMapper">
|
||||
|
||||
<resultMap type="SmUserVo" id="SmUserResult" autoMapping="true">
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="userName" column="user_name" />
|
||||
<result property="nickName" column="nick_name" />
|
||||
<result property="email" column="email" />
|
||||
<result property="phonenumber" column="phonenumber" />
|
||||
<result property="birthday" column="birthday" />
|
||||
<result property="sex" column="sex" />
|
||||
<result property="avatar" column="avatar" />
|
||||
<result property="password" column="password" />
|
||||
<result property="balance" column="balance" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler" />
|
||||
<result property="payPassword" column="pay_password" />
|
||||
<result property="status" column="status" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="loginIp" column="login_ip" />
|
||||
<result property="loginDate" column="login_date" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="rechargeAmount" column="recharge_amount" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler" />
|
||||
<result property="withDrawlAmount" column="with_drawl_amount" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler" />
|
||||
<result property="wechat" column="wechat" />
|
||||
<result property="totalIncome" column="total_income" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler" />
|
||||
<result property="identityCard" column="identity_card" />
|
||||
<result property="address" column="address" />
|
||||
<result property="wxOpenId" column="wx_open_id" />
|
||||
<result property="deleteTime" column="delete_time" />
|
||||
<result property="isMch" column="is_mch" />
|
||||
<result property="serviceRate" column="service_rate" />
|
||||
<result property="deviceAdmin" column="device_admin" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSmUserVo">
|
||||
|
@ -60,9 +33,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
su.update_by,
|
||||
su.update_time,
|
||||
su.remark,
|
||||
su.wechat,
|
||||
su.address,
|
||||
su.identity_card,
|
||||
su.wx_open_id,
|
||||
su.delete_time,
|
||||
su.is_mch,
|
||||
|
@ -167,9 +137,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="wechat != null">wechat,</if>
|
||||
<if test="identityCard != null">identity_card,</if>
|
||||
<if test="address != null">address,</if>
|
||||
<if test="wxOpenId != null">wx_open_id,</if>
|
||||
<if test="deleteTime != null">delete_time,</if>
|
||||
<if test="isMch != null">is_mch,</if>
|
||||
|
@ -196,9 +163,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="wechat != null">#{wechat},</if>
|
||||
<if test="identityCard != null">#{identityCard},</if>
|
||||
<if test="address != null">#{address},</if>
|
||||
<if test="wxOpenId != null">#{wxOpenId},</if>
|
||||
<if test="deleteTime != null">#{deleteTime},</if>
|
||||
<if test="isMch != null">#{isMch},</if>
|
||||
|
@ -235,8 +199,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="identityCard != null">identity_card = #{identityCard},</if>
|
||||
<if test="address != null">address = #{address},</if>
|
||||
<if test="wxOpenId != null">wx_open_id = #{wxOpenId},</if>
|
||||
<if test="deleteTime != null">delete_time = #{deleteTime},</if>
|
||||
<if test="isMch != null">is_mch = #{isMch},</if>
|
||||
|
|
|
@ -57,8 +57,7 @@ public class SmUserServiceImpl implements ISmUserService
|
|||
* @return 普通用户信息
|
||||
*/
|
||||
@Override
|
||||
public SmUserVo selectSmUserByUserId(Long userId)
|
||||
{
|
||||
public SmUserVo selectSmUserByUserId(Long userId) {
|
||||
return smUserMapper.selectSmUserByUserId(userId);
|
||||
}
|
||||
|
||||
|
@ -86,7 +85,6 @@ public class SmUserServiceImpl implements ISmUserService
|
|||
return;
|
||||
}
|
||||
list.forEach(item -> {
|
||||
item.setIdentityCard(null);
|
||||
item.setPassword(null);
|
||||
item.setPayPassword(null);
|
||||
});
|
||||
|
@ -329,20 +327,6 @@ public class SmUserServiceImpl implements ISmUserService
|
|||
return smUserMapper.selectSmUserByWxOpenId(wxOpenId);
|
||||
}
|
||||
|
||||
// 根据身份证号查询用户信息
|
||||
private SmUserVo selectUserByIdCard(String idCard) {
|
||||
if (idCard == null) {
|
||||
return null;
|
||||
}
|
||||
SmUserQuery dto = new SmUserQuery();
|
||||
dto.setIdentityCard(idCard);
|
||||
List<SmUserVo> list = smUserMapper.selectSmUserList(dto);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return null;
|
||||
}
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改普通用户信息
|
||||
*
|
||||
|
|
|
@ -7,7 +7,9 @@ import com.ruoyi.common.core.domain.JsonViewProfile;
|
|||
import com.ruoyi.common.core.domain.ValidGroup;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.ss.device.service.DeviceValidator;
|
||||
import com.ruoyi.ss.suit.domain.Suit;
|
||||
import com.ruoyi.ss.suit.domain.SuitBO;
|
||||
import com.ruoyi.ss.suit.domain.SuitQuery;
|
||||
import com.ruoyi.ss.suit.domain.SuitVo;
|
||||
|
@ -109,4 +111,14 @@ public class AppSuitController extends BaseController {
|
|||
return toAjax(suitService.logicDelByDeviceId(deviceId));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("套餐排序")
|
||||
@PutMapping("/sort")
|
||||
public AjaxResult setSort(@RequestBody List<Suit> list) {
|
||||
if (!suitValidator.isBelong(CollectionUtils.map(list, Suit::getSuitId), getUserId())) {
|
||||
return error("不允许操作不属于自己的套餐");
|
||||
}
|
||||
return toAjax(suitService.setSort(list));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,10 +8,12 @@ import com.ruoyi.common.core.domain.ValidGroup;
|
|||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.ss.device.domain.vo.DeviceVO;
|
||||
import com.ruoyi.ss.device.service.DeviceService;
|
||||
import com.ruoyi.ss.suit.domain.Suit;
|
||||
import com.ruoyi.ss.suit.domain.SuitBO;
|
||||
import com.ruoyi.ss.suit.domain.SuitQuery;
|
||||
import com.ruoyi.ss.suit.domain.SuitVo;
|
||||
import com.ruoyi.ss.suit.service.SuitValidator;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
Loading…
Reference in New Issue
Block a user