From 4db6a3b68eeac7c5d1d1eec9a5fecec21f3bab05 Mon Sep 17 00:00:00 2001 From: lenovo <123> Date: Wed, 8 Feb 2023 20:05:22 +0800 Subject: [PATCH] =?UTF-8?q?2023-2-8=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/device/ZyDeviceList.vue | 2 +- .../src/views/device/modules/ZyDeviceForm.vue | 6 ++- .../tool/brand/modules/ZyToolBrandForm.vue | 20 ++++--- .../src/views/tool/model/ZyToolModelList.vue | 2 +- .../tool/model/modules/ZyToolModelForm.vue | 53 ++++++++++++------- .../src/views/tool/tool/ZyToolList.vue | 12 ++++- .../views/tool/tool/modules/ZyToolForm.vue | 41 ++++++++++---- .../tool/type/modules/ZyToolTypeForm.vue | 4 ++ .../controller/ZyDevicebrandController.java | 2 +- .../controller/ZyToolBrandController.java | 10 +++- .../controller/ZyToolModelController.java | 13 ++++- .../controller/ZyToolTypeController.java | 19 ++++++- .../zytool/controller/ZyToolController.java | 26 ++++++++- .../zytool/zytool/mapper/ZyToolMapper.java | 8 +++ .../zytool/zytool/service/IZyToolService.java | 8 +++ .../service/impl/ZyToolServiceImpl.java | 17 ++++++ 16 files changed, 196 insertions(+), 47 deletions(-) diff --git a/ant-design-vue-jeecg/src/views/device/ZyDeviceList.vue b/ant-design-vue-jeecg/src/views/device/ZyDeviceList.vue index c0820745..02c51559 100644 --- a/ant-design-vue-jeecg/src/views/device/ZyDeviceList.vue +++ b/ant-design-vue-jeecg/src/views/device/ZyDeviceList.vue @@ -26,7 +26,7 @@ - diff --git a/ant-design-vue-jeecg/src/views/device/modules/ZyDeviceForm.vue b/ant-design-vue-jeecg/src/views/device/modules/ZyDeviceForm.vue index 786151be..1584eb5a 100644 --- a/ant-design-vue-jeecg/src/views/device/modules/ZyDeviceForm.vue +++ b/ant-design-vue-jeecg/src/views/device/modules/ZyDeviceForm.vue @@ -50,7 +50,7 @@ - @@ -137,6 +137,10 @@ }, confirmLoading: false, validatorRules: { + name:[ + { required: true, message: '请输入设备名称!'}, + {min: 1, max: 50, message: '最多输入50字!', trigger: 'blur'}, + ], }, url: { add: "/device/zyDevice/add", diff --git a/ant-design-vue-jeecg/src/views/tool/brand/modules/ZyToolBrandForm.vue b/ant-design-vue-jeecg/src/views/tool/brand/modules/ZyToolBrandForm.vue index 776e73d3..6f12e42d 100644 --- a/ant-design-vue-jeecg/src/views/tool/brand/modules/ZyToolBrandForm.vue +++ b/ant-design-vue-jeecg/src/views/tool/brand/modules/ZyToolBrandForm.vue @@ -9,20 +9,21 @@ - - + + - - + + - - + + + @@ -70,6 +71,10 @@ }, confirmLoading: false, validatorRules: { + brand:[ + { required: true, message: '请输入品牌名称!'}, + {min: 1, max: 50, message: '最多输入50字!', trigger: 'blur'}, + ], }, url: { add: "/toolbrand/zyToolBrand/add", @@ -88,6 +93,9 @@ this.modelDefault = JSON.parse(JSON.stringify(this.model)); }, methods: { + shengchan(){ + this.model.manufacturer=this.model.supplier + }, add () { this.edit(this.modelDefault); }, diff --git a/ant-design-vue-jeecg/src/views/tool/model/ZyToolModelList.vue b/ant-design-vue-jeecg/src/views/tool/model/ZyToolModelList.vue index 28446cf0..271a6c4e 100644 --- a/ant-design-vue-jeecg/src/views/tool/model/ZyToolModelList.vue +++ b/ant-design-vue-jeecg/src/views/tool/model/ZyToolModelList.vue @@ -185,7 +185,7 @@ title: '操作', dataIndex: 'action', align:"center", - fixed:"right", + width:147, scopedSlots: { customRender: 'action' } } diff --git a/ant-design-vue-jeecg/src/views/tool/model/modules/ZyToolModelForm.vue b/ant-design-vue-jeecg/src/views/tool/model/modules/ZyToolModelForm.vue index cc781b90..01db7ff5 100644 --- a/ant-design-vue-jeecg/src/views/tool/model/modules/ZyToolModelForm.vue +++ b/ant-design-vue-jeecg/src/views/tool/model/modules/ZyToolModelForm.vue @@ -8,7 +8,7 @@ - + --> - + - + - - - - - - + + + + + + - - - - - - - - + + + + + - - - + + + + + + + + + + + @@ -106,6 +111,14 @@ xs: { span: 24 }, sm: { span: 16 }, }, + labelCol1: { + xs: { span: 24 }, + sm: { span: 3 }, + }, + wrapperCol1: { + xs: { span: 24 }, + sm: { span: 21 }, + }, confirmLoading: false, validatorRules: { }, diff --git a/ant-design-vue-jeecg/src/views/tool/tool/ZyToolList.vue b/ant-design-vue-jeecg/src/views/tool/tool/ZyToolList.vue index 8b600860..a7599047 100644 --- a/ant-design-vue-jeecg/src/views/tool/tool/ZyToolList.vue +++ b/ant-design-vue-jeecg/src/views/tool/tool/ZyToolList.vue @@ -4,6 +4,16 @@
+ + + + + + + + + + @@ -16,7 +26,7 @@ - diff --git a/ant-design-vue-jeecg/src/views/tool/tool/modules/ZyToolForm.vue b/ant-design-vue-jeecg/src/views/tool/tool/modules/ZyToolForm.vue index bf8fb095..55d96ca5 100644 --- a/ant-design-vue-jeecg/src/views/tool/tool/modules/ZyToolForm.vue +++ b/ant-design-vue-jeecg/src/views/tool/tool/modules/ZyToolForm.vue @@ -24,14 +24,19 @@ + + + + + - - + + - - + + @@ -46,7 +51,7 @@ - @@ -70,11 +75,7 @@ - - - - - + @@ -82,7 +83,13 @@ - + + + + + + @@ -121,6 +129,9 @@ data () { return { bianhao:'', + parm1:{ + brand_id:'' + }, model:{ status:1, }, @@ -134,6 +145,10 @@ }, confirmLoading: false, validatorRules: { + name:[ + { required: true, message: '请输入设备名称!'}, + {min: 1, max: 50, message: '最多输入50字!', trigger: 'blur'}, + ], }, url: { add: "/zytool/zyTool/add", @@ -152,6 +167,10 @@ this.modelDefault = JSON.parse(JSON.stringify(this.model)); }, methods: { + canshu(){ + this.parm1.brand_id=this.model.canshu + console.log(this.parm1) + }, add () { this.model = Object.assign({}, this.modelDefault); }, diff --git a/ant-design-vue-jeecg/src/views/tool/type/modules/ZyToolTypeForm.vue b/ant-design-vue-jeecg/src/views/tool/type/modules/ZyToolTypeForm.vue index 38ae3a99..3702dcc3 100644 --- a/ant-design-vue-jeecg/src/views/tool/type/modules/ZyToolTypeForm.vue +++ b/ant-design-vue-jeecg/src/views/tool/type/modules/ZyToolTypeForm.vue @@ -68,6 +68,10 @@ selfId:'', confirmLoading: false, validatorRules: { + name:[ + { required: true, message: '请输入设备类型!'}, + {min: 1, max: 50, message: '最多输入50字!', trigger: 'blur'}, + ], }, url: { add: "/tooltype/zyToolType/add", diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/controller/ZyDevicebrandController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/controller/ZyDevicebrandController.java index 8b1b2866..328e7806 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/controller/ZyDevicebrandController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/controller/ZyDevicebrandController.java @@ -134,7 +134,7 @@ public class ZyDevicebrandController extends JeecgController=0){ - return Result.error("本型号已被使用,删除失败!!"); + return Result.error("本品牌已被使用,删除失败!!"); } zyDevicebrandService.removeById(id); return Result.OK("删除成功!"); diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/toolbrand/controller/ZyToolBrandController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/toolbrand/controller/ZyToolBrandController.java index bd126512..4e8938b1 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/toolbrand/controller/ZyToolBrandController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/toolbrand/controller/ZyToolBrandController.java @@ -22,6 +22,7 @@ import lombok.extern.slf4j.Slf4j; import org.jeecg.modules.zytool.toolbrand.entity.ZyToolBrand; import org.jeecg.modules.zytool.toolbrand.service.IZyToolBrandService; +import org.jeecg.modules.zytool.toolmodel.service.IZyToolModelService; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; @@ -51,7 +52,8 @@ import org.jeecg.common.aspect.annotation.AutoLog; public class ZyToolBrandController extends JeecgController { @Autowired private IZyToolBrandService zyToolBrandService; - + @Autowired + private IZyToolModelService zyToolModelService; /** * 分页列表查询 * @@ -126,6 +128,12 @@ public class ZyToolBrandController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.eq("brand_id",id); + int a=zyToolModelService.count(queryWrapper); + if(a>=0){ + return Result.error("本品牌已被使用,删除失败!!"); + } zyToolBrandService.removeById(id); return Result.OK("删除成功!"); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/toolmodel/controller/ZyToolModelController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/toolmodel/controller/ZyToolModelController.java index 1c73f57a..dc3bc709 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/toolmodel/controller/ZyToolModelController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/toolmodel/controller/ZyToolModelController.java @@ -30,6 +30,7 @@ import lombok.extern.slf4j.Slf4j; import org.jeecg.modules.zytool.toolmodel.entity.ZyToolModel; import org.jeecg.modules.zytool.toolmodel.service.IZyToolModelService; +import org.jeecg.modules.zytool.zytool.service.IZyToolService; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; @@ -59,8 +60,10 @@ import org.jeecg.common.aspect.annotation.AutoLog; public class ZyToolModelController extends JeecgController { @Autowired private IZyToolModelService zyToolModelService; - - /** + @Autowired + private IZyToolService zyToolService; + + /** * 分页列表查询 * * @param zyToolModel @@ -162,6 +165,12 @@ public class ZyToolModelController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.eq("model_id",id); + int a=zyToolService.count(queryWrapper); + if(a>=1){ + return Result.error("工具型号有使用,删除失败!!!"); + } zyToolModelService.removeById(id); return Result.OK("删除成功!"); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/tooltype/controller/ZyToolTypeController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/tooltype/controller/ZyToolTypeController.java index 1a9c98d0..a674222d 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/tooltype/controller/ZyToolTypeController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/tooltype/controller/ZyToolTypeController.java @@ -19,6 +19,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; +import org.jeecg.modules.zydevice.devicetype.entity.ZyDevicetype; +import org.jeecg.modules.zytool.toolmodel.service.IZyToolModelService; import org.jeecg.modules.zytool.tooltype.entity.ZyToolType; import org.jeecg.modules.zytool.tooltype.service.IZyToolTypeService; import org.jeecgframework.poi.excel.ExcelImportUtil; @@ -50,7 +52,8 @@ import org.jeecg.common.aspect.annotation.AutoLog; public class ZyToolTypeController extends JeecgController { @Autowired private IZyToolTypeService zyToolTypeService; - + @Autowired + private IZyToolModelService zyToolModelService; /** * 分页列表查询 * @@ -127,6 +130,20 @@ public class ZyToolTypeController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { + ZyToolType zyTooltype = zyToolTypeService.getById(id); + //判断型号中是否被使用 + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.eq("tooltype_code",zyTooltype.getCode()); + int a=zyToolModelService.count(queryWrapper); + if(a>=1){ + return Result.error("本类型已被使用,请先删除对应型号!!!"); + } + QueryWrapper queryWrapper1=new QueryWrapper(); + queryWrapper.eq("self_id",id); + int sonCount=zyToolTypeService.count(queryWrapper1); + if(sonCount>=1){ + return Result.error("请先删除子节点"); + } zyToolTypeService.removeById(id); return Result.OK("删除成功!"); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/controller/ZyToolController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/controller/ZyToolController.java index f0632697..d682f937 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/controller/ZyToolController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/controller/ZyToolController.java @@ -78,7 +78,27 @@ public class ZyToolController extends JeecgController { @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) throws WriterException, IOException { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(zyTool, req.getParameterMap()); + //QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(zyTool, req.getParameterMap()); + QueryWrapper queryWrapper=new QueryWrapper(); + if(zyTool.getName()!=null){ + queryWrapper.like("name",zyTool.getName()); + } + if(zyTool.getCode()!=null){ + queryWrapper.like("code",zyTool.getCode()); + } + if(zyTool.getStatus()!=null){ + queryWrapper.eq("status",zyTool.getStatus()); + } + if(zyTool.getBrandId()!=null){ + String s="%"+zyTool.getBrandId()+"%"; + List brand=zyToolService.findAllBrand(s); + queryWrapper.in("brand_id",brand); + } + if(zyTool.getModelId()!=null){ + String s="%"+zyTool.getModelId()+"%"; + List model=zyToolService.findAllModel(s); + queryWrapper.in("model_id",model); + } Page page = new Page(pageNo, pageSize); IPage pageList = zyToolService.page(page, queryWrapper); MultiFormatWriter multiFormatWriter = new MultiFormatWriter(); @@ -192,6 +212,10 @@ public class ZyToolController extends JeecgController { @ApiOperation(value="工具表-通过id删除", notes="工具表-通过id删除") @DeleteMapping(value = "/delete") public Result delete(@RequestParam(name="id",required=true) String id) { + int a=zyToolService.find(id); + if(a>=1){ + return Result.error("有工序使用本工具,删除失败!!!"); + } zyToolService.removeById(id); return Result.OK("删除成功!"); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/mapper/ZyToolMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/mapper/ZyToolMapper.java index 8bea8872..c657fc93 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/mapper/ZyToolMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/mapper/ZyToolMapper.java @@ -25,4 +25,12 @@ public interface ZyToolMapper extends BaseMapper { @Select("select code from zy_tool order by code desc limit 0,1") String getCode(); + + @Select("select id from zy_tool_brand where brand like #{s}") + List findAllBrand(String s); + @Select("select id from zy_tool_model where model like #{s}") + List findAllModel(String s); + + @Select("select count(1) from zy_operationtool where toolid=#{id}") + int find(String id); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/service/IZyToolService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/service/IZyToolService.java index 26082be7..2cc26038 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/service/IZyToolService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/service/IZyToolService.java @@ -6,6 +6,8 @@ import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel; import org.jeecg.modules.zytool.toolmodel.entity.ZyToolModel; import org.jeecg.modules.zytool.zytool.entity.ZyTool; +import java.util.List; + /** * @Description: 工具表 * @Author: jeecg-boot @@ -17,4 +19,10 @@ public interface IZyToolService extends IService { ZyToolModel findByModelId(String modelId); String getCode(); + + List findAllBrand(String s); + + List findAllModel(String s); + + int find(String id); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/service/impl/ZyToolServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/service/impl/ZyToolServiceImpl.java index faa872bb..335fc249 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/service/impl/ZyToolServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/service/impl/ZyToolServiceImpl.java @@ -10,6 +10,8 @@ import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import java.util.List; + /** * @Description: 工具表 * @Author: jeecg-boot @@ -30,4 +32,19 @@ public class ZyToolServiceImpl extends ServiceImpl impleme public String getCode() { return zyToolMapper.getCode(); } + + @Override + public List findAllBrand(String s) { + return zyToolMapper.findAllBrand(s); + } + + @Override + public List findAllModel(String s) { + return zyToolMapper.findAllModel(s); + } + + @Override + public int find(String id) { + return zyToolMapper.find(id); + } }