parent
fb346dde65
commit
721c07f06d
|
|
@ -34,3 +34,11 @@ export function update(integral) {
|
||||||
data:integral
|
data:integral
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取积分列表
|
||||||
|
export function getById(id) {
|
||||||
|
return request({
|
||||||
|
url: '/srb_core//admin/core/integralGrade/get/'+id,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import {save,update} from "@/api/srb/core/integral";
|
import {save, update, getById} from "@/api/srb/core/integral";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'IntegralForm',
|
name: 'IntegralForm',
|
||||||
|
|
@ -54,6 +54,12 @@ export default {
|
||||||
computed: {},
|
computed: {},
|
||||||
watch: {},
|
watch: {},
|
||||||
created() {
|
created() {
|
||||||
|
//当路由存在id属性的时候回显表单,需要调用回显接口
|
||||||
|
let id = this.$route.query.id;
|
||||||
|
if (id) {
|
||||||
|
this.getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
},
|
},
|
||||||
|
|
@ -61,20 +67,45 @@ export default {
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs['elForm'].validate(valid => {
|
this.$refs['elForm'].validate(valid => {
|
||||||
if (!valid) return
|
if (!valid) return
|
||||||
|
let id = this.$route.query.id;
|
||||||
|
if (id) {
|
||||||
|
this.updateData();
|
||||||
|
} else {
|
||||||
|
this.saveData();
|
||||||
|
}
|
||||||
|
|
||||||
this.saveData()
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
//根据id获取
|
||||||
|
getById(id) {
|
||||||
|
const loading = this.$loading({
|
||||||
|
lock: true,
|
||||||
|
text: 'Loading',
|
||||||
|
spinner: 'el-icon-loading',
|
||||||
|
background: "#666666"
|
||||||
|
});
|
||||||
|
getById(id).then(res => {
|
||||||
|
loading.close();
|
||||||
|
this.formData = res.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
//新增
|
//新增
|
||||||
saveData() {
|
saveData() {
|
||||||
save(this.formData).then(res=>{
|
save(this.formData).then(res => {
|
||||||
this.$modal.notifySuccess("保存成功");
|
this.$modal.notifySuccess("新增成功");
|
||||||
|
this.$router.push({path: '/srb/integral/list'})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//修改
|
||||||
|
updateData() {
|
||||||
|
update(this.formData).then(res => {
|
||||||
|
this.$modal.notifySuccess("修改成功");
|
||||||
|
this.$router.push({path: '/srb/integral/list'})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
resetForm() {
|
resetForm() {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,23 @@
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|
||||||
|
<router-link
|
||||||
|
:to="{
|
||||||
|
path: '/srb/integral/form/',
|
||||||
|
query: { id: scope.row.id },
|
||||||
|
}"
|
||||||
|
|
||||||
|
v-hasPermi="['srb:integralGrade:update']"
|
||||||
|
style="margin-right: 5px"
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
></el-button>
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
|
||||||
<el-popconfirm
|
<el-popconfirm
|
||||||
confirm-button-text='好的'
|
confirm-button-text='好的'
|
||||||
cancel-button-text='不用了'
|
cancel-button-text='不用了'
|
||||||
|
|
@ -64,9 +81,19 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
//获取数据
|
//获取数据
|
||||||
fetchData() {
|
fetchData() {
|
||||||
|
const loading = this.$loading({
|
||||||
|
lock: true,
|
||||||
|
text: 'Loading',
|
||||||
|
spinner: 'el-icon-loading',
|
||||||
|
background: "#666666"
|
||||||
|
});
|
||||||
|
|
||||||
getList().then(res => {
|
getList().then(res => {
|
||||||
|
loading.close();
|
||||||
this.list = res.data
|
this.list = res.data
|
||||||
|
}).catch(err => {
|
||||||
})
|
})
|
||||||
|
loading.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
//删除
|
//删除
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,16 @@ import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
import com.ruoyi.common.log.annotation.Log;
|
import com.ruoyi.common.log.annotation.Log;
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.xjs.exception.BusinessException;
|
||||||
import com.xjs.srb.core.entity.IntegralGrade;
|
import com.xjs.srb.core.entity.IntegralGrade;
|
||||||
import com.xjs.srb.core.service.IIntegralGradeService;
|
import com.xjs.srb.core.service.IIntegralGradeService;
|
||||||
|
import com.xjs.validation.group.AddGroup;
|
||||||
|
import com.xjs.validation.group.UpdateGroup;
|
||||||
import com.xjs.web.MyBaseController;
|
import com.xjs.web.MyBaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -55,7 +59,8 @@ public class IntegralGradeController extends MyBaseController<IntegralGrade> {
|
||||||
@ApiOperation("根据id更新积分等级")
|
@ApiOperation("根据id更新积分等级")
|
||||||
@RequiresPermissions("srb:integralGrade:update")
|
@RequiresPermissions("srb:integralGrade:update")
|
||||||
@Log(title = "融-积分管理", businessType = BusinessType.UPDATE)
|
@Log(title = "融-积分管理", businessType = BusinessType.UPDATE)
|
||||||
public AjaxResult updateById(IntegralGrade integralGrade) {
|
public AjaxResult updateById(@Validated(UpdateGroup.class) @RequestBody IntegralGrade integralGrade) {
|
||||||
|
this.compareSize(integralGrade);
|
||||||
return toAjax(integralGradeService.updateById(integralGrade));
|
return toAjax(integralGradeService.updateById(integralGrade));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,11 +68,21 @@ public class IntegralGradeController extends MyBaseController<IntegralGrade> {
|
||||||
@ApiOperation("保存积分等级")
|
@ApiOperation("保存积分等级")
|
||||||
@RequiresPermissions("srb:integralGrade:save")
|
@RequiresPermissions("srb:integralGrade:save")
|
||||||
@Log(title = "融-积分管理", businessType = BusinessType.INSERT)
|
@Log(title = "融-积分管理", businessType = BusinessType.INSERT)
|
||||||
public AjaxResult save(@RequestBody IntegralGrade integralGrade) {
|
public AjaxResult save(@Validated(AddGroup.class) @RequestBody IntegralGrade integralGrade) {
|
||||||
|
this.compareSize(integralGrade);
|
||||||
return toAjax(integralGradeService.save(integralGrade));
|
return toAjax(integralGradeService.save(integralGrade));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 比较大小
|
||||||
|
* @param integralGrade 积分实体
|
||||||
|
*/
|
||||||
|
private void compareSize(IntegralGrade integralGrade) {
|
||||||
|
if (integralGrade.getIntegralStart() > integralGrade.getIntegralEnd()) {
|
||||||
|
throw new BusinessException("开始区间大于结束区间!!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,15 @@ package com.xjs.srb.core.entity;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.xjs.validation.group.AddGroup;
|
||||||
|
import com.xjs.validation.group.UpdateGroup;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Min;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
@ -33,12 +37,18 @@ public class IntegralGrade implements Serializable {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ApiModelProperty("积分区间开始")
|
@ApiModelProperty("积分区间开始")
|
||||||
|
@NotNull(message = "积分区间开始不能为空",groups = {UpdateGroup.class, AddGroup.class})
|
||||||
|
@Min(message = "积分区间不能小于0",value = 0,groups = {UpdateGroup.class, AddGroup.class})
|
||||||
private Integer integralStart;
|
private Integer integralStart;
|
||||||
|
|
||||||
@ApiModelProperty("积分区间结束")
|
@ApiModelProperty("积分区间结束")
|
||||||
|
@NotNull(message = "积分区间结束不能为空",groups = {UpdateGroup.class, AddGroup.class})
|
||||||
|
@Min(message = "积分区间不能小于0",value = 0,groups = {UpdateGroup.class, AddGroup.class})
|
||||||
private Integer integralEnd;
|
private Integer integralEnd;
|
||||||
|
|
||||||
@ApiModelProperty("借款额度")
|
@ApiModelProperty("借款额度")
|
||||||
|
@NotNull(message = "借款额度不能为空",groups = {UpdateGroup.class, AddGroup.class})
|
||||||
|
@Min(message = "借款额度不能小于0",value = 0,groups = {UpdateGroup.class, AddGroup.class})
|
||||||
private BigDecimal borrowAmount;
|
private BigDecimal borrowAmount;
|
||||||
|
|
||||||
@ApiModelProperty("创建时间")
|
@ApiModelProperty("创建时间")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue