diff --git a/ant-design-vue-jeecg/src/views/device/ZyDeviceList.vue b/ant-design-vue-jeecg/src/views/device/ZyDeviceList.vue index ae6f70a5..4d330be7 100644 --- a/ant-design-vue-jeecg/src/views/device/ZyDeviceList.vue +++ b/ant-design-vue-jeecg/src/views/device/ZyDeviceList.vue @@ -4,6 +4,28 @@
+ + + + + + + + + + + + + + + + + + 查询 + 重置 + +
@@ -12,18 +34,18 @@
新增 - 导出 - - 导入 - - - - - - 删除 - - 批量操作 - + + + + + + + + + + + +
@@ -76,21 +98,13 @@ 编辑 - - - 更多 - - 详情 - - + 删除 - - - + @@ -130,11 +144,11 @@ return parseInt(index)+1; } }, - { - title:'设备类型', - align:"center", - dataIndex: 'typeCode_dictText' - }, + // { + // title:'设备类型编码', + // align:"center", + // dataIndex: 'typeCode' + // }, { title:'设备型号', align:"center", @@ -184,7 +198,7 @@ { title:'设备状态', align:"center", - dataIndex: 'status' + dataIndex: 'status_dictText' }, { title:'维护周期', @@ -214,7 +228,7 @@ title: '操作', dataIndex: 'action', align:"center", - fixed:"right", + // fixed:"right", width:147, scopedSlots: { customRender: 'action' } } 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 48e23b02..746d0305 100644 --- a/ant-design-vue-jeecg/src/views/device/modules/ZyDeviceForm.vue +++ b/ant-design-vue-jeecg/src/views/device/modules/ZyDeviceForm.vue @@ -4,29 +4,48 @@ - - + + - - - - + + + - - + + + + + + + + + + + + + + + + + + + + + @@ -37,15 +56,18 @@ - - - - - + + + + + - + + + @@ -128,6 +150,7 @@ }, edit (record) { this.model = Object.assign({}, record); + this.model.code1=this.model.typeCode this.visible = true; }, submitForm () { @@ -159,6 +182,9 @@ }) }, + popupCallback(value,row){ + this.model = Object.assign(this.model, row); + }, } } \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/process/ZyClothActionList.vue b/ant-design-vue-jeecg/src/views/process/ZyClothActionList.vue index 4701f83c..71993b5a 100644 --- a/ant-design-vue-jeecg/src/views/process/ZyClothActionList.vue +++ b/ant-design-vue-jeecg/src/views/process/ZyClothActionList.vue @@ -17,7 +17,7 @@ 查询 - + 重置 diff --git a/ant-design-vue-jeecg/src/views/zydevice/devicebrand/ZyDevicebrandList.vue b/ant-design-vue-jeecg/src/views/zydevice/devicebrand/ZyDevicebrandList.vue new file mode 100644 index 00000000..2905bc99 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/zydevice/devicebrand/ZyDevicebrandList.vue @@ -0,0 +1,227 @@ + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/zydevice/devicebrand/modules/ZyDevicebrandForm.vue b/ant-design-vue-jeecg/src/views/zydevice/devicebrand/modules/ZyDevicebrandForm.vue new file mode 100644 index 00000000..4e3fbadb --- /dev/null +++ b/ant-design-vue-jeecg/src/views/zydevice/devicebrand/modules/ZyDevicebrandForm.vue @@ -0,0 +1,129 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/zydevice/devicebrand/modules/ZyDevicebrandModal.vue b/ant-design-vue-jeecg/src/views/zydevice/devicebrand/modules/ZyDevicebrandModal.vue new file mode 100644 index 00000000..856965ae --- /dev/null +++ b/ant-design-vue-jeecg/src/views/zydevice/devicebrand/modules/ZyDevicebrandModal.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/zydevice/devicebrand/modules/ZyDevicebrandModal__Style#Drawer.vue b/ant-design-vue-jeecg/src/views/zydevice/devicebrand/modules/ZyDevicebrandModal__Style#Drawer.vue new file mode 100644 index 00000000..f7bff71d --- /dev/null +++ b/ant-design-vue-jeecg/src/views/zydevice/devicebrand/modules/ZyDevicebrandModal__Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/zydevice/devicemodel/ZyDevicemodelList.vue b/ant-design-vue-jeecg/src/views/zydevice/devicemodel/ZyDevicemodelList.vue new file mode 100644 index 00000000..2fc805d3 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/zydevice/devicemodel/ZyDevicemodelList.vue @@ -0,0 +1,233 @@ + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/zydevice/devicemodel/modules/ZyDevicemodelForm.vue b/ant-design-vue-jeecg/src/views/zydevice/devicemodel/modules/ZyDevicemodelForm.vue new file mode 100644 index 00000000..290689cd --- /dev/null +++ b/ant-design-vue-jeecg/src/views/zydevice/devicemodel/modules/ZyDevicemodelForm.vue @@ -0,0 +1,188 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/zydevice/devicemodel/modules/ZyDevicemodelModal.vue b/ant-design-vue-jeecg/src/views/zydevice/devicemodel/modules/ZyDevicemodelModal.vue new file mode 100644 index 00000000..96c3d44f --- /dev/null +++ b/ant-design-vue-jeecg/src/views/zydevice/devicemodel/modules/ZyDevicemodelModal.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/zydevice/devicemodel/modules/ZyDevicemodelModal__Style#Drawer.vue b/ant-design-vue-jeecg/src/views/zydevice/devicemodel/modules/ZyDevicemodelModal__Style#Drawer.vue new file mode 100644 index 00000000..568e7723 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/zydevice/devicemodel/modules/ZyDevicemodelModal__Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/controller/ZyDeviceController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/controller/ZyDeviceController.java index 41ebe983..b4ed827d 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/controller/ZyDeviceController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/controller/ZyDeviceController.java @@ -28,6 +28,7 @@ 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.devicemodel.entity.ZyDevicemodel; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; @@ -130,8 +131,33 @@ public class ZyDeviceController extends JeecgController add(@RequestBody ZyDevice zyDevice) { - zyDeviceService.save(zyDevice); - return Result.OK("添加成功!"); + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.eq("name",zyDevice.getName()); + int a=zyDeviceService.count(queryWrapper); + if(a==0){ + if(zyDevice.getModelId()!=null&&!zyDevice.getModelId().equals("")){ + ZyDevicemodel zyDevicemodel=zyDeviceService.findByModelId(zyDevice.getModelId()); + if(zyDevicemodel.getBrandId()!=null){ + zyDevice.setBrandId(zyDevicemodel.getBrandId()); + zyDevice.setTypeCode(zyDevicemodel.getDevicetypeCode()); + } + } + String code=zyDeviceService.getCode(); + if(code==null||code.equals("")){ + zyDevice.setCode(zyDevice.getTypeCode()+"001"); + }else{ + String sort=String.valueOf(Integer.parseInt(code.substring(6))+1); + while(sort.length()<3){ + sort="0"+sort; + } + zyDevice.setCode(zyDevice.getTypeCode()+sort); + } + zyDeviceService.save(zyDevice); + return Result.OK("添加成功!"); + }else{ + return Result.error("添加失败,设备名称重复!!!"); + } + } /** @@ -144,8 +170,33 @@ public class ZyDeviceController extends JeecgController edit(@RequestBody ZyDevice zyDevice) { - zyDeviceService.updateById(zyDevice); - return Result.OK("编辑成功!"); + + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.eq("name",zyDevice.getName()); + int a=zyDeviceService.count(queryWrapper); + if(a==0){ + if(zyDevice.getModelId()!=null&&!zyDevice.getModelId().equals("")){ + ZyDevicemodel zyDevicemodel=zyDeviceService.findByModelId(zyDevice.getModelId()); + if(zyDevicemodel.getBrandId()!=null){ + zyDevice.setBrandId(zyDevicemodel.getBrandId()); + zyDevice.setTypeCode(zyDevicemodel.getDevicetypeCode()); + } + } + String code=zyDeviceService.getCode(); + if(code==null||code.equals("")){ + zyDevice.setCode(zyDevice.getTypeCode()+"001"); + }else{ + String sort=String.valueOf(Integer.parseInt(code.substring(6))+1); + while(sort.length()<3){ + sort="0"+sort; + } + zyDevice.setCode(zyDevice.getTypeCode()+sort); + } + zyDeviceService.updateById(zyDevice); + return Result.OK("编辑成功!"); + }else{ + return Result.error("编辑失败,设备名称重复!!!"); + } } /** diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/entity/ZyDevice.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/entity/ZyDevice.java index 889f74f0..d69da413 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/entity/ZyDevice.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/entity/ZyDevice.java @@ -53,6 +53,7 @@ public class ZyDevice implements Serializable { private Date updateTime; /**所属部门*/ @ApiModelProperty(value = "所属部门") + @Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") private String orgCode; /**设备图片*/ @Excel(name = "设备图片", width = 15) @@ -85,6 +86,7 @@ public class ZyDevice implements Serializable { /**设备状态*/ @Excel(name = "设备状态", width = 15) @ApiModelProperty(value = "设备状态") + @Dict(dicCode = "devicestatus1") private String status; /**二维码*/ @Excel(name = "二维码", width = 15) @@ -116,7 +118,6 @@ public class ZyDevice implements Serializable { @Dict(dictTable = "zy_devicemodel", dicText = "model", dicCode = "id") @ApiModelProperty(value = "设备型号") private String modelId; - @Dict(dictTable = "zy_devicetype", dicText = "name", dicCode = "id") @ApiModelProperty(value = "设备类型") private String typeCode; diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/mapper/ZyDeviceMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/mapper/ZyDeviceMapper.java index 49ab2775..eada1e78 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/mapper/ZyDeviceMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/mapper/ZyDeviceMapper.java @@ -3,8 +3,10 @@ package org.jeecg.modules.device.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; import org.jeecg.modules.device.entity.ZyDevice; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel; /** * @Description: 设备信息 @@ -14,4 +16,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; */ public interface ZyDeviceMapper extends BaseMapper { + @Select("select * from zy_devicemodel where id=#{modelId}") + ZyDevicemodel findByModelId(String modelId); + + @Select("select code from zy_device order by code desc limit 0,1") + String getCode(); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/IZyDeviceService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/IZyDeviceService.java index d815db03..26cb92eb 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/IZyDeviceService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/IZyDeviceService.java @@ -2,6 +2,7 @@ package org.jeecg.modules.device.service; import org.jeecg.modules.device.entity.ZyDevice; import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel; /** * @Description: 设备信息 @@ -11,4 +12,7 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IZyDeviceService extends IService { + ZyDevicemodel findByModelId(String modelId); + + String getCode(); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/impl/ZyDeviceServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/impl/ZyDeviceServiceImpl.java index e5bfcce5..95332469 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/impl/ZyDeviceServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/device/service/impl/ZyDeviceServiceImpl.java @@ -3,6 +3,8 @@ package org.jeecg.modules.device.service.impl; import org.jeecg.modules.device.entity.ZyDevice; import org.jeecg.modules.device.mapper.ZyDeviceMapper; import org.jeecg.modules.device.service.IZyDeviceService; +import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -16,4 +18,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @Service public class ZyDeviceServiceImpl extends ServiceImpl implements IZyDeviceService { + @Autowired + ZyDeviceMapper zyDeviceMapper; + @Override + public ZyDevicemodel findByModelId(String modelId) { + return zyDeviceMapper.findByModelId(modelId); + } + + @Override + public String getCode() { + return zyDeviceMapper.getCode(); + } } 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 new file mode 100644 index 00000000..ff131200 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/controller/ZyDevicebrandController.java @@ -0,0 +1,188 @@ +package org.jeecg.modules.zydevice.devicebrand.controller; + + + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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.devicebrand.entity.ZyDevicebrand; +import org.jeecg.modules.zydevice.devicebrand.service.IZyDevicebrandService; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 设备品牌管理 + * @Author: jeecg-boot + * @Date: 2023-01-05 + * @Version: V1.0 + */ +@Api(tags="设备品牌管理") +@RestController +@RequestMapping("/devicebrand/zyDevicebrand") +@Slf4j +public class ZyDevicebrandController extends JeecgController { + @Autowired + private IZyDevicebrandService zyDevicebrandService; + + /** + * 分页列表查询 + * + * @param zyDevicebrand + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "设备品牌管理-分页列表查询") + @ApiOperation(value="设备品牌管理-分页列表查询", notes="设备品牌管理-分页列表查询") + @GetMapping(value = "/list") + public Result queryPageList(ZyDevicebrand zyDevicebrand, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(zyDevicebrand, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = zyDevicebrandService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param zyDevicebrand + * @return + */ + @AutoLog(value = "设备品牌管理-添加") + @ApiOperation(value="设备品牌管理-添加", notes="设备品牌管理-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody ZyDevicebrand zyDevicebrand) { + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.eq("brand",zyDevicebrand.getBrand()); + int a=zyDevicebrandService.count(queryWrapper); + if(a==0){ + zyDevicebrandService.save(zyDevicebrand); + return Result.OK("添加成功!"); + }else{ + return Result.error("添加失败,品牌名重复!!!"); + } + + } + + /** + * 编辑 + * + * @param zyDevicebrand + * @return + */ + @AutoLog(value = "设备品牌管理-编辑") + @ApiOperation(value="设备品牌管理-编辑", notes="设备品牌管理-编辑") + @PutMapping(value = "/edit") + public Result edit(@RequestBody ZyDevicebrand zyDevicebrand) { + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.eq("brand",zyDevicebrand.getBrand()); + int a=zyDevicebrandService.count(queryWrapper); + if(a==0){ + zyDevicebrandService.updateById(zyDevicebrand); + return Result.OK("编辑成功!"); + }else{ + return Result.error("编辑失败,品牌名重复!!!"); + } + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "设备品牌管理-通过id删除") + @ApiOperation(value="设备品牌管理-通过id删除", notes="设备品牌管理-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + zyDevicebrandService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "设备品牌管理-批量删除") + @ApiOperation(value="设备品牌管理-批量删除", notes="设备品牌管理-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.zyDevicebrandService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @AutoLog(value = "设备品牌管理-通过id查询") + @ApiOperation(value="设备品牌管理-通过id查询", notes="设备品牌管理-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + ZyDevicebrand zyDevicebrand = zyDevicebrandService.getById(id); + if(zyDevicebrand==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(zyDevicebrand); + } + + /** + * 导出excel + * + * @param request + * @param zyDevicebrand + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ZyDevicebrand zyDevicebrand) { + return super.exportXls(request, zyDevicebrand, ZyDevicebrand.class, "设备品牌管理"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, ZyDevicebrand.class); + } + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/entity/ZyDevicebrand.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/entity/ZyDevicebrand.java new file mode 100644 index 00000000..db598a1e --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/entity/ZyDevicebrand.java @@ -0,0 +1,80 @@ +package org.jeecg.modules.zydevice.devicebrand.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 设备品牌管理 + * @Author: jeecg-boot + * @Date: 2023-01-05 + * @Version: V1.0 + */ +@Data +@TableName("zy_devicebrand") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="zy_devicebrand对象", description="设备品牌管理") +public class ZyDevicebrand implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private Date updateTime; + /**品牌图片*/ + @Excel(name = "品牌图片", width = 15) + @ApiModelProperty(value = "品牌图片") + private String img; + /**品牌名称*/ + @Excel(name = "品牌名称", width = 15) + @ApiModelProperty(value = "品牌名称") + private String brand; + /**生产厂商*/ + @Excel(name = "生产厂商", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") + @Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") + @ApiModelProperty(value = "生产厂商") + private String manufacturer; + /**供应商*/ + @Excel(name = "供应商", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") + @Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") + @ApiModelProperty(value = "供应商") + private String supplier; + /**联系人*/ + @Excel(name = "联系人", width = 15) + @ApiModelProperty(value = "联系人") + private String contact; + /**产地*/ + @Excel(name = "产地", width = 15) + @ApiModelProperty(value = "产地") + private String place; +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/mapper/ZyDevicebrandMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/mapper/ZyDevicebrandMapper.java new file mode 100644 index 00000000..49c32881 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/mapper/ZyDevicebrandMapper.java @@ -0,0 +1,20 @@ +package org.jeecg.modules.zydevice.devicebrand.mapper; + + + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.zydevice.devicebrand.entity.ZyDevicebrand; + +/** + * @Description: 设备品牌管理 + * @Author: jeecg-boot + * @Date: 2023-01-05 + * @Version: V1.0 + */ +public interface ZyDevicebrandMapper extends BaseMapper { + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/mapper/xml/ZyDevicebrandMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/mapper/xml/ZyDevicebrandMapper.xml new file mode 100644 index 00000000..cdfee1f6 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/mapper/xml/ZyDevicebrandMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/service/IZyDevicebrandService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/service/IZyDevicebrandService.java new file mode 100644 index 00000000..f70edf29 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/service/IZyDevicebrandService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.zydevice.devicebrand.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.zydevice.devicebrand.entity.ZyDevicebrand; + +/** + * @Description: 设备品牌管理 + * @Author: jeecg-boot + * @Date: 2023-01-05 + * @Version: V1.0 + */ +public interface IZyDevicebrandService extends IService { + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/service/impl/ZyDevicebrandServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/service/impl/ZyDevicebrandServiceImpl.java new file mode 100644 index 00000000..48be6bcb --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicebrand/service/impl/ZyDevicebrandServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.zydevice.devicebrand.service.impl; + +import org.jeecg.modules.zydevice.devicebrand.entity.ZyDevicebrand; +import org.jeecg.modules.zydevice.devicebrand.mapper.ZyDevicebrandMapper; +import org.jeecg.modules.zydevice.devicebrand.service.IZyDevicebrandService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 设备品牌管理 + * @Author: jeecg-boot + * @Date: 2023-01-05 + * @Version: V1.0 + */ +@Service +public class ZyDevicebrandServiceImpl extends ServiceImpl implements IZyDevicebrandService { + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/controller/ZyDevicemodelController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/controller/ZyDevicemodelController.java new file mode 100644 index 00000000..82a378f2 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/controller/ZyDevicemodelController.java @@ -0,0 +1,223 @@ +package org.jeecg.modules.zydevice.devicemodel.controller; + + + +import java.io.ByteArrayOutputStream; +import java.util.*; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.google.zxing.BarcodeFormat; +import com.google.zxing.EncodeHintType; +import com.google.zxing.MultiFormatWriter; +import com.google.zxing.WriterException; +import com.google.zxing.client.j2se.MatrixToImageWriter; +import com.google.zxing.common.BitMatrix; +import com.google.zxing.qrcode.QRCodeWriter; +import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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.devicemodel.entity.ZyDevicemodel; +import org.jeecg.modules.zydevice.devicemodel.service.IZyDevicemodelService; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 设备型号表 + * @Author: jeecg-boot + * @Date: 2023-01-05 + * @Version: V1.0 + */ +@Api(tags="设备型号表") +@RestController +@RequestMapping("/devicemodel/zyDevicemodel") +@Slf4j +public class ZyDevicemodelController extends JeecgController { + @Autowired + private IZyDevicemodelService zyDevicemodelService; + + /** + * 分页列表查询 + * + * @param zyDevicemodel + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "设备型号表-分页列表查询") + @ApiOperation(value="设备型号表-分页列表查询", notes="设备型号表-分页列表查询") + @GetMapping(value = "/list") + public Result queryPageList(ZyDevicemodel zyDevicemodel, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) throws WriterException, IOException { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(zyDevicemodel, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = zyDevicemodelService.page(page, queryWrapper); + MultiFormatWriter multiFormatWriter = new MultiFormatWriter(); + @SuppressWarnings("rawtypes") + Map hints = new HashMap(); + //设置UTF-8, 防止中文乱码 + hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); + //设置二维码四周白色区域的大小 + hints.put(EncodeHintType.MARGIN, 1); + //设置二维码的容错性 + hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); + //width:图片完整的宽;height:图片完整的高 + //因为要在二维码下方附上文字,所以把图片设置为长方形(高大于宽) + int width = 150; + int height = 150; + //画二维码,记得调用multiFormatWriter.encode()时最后要带上hints参数,不然上面设置无效 + QRCodeWriter qrCodeWriter = new QRCodeWriter(); + List img= new ArrayList<>(); + String content=""; + //批量生成二维码 + for (int i=0;i add(@RequestBody ZyDevicemodel zyDevicemodel) { + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.eq("model",zyDevicemodel.getModel()); + int a=zyDevicemodelService.count(queryWrapper); + if(a==0){ + zyDevicemodelService.save(zyDevicemodel); + return Result.OK("添加成功!"); + }else{ + return Result.error("添加失败,型号重复!!!"); + } + + } + + /** + * 编辑 + * + * @param zyDevicemodel + * @return + */ + @AutoLog(value = "设备型号表-编辑") + @ApiOperation(value="设备型号表-编辑", notes="设备型号表-编辑") + @PutMapping(value = "/edit") + public Result edit(@RequestBody ZyDevicemodel zyDevicemodel) { + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.eq("model",zyDevicemodel.getModel()); + int a=zyDevicemodelService.count(queryWrapper); + if(a==0){ + zyDevicemodelService.updateById(zyDevicemodel); + return Result.OK("编辑成功!"); + }else{ + return Result.error("编辑失败,型号重复!!!"); + } + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "设备型号表-通过id删除") + @ApiOperation(value="设备型号表-通过id删除", notes="设备型号表-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + zyDevicemodelService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "设备型号表-批量删除") + @ApiOperation(value="设备型号表-批量删除", notes="设备型号表-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.zyDevicemodelService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @AutoLog(value = "设备型号表-通过id查询") + @ApiOperation(value="设备型号表-通过id查询", notes="设备型号表-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + ZyDevicemodel zyDevicemodel = zyDevicemodelService.getById(id); + if(zyDevicemodel==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(zyDevicemodel); + } + + /** + * 导出excel + * + * @param request + * @param zyDevicemodel + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ZyDevicemodel zyDevicemodel) { + return super.exportXls(request, zyDevicemodel, ZyDevicemodel.class, "设备型号表"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, ZyDevicemodel.class); + } + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/entity/ZyDevicemodel.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/entity/ZyDevicemodel.java new file mode 100644 index 00000000..a414ac30 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/entity/ZyDevicemodel.java @@ -0,0 +1,90 @@ +package org.jeecg.modules.zydevice.devicemodel.entity; + + + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 设备型号表 + * @Author: jeecg-boot + * @Date: 2023-01-05 + * @Version: V1.0 + */ +@Data +@TableName("zy_devicemodel") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="zy_devicemodel对象", description="设备型号表") +public class ZyDevicemodel implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private Date updateTime; + /**品牌id(名称)*/ + @Excel(name = "品牌id(名称)", width = 15) + @ApiModelProperty(value = "品牌id(名称)") + @Dict(dictTable = "zy_devicebrand" ,dicCode = "id",dicText = "brand") + private String brandId; + /**类型编号*/ + @Excel(name = "类型编号", width = 15) + @ApiModelProperty(value = "类型编号") +// @Dict(dictTable = "zy_devicetype" ,dicCode = "id",dicText = "code") + private String devicetypeCode; + /**型号图片*/ + @Excel(name = "型号图片", width = 15) + @ApiModelProperty(value = "型号图片") + private String img; + /**二维码*/ + @Excel(name = "二维码", width = 15) + @ApiModelProperty(value = "二维码") + private String qrcode; + /**型号*/ + @Excel(name = "型号", width = 15) + @ApiModelProperty(value = "型号") + private String model; + /**型号参数*/ + @Excel(name = "型号参数", width = 15) + @ApiModelProperty(value = "型号参数") + private String parameters; + /**型号描述*/ + @Excel(name = "型号描述", width = 15) + @ApiModelProperty(value = "型号描述") + private String description; + /**联系人*/ + @Excel(name = "联系人", width = 15) + @ApiModelProperty(value = "联系人") + private String contact; +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/mapper/ZyDevicemodelMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/mapper/ZyDevicemodelMapper.java new file mode 100644 index 00000000..f1a0ebf5 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/mapper/ZyDevicemodelMapper.java @@ -0,0 +1,20 @@ +package org.jeecg.modules.zydevice.devicemodel.mapper; + + + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel; + +/** + * @Description: 设备型号表 + * @Author: jeecg-boot + * @Date: 2023-01-05 + * @Version: V1.0 + */ +public interface ZyDevicemodelMapper extends BaseMapper { + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/mapper/xml/ZyDevicemodelMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/mapper/xml/ZyDevicemodelMapper.xml new file mode 100644 index 00000000..40a650e0 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/mapper/xml/ZyDevicemodelMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/service/IZyDevicemodelService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/service/IZyDevicemodelService.java new file mode 100644 index 00000000..a70c69cb --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/service/IZyDevicemodelService.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.zydevice.devicemodel.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel; + +/** + * @Description: 设备型号表 + * @Author: jeecg-boot + * @Date: 2023-01-05 + * @Version: V1.0 + */ +public interface IZyDevicemodelService extends IService { + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/service/impl/ZyDevicemodelServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/service/impl/ZyDevicemodelServiceImpl.java new file mode 100644 index 00000000..0d1ebf1a --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zydevice/devicemodel/service/impl/ZyDevicemodelServiceImpl.java @@ -0,0 +1,20 @@ +package org.jeecg.modules.zydevice.devicemodel.service.impl; + + +import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel; +import org.jeecg.modules.zydevice.devicemodel.mapper.ZyDevicemodelMapper; +import org.jeecg.modules.zydevice.devicemodel.service.IZyDevicemodelService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 设备型号表 + * @Author: jeecg-boot + * @Date: 2023-01-05 + * @Version: V1.0 + */ +@Service +public class ZyDevicemodelServiceImpl extends ServiceImpl implements IZyDevicemodelService { + +}