diff --git a/ant-design-vue-jeecg/src/views/product/productProcess/ZyProductProcessList.vue b/ant-design-vue-jeecg/src/views/product/productProcess/ZyProductProcessList.vue new file mode 100644 index 00000000..01b0ba58 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/product/productProcess/ZyProductProcessList.vue @@ -0,0 +1,269 @@ + + + + \ No newline at end of file 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 new file mode 100644 index 00000000..52229cbb --- /dev/null +++ b/ant-design-vue-jeecg/src/views/product/productProcess/modules/ZyProcessList.vue @@ -0,0 +1,301 @@ + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/product/productProcess/modules/ZyProductProcessForm.vue b/ant-design-vue-jeecg/src/views/product/productProcess/modules/ZyProductProcessForm.vue new file mode 100644 index 00000000..5f3dbafa --- /dev/null +++ b/ant-design-vue-jeecg/src/views/product/productProcess/modules/ZyProductProcessForm.vue @@ -0,0 +1,114 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/product/productProcess/modules/ZyProductProcessModal.vue b/ant-design-vue-jeecg/src/views/product/productProcess/modules/ZyProductProcessModal.vue new file mode 100644 index 00000000..60d9568c --- /dev/null +++ b/ant-design-vue-jeecg/src/views/product/productProcess/modules/ZyProductProcessModal.vue @@ -0,0 +1,79 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/product/productProcess/modules/ZyProductProcessModal__Style#Drawer.vue b/ant-design-vue-jeecg/src/views/product/productProcess/modules/ZyProductProcessModal__Style#Drawer.vue new file mode 100644 index 00000000..09218235 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/product/productProcess/modules/ZyProductProcessModal__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/product/zyproductprocess/controller/ZyProductProcessController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/controller/ZyProductProcessController.java new file mode 100644 index 00000000..ab701e08 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/controller/ZyProductProcessController.java @@ -0,0 +1,202 @@ +package org.jeecg.modules.product.zyproductprocess.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.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-14 + * @Version: V1.0 + */ +@Api(tags="产品工序") +@RestController +@RequestMapping("/zyproductprocess/zyProductProcess") +@Slf4j +public class ZyProductProcessController extends JeecgController { + @Autowired + private IZyProductProcessService zyProductProcessService; + + /** + * 分页列表查询 + * + * @param zyProductProcess + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "产品工序-分页列表查询") + @ApiOperation(value="产品工序-分页列表查询", notes="产品工序-分页列表查询") + @GetMapping(value = "/list") + public Result queryPageList(ZyProductProcess zyProductProcess, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + //QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(zyProductProcess, req.getParameterMap()); + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.orderByDesc("number"); + queryWrapper.eq("product_id",zyProductProcess.getProductId()); + if(zyProductProcess.getProcessId()!=null&&!zyProductProcess.getProcessId().equals("")){ + String s="%"+zyProductProcess.getProcessId()+"%"; + List list=zyProductProcessService.find(s); + queryWrapper.in("process_id",list); + } + + Page page = new Page(pageNo, pageSize); + IPage pageList = zyProductProcessService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param zyProductProcess + * @return + */ + @AutoLog(value = "产品工序-添加") + @ApiOperation(value="产品工序-添加", notes="产品工序-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody ZyProductProcess zyProductProcess) { + String[] split = zyProductProcess.getProcessId().split(","); + for (String k : split) { + zyProductProcess.setProcessId(k); + QueryWrapper s=new QueryWrapper(); + s.eq("product_id",zyProductProcess.getProductId()); + s.eq("process_id",zyProductProcess.getProcessId()); + int a=zyProductProcessService.count(s); + if(a==0) + zyProductProcessService.save(zyProductProcess); + zyProductProcess.setId(null); + } + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param zyProductProcess + * @return + */ + @AutoLog(value = "产品工序-编辑") + @ApiOperation(value="产品工序-编辑", notes="产品工序-编辑") + @PutMapping(value = "/edit") + public Result edit(@RequestBody ZyProductProcess zyProductProcess) { + zyProductProcessService.updateById(zyProductProcess); + 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) { + zyProductProcessService.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.zyProductProcessService.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) { + ZyProductProcess zyProductProcess = zyProductProcessService.getById(id); + if(zyProductProcess==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(zyProductProcess); + } + + /** + * 导出excel + * + * @param request + * @param zyProductProcess + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ZyProductProcess zyProductProcess) { + return super.exportXls(request, zyProductProcess, ZyProductProcess.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, ZyProductProcess.class); + } + + @GetMapping(value = "/up") + public Result up(@RequestParam(name="id",required=true) String id) { + zyProductProcessService.up(id); + return Result.OK("升序成功"); + } + @GetMapping(value = "/down") + public Result down(@RequestParam(name="id",required=true) String id) { + ZyProductProcess zyProductProcess = zyProductProcessService.getById(id); + if(zyProductProcess==null||zyProductProcess.getNumber()==0) + return Result.error("当前以是最低级别!!"); + zyProductProcessService.down(id); + return Result.OK("降序成功"); + } +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/entity/ZyProductProcess.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/entity/ZyProductProcess.java new file mode 100644 index 00000000..2e8b9098 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/entity/ZyProductProcess.java @@ -0,0 +1,70 @@ +package org.jeecg.modules.product.zyproductprocess.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-14 + * @Version: V1.0 + */ +@Data +@TableName("zy_product_process") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="zy_product_process对象", description="产品工序") +public class ZyProductProcess 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_product",dicText = "product_code",dicCode = "id") 由于当前产品还没有,需要后期打开 + private String productId; + /**工序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/product/zyproductprocess/mapper/ZyProductProcessMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/mapper/ZyProductProcessMapper.java new file mode 100644 index 00000000..299c0ff8 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/mapper/ZyProductProcessMapper.java @@ -0,0 +1,27 @@ +package org.jeecg.modules.product.zyproductprocess.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.product.zyproductprocess.entity.ZyProductProcess; + +/** + * @Description: 产品工序 + * @Author: jeecg-boot + * @Date: 2022-12-14 + * @Version: V1.0 + */ +public interface ZyProductProcessMapper extends BaseMapper { + + @Update("update zy_product_process set number=number+1 where id=#{id}") + void up(String id); + @Update("update zy_product_process set number=number-1 where id=#{id}") + void down(String id); + + @Select("select id from zy_process where process_name like #{s}") + List find(String s); +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/mapper/xml/ZyProductProcessMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/mapper/xml/ZyProductProcessMapper.xml new file mode 100644 index 00000000..7e944338 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/mapper/xml/ZyProductProcessMapper.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/product/zyproductprocess/service/IZyProductProcessService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/service/IZyProductProcessService.java new file mode 100644 index 00000000..b53b84b3 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/service/IZyProductProcessService.java @@ -0,0 +1,22 @@ +package org.jeecg.modules.product.zyproductprocess.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.product.zyproductprocess.entity.ZyProductProcess; + +import java.util.List; + +/** + * @Description: 产品工序 + * @Author: jeecg-boot + * @Date: 2022-12-14 + * @Version: V1.0 + */ +public interface IZyProductProcessService extends IService { + + void up(String id); + + void down(String id); + + List find(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 new file mode 100644 index 00000000..7270a804 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/product/zyproductprocess/service/impl/ZyProductProcessServiceImpl.java @@ -0,0 +1,39 @@ +package org.jeecg.modules.product.zyproductprocess.service.impl; + + +import org.jeecg.modules.product.zyproductprocess.entity.ZyProductProcess; +import org.jeecg.modules.product.zyproductprocess.mapper.ZyProductProcessMapper; +import org.jeecg.modules.product.zyproductprocess.service.IZyProductProcessService; +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-14 + * @Version: V1.0 + */ +@Service +public class ZyProductProcessServiceImpl extends ServiceImpl implements IZyProductProcessService { + + @Autowired + ZyProductProcessMapper zyProductProcessMapper; + @Override + public void up(String id) { + zyProductProcessMapper.up(id); + } + + @Override + public void down(String id) { + zyProductProcessMapper.down(id); + } + + @Override + public List find(String s) { + return zyProductProcessMapper.find(s); + } +}