Browse Source

商户上架商品数量

qxp 5 years ago
parent
commit
78d7d3dbf5

+ 11 - 0
dgtly-system/src/main/java/com/dgtly/system/domain/SysCompany.java

@@ -88,6 +88,9 @@ public class SysCompany extends BaseEntity
     /** 主营业务*/
     private String primaryBusiness;
 
+    /** 商品数量*/
+    private String goodsCount;
+
 
     public void setId(Long id)
     {
@@ -250,6 +253,14 @@ public class SysCompany extends BaseEntity
         this.sort = sort;
     }
 
+    public String getGoodsCount() {
+        return goodsCount;
+    }
+
+    public void setGoodsCount(String goodsCount) {
+        this.goodsCount = goodsCount;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 13 - 11
dgtly-system/src/main/resources/mapper/system/SysCompanyMapper.xml

@@ -28,29 +28,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="remark"    column="remark"    />
         <result property="primaryBusiness"    column="primary_business"    />
         <result property="sort"    column="sort"    />
+        <result property="goodsCount"    column="goodsCount"    />
     </resultMap>
 
 
     <sql id="selectSysCompanyVo">
-        select id, company_name,company_type,detail_address,longitude,latitude,legal_person,contact_number,establish_date,
-        unified_social_credit_code,business_license_url,default_img_url,propaganda_img_url,company_introduce,version_num,
-        create_by,update_by,update_time,remark,status,create_time,primary_business,sort
-        from sys_company
+        select sc.id, sc.company_name,sc.company_type,sc.detail_address,sc.longitude,sc.latitude,sc.legal_person,sc.contact_number,sc.establish_date,
+        sc.unified_social_credit_code,sc.business_license_url,sc.default_img_url,sc.propaganda_img_url,sc.company_introduce,sc.version_num,
+        sc.create_by,sc.update_by,sc.update_time,sc.remark,sc.status,sc.create_time,sc.primary_business,sc.sort
+        ,(select count(0) from goods_info gi where gi.company_id = sc.id and gi.putaway_flag = '0' and del_flag='0') goodsCount
+        from sys_company sc
     </sql>
 
     <select id="selectSysCompanyList" parameterType="SysCompany" resultMap="SysCompanyResult">
         <include refid="selectSysCompanyVo"/>
         <where>  
-            <if test="companyName != null  and companyName != ''"> and company_name like concat('%', #{companyName},'%')</if>
-            <if test="status != null  and status != ''">and status =#{status}</if>
-            <if test="companyType != null  and companyType != ''">and companyType =#{company_type}</if>
+            <if test="companyName != null  and companyName != ''"> and sc.company_name like concat('%', #{companyName},'%')</if>
+            <if test="status != null  and status != ''">and sc.status =#{status}</if>
+            <if test="companyType != null  and companyType != ''">and sc.companyType =#{company_type}</if>
         </where>
         order by sort desc
     </select>
     
     <select id="selectSysCompanyById" parameterType="Long" resultMap="SysCompanyResult">
         <include refid="selectSysCompanyVo"/>
-        where id = #{id}
+        where sc.id = #{id}
     </select>
         
     <insert id="insertSysCompany" parameterType="SysCompany" useGeneratedKeys="true" keyProperty="id">
@@ -153,10 +155,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectSysCompanyListExRoot" parameterType="SysCompany" resultMap="SysCompanyResult">
         <include refid="selectSysCompanyVo"/>
         <where>
-            id !=1
-            <if test="companyName != null  and companyName != ''"> and company_name like concat('%',#{companyName},'%') </if>
+            sc.id !=1
+            <if test="companyName != null  and companyName != ''"> and sc.company_name like concat('%',#{companyName},'%') </if>
         </where>
-        order by sort desc
+        order by sc.sort desc
     </select>