Parcourir la source

资产的录入修改和列表

il y a 6 ans
Parent
commit
8353379f9a

+ 13 - 0
pcbms/src/main/java/com/hssx/pcbms/controller/GoodsController.java

@@ -80,5 +80,18 @@ public class GoodsController {
         return msg;
     }
 
+    /**
+     * 商品的删除
+     * 参数:id:商品基本信息id
+     * @return
+     */
+    @ApiOperation(value = "商品的删除", notes = "商品的删除方法")
+    @RequestMapping("/del")
+    @ResponseBody
+    public HttpRespMsg del(Goods goods) {
+        HttpRespMsg msg = goodsService.del(goods);
+        return msg;
+    }
+
 }
 

+ 15 - 0
pcbms/src/main/java/com/hssx/pcbms/entity/Goods.java

@@ -78,6 +78,12 @@ public class Goods extends Model<Goods> {
     @TableField("next_indate")
     private String nextIndate;
 
+    /**
+     * 是否删除0-未删除,1-已删除
+     */
+    @TableField("is_delete")
+    private Integer isDelete;
+
 
     public Integer getId() {
         return id;
@@ -159,6 +165,14 @@ public class Goods extends Model<Goods> {
         this.nextIndate = nextIndate;
     }
 
+    public Integer getIsDelete() {
+        return isDelete;
+    }
+
+    public void setIsDelete(Integer isDelete) {
+        this.isDelete = isDelete;
+    }
+
     @Override
     protected Serializable pkVal() {
         return this.id;
@@ -177,6 +191,7 @@ public class Goods extends Model<Goods> {
         ", pic=" + pic +
         ", serviceLife=" + serviceLife +
         ", nextIndate=" + nextIndate +
+        ", isDelete=" + isDelete +
         "}";
     }
 }

+ 2 - 0
pcbms/src/main/java/com/hssx/pcbms/service/GoodsService.java

@@ -22,4 +22,6 @@ public interface GoodsService extends IService<Goods> {
     HttpRespMsg updateInfo(Goods goods, MultipartFile file);
 
     HttpRespMsg getList(PageUtil page,String keyName,Integer tagId);
+
+    HttpRespMsg del(Goods goods);
 }

+ 8 - 0
pcbms/src/main/java/com/hssx/pcbms/service/impl/GoodsServiceImpl.java

@@ -85,6 +85,14 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         return msg;
     }
 
+    @Override
+    public HttpRespMsg del(Goods goods) {
+        HttpRespMsg msg = new HttpRespMsg();
+        goods.setIsDelete(1);
+        goodsMapper.updateById(goods);
+        return msg;
+    }
+
     public static void main(String[] args) {
         String format = String.format("%04d", 0);
         System.out.println(format);

+ 9 - 8
pcbms/src/main/resources/mapper/GoodsMapper.xml

@@ -14,8 +14,13 @@
         <result column="pic" property="pic" />
         <result column="service_life" property="serviceLife" />
         <result column="next_indate" property="nextIndate" />
+        <result column="is_delete" property="isDelete" />
     </resultMap>
 
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, name, tag_id, model_number, company, address, factory, pic, service_life, next_indate, is_delete
+    </sql>
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMapVO" type="com.hssx.pcbms.entity.vo.GoodsVO">
         <id column="id" property="id" />
@@ -32,19 +37,15 @@
         </collection>
     </resultMap>
 
-    <!-- 通用查询结果列 -->
-    <sql id="Base_Column_List">
-        id, name, tag_id, model_number, company, address, factory, pic, service_life, next_indate
-    </sql>
-
     <select id="getListBycondition" resultMap="BaseResultMapVO">
         select
             id, name, tag_id, model_number, company, address, factory, pic, service_life, next_indate
         from
             goods
         <where>
+            is_delete = 0
             <if test="keyName != null and keyName != ''">
-               and name like concat('%',#{keyName},'%')
+                and name like concat('%',#{keyName},'%')
             </if>
             <if test="tagId != null">
                 and tag_id = #{tagId}
@@ -54,9 +55,9 @@
     <select id="selectGoodsNoByGoodsId" resultType="com.hssx.pcbms.entity.GoodsNo">
         select
             id, model_no, state, indate, goods_id
-          from
+        from
             goods_no
-          where
+        where
               goods_id = #{goodId}
     </select>
 </mapper>