Guo1B0 hace 1 año
padre
commit
225072035f

+ 10 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/BusinessItemProduct.java

@@ -35,6 +35,16 @@ public class BusinessItemProduct extends Model<BusinessItemProduct> {
      */
     @TableField("product_id")
     private Integer productId;
+    @TableField(exist = false)
+    private String productName;
+    @TableField(exist = false)
+    private String unit;
+    @TableField(exist = false)
+    private BigDecimal price;
+    @TableField(exist = false)
+    private String inventory;
+    @TableField(exist = false)
+    private String productType;
 
     /**
      * 商机id

+ 3 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/BusinessOpportunity.java

@@ -81,7 +81,10 @@ public class BusinessOpportunity extends Model<BusinessOpportunity> {
      */
     @TableField("stage_id")
     private Integer stageId;
+    @TableField(exist = false)
     private String stageValue;
+    @TableField(exist = false)
+    private String total;
 
     /**
      * 创建时间

+ 3 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/BusinessItemProductMapper.java

@@ -3,6 +3,8 @@ package com.management.platform.mapper;
 import com.management.platform.entity.BusinessItemProduct;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+
 /**
  * <p>
  *  Mapper 接口
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface BusinessItemProductMapper extends BaseMapper<BusinessItemProduct> {
 
+    List<BusinessItemProduct> selectListToBoId(Integer id);
 }

+ 11 - 9
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/BusinessOpportunityServiceImpl.java

@@ -24,7 +24,7 @@ import java.util.List;
 
 /**
  * <p>
- *  服务实现类
+ * 服务实现类
  * </p>
  *
  * @author Seyason
@@ -47,6 +47,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
     private BusinessItemProductMapper biMapper;
     @Autowired
     private SysFormMapper sysFormMapper;
+
     @Override
     public List<BusinessOpportunity> getAll(BusinessOpportunity bo) {
         return bOMapper.selectAllList(bo);
@@ -54,20 +55,20 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
 
     @Override
     public List<BusinessOpportunity> getAll1(BusinessOpportunity bo, User user) {
-        return bOMapper.selectAllList1(bo,user.getId());
+        return bOMapper.selectAllList1(bo, user.getId());
     }
 
     @Override
     public BusinessOpportunity getInfo(BusinessOpportunity bo, User user) {
         BusinessOpportunity businessOpportunity = bOMapper.selectById(bo.getId());
-        businessOpportunity.setBusinessItemProductList(biMapper.selectList(new QueryWrapper<BusinessItemProduct>().eq("business_id",bo.getId())));
-        businessOpportunity.setActionLogList(actionLogMapper.selectList(new QueryWrapper<ActionLog>().eq("item_id",bo.getId()).eq("code","business")));
+        businessOpportunity.setBusinessItemProductList(biMapper.selectListToBoId(bo.getId()));
+        businessOpportunity.setActionLogList(actionLogMapper.selectList(new QueryWrapper<ActionLog>().eq("item_id", bo.getId()).eq("code", "business")));
         return businessOpportunity;
     }
 
     @Override
     public List<BusinessOpportunity> getAll2(BusinessOpportunity bo, User user) {
-        return bOMapper.selectAllList2(bo,user.getId());
+        return bOMapper.selectAllList2(bo, user.getId());
     }
 
     @Override
@@ -77,12 +78,12 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
 
     @Override
     public int getTotal1(BusinessOpportunity bo, User user) {
-        return bOMapper.getTotal1(bo,user.getId());
+        return bOMapper.getTotal1(bo, user.getId());
     }
 
     @Override
     public int getTotal2(BusinessOpportunity bo, User user) {
-        return bOMapper.getTotal2(bo,user.getId());
+        return bOMapper.getTotal2(bo, user.getId());
     }
 
     @Override
@@ -101,7 +102,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void update(BusinessOpportunity bo,String userId) {
+    public void update(BusinessOpportunity bo, String userId) {
         setNull(bo);
         bOMapper.updateById(bo);
         ActionLog log = new ActionLog();
@@ -148,12 +149,13 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
             }
         }
 
-        updateWrapper.set("incharger_id",inchargerId);
+        updateWrapper.set("incharger_id", inchargerId);
         bOMapper.update(null, updateWrapper);
     }
 
     @Value(value = "${upload.file}")
     private String path;
+
     @Override
     public Object exportData(BusinessOpportunity bo, HttpServletRequest request) throws Exception {
         User user = userMapper.selectById(request.getHeader("token"));

+ 16 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/BusinessItemProductMapper.xml

@@ -15,5 +15,21 @@
     <sql id="Base_Column_List">
         id, product_id, quantity, discount, total_price
     </sql>
+    <select id="selectListToBoId" resultType="com.management.platform.entity.BusinessItemProduct">
+        select i.id,
+               i.product_id,
+               i.quantity,
+               i.discount,
+               i.total_price,
+               p.product_name productName,
+               p.price price,
+               (select `name` from sys_dict where id = p.unit and code = 'ProductUnit') unit,
+               (select `name` from sys_dict where id = p.type and code = 'ProductType') productType,
+               p.inventory inventory,
+        from business_item_product i
+                 left join product p on i.product_id = p.id
+--         left join sys_dict d on
+        where business_id = #{id}
+    </select>
 
 </mapper>

+ 2 - 2
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/BusinessOpportunityMapper.xml

@@ -38,14 +38,14 @@
         (select `name` from contacts where id = contacts_id) contactsName,
         (select `name` from `user` where id = contacts_id) inchargerName,
         (select `name` from `user` where id = creator_id) creatorName,
-        (SELECT sum(total) from business_product WHERE business_id = id)
+        (SELECT sum(total) from business_product WHERE business_id = id) total
         from business_opportunity
         where company_id = #{companyId}
         and is_delete = #{isDelete}
         <if test="name != null and name != ''">
             and `name` LIKE CONCAT('%', #{name}, '%')
         </if>
-        <if test="inchargerId != null ">
+        <if test="inchargerId != null and inchargerId == '' ">
             and incharger_id = #{inchargerId}
         </if>
         <if test="startTime != null and endTime != null ">