| | |
| | | UpdateWrapper uwrapper=new UpdateWrapper(); |
| | | uwrapper.set("lock_flag",attachLock.getLockFlag()); |
| | | uwrapper.set("local_reason",attachLock.getLocalReason()); |
| | | uwrapper.eq("attach_name",attachLock.getAttachName()); |
| | | uwrapper.eq("material_id",attachLock.getMaterialId()); |
| | | mapper.update(null,uwrapper); |
| | | }else{ |
| | | mapper.insert(attachLock); |
| | |
| | | }); |
| | | return new Response().set(1,true,""); |
| | | } |
| | | |
| | | @Transactional |
| | | public Response updateProductLock(List<AttachLock> list) { |
| | | if(list!=null&&list.size()>0){} |
| | | list.stream().forEach(attachLock -> { |
| | | //1.查询是否存在该记录 |
| | | QueryWrapper qwrapper=new QueryWrapper(); |
| | | qwrapper.eq("product_id",attachLock.getProductId()); |
| | | qwrapper.eq("attach_name",attachLock.getAttachName()); |
| | | qwrapper.last("limit 1"); |
| | | AttachLock attach=mapper.selectOne(qwrapper); |
| | | if(attach!=null){ |
| | | UpdateWrapper uwrapper=new UpdateWrapper(); |
| | | uwrapper.set("lock_flag",attachLock.getLockFlag()); |
| | | uwrapper.set("local_reason",attachLock.getLocalReason()); |
| | | uwrapper.eq("attach_name",attachLock.getAttachName()); |
| | | uwrapper.eq("product_id",attachLock.getProductId()); |
| | | mapper.update(null,uwrapper); |
| | | }else{ |
| | | mapper.insert(attachLock); |
| | | } |
| | | }); |
| | | return new Response().set(1,true,""); |
| | | } |
| | | } |