From efc758c8609f056bb4d800000d2b8ad5b4cbf811 Mon Sep 17 00:00:00 2001 From: x_z Date: Wed, 14 Sep 2022 21:02:43 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=B7=BB=E5=8A=A0=E5=8D=95=E6=8D=AE=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E8=A1=A8=E7=9A=84mongodb=E6=93=8D=E4=BD=9C=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../glxp/udi/admin/mongo/dao/CodesDao.java | 146 ++++++++++++++ .../udi/admin/mongo/dao/CodesTempDao.java | 144 ++++++++++++++ .../udi/admin/mongo/dao/InvProductDao.java | 182 ++++++++++++++++++ .../admin/mongo/dao/InvProductDetailDao.java | 156 +++++++++++++++ 4 files changed, 628 insertions(+) create mode 100644 src/main/java/com/glxp/udi/admin/mongo/dao/CodesDao.java create mode 100644 src/main/java/com/glxp/udi/admin/mongo/dao/CodesTempDao.java create mode 100644 src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDao.java create mode 100644 src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDetailDao.java diff --git a/src/main/java/com/glxp/udi/admin/mongo/dao/CodesDao.java b/src/main/java/com/glxp/udi/admin/mongo/dao/CodesDao.java new file mode 100644 index 0000000..e0e6ea7 --- /dev/null +++ b/src/main/java/com/glxp/udi/admin/mongo/dao/CodesDao.java @@ -0,0 +1,146 @@ +package com.glxp.udi.admin.mongo.dao; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.ReflectUtil; +import com.glxp.udi.admin.entity.inout.WarehouseEntity; +import com.glxp.udi.admin.mongo.MongoDBName; +import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao; +import com.glxp.udi.admin.mongo.utils.MongoPageHelper; +import com.glxp.udi.admin.mongo.utils.PageResult; +import com.glxp.udi.admin.req.inout.FilterWarehouseRequest; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.List; + +@Component +public class CodesDao implements MongoBaseDao { + + @Resource + private MongoTemplate mongoTemplate; + @Resource + private MongoPageHelper mongoPageHelper; + + @Override + public PageResult pageQuery(Query query, FilterWarehouseRequest filterWarehouseRequest, int page, int size) { + if (null == query && null != filterWarehouseRequest) { + query = buildQuery(filterWarehouseRequest); + } + return mongoPageHelper.pageQuery(query, WarehouseEntity.class, page, size, MongoDBName.NAME_CODE); + } + + @Override + public List findList(Query query, FilterWarehouseRequest filterWarehouseRequest) { + if (null == query && null != filterWarehouseRequest) { + query = buildQuery(filterWarehouseRequest); + } + return mongoTemplate.find(query, WarehouseEntity.class, MongoDBName.NAME_CODE); + } + + @Override + public WarehouseEntity findOne(Query query, FilterWarehouseRequest filterWarehouseRequest) { + if (null == query && null != filterWarehouseRequest) { + query = buildQuery(filterWarehouseRequest); + } + return mongoTemplate.findOne(query, WarehouseEntity.class, MongoDBName.NAME_CODE); + } + + @Override + public void update(Query query, Update update, WarehouseEntity warehouseEntity) { + if (null == query) { + query = buildQuery(warehouseEntity); + } + if (null == update) { + update = buildUpdate(warehouseEntity); + } + mongoTemplate.updateMulti(query, update, WarehouseEntity.class, MongoDBName.NAME_CODE); + } + + @Override + public void delete(Query query, FilterWarehouseRequest filterWarehouseRequest) { + if (null == query) { + query = buildQuery(filterWarehouseRequest); + } + mongoTemplate.remove(query, WarehouseEntity.class, MongoDBName.NAME_CODE); + } + + @Override + public long count(Query query, FilterWarehouseRequest filterWarehouseRequest) { + if (null == query) { + query = buildQuery(filterWarehouseRequest); + } + return mongoTemplate.count(query, WarehouseEntity.class, MongoDBName.NAME_CODE); + } + + @Override + public void insert(WarehouseEntity warehouseEntity) { + mongoTemplate.insert(warehouseEntity, MongoDBName.NAME_CODE); + } + + @Override + public void insert(List records) { + mongoTemplate.insert(records, MongoDBName.NAME_CODE); + } + + /** + * 根据查询库存详情参数,构造mongodb查询条件 + * + * @param filterWarehouseRequest + * @return + */ + private Query buildQuery(FilterWarehouseRequest filterWarehouseRequest) { + Query query = new Query(); + Field[] fields = ReflectUtil.getFields(FilterWarehouseRequest.class); + Arrays.stream(fields).forEach(field -> { + Object fieldValue = ReflectUtil.getFieldValue(filterWarehouseRequest, field); + if (ObjectUtil.isNotEmpty(fieldValue)) { + query.addCriteria(Criteria.where(field.getName()).is(fieldValue)); + } + }); + return query; + } + + /** + * 根据库存详情实体,构造mongodb查询条件 + * + * @param warehouseEntity + * @return + */ + private Query buildQuery(WarehouseEntity warehouseEntity) { + Query query = new Query(); + Field[] fields = ReflectUtil.getFields(WarehouseEntity.class); + Arrays.stream(fields).forEach(field -> { + Object fieldValue = ReflectUtil.getFieldValue(warehouseEntity, field); + if (ObjectUtil.isNotEmpty(fieldValue)) { + query.addCriteria(Criteria.where(field.getName()).is(fieldValue)); + } + }); + return query; + } + + /** + * 根据库存详情实体,构造mongodb更新条件 + * + * @param warehouseEntity + * @return + */ + private Update buildUpdate(WarehouseEntity warehouseEntity) { + Update update = new Update(); + Field[] fields = ReflectUtil.getFields(WarehouseEntity.class); + Arrays.stream(fields).forEach(field -> { + Object fieldValue = ReflectUtil.getFieldValue(warehouseEntity, field); + if (ObjectUtil.isNotEmpty(fieldValue)) { + update.set(field.getName(), fieldValue); + } + }); + return update; + } + + +} diff --git a/src/main/java/com/glxp/udi/admin/mongo/dao/CodesTempDao.java b/src/main/java/com/glxp/udi/admin/mongo/dao/CodesTempDao.java new file mode 100644 index 0000000..9398728 --- /dev/null +++ b/src/main/java/com/glxp/udi/admin/mongo/dao/CodesTempDao.java @@ -0,0 +1,144 @@ +package com.glxp.udi.admin.mongo.dao; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.ReflectUtil; +import com.glxp.udi.admin.entity.inout.WarehousetempEntity; +import com.glxp.udi.admin.mongo.MongoDBName; +import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao; +import com.glxp.udi.admin.mongo.utils.MongoPageHelper; +import com.glxp.udi.admin.mongo.utils.PageResult; +import com.glxp.udi.admin.req.inout.FilterWarehouseRequest; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.List; + +@Component +public class CodesTempDao implements MongoBaseDao { + + @Resource + private MongoTemplate mongoTemplate; + @Resource + private MongoPageHelper mongoPageHelper; + + public PageResult pageQuery(Query query, FilterWarehouseRequest filterWarehouseRequest, int page, int size) { + if (null == query && null != filterWarehouseRequest) { + query = buildQuery(filterWarehouseRequest); + } + return mongoPageHelper.pageQuery(query, WarehousetempEntity.class, page, size, MongoDBName.NAME_CODE_TEMP); + } + + @Override + public List findList(Query query, FilterWarehouseRequest filterWarehouseRequest) { + if (null == query && null != filterWarehouseRequest) { + query = buildQuery(filterWarehouseRequest); + } + return mongoTemplate.find(query, WarehousetempEntity.class, MongoDBName.NAME_CODE_TEMP); + } + + @Override + public WarehousetempEntity findOne(Query query, FilterWarehouseRequest filterWarehouseRequest) { + if (null == query && null != filterWarehouseRequest) { + query = buildQuery(filterWarehouseRequest); + } + return mongoTemplate.findOne(query, WarehousetempEntity.class, MongoDBName.NAME_CODE_TEMP); + } + + @Override + public void update(Query query, Update update, WarehousetempEntity WarehousetempEntity) { + if (null == query) { + query = buildQuery(WarehousetempEntity); + } + if (null == update) { + update = buildUpdate(WarehousetempEntity); + } + mongoTemplate.updateMulti(query, update, WarehousetempEntity.class, MongoDBName.NAME_CODE_TEMP); + } + + @Override + public void delete(Query query, FilterWarehouseRequest filterWarehouseRequest) { + if (null == query) { + query = buildQuery(filterWarehouseRequest); + } + mongoTemplate.remove(query, WarehousetempEntity.class, MongoDBName.NAME_CODE_TEMP); + } + + @Override + public long count(Query query, FilterWarehouseRequest filterWarehouseRequest) { + if (null == query) { + query = buildQuery(filterWarehouseRequest); + } + return mongoTemplate.count(query, WarehousetempEntity.class, MongoDBName.NAME_CODE_TEMP); + } + + @Override + public void insert(WarehousetempEntity WarehousetempEntity) { + mongoTemplate.insert(WarehousetempEntity, MongoDBName.NAME_CODE_TEMP); + } + + @Override + public void insert(List records) { + mongoTemplate.insert(records, MongoDBName.NAME_CODE_TEMP); + } + + /** + * 根据查询库存详情参数,构造mongodb查询条件 + * + * @param filterWarehouseRequest + * @return + */ + private Query buildQuery(FilterWarehouseRequest filterWarehouseRequest) { + Query query = new Query(); + Field[] fields = ReflectUtil.getFields(FilterWarehouseRequest.class); + Arrays.stream(fields).forEach(field -> { + Object fieldValue = ReflectUtil.getFieldValue(filterWarehouseRequest, field); + if (ObjectUtil.isNotEmpty(fieldValue)) { + query.addCriteria(Criteria.where(field.getName()).is(fieldValue)); + } + }); + return query; + } + + /** + * 根据库存详情实体,构造mongodb查询条件 + * + * @param warehousetempEntity + * @return + */ + private Query buildQuery(WarehousetempEntity warehousetempEntity) { + Query query = new Query(); + Field[] fields = ReflectUtil.getFields(WarehousetempEntity.class); + Arrays.stream(fields).forEach(field -> { + Object fieldValue = ReflectUtil.getFieldValue(warehousetempEntity, field); + if (ObjectUtil.isNotEmpty(fieldValue)) { + query.addCriteria(Criteria.where(field.getName()).is(fieldValue)); + } + }); + return query; + } + + /** + * 根据库存详情实体,构造mongodb更新条件 + * + * @param warehousetempEntity + * @return + */ + private Update buildUpdate(WarehousetempEntity warehousetempEntity) { + Update update = new Update(); + Field[] fields = ReflectUtil.getFields(WarehousetempEntity.class); + Arrays.stream(fields).forEach(field -> { + Object fieldValue = ReflectUtil.getFieldValue(warehousetempEntity, field); + if (ObjectUtil.isNotEmpty(fieldValue)) { + update.set(field.getName(), fieldValue); + } + }); + return update; + } + +} diff --git a/src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDao.java b/src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDao.java new file mode 100644 index 0000000..7e60dbf --- /dev/null +++ b/src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDao.java @@ -0,0 +1,182 @@ +package com.glxp.udi.admin.mongo.dao; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.ReflectUtil; +import com.glxp.udi.admin.entity.inout.InvProductEntity; +import com.glxp.udi.admin.mongo.MongoDBName; +import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao; +import com.glxp.udi.admin.mongo.utils.MongoPageHelper; +import com.glxp.udi.admin.mongo.utils.PageResult; +import com.glxp.udi.admin.req.inventory.FilterInvProductRequest; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Pattern; + +@Component +public class InvProductDao implements MongoBaseDao { + + @Resource + private MongoTemplate mongoTemplate; + @Resource + private MongoPageHelper mongoPageHelper; + + @Override + public PageResult pageQuery(Query query, FilterInvProductRequest filterInvProductRequest, int page, int size) { + if (null == query && null != filterInvProductRequest) { + query = buildQuery(filterInvProductRequest); + } + return mongoPageHelper.pageQuery(query, InvProductEntity.class, page, size, MongoDBName.NAME_INV_PRODUCT); + } + + @Override + public List findList(Query query, FilterInvProductRequest filterInvProductRequest) { + if (null == query && null != filterInvProductRequest) { + query = buildQuery(filterInvProductRequest); + } + return mongoTemplate.find(query, InvProductEntity.class, MongoDBName.NAME_INV_PRODUCT); + } + + @Override + public InvProductEntity findOne(Query query, FilterInvProductRequest filterInvProductRequest) { + if (null == query && null != filterInvProductRequest) { + query = buildQuery(filterInvProductRequest); + } + return mongoTemplate.findOne(query, InvProductEntity.class, MongoDBName.NAME_INV_PRODUCT); + } + + @Override + public void update(Query query, Update update, InvProductEntity invProductEntity) { + if (null == query) { + query = buildQuery(invProductEntity); + } + if (null == update) { + update = buildUpdate(invProductEntity); + } + mongoTemplate.updateMulti(query, update, InvProductEntity.class, MongoDBName.NAME_INV_PRODUCT); + } + + @Override + public void delete(Query query, FilterInvProductRequest filterInvProductRequest) { + if (null == query && null != filterInvProductRequest) { + query = buildQuery(filterInvProductRequest); + } + mongoTemplate.remove(query, InvProductEntity.class, MongoDBName.NAME_INV_PRODUCT); + } + + @Override + public long count(Query query, FilterInvProductRequest filterInvProductRequest) { + if (null == query && null != filterInvProductRequest) { + query = buildQuery(filterInvProductRequest); + } + return mongoTemplate.count(query, InvProductEntity.class, MongoDBName.NAME_INV_PRODUCT); + } + + @Override + public void insert(InvProductEntity invProductEntity) { + mongoTemplate.insert(invProductEntity, MongoDBName.NAME_INV_PRODUCT); + } + + @Override + public void insert(List records) { + mongoTemplate.insert(records, MongoDBName.NAME_INV_PRODUCT); + } + + /** + * 根据库存查询参数,构造mongodb查询条件 + * + * @param filterInvProductRequest + * @return + */ + private Query buildQuery(FilterInvProductRequest filterInvProductRequest) { + Query query = new Query(); + Field[] fields = ReflectUtil.getFields(FilterInvProductRequest.class); + Arrays.stream(fields).forEach(field -> { + Object fieldValue = ReflectUtil.getFieldValue(filterInvProductRequest, field); + if (ObjectUtil.isNotEmpty(fieldValue)) { + switch (field.getName()) { + case "uuids": + query.addCriteria(Criteria.where("relIdFk").in(fieldValue)); + break; + case "invCodes": + query.addCriteria(Criteria.where("locStorageCode").in(fieldValue)); + break; + case "cpmctymc": { + Pattern pattern = Pattern.compile("^.*" + fieldValue + ".*$"); + query.addCriteria(Criteria.where("productsName").regex(pattern)); + break; + } + case "zczbhhzbapzbh": { + Pattern pattern = Pattern.compile("^.*" + fieldValue + ".*$"); + query.addCriteria(Criteria.where("zczbhhzbapzbh").regex(pattern)); + break; + } + case "manufactory": { + Pattern pattern = Pattern.compile("^.*" + fieldValue + ".*$"); + query.addCriteria(Criteria.where("manufactory").regex(pattern)); + break; + } + case "ggxh": { + Pattern pattern = Pattern.compile("^.*" + fieldValue + ".*$"); + query.addCriteria(Criteria.where("ggxh").regex(pattern)); + break; + } + default: + query.addCriteria(Criteria.where(field.getName()).is(fieldValue)); + break; + } + } + }); + return query; + } + + /** + * 根据库存实体,构造mongodb查询条件 + * + * @param invProductEntity + * @return + */ + private Query buildQuery(InvProductEntity invProductEntity) { + Query query = new Query(); + Field[] fields = ReflectUtil.getFields(InvProductEntity.class); + Arrays.stream(fields).forEach(field -> { + Object fieldValue = ReflectUtil.getFieldValue(invProductEntity, field); + if (ObjectUtil.isNotEmpty(fieldValue)) { + if ("id".equals(field.getName())) { + query.addCriteria(Criteria.where("_id").is(fieldValue)); + } else { + query.addCriteria(Criteria.where(field.getName()).is(fieldValue)); + } + } + }); + return query; + } + + /** + * 根据库存实体,构造mongodb更新条件 + * + * @param invProductEntity + * @return + */ + private Update buildUpdate(InvProductEntity invProductEntity) { + Update update = new Update(); + Field[] fields = ReflectUtil.getFields(InvProductEntity.class); + Arrays.stream(fields).forEach(field -> { + Object fieldValue = ReflectUtil.getFieldValue(invProductEntity, field); + if (ObjectUtil.isNotEmpty(fieldValue)) { + if (!"id".equals(field.getName())) { + update.set(field.getName(), fieldValue); + } + } + }); + return update; + } + +} diff --git a/src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDetailDao.java b/src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDetailDao.java new file mode 100644 index 0000000..527011d --- /dev/null +++ b/src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDetailDao.java @@ -0,0 +1,156 @@ +package com.glxp.udi.admin.mongo.dao; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.ReflectUtil; +import com.glxp.udi.admin.entity.inout.InvProductDetailEntity; +import com.glxp.udi.admin.mongo.MongoDBName; +import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao; +import com.glxp.udi.admin.mongo.utils.MongoPageHelper; +import com.glxp.udi.admin.mongo.utils.PageResult; +import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.List; + +@Component +public class InvProductDetailDao implements MongoBaseDao { + + @Resource + private MongoTemplate mongoTemplate; + @Resource + private MongoPageHelper mongoPageHelper; + + @Override + public PageResult pageQuery(Query query, FilterInvProductDetailRequest filterInvProductDetailRequest, int page, int size) { + if (null == query && null != filterInvProductDetailRequest) { + query = buildQuery(filterInvProductDetailRequest); + } + return mongoPageHelper.pageQuery(query, InvProductDetailEntity.class, page, size, MongoDBName.NAME_INV_PRODUCT_DETAIL); + } + + @Override + public List findList(Query query, FilterInvProductDetailRequest filterInvProductDetailRequest) { + if (null == query && null != filterInvProductDetailRequest) { + query = buildQuery(filterInvProductDetailRequest); + } + return mongoTemplate.find(query, InvProductDetailEntity.class, MongoDBName.NAME_INV_PRODUCT_DETAIL); + } + + @Override + public InvProductDetailEntity findOne(Query query, FilterInvProductDetailRequest filterInvProductDetailRequest) { + if (null == query && null != filterInvProductDetailRequest) { + query = buildQuery(filterInvProductDetailRequest); + } + return mongoTemplate.findOne(query, InvProductDetailEntity.class, MongoDBName.NAME_INV_PRODUCT_DETAIL); + } + + @Override + public void update(Query query, Update update, InvProductDetailEntity invProductDetailEntity) { + if (null == query) { + query = buildQuery(invProductDetailEntity); + } + if (null == update) { + update = buildUpdate(invProductDetailEntity); + } + mongoTemplate.updateMulti(query, update, InvProductDetailEntity.class, MongoDBName.NAME_INV_PRODUCT_DETAIL); + } + + @Override + public void delete(Query query, FilterInvProductDetailRequest filterInvProductDetailRequest) { + if (null == query && null != filterInvProductDetailRequest) { + buildQuery(filterInvProductDetailRequest); + } + mongoTemplate.remove(query, InvProductDetailEntity.class, MongoDBName.NAME_INV_PRODUCT_DETAIL); + } + + @Override + public long count(Query query, FilterInvProductDetailRequest filterInvProductDetailRequest) { + if (null == query && null != filterInvProductDetailRequest) { + buildQuery(filterInvProductDetailRequest); + } + return mongoTemplate.count(query, InvProductDetailEntity.class, MongoDBName.NAME_INV_PRODUCT_DETAIL); + } + + @Override + public void insert(InvProductDetailEntity invProductDetailEntity) { + mongoTemplate.insert(invProductDetailEntity, MongoDBName.NAME_INV_PRODUCT_DETAIL); + } + + @Override + public void insert(List records) { + mongoTemplate.insert(records, MongoDBName.NAME_INV_PRODUCT_DETAIL); + } + + /** + * 根据查询库存详情参数,构造mongodb查询条件 + * + * @param filterInvProductDetailRequest + * @return + */ + private Query buildQuery(FilterInvProductDetailRequest filterInvProductDetailRequest) { + Query query = new Query(); + Field[] fields = ReflectUtil.getFields(FilterInvProductDetailRequest.class); + Arrays.stream(fields).forEach(field -> { + Object fieldValue = ReflectUtil.getFieldValue(filterInvProductDetailRequest, field); + if (ObjectUtil.isNotEmpty(fieldValue)) { + if ("invCodes".equals(field.getName())) { + query.addCriteria(Criteria.where("locStorageCode").in(fieldValue)); + } else { + query.addCriteria(Criteria.where(field.getName()).is(fieldValue)); + } + } + }); + return query; + } + + /** + * 根据库存详情实体,构造mongodb查询条件 + * + * @param invProductDetailEntity + * @return + */ + private Query buildQuery(InvProductDetailEntity invProductDetailEntity) { + Query query = new Query(); + Field[] fields = ReflectUtil.getFields(InvProductDetailEntity.class); + Arrays.stream(fields).forEach(field -> { + Object fieldValue = ReflectUtil.getFieldValue(invProductDetailEntity, field); + if (ObjectUtil.isNotEmpty(fieldValue)) { + if ("id".equals(field.getName())) { + query.addCriteria(Criteria.where("_id").is(fieldValue)); + } else { + query.addCriteria(Criteria.where(field.getName()).is(fieldValue)); + } + } + }); + return query; + } + + /** + * 根据库存详情实体,构造mongodb更新条件 + * + * @param invProductDetailEntity + * @return + */ + private Update buildUpdate(InvProductDetailEntity invProductDetailEntity) { + Update update = new Update(); + Field[] fields = ReflectUtil.getFields(InvProductDetailEntity.class); + Arrays.stream(fields).forEach(field -> { + Object fieldValue = ReflectUtil.getFieldValue(invProductDetailEntity, field); + if (ObjectUtil.isNotEmpty(fieldValue)) { + if (!"id".equals(field.getName())) { + update.set(field.getName(), fieldValue); + } + } + }); + return update; + } + + +}