| | |
| | | theProductHasBeenReviewedAndCannotBeDeleted:'产品已审核,无法删除', |
| | | |
| | | productAbbreviation:'产品简称', |
| | | productDuplication:'产品重复', |
| | | } |
| | | }, |
| | | order:{ |
| | |
| | | import GlassType from "@/components/sd/product/GlassType.vue" |
| | | import useProductGlassTypeStore from "@/stores/sd/product/productGlassType" |
| | | import {useI18n} from "vue-i18n"; |
| | | import companyInfo from "@/stores/sd/companyInfo"; |
| | | const company = companyInfo() |
| | | const { t } = useI18n() |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | |
| | | } |
| | | }) |
| | | productTotal.value.productName=productName |
| | | productTotal.value.productAbbreviation=productTotal.value.productAbbreviation.trim() |
| | | let product = { |
| | | title: productTotal.value, |
| | | detail:productDetailList.value |
| | | } |
| | | //查询产品是否重复 |
| | | request.post(`/product/selectProduct/${company.productName}`,product).then((res) =>{ |
| | | if(res.code==200){ |
| | | if(res.data.data.length>0){ |
| | | ElMessage.warning(t('product.msg.productDuplication')) |
| | | }else{ |
| | | saveProducts(product) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | } |
| | | |
| | | const saveProducts=(product)=>{ |
| | | request.post(`/product/saveProduct`,product).then((res) =>{ |
| | | if(res.code==200){ |
| | | ElMessage.success(t('product.msg.saveSuccess')) |
| | |
| | | public Result saveProduct(@RequestBody Map<String,Object> product){ |
| | | return Result.seccess(productService.saveProduct(product)); |
| | | } |
| | | |
| | | @ApiOperation("产品查重接口") |
| | | @SaCheckPermission("createProduct.add") |
| | | @PostMapping("/selectProduct/{productName}") |
| | | public Result selectProduct(@PathVariable String productName,@RequestBody Map<String,Object> product){ |
| | | return Result.seccess(productService.selectProduct(productName,product)); |
| | | } |
| | | |
| | | @ApiOperation("产品删除接口") |
| | | @SaCheckPermission("selectProduct.delete") |
| | | @PostMapping("/deleteProductById/{id}") |
| | |
| | | Integer getPageTotal(Integer offset, Integer pageSize, String glassTypeId, Product product); |
| | | |
| | | boolean updateProductStateById(Integer id,Integer state); |
| | | |
| | | List<Product> selectProduct(@Param("productName") String productName,@Param("productNameValue") String productNameValue); |
| | | |
| | | List<Product> selectProductId(@Param("productName") String productName,@Param("productNameValue") String productNameValue,@Param("id") Long id); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.example.erp.common.Constants; |
| | | import com.example.erp.entity.sd.Order; |
| | | import com.example.erp.entity.sd.Product; |
| | | import com.example.erp.entity.sd.ProductDetail; |
| | | import com.example.erp.exception.ServiceException; |
| | |
| | | |
| | | } |
| | | |
| | | public Map<String,Object> selectProduct(String productName,Map<String,Object> productObject) { |
| | | Map<String,Object> map = new HashMap<>(); |
| | | //把传入主附表的object类型转换成实体类类型 |
| | | JSONObject productJson = new JSONObject(productObject); |
| | | Product product = JSONObject.parseObject(JSONObject.toJSONString(productJson.get("title")), Product.class); |
| | | List<ProductDetail> productDetails = JSONArray.parseArray(JSONObject.toJSONString(productJson.get("detail")), ProductDetail.class); |
| | | //完善主附表信息并返回 |
| | | Map<String,Object> getProductJson = updateProduct(productDetails,product); |
| | | Product getProduct = JSONObject.parseObject(JSONObject.toJSONString(getProductJson.get("title")), Product.class); |
| | | List<ProductDetail> getProductDetails = JSONArray.parseArray(JSONObject.toJSONString(getProductJson.get("detail")), ProductDetail.class); |
| | | if(getProduct.getId()!=null){ |
| | | map.put("data",productMapper.selectProductId(productName,getProduct.getProductAbbreviation(), getProduct.getId())); |
| | | }else{ |
| | | map.put("data",productMapper.selectProduct(productName,getProduct.getProductAbbreviation())); |
| | | } |
| | | |
| | | return map; |
| | | |
| | | } |
| | | |
| | | private void updateProductData(List<ProductDetail> getProductDetails, Product getProduct) { |
| | | productMapper.update(getProduct,new UpdateWrapper<Product>().eq("id",getProduct.getId())); |
| | | productDetailMapper.delete(new QueryWrapper<ProductDetail>().eq("prod_id",getProduct.getId())); |
| | |
| | | ; |
| | | </select> |
| | | |
| | | <select id="selectProduct"> |
| | | select * from sd.product where ${productName}=#{productNameValue} |
| | | </select> |
| | | |
| | | <select id="selectProductId"> |
| | | select * from sd.product where ${productName}=#{productNameValue} and id != #{id} |
| | | </select> |
| | | |
| | | <select id="getPageTotal" > |
| | | select |
| | | CEILING(count(a.id)/#{pageSize}) |