diff --git a/ant-design-vue-jeecg/src/views/pdmodulecomponent/ProductModuleComponentList.vue b/ant-design-vue-jeecg/src/views/pdmodulecomponent/ProductModuleComponentList.vue new file mode 100644 index 00000000..1cd056a1 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/pdmodulecomponent/ProductModuleComponentList.vue @@ -0,0 +1,284 @@ + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/pdmodulecomponent/modules/ProductModuleComponentForm.vue b/ant-design-vue-jeecg/src/views/pdmodulecomponent/modules/ProductModuleComponentForm.vue new file mode 100644 index 00000000..f46bc54f --- /dev/null +++ b/ant-design-vue-jeecg/src/views/pdmodulecomponent/modules/ProductModuleComponentForm.vue @@ -0,0 +1,124 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/pdmodulecomponent/modules/ProductModuleComponentModal.vue b/ant-design-vue-jeecg/src/views/pdmodulecomponent/modules/ProductModuleComponentModal.vue new file mode 100644 index 00000000..26e7ac59 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/pdmodulecomponent/modules/ProductModuleComponentModal.vue @@ -0,0 +1,78 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/pdmodulecomponent/modules/ProductModuleComponentModal__Style#Drawer.vue b/ant-design-vue-jeecg/src/views/pdmodulecomponent/modules/ProductModuleComponentModal__Style#Drawer.vue new file mode 100644 index 00000000..95261a91 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/pdmodulecomponent/modules/ProductModuleComponentModal__Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/pdmodulecomponent/modules/ZyClothsComponentList.vue b/ant-design-vue-jeecg/src/views/pdmodulecomponent/modules/ZyClothsComponentList.vue new file mode 100644 index 00000000..cd056eb5 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/pdmodulecomponent/modules/ZyClothsComponentList.vue @@ -0,0 +1,165 @@ + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/pdmoduleprocess/ProductModuleProcessList.vue b/ant-design-vue-jeecg/src/views/pdmoduleprocess/ProductModuleProcessList.vue new file mode 100644 index 00000000..894b976c --- /dev/null +++ b/ant-design-vue-jeecg/src/views/pdmoduleprocess/ProductModuleProcessList.vue @@ -0,0 +1,286 @@ + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/pdmoduleprocess/modules/ProductModuleProcessForm.vue b/ant-design-vue-jeecg/src/views/pdmoduleprocess/modules/ProductModuleProcessForm.vue new file mode 100644 index 00000000..c7fd6047 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/pdmoduleprocess/modules/ProductModuleProcessForm.vue @@ -0,0 +1,124 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/pdmoduleprocess/modules/ProductModuleProcessModal.vue b/ant-design-vue-jeecg/src/views/pdmoduleprocess/modules/ProductModuleProcessModal.vue new file mode 100644 index 00000000..e2daf499 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/pdmoduleprocess/modules/ProductModuleProcessModal.vue @@ -0,0 +1,76 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/pdmoduleprocess/modules/ProductModuleProcessModal__Style#Drawer.vue b/ant-design-vue-jeecg/src/views/pdmoduleprocess/modules/ProductModuleProcessModal__Style#Drawer.vue new file mode 100644 index 00000000..0a9b3768 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/pdmoduleprocess/modules/ProductModuleProcessModal__Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/pdmoduleprocess/modules/ZyProcessList.vue b/ant-design-vue-jeecg/src/views/pdmoduleprocess/modules/ZyProcessList.vue new file mode 100644 index 00000000..31f8b3f8 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/pdmoduleprocess/modules/ZyProcessList.vue @@ -0,0 +1,288 @@ + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/product/productProcess/ZyProductProcessList.vue b/ant-design-vue-jeecg/src/views/product/productProcess/ZyProductProcessList.vue index 01b0ba58..6351464e 100644 --- a/ant-design-vue-jeecg/src/views/product/productProcess/ZyProductProcessList.vue +++ b/ant-design-vue-jeecg/src/views/product/productProcess/ZyProductProcessList.vue @@ -115,10 +115,10 @@ data () { return { description: '产品工序管理页面', + processId:'', // 表头 columns: [ { - processId:'', title: '#', dataIndex: '', key:'rowIndex', @@ -131,7 +131,7 @@ { title:'产品编号', align:"center", - dataIndex: 'productId_dicText' + dataIndex: 'productId_dictText' }, { title:'工序名称', diff --git a/ant-design-vue-jeecg/src/views/product/productProcess/modules/ZyProcessList.vue b/ant-design-vue-jeecg/src/views/product/productProcess/modules/ZyProcessList.vue index 52229cbb..0718a96d 100644 --- a/ant-design-vue-jeecg/src/views/product/productProcess/modules/ZyProcessList.vue +++ b/ant-design-vue-jeecg/src/views/product/productProcess/modules/ZyProcessList.vue @@ -43,20 +43,7 @@ - - - - - - - 删除 - - - 批量操作 - - - + diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/controller/ProductModuleComponentController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/controller/ProductModuleComponentController.java new file mode 100644 index 00000000..aa2049fd --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/controller/ProductModuleComponentController.java @@ -0,0 +1,217 @@ +package org.jeecg.modules.pdmodulecomponent.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.pdmodulecomponent.entity.ProductModuleComponent; +import org.jeecg.modules.pdmodulecomponent.service.IProductModuleComponentService; +import org.jeecg.modules.pdmoduleprocess.entity.ProductModuleProcess; +import org.jeecg.modules.product.zyproductprocess.service.IZyProductProcessService; +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: 2022-12-19 + * @Version: V1.0 + */ +@Api(tags="产品模块部件表") +@RestController +@RequestMapping("/pdmodulecomponent/productModuleComponent") +@Slf4j +public class ProductModuleComponentController extends JeecgController { + @Autowired + private IProductModuleComponentService productModuleComponentService; + @Autowired + IZyProductProcessService zyProductProcessService; + /** + * 分页列表查询 + * + * @param productModuleComponent + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "产品模块部件表-分页列表查询") + @ApiOperation(value="产品模块部件表-分页列表查询", notes="产品模块部件表-分页列表查询") + @GetMapping(value = "/list") + public Result queryPageList(ProductModuleComponent productModuleComponent, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.orderByDesc("number"); + //查询指定模块对应的工序 + queryWrapper.eq("product_module_id",productModuleComponent.getProductModuleId()); + //根据产品编号查询 +// if(productModuleComponent.getProductId()!=null&&!productModuleComponent.getProductId().equals("")){ +// String s="%"+productModuleComponent.getProductId()+"%"; +// List list=zyProductProcessService.findProduct(s); +// queryWrapper.in("product_id",list); +// } + //根据部件查询 + if(productModuleComponent.getComponentId()!=null&&!productModuleComponent.getComponentId().equals("")){ + String s="%"+productModuleComponent.getComponentId()+"%"; + List list=productModuleComponentService.find(s); + queryWrapper.in("component_id",list); + } + Page page = new Page(pageNo, pageSize); + IPage pageList = productModuleComponentService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param productModuleComponent + * @return + */ + @AutoLog(value = "产品模块部件表-添加") + @ApiOperation(value="产品模块部件表-添加", notes="产品模块部件表-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody ProductModuleComponent productModuleComponent) { + /* + * 通过模块id获取模块中的模块id和产品id,由于当前产品模块还没有写,暂时先不添加模块id和产品id + * */ + String[] split = productModuleComponent.getComponentId().split(","); + for (String k : split) { + productModuleComponent.setComponentId(k); + QueryWrapper s=new QueryWrapper(); + s.eq("product_module_id",productModuleComponent.getProductModuleId()); + s.eq("component_id",productModuleComponent.getComponentId()); + int a=productModuleComponentService.count(s); + if(a==0) + productModuleComponentService.save(productModuleComponent); + productModuleComponent.setId(null); + } + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param productModuleComponent + * @return + */ + @AutoLog(value = "产品模块部件表-编辑") + @ApiOperation(value="产品模块部件表-编辑", notes="产品模块部件表-编辑") + @PutMapping(value = "/edit") + public Result edit(@RequestBody ProductModuleComponent productModuleComponent) { + productModuleComponentService.updateById(productModuleComponent); + return Result.OK("编辑成功!"); + } + + /** + * 通过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) { + productModuleComponentService.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.productModuleComponentService.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) { + ProductModuleComponent productModuleComponent = productModuleComponentService.getById(id); + if(productModuleComponent==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(productModuleComponent); + } + + /** + * 导出excel + * + * @param request + * @param productModuleComponent + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ProductModuleComponent productModuleComponent) { + return super.exportXls(request, productModuleComponent, ProductModuleComponent.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, ProductModuleComponent.class); + } + @GetMapping(value = "/up") + public Result up(@RequestParam(name="id",required=true) String id) { + productModuleComponentService.up(id); + return Result.OK("升序成功"); + } + @GetMapping(value = "/down") + public Result down(@RequestParam(name="id",required=true) String id) { + ProductModuleComponent zyProductProcess = productModuleComponentService.getById(id); + if(zyProductProcess==null||zyProductProcess.getNumber()==0) + return Result.error("当前以是最低级别!!"); + productModuleComponentService.down(id); + return Result.OK("降序成功"); + } +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/entity/ProductModuleComponent.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/entity/ProductModuleComponent.java new file mode 100644 index 00000000..d909362b --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/entity/ProductModuleComponent.java @@ -0,0 +1,70 @@ +package org.jeecg.modules.pdmodulecomponent.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: 2022-12-19 + * @Version: V1.0 + */ +@Data +@TableName("product_module_component") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="product_module_component对象", description="产品模块部件表") +public class ProductModuleComponent 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; + /**产品id*/ + @Excel(name = "产品id", width = 15) + @ApiModelProperty(value = "产品id") + //@Dict(dictTable = "zy_product",dicText = "product_code",dicCode = "id") 表暂未设计暂时不打开 + private String productId; + /**产品模块id*/ + @Excel(name = "产品模块id", width = 15) + @ApiModelProperty(value = "产品模块id") + private String productModuleId; + /**模块id*/ + @Excel(name = "模块id", width = 15) + @ApiModelProperty(value = "模块id") + @Dict(dictTable = "zy_cloths_modular",dicText = "modular_name",dicCode = "id") + private String moduleId; + /**部件id*/ + @Excel(name = "部件id", width = 15) + @ApiModelProperty(value = "部件id") + @Dict(dictTable = "zy_cloths_component",dicText = "parts_name",dicCode = "id") + private String componentId; + /**序号*/ + @Excel(name = "序号", width = 15) + @ApiModelProperty(value = "序号") + private Integer number; +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/mapper/ProductModuleComponentMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/mapper/ProductModuleComponentMapper.java new file mode 100644 index 00000000..be7c943f --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/mapper/ProductModuleComponentMapper.java @@ -0,0 +1,27 @@ +package org.jeecg.modules.pdmodulecomponent.mapper; + + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import org.jeecg.modules.pdmodulecomponent.entity.ProductModuleComponent; + +/** + * @Description: 产品模块部件表 + * @Author: jeecg-boot + * @Date: 2022-12-19 + * @Version: V1.0 + */ +public interface ProductModuleComponentMapper extends BaseMapper { + + @Select("select id from zy_cloths_component where parts_name like #{s}") + List find(String s); + @Update("update product_module_component set number=number+1 where id=#{id}") + void up(String id); + @Update("update product_module_component set number=number-1 where id=#{id}") + void down(String id); +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/mapper/xml/ProductModuleComponentMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/mapper/xml/ProductModuleComponentMapper.xml new file mode 100644 index 00000000..c4361def --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/mapper/xml/ProductModuleComponentMapper.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/pdmodulecomponent/service/IProductModuleComponentService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/service/IProductModuleComponentService.java new file mode 100644 index 00000000..ffbfa035 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/service/IProductModuleComponentService.java @@ -0,0 +1,22 @@ +package org.jeecg.modules.pdmodulecomponent.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.pdmodulecomponent.entity.ProductModuleComponent; + +import java.util.List; + +/** + * @Description: 产品模块部件表 + * @Author: jeecg-boot + * @Date: 2022-12-19 + * @Version: V1.0 + */ +public interface IProductModuleComponentService extends IService { + + List find(String s); + + void up(String id); + + void down(String id); +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/service/impl/ProductModuleComponentServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/service/impl/ProductModuleComponentServiceImpl.java new file mode 100644 index 00000000..379e8471 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmodulecomponent/service/impl/ProductModuleComponentServiceImpl.java @@ -0,0 +1,39 @@ +package org.jeecg.modules.pdmodulecomponent.service.impl; + + +import org.jeecg.modules.pdmodulecomponent.entity.ProductModuleComponent; +import org.jeecg.modules.pdmodulecomponent.mapper.ProductModuleComponentMapper; +import org.jeecg.modules.pdmodulecomponent.service.IProductModuleComponentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import java.util.List; + +/** + * @Description: 产品模块部件表 + * @Author: jeecg-boot + * @Date: 2022-12-19 + * @Version: V1.0 + */ +@Service +public class ProductModuleComponentServiceImpl extends ServiceImpl implements IProductModuleComponentService { + + @Autowired + ProductModuleComponentMapper productModuleComponentMapper; + @Override + public List find(String s) { + return productModuleComponentMapper.find(s); + } + + @Override + public void up(String id) { + productModuleComponentMapper.up(id); + } + + @Override + public void down(String id) { + productModuleComponentMapper.down(id); + } +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/controller/ProductModuleProcessController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/controller/ProductModuleProcessController.java new file mode 100644 index 00000000..d752d09c --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/controller/ProductModuleProcessController.java @@ -0,0 +1,217 @@ +package org.jeecg.modules.pdmoduleprocess.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.pdmoduleprocess.entity.ProductModuleProcess; +import org.jeecg.modules.pdmoduleprocess.service.IProductModuleProcessService; +import org.jeecg.modules.product.zyproductprocess.entity.ZyProductProcess; +import org.jeecg.modules.product.zyproductprocess.service.IZyProductProcessService; +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: 2022-12-16 + * @Version: V1.0 + */ +@Api(tags="产品模块工序") +@RestController +@RequestMapping("/pdmoduleprocess/productModuleProcess") +@Slf4j +public class ProductModuleProcessController extends JeecgController { + @Autowired + private IProductModuleProcessService productModuleProcessService; + @Autowired + IZyProductProcessService zyProductProcessService; + /** + * 分页列表查询 + * + * @param productModuleProcess + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "产品模块工序-分页列表查询") + @ApiOperation(value="产品模块工序-分页列表查询", notes="产品模块工序-分页列表查询") + @GetMapping(value = "/list") + public Result queryPageList(ProductModuleProcess productModuleProcess, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { +// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(productModuleProcess, req.getParameterMap()); + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.orderByDesc("number"); + //查询指定模块对应的工序 + queryWrapper.eq("product_module_id",productModuleProcess.getProductModuleId()); + //根据产品编号查询 +// if(productModuleProcess.getProductId()!=null&&!productModuleProcess.getProductId().equals("")){ +// String s="%"+productModuleProcess.getProductId()+"%"; +// List list=zyProductProcessService.findProduct(s); +// queryWrapper.in("product_id",list); +// } + if(productModuleProcess.getProcessId()!=null&&!productModuleProcess.getProcessId().equals("")){ + String s="%"+productModuleProcess.getProcessId()+"%"; + List list=zyProductProcessService.find(s); + queryWrapper.in("process_id",list); + } + Page page = new Page(pageNo, pageSize); + IPage pageList = productModuleProcessService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param productModuleProcess + * @return + */ + @AutoLog(value = "产品模块工序-添加") + @ApiOperation(value="产品模块工序-添加", notes="产品模块工序-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody ProductModuleProcess productModuleProcess) { + /* + * 通过模块id获取模块中的模块id和产品id,由于当前产品模块还没有写,暂时先不添加模块id和产品id + * */ + String[] split = productModuleProcess.getProcessId().split(","); + for (String k : split) { + productModuleProcess.setProcessId(k); + QueryWrapper s=new QueryWrapper(); + s.eq("product_module_id",productModuleProcess.getProductModuleId()); + s.eq("process_id",productModuleProcess.getProcessId()); + int a=productModuleProcessService.count(s); + if(a==0) + productModuleProcessService.save(productModuleProcess); + productModuleProcess.setId(null); + } + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param productModuleProcess + * @return + */ + @AutoLog(value = "产品模块工序-编辑") + @ApiOperation(value="产品模块工序-编辑", notes="产品模块工序-编辑") + @PutMapping(value = "/edit") + public Result edit(@RequestBody ProductModuleProcess productModuleProcess) { + productModuleProcessService.updateById(productModuleProcess); + return Result.OK("编辑成功!"); + } + + /** + * 通过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) { + productModuleProcessService.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.productModuleProcessService.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) { + ProductModuleProcess productModuleProcess = productModuleProcessService.getById(id); + if(productModuleProcess==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(productModuleProcess); + } + + /** + * 导出excel + * + * @param request + * @param productModuleProcess + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ProductModuleProcess productModuleProcess) { + return super.exportXls(request, productModuleProcess, ProductModuleProcess.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, ProductModuleProcess.class); + } + @GetMapping(value = "/up") + public Result up(@RequestParam(name="id",required=true) String id) { + productModuleProcessService.up(id); + return Result.OK("升序成功"); + } + @GetMapping(value = "/down") + public Result down(@RequestParam(name="id",required=true) String id) { + ProductModuleProcess zyProductProcess = productModuleProcessService.getById(id); + if(zyProductProcess==null||zyProductProcess.getNumber()==0) + return Result.error("当前以是最低级别!!"); + productModuleProcessService.down(id); + return Result.OK("降序成功"); + } + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/entity/ProductModuleProcess.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/entity/ProductModuleProcess.java new file mode 100644 index 00000000..2d991040 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/entity/ProductModuleProcess.java @@ -0,0 +1,71 @@ +package org.jeecg.modules.pdmoduleprocess.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: 2022-12-16 + * @Version: V1.0 + */ +@Data +@TableName("product_module_process") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="product_module_process对象", description="产品模块工序") +public class ProductModuleProcess 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; + /**产品id*/ + @Excel(name = "产品id", width = 15) + @ApiModelProperty(value = "产品id") + //@Dict(dictTable = "zy_product",dicText = "product_code",dicCode = "id") 表暂未设计暂时不打开 + private String productId; + /**产品模块id*/ + @Excel(name = "产品模块id", width = 15) + @ApiModelProperty(value = "产品模块id") + private String productModuleId; + /**模块id*/ + @Excel(name = "模块id", width = 15) + @ApiModelProperty(value = "模块id") + @Dict(dictTable = "zy_cloths_modular",dicText = "modular_name",dicCode = "id") + private String moduleId; + /**工序id*/ + @Excel(name = "工序id", width = 15) + @ApiModelProperty(value = "工序id") + @Dict(dictTable = "zy_process",dicText = "process_name",dicCode = "id") + private String processId; + /**序号*/ + @Excel(name = "序号", width = 15) + @ApiModelProperty(value = "序号") + private Integer number; +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/mapper/ProductModuleProcessMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/mapper/ProductModuleProcessMapper.java new file mode 100644 index 00000000..506448fb --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/mapper/ProductModuleProcessMapper.java @@ -0,0 +1,24 @@ +package org.jeecg.modules.pdmoduleprocess.mapper; + + + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Update; +import org.jeecg.modules.pdmoduleprocess.entity.ProductModuleProcess; + +/** + * @Description: 产品模块工序 + * @Author: jeecg-boot + * @Date: 2022-12-16 + * @Version: V1.0 + */ +public interface ProductModuleProcessMapper extends BaseMapper { + @Update("update product_module_process set number=number+1 where id=#{id}") + void up(String id); + @Update("update product_module_process set number=number-1 where id=#{id}") + void down(String id); +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/mapper/xml/ProductModuleProcessMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/mapper/xml/ProductModuleProcessMapper.xml new file mode 100644 index 00000000..a880954d --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/mapper/xml/ProductModuleProcessMapper.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/pdmoduleprocess/service/IProductModuleProcessService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/service/IProductModuleProcessService.java new file mode 100644 index 00000000..300f0892 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/service/IProductModuleProcessService.java @@ -0,0 +1,18 @@ +package org.jeecg.modules.pdmoduleprocess.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.pdmoduleprocess.entity.ProductModuleProcess; + +/** + * @Description: 产品模块工序 + * @Author: jeecg-boot + * @Date: 2022-12-16 + * @Version: V1.0 + */ +public interface IProductModuleProcessService extends IService { + + void up(String id); + + void down(String id); +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/service/impl/ProductModuleProcessServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/service/impl/ProductModuleProcessServiceImpl.java new file mode 100644 index 00000000..3ce6d1f1 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/pdmoduleprocess/service/impl/ProductModuleProcessServiceImpl.java @@ -0,0 +1,31 @@ +package org.jeecg.modules.pdmoduleprocess.service.impl; + +import org.jeecg.modules.pdmoduleprocess.entity.ProductModuleProcess; +import org.jeecg.modules.pdmoduleprocess.mapper.ProductModuleProcessMapper; +import org.jeecg.modules.pdmoduleprocess.service.IProductModuleProcessService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 产品模块工序 + * @Author: jeecg-boot + * @Date: 2022-12-16 + * @Version: V1.0 + */ +@Service +public class ProductModuleProcessServiceImpl extends ServiceImpl implements IProductModuleProcessService { + + @Autowired + ProductModuleProcessMapper productModuleProcessMapper; + @Override + public void up(String id) { + productModuleProcessMapper.up(id); + } + + @Override + public void down(String id) { + productModuleProcessMapper.down(id); + } +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/mapper/ZyProductProcessMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/mapper/ZyProductProcessMapper.java index 299c0ff8..ff07e99e 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/mapper/ZyProductProcessMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/mapper/ZyProductProcessMapper.java @@ -24,4 +24,7 @@ public interface ZyProductProcessMapper extends BaseMapper { @Select("select id from zy_process where process_name like #{s}") List find(String s); + + @Select("select id from zy_product where product_code like #{s}") + List findProduct(String s); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/service/IZyProductProcessService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/service/IZyProductProcessService.java index b53b84b3..da88cbb4 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/service/IZyProductProcessService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/service/IZyProductProcessService.java @@ -19,4 +19,6 @@ public interface IZyProductProcessService extends IService { void down(String id); List find(String s); + + List findProduct(String s); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/service/impl/ZyProductProcessServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/service/impl/ZyProductProcessServiceImpl.java index 7270a804..f7079f5e 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/service/impl/ZyProductProcessServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/service/impl/ZyProductProcessServiceImpl.java @@ -36,4 +36,9 @@ public class ZyProductProcessServiceImpl extends ServiceImpl find(String s) { return zyProductProcessMapper.find(s); } + + @Override + public List findProduct(String s) { + return zyProductProcessMapper.findProduct(s); + } }