删除版本相关功能完善

This commit is contained in:
SjS 2025-05-16 10:33:36 +08:00
parent decbefe7d7
commit c0f41d8f7a
14 changed files with 455 additions and 301 deletions

View File

@ -1,6 +1,7 @@
package com.ruoyi.common.core.domain; package com.ruoyi.common.core.domain;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;

View File

@ -25,13 +25,22 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="型号" prop="model"> <el-form-item label="型号" prop="model">
<el-input <el-select
v-model="queryParams.model" v-model="queryParams.modelId"
placeholder="请输入型号" filterable
clearable clearable
@keyup.enter.native="handleQuery" placeholder="请输入或选择型号"
/> @change="handleQuery"
>
<el-option
v-for="item in modelOptions"
:key="item.modelId"
:label="`${item.model}${item.modelName}`"
:value="item.modelId"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="Mac号" prop="mac"> <el-form-item label="Mac号" prop="mac">
<el-input <el-input
@ -46,6 +55,7 @@
v-model="queryParams.onlineStatus" v-model="queryParams.onlineStatus"
placeholder="请选择在线状态" placeholder="请选择在线状态"
clearable clearable
@change="handleQuery"
> >
<el-option <el-option
v-for="dict in dict.type.as_online_status" v-for="dict in dict.type.as_online_status"
@ -69,10 +79,12 @@
icon="el-icon-search" icon="el-icon-search"
size="mini" size="mini"
@click="handleQuery" @click="handleQuery"
>搜索</el-button >搜索
</el-button
> >
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery" <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button >重置
</el-button
> >
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -87,7 +99,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['device:device:add']" v-hasPermi="['device:device:add']"
>新增</el-button >新增
</el-button
> >
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@ -99,7 +112,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['device:device:edit']" v-hasPermi="['device:device:edit']"
>修改</el-button >修改
</el-button
> >
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@ -111,7 +125,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['device:device:remove']" v-hasPermi="['device:device:remove']"
>删除</el-button >删除
</el-button
> >
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@ -122,7 +137,8 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['device:device:export']" v-hasPermi="['device:device:export']"
>导出</el-button >导出
</el-button
> >
</el-col> </el-col>
<right-toolbar <right-toolbar
@ -137,20 +153,19 @@
:data="deviceList" :data="deviceList"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="id" align="center" prop="deviceId" /> <el-table-column label="设备Mac号" align="center" prop="mac"/>
<el-table-column label="分类" align="center" prop="classifyName" /> <el-table-column label="分类" align="center" prop="classifyName"/>
<el-table-column label="设备Mac号" align="center" prop="mac" /> <el-table-column label="型号" align="center" prop="model"/>
<el-table-column label="型号" align="center" prop="model" /> <el-table-column label="型号名称" align="center" prop="modelName"/>
<el-table-column label="型号名称" align="center" prop="modelName" />
<el-table-column label="型号图片" align="center" prop="modelPicture" width="100"> <el-table-column label="型号图片" align="center" prop="modelPicture" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<image-preview :src="scope.row.modelPicture" :width="50" :height="50" /> <image-preview :src="scope.row.modelPicture" :width="50" :height="50"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="版本号" align="center" prop="version" /> <el-table-column label="版本号" align="center" prop="version"/>
<el-table-column label="设备名称" align="center" prop="deviceName" /> <el-table-column label="设备名称" align="center" prop="deviceName"/>
<el-table-column label="用户" align="center" prop="userName" > <el-table-column label="用户" align="center" prop="userName">
<template slot-scope="scope"> <template slot-scope="scope">
<router-link :to="'/user/user/userName/index/' + scope.row.userName" class="link-type"> <router-link :to="'/user/user/userName/index/' + scope.row.userName" class="link-type">
<span>{{ scope.row.userName }}</span> <span>{{ scope.row.userName }}</span>
@ -159,7 +174,7 @@
</el-table-column> </el-table-column>
<el-table-column label="设备图片" align="center" prop="picture" width="100"> <el-table-column label="设备图片" align="center" prop="picture" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<image-preview :src="scope.row.picture" :width="50" :height="50" /> <image-preview :src="scope.row.picture" :width="50" :height="50"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -183,7 +198,6 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="操作" label="操作"
:width="200" :width="200"
@ -197,7 +211,8 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['device:device:edit']" v-hasPermi="['device:device:edit']"
>修改</el-button >修改
</el-button
> >
<el-button <el-button
size="mini" size="mini"
@ -205,7 +220,8 @@
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['device:device:remove']" v-hasPermi="['device:device:remove']"
>删除</el-button >删除
</el-button
> >
</template> </template>
</el-table-column> </el-table-column>
@ -242,14 +258,14 @@
prop="deviceName" prop="deviceName"
style="margin-bottom: 12px" style="margin-bottom: 12px"
> >
<el-input <el-input
v-model="form.deviceName" v-model="form.deviceName"
placeholder="请输入设备名称" placeholder="请输入设备名称"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="用户" prop="userId" > <el-form-item label="用户" prop="userId">
<el-select <el-select
v-model="form.userId" v-model="form.userId"
filterable filterable
@ -257,12 +273,12 @@
placeholder="请选择用户" placeholder="请选择用户"
style="width: 100%" style="width: 100%"
> >
<el-option <el-option
v-for="item in userOptions" v-for="item in userOptions"
:key="item.userId" :key="item.userId"
:label="item.userName" :label="item.userName"
:value="item.userId" :value="item.userId"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -273,12 +289,12 @@
prop="mac" prop="mac"
style="margin-bottom: 12px" style="margin-bottom: 12px"
> >
<el-input <el-input
v-model="form.mac" v-model="form.mac"
placeholder="请输入设备Mac号" placeholder="请输入设备Mac号"
:disabled="title === '修改设备'" :disabled="title === '修改设备'"
style="width: 300px" style="width: 300px"
/> />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="型号前缀" label="型号前缀"
@ -295,7 +311,7 @@
<!-- 图片 --> <!-- 图片 -->
<el-form-item label="图片" prop="picture"> <el-form-item label="图片" prop="picture">
<image-upload v-model="form.picture" /> <image-upload v-model="form.picture"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -362,8 +378,6 @@
<!-- </el-col>--> <!-- </el-col>-->
<script> <script>
import { import {
listDevice, listDevice,
@ -377,10 +391,11 @@ import {
getadd, getadd,
getxiug, getxiug,
} from "@/api/device/device"; } from "@/api/device/device";
import { listClassify } from "@/api/device/classify"; import {listClassify} from "@/api/device/classify";
import { listVersion } from "@/api/device/version"; import {listVersion} from "@/api/device/version";
import { listModel } from "@/api/device/model"; import {listModel} from "@/api/device/model";
import { listUser } from "@/api/user/user"; import {listUser} from "@/api/user/user";
import model from "@/views/device/model/index.vue";
export default { export default {
name: "Device", name: "Device",
@ -392,9 +407,9 @@ export default {
], ],
data() { data() {
return { return {
checkedval:false, checkedval: false,
value2: new Date(2016,9,12,18,40,12), value2: new Date(2016, 9, 12, 18, 40, 12),
value1:'', value1: '',
addflag: false, addflag: false,
addlist: [], addlist: [],
@ -427,13 +442,13 @@ export default {
}, },
options: [{ options: [{
value: '1', value: '1',
label: '单次浇水' label: '单次浇水'
}, { }, {
value: '2', value: '2',
label: '循环浇水' label: '循环浇水'
}], }],
value: '', value: '',
addflag2: false, addflag2: false,
result: [], result: [],
@ -475,7 +490,7 @@ export default {
classifyOptions: [], classifyOptions: [],
// //
versionOptions: [], versionOptions: [],
weekday:'', weekday: '',
// //
loading: true, loading: true,
// //
@ -503,14 +518,17 @@ export default {
modelName: null, modelName: null,
modelPicture: null, modelPicture: null,
model: null, model: null,
modelId: null,
mac: null, mac: null,
orderBy: 'createTime',
order: 'desc',
onlineStatus: null, onlineStatus: null,
nickName: null, nickName: null,
}, },
deviceidedit:'', deviceidedit: '',
indexsedit:'', indexsedit: '',
isSwitchedit:'', isSwitchedit: '',
sjmiao:'', sjmiao: '',
// //
form: { form: {
sprayTimeMin: null, // sprayTimeMin: null, //
@ -548,23 +566,23 @@ export default {
// //
rules: { rules: {
deviceName: [ deviceName: [
{ required: true, message: "设备名称不能为空", trigger: "blur" }, {required: true, message: "设备名称不能为空", trigger: "blur"},
], ],
classifyId: [ classifyId: [
{ required: true, message: "分类不能为空", trigger: "blur" }, {required: true, message: "分类不能为空", trigger: "blur"},
], ],
pre: [ pre: [
{ required: true, message: "设备名称不能为空", trigger: "blur" }, {required: true, message: "设备名称不能为空", trigger: "blur"},
], ],
versionId: [ versionId: [
{ required: true, message: "版本不能为空", trigger: "blur" }, {required: true, message: "版本不能为空", trigger: "blur"},
], ],
// classifyName: [ // classifyName: [
// { required: true, message: "", trigger: "blur" } // { required: true, message: "", trigger: "blur" }
// ], // ],
modelId: [{ required: true, message: "型号不能为空", trigger: "blur" }], modelId: [{required: true, message: "型号不能为空", trigger: "blur"}],
// userId: [{ required: true, message: "", trigger: "blur" }], // userId: [{ required: true, message: "", trigger: "blur" }],
mac: [{ required: true, message: "mac值不能为空", trigger: "blur" }], mac: [{required: true, message: "mac值不能为空", trigger: "blur"}],
}, },
}; };
}, },
@ -573,9 +591,13 @@ export default {
if (userName != null) { if (userName != null) {
this.queryParams.userName = userName; this.queryParams.userName = userName;
} }
this.loadModelOptions();
this.getList(); this.getList();
}, },
computed: { computed: {
model() {
return model
},
// 0000000 // 0000000
dayBinaryString() { dayBinaryString() {
// //
@ -604,30 +626,35 @@ export default {
}, },
}, },
methods: { methods: {
loadModelOptions() {
listModel().then(response => {
this.modelOptions = response.rows;
});
},
// switchwater(){ // switchwater(){
// console.log(this.form.waterIntensity); // console.log(this.form.waterIntensity);
// }, // },
// //
inpqx(){ inpqx() {
if (this.checkedval == true) { if (this.checkedval == true) {
this.riindex = 1 this.riindex = 1
this.yiindex = 1 this.yiindex = 1
this.erindex = 1 this.erindex = 1
this.sanindex = 1 this.sanindex = 1
this.siindex = 1 this.siindex = 1
this.wuindex = 1 this.wuindex = 1
this.liuindex = 1 this.liuindex = 1
this.funxz() this.funxz()
} else { } else {
this.riindex = 0 this.riindex = 0
this.yiindex = 0 this.yiindex = 0
this.erindex = 0 this.erindex = 0
this.sanindex = 0 this.sanindex = 0
this.siindex = 0 this.siindex = 0
this.wuindex = 0 this.wuindex = 0
this.liuindex = 0 this.liuindex = 0
this.funxz() this.funxz()
} }
}, },
addqutjedit() { addqutjedit() {
this.addflag2 = false; this.addflag2 = false;
@ -644,85 +671,85 @@ export default {
this.indexsedit = item.index; this.indexsedit = item.index;
this.isSwitchedit = item.isSwitch; this.isSwitchedit = item.isSwitch;
this.value = item.mode; this.value = item.mode;
this.value1 = new Date(2016,9,12,item.startTime.slice(0, 2),item.startTime.slice(3, 5),item.startTime.slice(6, 8)); this.value1 = new Date(2016, 9, 12, item.startTime.slice(0, 2), item.startTime.slice(3, 5), item.startTime.slice(6, 8));
const miao = this.formatSeconds(item.wateringDuration) const miao = this.formatSeconds(item.wateringDuration)
this.value2 = new Date(2016,9,12,miao.slice(0, 2),miao.slice(3, 5),miao.slice(6, 8)); this.value2 = new Date(2016, 9, 12, miao.slice(0, 2), miao.slice(3, 5), miao.slice(6, 8));
this.weekday = item.week this.weekday = item.week
// const weekday = weekdays.toString() // const weekday = weekdays.toString()
// console.log(this.weekday); // console.log(this.weekday);
if(this.weekday == '1111111'){ if (this.weekday == '1111111') {
this.riindex = 1 this.riindex = 1
this.yiindex = 1 this.yiindex = 1
this.erindex = 1 this.erindex = 1
this.sanindex = 1 this.sanindex = 1
this.siindex = 1 this.siindex = 1
this.wuindex = 1 this.wuindex = 1
this.liuindex = 1 this.liuindex = 1
this.funxz() this.funxz()
}else{ } else {
this.weekday = String(this.weekday); this.weekday = String(this.weekday);
this.weekday = this.weekday.padStart(7, '0') this.weekday = this.weekday.padStart(7, '0')
this.yiindex = this.weekday.charAt(6) this.yiindex = this.weekday.charAt(6)
this.erindex = this.weekday.charAt(5) this.erindex = this.weekday.charAt(5)
this.sanindex = this.weekday.charAt(4) this.sanindex = this.weekday.charAt(4)
this.siindex = this.weekday.charAt(3) this.siindex = this.weekday.charAt(3)
this.wuindex = this.weekday.charAt(2) this.wuindex = this.weekday.charAt(2)
this.liuindex = this.weekday.charAt(1) this.liuindex = this.weekday.charAt(1)
this.riindex = this.weekday.charAt(0) this.riindex = this.weekday.charAt(0)
this.funxz() this.funxz()
} }
this.addflag2 = true; this.addflag2 = true;
}, },
convertToSecondsFromArray(arr) { convertToSecondsFromArray(arr) {
return parseInt(arr[0], 10) * 3600 + parseInt(arr[1], 10) * 60 + parseInt(arr[2], 10); return parseInt(arr[0], 10) * 3600 + parseInt(arr[1], 10) * 60 + parseInt(arr[2], 10);
}, },
btnedit(){ btnedit() {
this.addlist.push(this.yiindex==''?0:this.yiindex, this.erindex==''?0:this.erindex, this.sanindex == '' ? 0:this.sanindex, this.siindex == '' ? 0 :this.siindex, this.wuindex == 0 ? 0 :this.wuindex, this.liuindex == '' ? 0 : this.liuindex,this.riindex == '' ? 0 :this.riindex) this.addlist.push(this.yiindex == '' ? 0 : this.yiindex, this.erindex == '' ? 0 : this.erindex, this.sanindex == '' ? 0 : this.sanindex, this.siindex == '' ? 0 : this.siindex, this.wuindex == 0 ? 0 : this.wuindex, this.liuindex == '' ? 0 : this.liuindex, this.riindex == '' ? 0 : this.riindex)
console.log(this.addlist); console.log(this.addlist);
this.addlist = this.addlist.reverse().join(''); this.addlist = this.addlist.reverse().join('');
this.value1 = this.extractedTime(this.value1) this.value1 = this.extractedTime(this.value1)
this.value2 = this.extractedTimeToArrays(this.value2) this.value2 = this.extractedTimeToArrays(this.value2)
this.sjmiao = this.convertToSecondsFromArray(this.value2) this.sjmiao = this.convertToSecondsFromArray(this.value2)
console.log(this.sjmiao); console.log(this.sjmiao);
let data = { let data = {
deviceId: this.deviceidedit, deviceId: this.deviceidedit,
startTimeStr: this.value1, startTimeStr: this.value1,
wateringDuration:this.sjmiao, wateringDuration: this.sjmiao,
week: this.addlist, week: this.addlist,
mode:this.value, mode: this.value,
isSwitch:this.isSwitchedit, isSwitch: this.isSwitchedit,
index:this.indexsedit index: this.indexsedit
} }
getxiug(data).then(res => { getxiug(data).then(res => {
this.$message({ this.$message({
message: "修改成功", message: "修改成功",
type: "success", type: "success",
}); });
setTimeout(() => { setTimeout(() => {
this.getgetregular(this.deviceid); this.getgetregular(this.deviceid);
}, 2000); }, 2000);
this.addflag2 = false this.addflag2 = false
this.addlist = [] this.addlist = []
this.checkedval = false this.checkedval = false
}) })
}, },
extractedTimeToArrays(originalDateString) { extractedTimeToArrays(originalDateString) {
// //
const date = new Date(originalDateString); const date = new Date(originalDateString);
if (isNaN(date)) { if (isNaN(date)) {
console.error('无法解析日期字符串'); console.error('无法解析日期字符串');
return null; // return null; //
} }
// //
const hours = date.getHours().toString().padStart(2, '0'); const hours = date.getHours().toString().padStart(2, '0');
const minutes = date.getMinutes().toString().padStart(2, '0'); const minutes = date.getMinutes().toString().padStart(2, '0');
const seconds = date.getSeconds().toString().padStart(2, '0'); const seconds = date.getSeconds().toString().padStart(2, '0');
// //
return [hours, minutes, seconds]; return [hours, minutes, seconds];
}, },
extractedTime(originalDateString) { extractedTime(originalDateString) {
// //
const date = new Date(originalDateString); const date = new Date(originalDateString);
@ -742,15 +769,15 @@ export default {
formatSeconds(totalSeconds) { formatSeconds(totalSeconds) {
const hours = Math.floor(totalSeconds / 3600); const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60); const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60; const seconds = totalSeconds % 60;
// 使padStart // 使padStart
const formattedHours = String(hours).padStart(2, '0'); const formattedHours = String(hours).padStart(2, '0');
const formattedMinutes = String(minutes).padStart(2, '0'); const formattedMinutes = String(minutes).padStart(2, '0');
const formattedSeconds = String(seconds).padStart(2, '0'); const formattedSeconds = String(seconds).padStart(2, '0');
return `${formattedHours}:${formattedMinutes}:${formattedSeconds}`; return `${formattedHours}:${formattedMinutes}:${formattedSeconds}`;
}, },
// //
getgetregular(deviceId) { getgetregular(deviceId) {
@ -963,56 +990,56 @@ export default {
}); });
}, },
funxz() { funxz() {
if (this.sanindex == 1) { if (this.sanindex == 1) {
this.daysan = '周三' this.daysan = '周三'
this.sanindex = 1 this.sanindex = 1
} else { } else {
this.daysan = '' this.daysan = ''
this.sanindex = 0 this.sanindex = 0
} }
if (this.siindex == 1) { if (this.siindex == 1) {
this.daysi = '周四' this.daysi = '周四'
this.siindex = 1 this.siindex = 1
} else { } else {
this.daysi = '' this.daysi = ''
this.siindex = 0 this.siindex = 0
} }
if (this.wuindex == 1) { if (this.wuindex == 1) {
this.daywu = '周五' this.daywu = '周五'
this.wuindex = 1 this.wuindex = 1
} else { } else {
this.daywu = '' this.daywu = ''
this.wuindex = 0 this.wuindex = 0
} }
if (this.riindex == 1) { if (this.riindex == 1) {
this.dayri = '周日' this.dayri = '周日'
this.riindex = 1 this.riindex = 1
} else { } else {
this.dayri = '' this.dayri = ''
this.riindex = 0 this.riindex = 0
} }
if (this.erindex == 1) { if (this.erindex == 1) {
this.dayer = '周二' this.dayer = '周二'
this.erindex = 1 this.erindex = 1
} else { } else {
this.dayer = '' this.dayer = ''
this.erindex = 0 this.erindex = 0
} }
if (this.yiindex == 1) { if (this.yiindex == 1) {
this.dayyi = '周一' this.dayyi = '周一'
this.yiindex = 1 this.yiindex = 1
} else { } else {
this.dayyi = '' this.dayyi = ''
this.yiindex = 0 this.yiindex = 0
} }
if (this.liuindex == 1) { if (this.liuindex == 1) {
this.dayliu = '周六' this.dayliu = '周六'
this.liuindex = 1 this.liuindex = 1
} else { } else {
this.dayliu = '' this.dayliu = ''
this.liuindex = 0 this.liuindex = 0
} }
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
@ -1042,10 +1069,10 @@ export default {
}); });
}, },
convertSecondsToString(seconds) { convertSecondsToString(seconds) {
const minutes = Math.floor(seconds / 60); const minutes = Math.floor(seconds / 60);
const secs = seconds % 60; const secs = seconds % 60;
return `${minutes.toString().padStart(2, '0') + '分'}${secs.toString().padStart(2, '0') + '秒'}`; return `${minutes.toString().padStart(2, '0') + '分'}${secs.toString().padStart(2, '0') + '秒'}`;
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
@ -1078,7 +1105,8 @@ export default {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}) })
.catch(() => {}); .catch(() => {
});
}, },
// //
onCheckboxChange(item) { onCheckboxChange(item) {
@ -1300,6 +1328,7 @@ export default {
background: #3dada9 !important; background: #3dada9 !important;
color: #fff !important; color: #fff !important;
} }
.circulate { .circulate {
width: 600px; width: 600px;
height: 100%; height: 100%;
@ -1315,6 +1344,7 @@ export default {
padding-bottom: 20px; padding-bottom: 20px;
box-sizing: border-box; box-sizing: border-box;
} }
.circulatetext { .circulatetext {
width: 100%; width: 100%;
display: flex; display: flex;
@ -1326,6 +1356,7 @@ export default {
color: #3d3d3d; color: #3d3d3d;
line-height: 40px; line-height: 40px;
} }
.circulateday { .circulateday {
width: 432px; width: 432px;
height: 60px; height: 60px;
@ -1335,10 +1366,12 @@ export default {
color: #3dada9; color: #3dada9;
line-height: 40px; line-height: 40px;
} }
.circulatelist { .circulatelist {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.circulatelist span { .circulatelist span {
width: 50px; width: 50px;
height: 50px; height: 50px;
@ -1349,6 +1382,7 @@ export default {
line-height: 50px; line-height: 50px;
border-radius: 50%; border-radius: 50%;
} }
.adddingshi { .adddingshi {
width: 1000px; width: 1000px;
background-color: #fff; background-color: #fff;
@ -1370,6 +1404,7 @@ export default {
.qx a:hover { .qx a:hover {
color: #409eff; color: #409eff;
} }
.mask { .mask {
width: 100%; width: 100%;
height: 100vh; height: 100vh;
@ -1380,6 +1415,7 @@ export default {
z-index: 98; z-index: 98;
left: 0; left: 0;
} }
/* 定时样式 */ /* 定时样式 */
.anniu { .anniu {
text-align: right; text-align: right;
@ -1387,6 +1423,7 @@ export default {
padding-bottom: 40px; padding-bottom: 40px;
box-sizing: border-box; box-sizing: border-box;
} }
.dingshibox { .dingshibox {
width: 1000px; width: 1000px;
background-color: #fff; background-color: #fff;
@ -1400,12 +1437,14 @@ export default {
overflow: auto; overflow: auto;
z-index: 99; z-index: 99;
} }
.dingshibox ul { .dingshibox ul {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
padding-right: 40px; padding-right: 40px;
} }
.dingshibox ul li { .dingshibox ul li {
/* display: inline-block !important; */ /* display: inline-block !important; */
flex: 0 0 calc(50% - 10px); flex: 0 0 calc(50% - 10px);
@ -1428,13 +1467,16 @@ export default {
margin-left: 10px; margin-left: 10px;
color: #666; color: #666;
} }
.activeli { .activeli {
background-color: #1890ff !important; background-color: #1890ff !important;
color: #fff !important; color: #fff !important;
} }
.day ul li:hover { .day ul li:hover {
cursor: pointer; cursor: pointer;
} }
.day .title { .day .title {
padding-left: 55px; padding-left: 55px;
color: #1890ff; color: #1890ff;
@ -1442,19 +1484,23 @@ export default {
display: flex; display: flex;
height: 20px; height: 20px;
} }
.kongb { .kongb {
width: 100%; width: 100%;
height: 220px; height: 220px;
} }
.switch-margin { .switch-margin {
margin-right: 40px; margin-right: 40px;
float: right; float: right;
padding: 15px 0 0 0; padding: 15px 0 0 0;
} }
.margin-5px { .margin-5px {
margin-left: 5px; margin-left: 5px;
width: 90%; width: 90%;
} }
.fontdesc { .fontdesc {
font-size: 14px; font-size: 14px;
font-weight: 600; font-weight: 600;
@ -1471,29 +1517,36 @@ export default {
padding: 5px; padding: 5px;
height: 200px; height: 200px;
} }
.div1 { .div1 {
margin-left: 20px; margin-left: 20px;
padding: 5px 0 0 0; padding: 5px 0 0 0;
height: 40px; height: 40px;
} }
.div1:hover { .div1:hover {
background-color: #e7e7e7; background-color: #e7e7e7;
} }
.span1 { .span1 {
font-weight: 500; font-weight: 500;
float: left; float: left;
} }
.span2 { .span2 {
float: right; float: right;
width: 100px !important; width: 100px !important;
} }
.span3 { .span3 {
float: right; float: right;
line-height: 30px; line-height: 30px;
} }
.el-form-item { .el-form-item {
margin-bottom: 10px; margin-bottom: 10px;
} }
.font11 { .font11 {
font-size: 11px; font-size: 11px;
color: #7a7a7a; color: #7a7a7a;
@ -1502,24 +1555,30 @@ export default {
.col-style { .col-style {
margin-top: 10px; margin-top: 10px;
} }
.switch-water .el-slider__button { .switch-water .el-slider__button {
width: 30px; width: 30px;
height: 30px; height: 30px;
background-color: #1890ff; background-color: #1890ff;
} }
.switch-water { .switch-water {
padding-top: 25px; padding-top: 25px;
padding-right: 20px; padding-right: 20px;
} }
.margin-top20 { .margin-top20 {
margin-top: 20px; margin-top: 20px;
} }
.el-select { .el-select {
width: 100%; width: 100%;
} }
.col-style { .col-style {
margin-right: 15px; margin-right: 15px;
} }
.el-col-12 { .el-col-12 {
width: 48%; width: 48%;
} }

View File

@ -83,7 +83,6 @@
<!-- 列表区 --> <!-- 列表区 -->
<el-table v-loading="loading" :data="versionList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="versionList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="versionId" />
<el-table-column label="型号" align="center" prop="model" /> <el-table-column label="型号" align="center" prop="model" />
<el-table-column label="型号名称" align="center" prop="modelName" /> <el-table-column label="型号名称" align="center" prop="modelName" />
<el-table-column label="版本号" align="center" prop="version" /> <el-table-column label="版本号" align="center" prop="version" />

View File

@ -101,7 +101,7 @@ public class AsDeviceVersionController extends BaseController
@PreAuthorize("@ss.hasPermi('device:version:remove')") @PreAuthorize("@ss.hasPermi('device:version:remove')")
@Log(title = "固件版本", businessType = BusinessType.DELETE) @Log(title = "固件版本", businessType = BusinessType.DELETE)
@DeleteMapping("/{versionIds}") @DeleteMapping("/{versionIds}")
public AjaxResult remove(@PathVariable Long[] versionIds) public AjaxResult remove(@PathVariable List<Long> versionIds)
{ {
return toAjax(asDeviceVersionService.deleteAsDeviceVersionByVersionIds(versionIds)); return toAjax(asDeviceVersionService.deleteAsDeviceVersionByVersionIds(versionIds));
} }

View File

@ -79,4 +79,7 @@ public class AsModel extends BaseEntity
@Excel(name = "介绍视频") @Excel(name = "介绍视频")
private String video; private String video;
@Excel(name = "版本ID列表")
private List<Long> versionIdList;
} }

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.device.domain.AsDeviceVersion; import com.ruoyi.device.domain.AsDeviceVersion;
import org.apache.ibatis.annotations.Param;
/** /**
* 固件版本Mapper接口 * 固件版本Mapper接口
@ -65,7 +66,7 @@ public interface AsDeviceVersionMapper extends BaseMapper<AsDeviceVersion>
* @param versionIds 需要删除的数据主键集合 * @param versionIds 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
public int deleteAsDeviceVersionByVersionIds(Long[] versionIds); public int deleteAsDeviceVersionByVersionIds(@Param("ids") List<Long> versionIds);
public List<String> selectAsDeviceVersionByModelId(Long modelId); public List<String> selectAsDeviceVersionByModelId(Long modelId);

View File

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.device.domain.AsDeviceVersion; import com.ruoyi.device.domain.AsDeviceVersion;
import com.ruoyi.device.domain.AsModel; import com.ruoyi.device.domain.AsModel;
import com.ruoyi.device.domain.vo.AsModelVO; import com.ruoyi.device.domain.vo.AsModelVO;
import org.apache.ibatis.annotations.Param;
/** /**
* 型号列表Mapper接口 * 型号列表Mapper接口
@ -81,4 +82,5 @@ public interface AsModelMapper extends BaseMapper<AsModel>
public AsModelVO checkModelByPre(AsModel asModel); public AsModelVO checkModelByPre(AsModel asModel);
List<AsModelVO> selectAsModelByVersionIds(@Param("ids") List<Long> versionIds);
} }

View File

@ -58,7 +58,7 @@ public interface IAsDeviceVersionService
* @param versionIds 需要删除的固件版本主键集合 * @param versionIds 需要删除的固件版本主键集合
* @return 结果 * @return 结果
*/ */
public int deleteAsDeviceVersionByVersionIds(Long[] versionIds); public int deleteAsDeviceVersionByVersionIds(List<Long> versionIds);
/** /**
* 删除固件版本信息 * 删除固件版本信息

View File

@ -91,4 +91,11 @@ public interface IAsModelService
* @return * @return
*/ */
AsModelVO selectAsModelByPre(AsModel asModel); AsModelVO selectAsModelByPre(AsModel asModel);
/**
* 根据版本号查询对应的设备信息
* @param versionIds
* @return
*/
List<AsModelVO> selectAsModelByVersionIds(List<Long> versionIds);
} }

View File

@ -306,6 +306,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
} }
// 设置版本数据 // 设置版本数据
AsDeviceVersion asDeviceVersion = versionMapper.selectAsDeviceVersionByVersionId(model.getVersionId()); AsDeviceVersion asDeviceVersion = versionMapper.selectAsDeviceVersionByVersionId(model.getVersionId());
ServiceUtil.assertion(asDeviceVersion == null,"当前型号版本信息不存在,请绑定版本后再进行操作");
asDevice.setVersion(asDeviceVersion.getVersion()); asDevice.setVersion(asDeviceVersion.getVersion());
asDevice.setVersionId(model.getVersionId()); asDevice.setVersionId(model.getVersionId());
asDevice.setIsDefault("1"); asDevice.setIsDefault("1");
@ -521,8 +522,6 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
i = asDeviceMapper.insertAsDevice(device); i = asDeviceMapper.insertAsDevice(device);
} }
ServiceUtil.assertion(i == 0, "绑定失败!"); ServiceUtil.assertion(i == 0, "绑定失败!");
// 切换默认设备
// toggleDevice(asDevice.getUserId(), asDevice.getDeviceId());
logger.info("=================【绑定设备】成功=================="); logger.info("=================【绑定设备】成功==================");
return Boolean.TRUE; return Boolean.TRUE;
}); });

View File

@ -5,15 +5,20 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.device.domain.AsModel; import com.ruoyi.device.domain.AsModel;
import com.ruoyi.device.domain.vo.AsModelVO;
import com.ruoyi.device.mapper.AsModelMapper; import com.ruoyi.device.mapper.AsModelMapper;
import com.ruoyi.device.service.IAsModelService; import com.ruoyi.device.service.IAsModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.device.mapper.AsDeviceVersionMapper; import com.ruoyi.device.mapper.AsDeviceVersionMapper;
import com.ruoyi.device.domain.AsDeviceVersion; import com.ruoyi.device.domain.AsDeviceVersion;
import com.ruoyi.device.service.IAsDeviceVersionService; import com.ruoyi.device.service.IAsDeviceVersionService;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -31,6 +36,11 @@ public class AsDeviceVersionServiceImpl extends ServiceImpl<AsDeviceVersionMappe
@Resource @Resource
private IAsModelService asModelService; private IAsModelService asModelService;
@Autowired
private TransactionTemplate transactionTemplate;
@Autowired
private AsModelMapper asModelMapper;
/** /**
* 查询固件版本 * 查询固件版本
* *
@ -75,7 +85,7 @@ public class AsDeviceVersionServiceImpl extends ServiceImpl<AsDeviceVersionMappe
@Override @Override
public int insertAsDeviceVersion(AsDeviceVersion asDeviceVersion) public int insertAsDeviceVersion(AsDeviceVersion asDeviceVersion)
{ {
asDeviceVersion.setCreateTime(DateUtils.getNowDate()); asDeviceVersion.setCreateLocalDateTime(LocalDateTime.now());
return asDeviceVersionMapper.insertAsDeviceVersion(asDeviceVersion); return asDeviceVersionMapper.insertAsDeviceVersion(asDeviceVersion);
} }
@ -91,10 +101,26 @@ public class AsDeviceVersionServiceImpl extends ServiceImpl<AsDeviceVersionMappe
asDeviceVersion.setUpdateTime(DateUtils.getNowDate()); asDeviceVersion.setUpdateTime(DateUtils.getNowDate());
// 更新对应的设备固件版本为最新的版本 // 更新对应的设备固件版本为最新的版本
AsDeviceVersion latestAsDeviceVersion = asDeviceVersionMapper.selectLatestAsDeviceVersion(asDeviceVersion.getModelId()); AsDeviceVersion latestAsDeviceVersion = asDeviceVersionMapper.selectLatestAsDeviceVersion(asDeviceVersion.getModelId());
ServiceUtil.assertion(latestAsDeviceVersion==null,"设备未绑定过固件版本");
AsModel asModel = asModelService.selectAsModelByModelId(asDeviceVersion.getModelId()); AsModel asModel = asModelService.selectAsModelByModelId(asDeviceVersion.getModelId());
asModel.setVersionId(latestAsDeviceVersion.getVersionId()); ServiceUtil.assertion(asModel==null,"该型号不存在");
asModelService.updateAsModel(asModel); if (asDeviceVersion.getCreateLocalDateTime().isAfter(latestAsDeviceVersion.getCreateLocalDateTime())){
return asDeviceVersionMapper.updateAsDeviceVersion(asDeviceVersion); asModel.setVersion(asDeviceVersion.getVersion());
asModel.setVersionId(asDeviceVersion.getVersionId());
}else {
asModel.setVersionId(latestAsDeviceVersion.getVersionId());
asModel.setVersion(latestAsDeviceVersion.getVersion());
}
Boolean execute = transactionTemplate.execute(e -> {
// 更新型号对应的版本号
int i = asModelMapper.updateAsModel(asModel);
ServiceUtil.assertion(i == 0, "修改失败!");
i = asDeviceVersionMapper.updateAsDeviceVersion(asDeviceVersion);
ServiceUtil.assertion(i == 0, "修改失败!");
return Boolean.TRUE;
});
if(Boolean.FALSE.equals(execute))throw new ServiceException("修改失败");
return 1;
} }
/** /**
@ -104,9 +130,22 @@ public class AsDeviceVersionServiceImpl extends ServiceImpl<AsDeviceVersionMappe
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteAsDeviceVersionByVersionIds(Long[] versionIds) public int deleteAsDeviceVersionByVersionIds(List<Long> versionIds)
{ {
return asDeviceVersionMapper.deleteAsDeviceVersionByVersionIds(versionIds); List<AsModelVO> asModelVOS = asModelService.selectAsModelByVersionIds(versionIds);
Boolean execute = transactionTemplate.execute(e -> {
for (AsModelVO asModelVO : asModelVOS) {
asModelVO.setVersionId(null);
int i = asModelMapper.updateAsModel(asModelVO);
ServiceUtil.assertion(i == 0, "删除失败!");
}
int i = asDeviceVersionMapper.deleteAsDeviceVersionByVersionIds(versionIds);
ServiceUtil.assertion(i == 0, "删除失败!");
return Boolean.TRUE;
});
if(Boolean.FALSE.equals(execute))throw new ServiceException("删除失败");
return 1;
} }
/** /**
@ -127,15 +166,19 @@ public class AsDeviceVersionServiceImpl extends ServiceImpl<AsDeviceVersionMappe
} }
@Override @Override
@Transactional
public int insertAsDeviceVersionAndUpdateAsModel(AsDeviceVersion asDeviceVersion) { public int insertAsDeviceVersionAndUpdateAsModel(AsDeviceVersion asDeviceVersion) {
asDeviceVersion.setCreateLocalDateTime(LocalDateTime.now()); asDeviceVersion.setCreateLocalDateTime(LocalDateTime.now());
int rows = asDeviceVersionMapper.insertAsDeviceVersion(asDeviceVersion); Boolean execute = transactionTemplate.execute(e -> {
if (rows > 0) { // 更新型号对应的版本号
int i = asDeviceVersionMapper.insertAsDeviceVersion(asDeviceVersion);
ServiceUtil.assertion(i == 0, "修改失败!");
AsModel asModel = asModelService.selectAsModelByModelId(asDeviceVersion.getModelId()); AsModel asModel = asModelService.selectAsModelByModelId(asDeviceVersion.getModelId());
asModel.setVersionId(asDeviceVersion.getVersionId()); asModel.setVersionId(asDeviceVersion.getVersionId());
asModelService.updateAsModel(asModel); i = asModelMapper.updateAsModel(asModel);
} ServiceUtil.assertion(i == 0, "修改失败!");
return rows; return Boolean.TRUE;
});
if(Boolean.FALSE.equals(execute))throw new ServiceException("修改失败");
return 1;
} }
} }

View File

@ -3,6 +3,7 @@ package com.ruoyi.device.service.impl;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.Collections;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -154,16 +155,31 @@ public class AsModelServiceImpl extends ServiceImpl<AsModelMapper, AsModel> impl
AsDeviceClassify deviceClassify = classifyMapper.selectAsDeviceClassifyByClassifyId(asModel.getClassifyId()); AsDeviceClassify deviceClassify = classifyMapper.selectAsDeviceClassifyByClassifyId(asModel.getClassifyId());
String classifyName = deviceClassify.getClassifyName(); String classifyName = deviceClassify.getClassifyName();
asModel.setClassifyName(classifyName); asModel.setClassifyName(classifyName);
int i = asModelMapper.updateAsModel(asModel);
asModelVideoMapper.updateAsModelVideo(asModel); Boolean execute = transactionTemplate.execute(e -> {
AsDeviceQuery device = new AsDeviceQuery(); // 插入型号数据
device.setModelId(asModel.getModelId()); int i = asModelMapper.updateAsModel(asModel);
List<AsDevice> asDevices = deviceMapper.selectAsDeviceList(device); ServiceUtil.assertion(i == 0, "更新失败!");
for(AsDevice device1: asDevices){ // 更新型号视频表
device1.setModel(asModel.getModel()); if (asModel.getVideo() != null) {
deviceMapper.updateAsDevice(device1); i = asModelVideoMapper.updateAsModelVideo(asModel);
} ServiceUtil.assertion(i == 0, "更新失败!");
return i; }
// 更新设备对应的型号
AsDeviceQuery device = new AsDeviceQuery();
device.setModelId(asModel.getModelId());
List<AsDevice> asDevices = deviceMapper.selectAsDeviceList(device);
if (!asDevices.isEmpty()) {
for(AsDevice device1: asDevices){
device1.setModel(asModel.getModel());
i = deviceMapper.updateAsDevice(device1);
ServiceUtil.assertion(i == 0, "更新失败!");
}
}
return Boolean.TRUE;
});
if(Boolean.FALSE.equals(execute))throw new ServiceException("更新失败");
return 1;
} }
/** /**
@ -242,4 +258,11 @@ public class AsModelServiceImpl extends ServiceImpl<AsModelMapper, AsModel> impl
ServiceUtil.assertion(asModelVO == null,"当前型号不存在"); ServiceUtil.assertion(asModelVO == null,"当前型号不存在");
return asModelVO; return asModelVO;
} }
@Override
public List<AsModelVO> selectAsModelByVersionIds(List<Long> versionIds) {
AsModel asModel = new AsModel();
asModel.setVersionIdList(versionIds);
return asModelMapper.selectAsModelByVersionIds(versionIds);
}
} }

View File

@ -124,9 +124,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from as_device_version where version_id = #{versionId} delete from as_device_version where version_id = #{versionId}
</delete> </delete>
<delete id="deleteAsDeviceVersionByVersionIds" parameterType="String"> <delete id="deleteAsDeviceVersionByVersionIds" parameterType="Long">
delete from as_device_version where version_id in delete from as_device_version where version_id in
<foreach item="versionId" collection="array" open="(" separator="," close=")"> <foreach item="versionId" collection="ids" open="(" separator="," close=")">
#{versionId} #{versionId}
</foreach> </foreach>
</delete> </delete>

View File

@ -1,63 +1,64 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.device.mapper.AsModelMapper"> <mapper namespace="com.ruoyi.device.mapper.AsModelMapper">
<resultMap type="AsModel" id="AsModelResult"> <resultMap type="AsModel" id="AsModelResult">
<result property="modelId" column="model_id" /> <result property="modelId" column="model_id"/>
<result property="classifyId" column="classify_id" /> <result property="classifyId" column="classify_id"/>
<result property="modelName" column="model_name" /> <result property="modelName" column="model_name"/>
<result property="model" column="model" /> <result property="model" column="model"/>
<result property="picture" column="picture" /> <result property="picture" column="picture"/>
<result property="idCode" column="id_code" /> <result property="idCode" column="id_code"/>
<result property="classifyName" column="classify_name" /> <result property="classifyName" column="classify_name"/>
<result property="versionId" column="version_id" /> <result property="versionId" column="version_id"/>
<result property="introduce" column="introduce" /> <result property="introduce" column="introduce"/>
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time"/>
<result property="remark" column="remark" /> <result property="remark" column="remark"/>
</resultMap> </resultMap>
<sql id="selectAsModelVo"> <sql id="selectAsModelVo">
select select am.model_id,
am.model_id, am.classify_id,
am.classify_id, am.model_name,
am.model_name, am.article_id,
am.article_id, am.model,
am.model, am.picture,
am.picture, am.id_code,
am.id_code, am.classify_name,
am.classify_name, am.version_id,
am.version_id, am.introduce,
am.introduce, am.create_by,
am.create_by, am.create_time,
am.create_time, am.update_by,
am.update_by, am.update_time,
am.update_time, am.pre,
am.pre, am.remark,
am.remark, adv.version,
adv.version, amv.video,
amv.video, aa.title
aa.title from as_model am
from as_model am left join as_device_version adv on am.version_id = adv.version_id
left join as_device_version adv on am.version_id = adv.version_id left join as_model_video amv on am.model_id = amv.model_id
left join as_model_video amv on am.model_id = amv.model_id left join as_article aa on am.article_id = aa.article_id
left join as_article aa on am.article_id = aa.article_id
</sql> </sql>
<select id="selectAsModelList" parameterType="AsModel" resultMap="AsModelResult"> <select id="selectAsModelList" parameterType="AsModel" resultMap="AsModelResult">
<include refid="selectAsModelVo"/> <include refid="selectAsModelVo"/>
<where> <where>
<if test="modelName != null and modelName != ''"> and am.model_name like concat('%', #{modelName}, '%')</if> <if test="modelName != null and modelName != ''">and am.model_name like concat('%', #{modelName}, '%')</if>
<if test="model != null and model != ''"> and am.model = #{model}</if> <if test="model != null and model != ''">and am.model = #{model}</if>
<if test="picture != null and picture != ''"> and am.picture = #{picture}</if> <if test="picture != null and picture != ''">and am.picture = #{picture}</if>
<if test="idCode != null and idCode != ''"> and am.id_code = #{idCode}</if> <if test="idCode != null and idCode != ''">and am.id_code = #{idCode}</if>
<if test="classifyName != null and classifyName != ''"> and am.classify_name like concat('%', #{classifyName}, '%')</if> <if test="classifyName != null and classifyName != ''">and am.classify_name like concat('%',
<if test="versionId != null "> and am.version_id = #{versionId}</if> #{classifyName}, '%')
<if test="introduce != null and introduce != ''"> and am.introduce = #{introduce}</if> </if>
<if test="versionId != null ">and am.version_id = #{versionId}</if>
<if test="introduce != null and introduce != ''">and am.introduce = #{introduce}</if>
</where> </where>
</select> </select>
@ -67,7 +68,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="checkModelUnique" parameterType="String" resultMap="AsModelResult"> <select id="checkModelUnique" parameterType="String" resultMap="AsModelResult">
select model_id, model from as_model where model = #{model} limit 1 select model_id, model
from as_model
where model = #{model} limit 1
</select> </select>
<select id="selectAsModelByModel" parameterType="string" resultMap="AsModelResult"> <select id="selectAsModelByModel" parameterType="string" resultMap="AsModelResult">
@ -78,11 +81,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="checkModelByPre" resultType="com.ruoyi.device.domain.vo.AsModelVO"> <select id="checkModelByPre" resultType="com.ruoyi.device.domain.vo.AsModelVO">
<include refid="selectAsModelVo"/> <include refid="selectAsModelVo"/>
<where> <where>
<if test="pre != null and pre != ''">and FIND_IN_SET (#{pre},am.pre) </if> <if test="pre != null and pre != ''">and FIND_IN_SET (#{pre},am.pre)</if>
<if test="modelId != null and modelId != ''">and am.model_id != #{modelId}</if> <if test="modelId != null and modelId != ''">and am.model_id != #{modelId}</if>
</where> </where>
</select> </select>
<select id="selectAsModelByVersionIds" resultType="com.ruoyi.device.domain.vo.AsModelVO">
select
am.model_id,
am.version_id
from as_model am
where am.version_id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<insert id="insertAsModel" parameterType="AsModel" useGeneratedKeys="true" keyProperty="modelId"> <insert id="insertAsModel" parameterType="AsModel" useGeneratedKeys="true" keyProperty="modelId">
insert into as_model insert into as_model
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -101,7 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="pre != null">pre,</if> <if test="pre != null">pre,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="classifyId != null">#{classifyId},</if> <if test="classifyId != null">#{classifyId},</if>
<if test="articleId != null">#{articleId},</if> <if test="articleId != null">#{articleId},</if>
@ -118,7 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="pre != null">#{pre},</if> <if test="pre != null">#{pre},</if>
</trim> </trim>
</insert> </insert>
<update id="updateAsModel" parameterType="AsModel"> <update id="updateAsModel" parameterType="AsModel">
@ -131,6 +145,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="idCode != null">id_code = #{idCode},</if> <if test="idCode != null">id_code = #{idCode},</if>
<if test="classifyName != null">classify_name = #{classifyName},</if> <if test="classifyName != null">classify_name = #{classifyName},</if>
<if test="versionId != null">version_id = #{versionId},</if> <if test="versionId != null">version_id = #{versionId},</if>
<if test="versionId == null">version_id = null,</if>
<if test="introduce != null">introduce = #{introduce},</if> <if test="introduce != null">introduce = #{introduce},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
@ -143,7 +158,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteAsModelByModelId" parameterType="Long"> <delete id="deleteAsModelByModelId" parameterType="Long">
delete from as_model where model_id = #{modelId} delete
from as_model
where model_id = #{modelId}
</delete> </delete>
<delete id="deleteAsModelByModelIds" parameterType="String"> <delete id="deleteAsModelByModelIds" parameterType="String">