Browse Source

添加删除标志

yuanliang 1 year ago
parent
commit
08186e2b8b

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Goods.java

@@ -182,6 +182,9 @@ public class Goods {
 	@ApiModelProperty(value = "是否是组合商品,1:是,0:不是")
 	private Boolean groupGoods;
 
+	@ApiModelProperty(value = "是否删除")
+	private Boolean delFlag;
+
 	private Integer tenantId = TenantContextHolder.getTenantId();
 
 	private String childId;

+ 6 - 5
mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml

@@ -55,6 +55,7 @@
         <result column="child_sn_" property="childSn"/>
         <result column="child_organ_cost_price_" property="childOrganCostPrice"/>
         <result column="group_goods_" property="groupGoods"/>
+        <result column="del_flag_" property="delFlag"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -69,7 +70,7 @@
 
     <!-- 全查询 -->
     <select id="findAll" resultMap="Goods">
-        SELECT * FROM goods where tenant_id_ = #{tenantId} ORDER BY id_
+        SELECT * FROM goods where tenant_id_ = #{tenantId} and del_flag_ = 0 ORDER BY id_
     </select>
 
     <!-- 向数据库增加一条记录 -->
@@ -324,7 +325,7 @@
 
     <sql id="queryGoodsPageSql">
         <where>
-            g.tenant_id_ = #{tenantId}
+            g.tenant_id_ = #{tenantId} and g.del_flag_ = 0
             <if test="goodsCategoryId != null">
                 AND g.goods_category_id_ = #{goodsCategoryId}
             </if>
@@ -398,7 +399,7 @@
 
     <sql id="queryOrganIdSql">
         <where>
-            AND g.status_ != 0 and g.tenant_id_ = #{goodsQuery.tenantId}
+            AND g.status_ != 0 and g.tenant_id_ = #{goodsQuery.tenantId} and g.del_flag_ = 0
             <if test="goodsQuery.subjectId != null">
                 AND sgm.subject_id_ = #{goodsQuery.subjectId}
             </if>
@@ -437,13 +438,13 @@
 
     <!-- 根据 -->
     <select id="findGoodsNumByCategoryId" resultType="int">
-        SELECT COUNT(*) FROM goods WHERE goods_category_id_ = #{goodsCategoryId} and tenant_id_ = #{tenantId}
+        SELECT COUNT(*) FROM goods WHERE goods_category_id_ = #{goodsCategoryId} and tenant_id_ = #{tenantId} and del_flag_ = 0
     </select>
     <select id="findGoodsByIds" resultMap="Goods">
         SELECT * FROM goods WHERE FIND_IN_SET(id_,#{ids})
     </select>
     <select id="findTypeGoods" resultMap="Goods">
-        SELECT * FROM goods WHERE type_ = #{type} AND status_ != 0 and tenant_id_ = #{tenantId}
+        SELECT * FROM goods WHERE type_ = #{type} AND status_ != 0 and tenant_id_ = #{tenantId} and del_flag_ = 0
     </select>
     <select id="getGoodies" resultMap="Goods">
         SELECT * FROM goods WHERE id_ IN