2023-2-2设备

zhc4dev
lenovo 2 years ago
parent a72f32a8a2
commit 87501ef21f
  1. 10
      ant-design-vue-jeecg/src/views/device/ZyDeviceList.vue
  2. 18
      ant-design-vue-jeecg/src/views/device/modules/ZyDeviceForm.vue
  3. 40
      ant-design-vue-jeecg/src/views/zydevice/devicebrand/modules/ZyDevicebrandForm.vue
  4. 42
      ant-design-vue-jeecg/src/views/zydevice/devicemodel/modules/ZyDevicemodelForm.vue
  5. 4
      ant-design-vue-jeecg/src/views/zydevice/devicetype/modules/ZyDevicetypeForm.vue
  6. 27
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/controller/ZyDeviceController.java
  7. 8
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/mapper/ZyDeviceMapper.java
  8. 8
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/IZyDeviceService.java
  9. 17
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/impl/ZyDeviceServiceImpl.java
  10. 11
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/controller/ZyDevicebrandController.java
  11. 10
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/controller/ZyDevicemodelController.java
  12. 21
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicetype/controller/ZyDevicetypeController.java

@ -4,6 +4,16 @@
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-model-item label="品牌" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="organizer">
<a-input v-model="queryParam.brandId" placeholder="请输入品牌名称" ></a-input>
</a-form-model-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-model-item label="型号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="organizer">
<a-input v-model="queryParam.modelId" placeholder="请输入品牌名称" ></a-input>
</a-form-model-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-model-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="organizer"> <a-form-model-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="organizer">
<a-input v-model="queryParam.name" placeholder="请输入名称" ></a-input> <a-input v-model="queryParam.name" placeholder="请输入名称" ></a-input>

@ -40,7 +40,7 @@
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="经办人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="agent"> <a-form-model-item label="经办人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="agent">
<j-select-user-by-dep v-model="model.agent" /> <j-select-user-by-dep v-model="model.agent" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<!-- <a-col :span="24">--> <!-- <a-col :span="24">-->
@ -53,8 +53,6 @@
<j-dict-select-tag v-model="model.status" dictCode="devicestatus1" <j-dict-select-tag v-model="model.status" dictCode="devicestatus1"
placeholder="设备状态"></j-dict-select-tag> placeholder="设备状态"></j-dict-select-tag>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="维护周期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="maintenancecycle"> <a-form-model-item label="维护周期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="maintenancecycle">
@ -77,6 +75,12 @@
<a-input v-model="model.img3d" placeholder="请输入模型地址" ></a-input> <a-input v-model="model.img3d" placeholder="请输入模型地址" ></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24">
<a-form-model-item label="设备品牌" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
<j-dict-select-tag v-model="model.canshu" dictCode="zy_devicebrand,brand,id"
placeholder="设备品牌" @change="canshu"></j-dict-select-tag>
</a-form-model-item>
</a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="类型编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="devicetypeCode "> <a-form-model-item label="类型编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="devicetypeCode ">
<j-popup <j-popup
@ -86,6 +90,7 @@
dest-fields="code1,modelId" dest-fields="code1,modelId"
code="zy_devicemodel" code="zy_devicemodel"
:multi="false" :multi="false"
:param="parm1"
@input="popupCallback" @input="popupCallback"
/> />
</a-form-model-item> </a-form-model-item>
@ -116,6 +121,9 @@
}, },
data () { data () {
return { return {
parm1:{
brand_id:''
},
model:{ model:{
status:1, status:1,
}, },
@ -147,6 +155,10 @@
this.modelDefault = JSON.parse(JSON.stringify(this.model)); this.modelDefault = JSON.parse(JSON.stringify(this.model));
}, },
methods: { methods: {
canshu(){
this.parm1.brand_id=this.model.canshu
console.log(this.parm1)
},
add () { add () {
this.edit(this.modelDefault); this.edit(this.modelDefault);
}, },

@ -3,33 +3,36 @@
<j-form-container :disabled="formDisabled"> <j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row> <a-row>
<a-col :span="24"> <a-col :span="12">
<a-form-model-item label="品牌图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="img"> <a-form-model-item label="品牌图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="img">
<j-image-upload isMultiple v-model="model.img" ></j-image-upload> <j-image-upload isMultiple v-model="model.img" ></j-image-upload>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="12">
<a-form-model-item label="品牌名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="brand"> <a-form-model-item label="品牌名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="brand">
<a-input v-model="model.brand" placeholder="请输入品牌名称" ></a-input> <a-input v-model="model.brand" placeholder="请输入品牌名称" ></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="12">
<a-form-model-item label="生产厂商" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="manufacturer"> <a-form-model-item label="供应商" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="supplier">
<j-select-depart v-model="model.manufacturer" /> <j-select-depart v-model="model.supplier" @change="shengchan" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="12">
<a-form-model-item label="供应商" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="supplier"> <a-form-model-item label="生产厂商" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="manufacturer">
<j-select-depart v-model="model.supplier" /> <j-select-depart v-model="model.manufacturer" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24">
<a-col :span="12">
<a-form-model-item label="联系人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contact"> <a-form-model-item label="联系人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contact">
<a-input v-model="model.contact" placeholder="请输入联系人" ></a-input> <a-input v-model="model.contact" placeholder="请输入联系人" ></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> </a-row>
<a-form-model-item label="产地" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="place"> <a-row>
<a-col :span="48">
<a-form-model-item label="产地" :labelCol="labelCol1" :wrapperCol="wrapperCol1" prop="place" >
<a-input v-model="model.place" placeholder="请输入产地" ></a-input> <a-input v-model="model.place" placeholder="请输入产地" ></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
@ -68,8 +71,20 @@
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 16 }, sm: { span: 16 },
}, },
labelCol1: {
xs: { span: 24 },
sm: { span: 3 },
},
wrapperCol1: {
xs: { span: 24 },
sm: { span: 21 },
},
confirmLoading: false, confirmLoading: false,
validatorRules: { validatorRules: {
brand:[
{ required: true, message: '请输入品牌名称!'},
{min: 1, max: 50, message: '最多输入50字!', trigger: 'blur'},
],
}, },
url: { url: {
add: "/devicebrand/zyDevicebrand/add", add: "/devicebrand/zyDevicebrand/add",
@ -88,6 +103,9 @@
this.modelDefault = JSON.parse(JSON.stringify(this.model)); this.modelDefault = JSON.parse(JSON.stringify(this.model));
}, },
methods: { methods: {
shengchan(){
this.model.manufacturer=this.model.supplier
},
add () { add () {
this.edit(this.modelDefault); this.edit(this.modelDefault);
}, },

@ -16,7 +16,7 @@
<!-- />--> <!-- />-->
<!-- </a-form-model-item>--> <!-- </a-form-model-item>-->
<!-- </a-col>--> <!-- </a-col>-->
<a-col :span="24"> <a-col :span="12">
<a-form-model-item label="设备品牌" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="brandId "> <a-form-model-item label="设备品牌" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="brandId ">
<j-popup <j-popup
v-model="model.brand" v-model="model.brand"
@ -43,7 +43,7 @@
<!-- />--> <!-- />-->
<!-- </a-form-model-item>--> <!-- </a-form-model-item>-->
<!-- </a-col>--> <!-- </a-col>-->
<a-col :span="24"> <a-col :span="12">
<a-form-model-item label="类型编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="devicetypeCode "> <a-form-model-item label="类型编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="devicetypeCode ">
<j-popup <j-popup
v-model="model.code" v-model="model.code"
@ -57,7 +57,7 @@
</a-form-model-item> </a-form-model-item>
<a-input v-model="model.devicetypeCode" hidden/> <a-input v-model="model.devicetypeCode" hidden/>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="12">
<a-form-model-item label="型号图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="img"> <a-form-model-item label="型号图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="img">
<j-image-upload v-model="model.img" ></j-image-upload> <j-image-upload v-model="model.img" ></j-image-upload>
</a-form-model-item> </a-form-model-item>
@ -67,24 +67,24 @@
<!-- <a-input v-model="model.qrcode" placeholder="请输入二维码" ></a-input>--> <!-- <a-input v-model="model.qrcode" placeholder="请输入二维码" ></a-input>-->
<!-- </a-form-model-item>--> <!-- </a-form-model-item>-->
<!-- </a-col>--> <!-- </a-col>-->
<a-col :span="24"> <a-col :span="12">
<a-form-model-item label="型号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="model"> <a-form-model-item label="型号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="model">
<a-input v-model="model.model" placeholder="请输入型号" ></a-input> <a-input v-model="model.model" placeholder="请输入型号" ></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> </a-row>
<a-form-model-item label="型号参数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="parameters"> <a-row>
<a-input v-model="model.parameters" placeholder="请输入型号参数" ></a-input> <a-col :span="48">
</a-form-model-item> <a-form-model-item label="型号参数" :labelCol="labelCol1" :wrapperCol="wrapperCol1" prop="parameters">
</a-col> <a-textarea v-model="model.parameters" rows="2" placeholder="请输入型号参数"/>
<a-col :span="24">
<a-form-model-item label="型号描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="description">
<a-input v-model="model.description" placeholder="请输入型号描述" ></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> </a-row>
<a-form-model-item label="联系人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contact"> <a-row>
<a-input v-model="model.contact" placeholder="请输入联系人" ></a-input> <a-col :span="48">
<a-form-model-item label="型号描述" :labelCol="labelCol1" :wrapperCol="wrapperCol1" prop="description">
<!-- <a-input v-model="model.description" placeholder="请输入型号描述" ></a-input>-->
<a-textarea v-model="model.description" rows="2" placeholder="请输入型号描述"/>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
@ -122,8 +122,20 @@
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 16 }, sm: { span: 16 },
}, },
labelCol1: {
xs: { span: 24 },
sm: { span: 3 },
},
wrapperCol1: {
xs: { span: 24 },
sm: { span: 21 },
},
confirmLoading: false, confirmLoading: false,
validatorRules: { validatorRules: {
model:[
{ required: true, message: '请输入型号名称!'},
{min: 1, max: 50, message: '最多输入50字!', trigger: 'blur'},
],
}, },
url: { url: {
add: "/devicemodel/zyDevicemodel/add", add: "/devicemodel/zyDevicemodel/add",

@ -56,6 +56,10 @@
}, },
confirmLoading: false, confirmLoading: false,
validatorRules: { validatorRules: {
name:[
{ required: true, message: '请输入设备类型!'},
{min: 1, max: 50, message: '最多输入50字!', trigger: 'blur'},
],
}, },
url: { url: {
add: "/devicetype/zyDevicetype/add", add: "/devicetype/zyDevicetype/add",

@ -75,7 +75,28 @@ public class ZyDeviceController extends JeecgController<ZyDevice, IZyDeviceServi
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) throws WriterException, IOException { HttpServletRequest req) throws WriterException, IOException {
QueryWrapper<ZyDevice> queryWrapper = QueryGenerator.initQueryWrapper(zyDevice, req.getParameterMap()); // QueryWrapper<ZyDevice> queryWrapper = QueryGenerator.initQueryWrapper(zyDevice, req.getParameterMap());
QueryWrapper queryWrapper=new QueryWrapper();
if(zyDevice.getName()!=null){
queryWrapper.like("name",zyDevice.getName());
}
if(zyDevice.getCode()!=null){
queryWrapper.like("code",zyDevice.getCode());
}
if(zyDevice.getStatus()!=null){
queryWrapper.eq("status",zyDevice.getStatus());
}
if(zyDevice.getBrandId()!=null){
String s="%"+zyDevice.getBrandId()+"%";
List<String> brand=zyDeviceService.findAllBrand(s);
queryWrapper.in("brand_id",brand);
}
if(zyDevice.getModelId()!=null){
String s="%"+zyDevice.getModelId()+"%";
List<String> model=zyDeviceService.findAllModel(s);
queryWrapper.in("model_id",model);
}
Page<ZyDevice> page = new Page<ZyDevice>(pageNo, pageSize); Page<ZyDevice> page = new Page<ZyDevice>(pageNo, pageSize);
IPage<ZyDevice> pageList = zyDeviceService.page(page, queryWrapper); IPage<ZyDevice> pageList = zyDeviceService.page(page, queryWrapper);
MultiFormatWriter multiFormatWriter = new MultiFormatWriter(); MultiFormatWriter multiFormatWriter = new MultiFormatWriter();
@ -192,6 +213,10 @@ public class ZyDeviceController extends JeecgController<ZyDevice, IZyDeviceServi
@ApiOperation(value="设备信息-通过id删除", notes="设备信息-通过id删除") @ApiOperation(value="设备信息-通过id删除", notes="设备信息-通过id删除")
@DeleteMapping(value = "/delete") @DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) { public Result<?> delete(@RequestParam(name="id",required=true) String id) {
int a=zyDeviceService.find(id);
if(a>=1){
return Result.error("有工序使用本设备,删除失败!!!");
}
zyDeviceService.removeById(id); zyDeviceService.removeById(id);
return Result.OK("删除成功!"); return Result.OK("删除成功!");
} }

@ -21,4 +21,12 @@ public interface ZyDeviceMapper extends BaseMapper<ZyDevice> {
@Select("select code from zy_device order by code desc limit 0,1") @Select("select code from zy_device order by code desc limit 0,1")
String getCode(); String getCode();
@Select("select id from zy_devicebrand where brand like #{s}")
List<String> findAllBrand(String s);
@Select("select id from zy_devicemodel where model like #{s}")
List<String> findAllModel(String s);
@Select("select count(1) from zy_process_machine where machineId=#{id}")
int find(String id);
} }

@ -4,6 +4,8 @@ import org.jeecg.modules.device.entity.ZyDevice;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel; import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel;
import java.util.List;
/** /**
* @Description: 设备信息 * @Description: 设备信息
* @Author: jeecg-boot * @Author: jeecg-boot
@ -15,4 +17,10 @@ public interface IZyDeviceService extends IService<ZyDevice> {
ZyDevicemodel findByModelId(String modelId); ZyDevicemodel findByModelId(String modelId);
String getCode(); String getCode();
List<String> findAllBrand(String s);
List<String> findAllModel(String s);
int find(String id);
} }

@ -9,6 +9,8 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
/** /**
* @Description: 设备信息 * @Description: 设备信息
* @Author: jeecg-boot * @Author: jeecg-boot
@ -29,4 +31,19 @@ public class ZyDeviceServiceImpl extends ServiceImpl<ZyDeviceMapper, ZyDevice> i
public String getCode() { public String getCode() {
return zyDeviceMapper.getCode(); return zyDeviceMapper.getCode();
} }
@Override
public List<String> findAllBrand(String s) {
return zyDeviceMapper.findAllBrand(s);
}
@Override
public List<String> findAllModel(String s) {
return zyDeviceMapper.findAllModel(s);
}
@Override
public int find(String id) {
return zyDeviceMapper.find(id);
}
} }

@ -22,6 +22,7 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.zydevice.devicebrand.entity.ZyDevicebrand; import org.jeecg.modules.zydevice.devicebrand.entity.ZyDevicebrand;
import org.jeecg.modules.zydevice.devicebrand.service.IZyDevicebrandService; import org.jeecg.modules.zydevice.devicebrand.service.IZyDevicebrandService;
import org.jeecg.modules.zydevice.devicemodel.service.IZyDevicemodelService;
import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ExportParams;
@ -51,8 +52,10 @@ import org.jeecg.common.aspect.annotation.AutoLog;
public class ZyDevicebrandController extends JeecgController<ZyDevicebrand, IZyDevicebrandService> { public class ZyDevicebrandController extends JeecgController<ZyDevicebrand, IZyDevicebrandService> {
@Autowired @Autowired
private IZyDevicebrandService zyDevicebrandService; private IZyDevicebrandService zyDevicebrandService;
@Autowired
private IZyDevicemodelService zyDevicemodelService;
/** /**
* 分页列表查询 * 分页列表查询
* *
* @param zyDevicebrand * @param zyDevicebrand
@ -127,6 +130,12 @@ public class ZyDevicebrandController extends JeecgController<ZyDevicebrand, IZyD
@ApiOperation(value="设备品牌管理-通过id删除", notes="设备品牌管理-通过id删除") @ApiOperation(value="设备品牌管理-通过id删除", notes="设备品牌管理-通过id删除")
@DeleteMapping(value = "/delete") @DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) { public Result<?> delete(@RequestParam(name="id",required=true) String id) {
QueryWrapper queryWrapper=new QueryWrapper();
queryWrapper.eq("brand_id",id);
int a=zyDevicemodelService.count(queryWrapper);
if(a>=0){
return Result.error("本型号已被使用,删除失败!!");
}
zyDevicebrandService.removeById(id); zyDevicebrandService.removeById(id);
return Result.OK("删除成功!"); return Result.OK("删除成功!");
} }

@ -28,6 +28,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.device.service.IZyDeviceService;
import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel; import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel;
import org.jeecg.modules.zydevice.devicemodel.service.IZyDevicemodelService; import org.jeecg.modules.zydevice.devicemodel.service.IZyDevicemodelService;
import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil;
@ -59,7 +60,8 @@ import org.jeecg.common.aspect.annotation.AutoLog;
public class ZyDevicemodelController extends JeecgController<ZyDevicemodel, IZyDevicemodelService> { public class ZyDevicemodelController extends JeecgController<ZyDevicemodel, IZyDevicemodelService> {
@Autowired @Autowired
private IZyDevicemodelService zyDevicemodelService; private IZyDevicemodelService zyDevicemodelService;
@Autowired
private IZyDeviceService zyDeviceService;
/** /**
* 分页列表查询 * 分页列表查询
* *
@ -162,6 +164,12 @@ public class ZyDevicemodelController extends JeecgController<ZyDevicemodel, IZyD
@ApiOperation(value="设备型号表-通过id删除", notes="设备型号表-通过id删除") @ApiOperation(value="设备型号表-通过id删除", notes="设备型号表-通过id删除")
@DeleteMapping(value = "/delete") @DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) { public Result<?> delete(@RequestParam(name="id",required=true) String id) {
QueryWrapper queryWrapper=new QueryWrapper();
queryWrapper.eq("model_id",id);
int a=zyDeviceService.count(queryWrapper);
if(a>=1){
return Result.error("设备型号有使用,删除失败!!!");
}
zyDevicemodelService.removeById(id); zyDevicemodelService.removeById(id);
return Result.OK("删除成功!"); return Result.OK("删除成功!");
} }

@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.zydevice.devicemodel.service.IZyDevicemodelService;
import org.jeecg.modules.zydevice.devicetype.entity.ZyDevicetype; import org.jeecg.modules.zydevice.devicetype.entity.ZyDevicetype;
import org.jeecg.modules.zydevice.devicetype.service.IZyDevicetypeService; import org.jeecg.modules.zydevice.devicetype.service.IZyDevicetypeService;
import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil;
@ -49,8 +50,10 @@ import org.jeecg.common.aspect.annotation.AutoLog;
public class ZyDevicetypeController extends JeecgController<ZyDevicetype, IZyDevicetypeService> { public class ZyDevicetypeController extends JeecgController<ZyDevicetype, IZyDevicetypeService> {
@Autowired @Autowired
private IZyDevicetypeService zyDevicetypeService; private IZyDevicetypeService zyDevicetypeService;
@Autowired
private IZyDevicemodelService zyDevicemodelService;
/** /**
* 分页列表查询 * 分页列表查询
* *
* @param zyDevicetype * @param zyDevicetype
@ -83,6 +86,9 @@ public class ZyDevicetypeController extends JeecgController<ZyDevicetype, IZyDev
@ApiOperation(value="设备类型-添加", notes="设备类型-添加") @ApiOperation(value="设备类型-添加", notes="设备类型-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@RequestBody ZyDevicetype zyDevicetype) { public Result<?> add(@RequestBody ZyDevicetype zyDevicetype) {
if(zyDevicetype.getName().length()>200){
return Result.error("添加失败,设备类型名称太长!");
}
QueryWrapper queryWrapper=new QueryWrapper(); QueryWrapper queryWrapper=new QueryWrapper();
queryWrapper.eq("name",zyDevicetype.getName()); queryWrapper.eq("name",zyDevicetype.getName());
int a=zyDevicetypeService.count(queryWrapper); int a=zyDevicetypeService.count(queryWrapper);
@ -90,7 +96,7 @@ public class ZyDevicetypeController extends JeecgController<ZyDevicetype, IZyDev
zyDevicetypeService.save(zyDevicetype); zyDevicetypeService.save(zyDevicetype);
return Result.OK("添加成功!");} return Result.OK("添加成功!");}
else{ else{
return Result.error("添加失败,该设备名称已存在!"); return Result.error("添加失败,该设备类型名称已存在!");
} }
} }
@ -104,6 +110,9 @@ public class ZyDevicetypeController extends JeecgController<ZyDevicetype, IZyDev
@ApiOperation(value="设备类型-编辑", notes="设备类型-编辑") @ApiOperation(value="设备类型-编辑", notes="设备类型-编辑")
@PutMapping(value = "/edit") @PutMapping(value = "/edit")
public Result<?> edit(@RequestBody ZyDevicetype zyDevicetype) { public Result<?> edit(@RequestBody ZyDevicetype zyDevicetype) {
if(zyDevicetype.getName().length()>200){
return Result.error("添加失败,设备类型名称太长!");
}
QueryWrapper queryWrapper=new QueryWrapper(); QueryWrapper queryWrapper=new QueryWrapper();
queryWrapper.eq("name",zyDevicetype.getName()); queryWrapper.eq("name",zyDevicetype.getName());
int a=zyDevicetypeService.count(queryWrapper); int a=zyDevicetypeService.count(queryWrapper);
@ -125,6 +134,14 @@ public class ZyDevicetypeController extends JeecgController<ZyDevicetype, IZyDev
@ApiOperation(value="设备类型-通过id删除", notes="设备类型-通过id删除") @ApiOperation(value="设备类型-通过id删除", notes="设备类型-通过id删除")
@DeleteMapping(value = "/delete") @DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) { public Result<?> delete(@RequestParam(name="id",required=true) String id) {
ZyDevicetype zyDevicetype = zyDevicetypeService.getById(id);
//判断型号中是否被使用
QueryWrapper queryWrapper=new QueryWrapper();
queryWrapper.eq("devicetype_code",zyDevicetype.getCode());
int a=zyDevicemodelService.count(queryWrapper);
if(a>=1){
return Result.error("本类型已被使用,请先删除对应型号!!!");
}
zyDevicetypeService.removeById(id); zyDevicetypeService.removeById(id);
return Result.OK("删除成功!"); return Result.OK("删除成功!");
} }

Loading…
Cancel
Save