dcs 3 kuukautta sitten
vanhempi
commit
29d8dd829a

+ 13 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/workark/model/Product.java

@@ -11,6 +11,11 @@ public class Product {
 
     private Long id;
 
+    /**
+     * 组织id
+     */
+    private long organizationId;
+
     /**
      * 状态
      */
@@ -61,6 +66,14 @@ public class Product {
         this.id = id;
     }
 
+    public long getOrganizationId() {
+        return organizationId;
+    }
+
+    public void setOrganizationId(long organizationId) {
+        this.organizationId = organizationId;
+    }
+
     public Integer getState() {
         return state;
     }

+ 6 - 1
virgo.api/src/main/resources/mapper/ProductMapper.xml

@@ -6,6 +6,7 @@
 
     <resultMap type="com.bosshand.virgo.api.workark.model.Product" id="result">
         <id column="id" property="id"/>
+        <result column="organizationId" property="organizationId"/>
         <result column="state" property="state"/>
         <result column="type" property="type"/>
         <result column="productLevelId" property="productLevelId"/>
@@ -23,6 +24,9 @@
     <select id="getList" resultMap="result">
         select * from workark_product
         <where>
+            <if test="organizationId != 0">
+                and organizationId = #{organizationId}
+            </if>
             <if test="name != null">
                 and name = #{name}
             </if>
@@ -39,12 +43,13 @@
     </select>
 
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        INSERT INTO workark_product (type, productLevelId, createTime, name, price, intro) VALUES (#{type}, #{productLevelId}, now(), #{name}, #{price}, #{intro})
+        INSERT INTO workark_product (organizationId, type, productLevelId, createTime, name, price, intro) VALUES (#{organizationId}, #{type}, #{productLevelId}, now(), #{name}, #{price}, #{intro})
     </insert>
 
     <update id="update" parameterType="com.bosshand.virgo.api.workark.model.Product">
         UPDATE workark_product
         <trim prefix="set" suffixOverrides=",">
+            <if test="organizationId!=0">organizationId=#{organizationId},</if>
             <if test="type!=null">type=#{type},</if>
             <if test="productLevelId!=0">productLevelId=#{productLevelId},</if>
             <if test="name!=null">name=#{name},</if>