he2802 il y a 2 ans
Parent
commit
fc05a04d0b

+ 23 - 0
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/goods/TopGoodsController.java

@@ -7,7 +7,10 @@ import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.enums.BusinessType;
 import com.zhongzheng.common.enums.BusinessType;
 import com.zhongzheng.modules.goods.bo.GoodsAddBo;
 import com.zhongzheng.modules.goods.bo.GoodsAddBo;
 import com.zhongzheng.modules.goods.bo.GoodsBankAddBo;
 import com.zhongzheng.modules.goods.bo.GoodsBankAddBo;
+import com.zhongzheng.modules.goods.bo.GoodsEditBo;
+import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.service.IGoodsService;
+import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.goods.vo.TopGoodsVo;
 import com.zhongzheng.modules.goods.vo.TopGoodsVo;
 import com.zhongzheng.modules.top.goods.bo.TopGoodsQueryBo;
 import com.zhongzheng.modules.top.goods.bo.TopGoodsQueryBo;
 import com.zhongzheng.modules.top.goods.service.ITopGoodsService;
 import com.zhongzheng.modules.top.goods.service.ITopGoodsService;
@@ -75,4 +78,24 @@ public class TopGoodsController extends BaseController {
     public AjaxResult<Void> addPoints(@RequestBody GoodsAddBo bo) {
     public AjaxResult<Void> addPoints(@RequestBody GoodsAddBo bo) {
         return toAjax(iGoodsService.insertPointsByAddBo(bo)>0 ? 1 : 0);
         return toAjax(iGoodsService.insertPointsByAddBo(bo)>0 ? 1 : 0);
     }
     }
+
+    /**
+     * 新增题库商品
+     */
+    @ApiOperation("编辑积分商品")
+    @PreAuthorize("@ss.hasPermi('system:goods:add')")
+    @Log(title = "编辑积分商品", businessType = BusinessType.INSERT)
+    @PostMapping("/updatePoints")
+    public AjaxResult<Void> updatePoints(@RequestBody GoodsEditBo bo) {
+        return toAjax(iGoodsService.updatePointsByEditBo(bo) ? 1 : 0);
+    }
+
+    @ApiOperation("查询积分商品列表")
+    @PreAuthorize("@ss.hasPermi('system:goods:list')")
+    @GetMapping("/listPoints")
+    public TableDataInfo<GoodsVo> listPoints(GoodsQueryBo bo) {
+        startPage();
+        List<GoodsVo> list = iGoodsService.queryPointsList(bo);
+        return getDataTable(list);
+    }
 }
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsMapper.java

@@ -72,4 +72,6 @@ public interface GoodsMapper extends BaseMapper<Goods> {
 
 
     @InterceptorIgnore(tenantLine = "true")
     @InterceptorIgnore(tenantLine = "true")
     Goods getGoodsByIdNotTenant(Long goodsId);
     Goods getGoodsByIdNotTenant(Long goodsId);
+
+    List<GoodsVo> queryPointsList(GoodsQueryBo bo);
 }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsService.java

@@ -57,6 +57,9 @@ public interface IGoodsService extends IService<Goods> {
 
 
 	Long insertPointsByAddBo(GoodsAddBo bo);
 	Long insertPointsByAddBo(GoodsAddBo bo);
 
 
+	Boolean updatePointsByEditBo(GoodsEditBo bo);
+
+	List<GoodsVo> queryPointsList(GoodsQueryBo bo);
 	/**
 	/**
 	 * 根据编辑业务对象修改商品
 	 * 根据编辑业务对象修改商品
 	 * @param bo 商品编辑业务对象
 	 * @param bo 商品编辑业务对象
@@ -66,6 +69,8 @@ public interface IGoodsService extends IService<Goods> {
 
 
 	Boolean updateBankByEditBo(GoodsBankEditBo bo);
 	Boolean updateBankByEditBo(GoodsBankEditBo bo);
 
 
+
+
 	/**
 	/**
 	 * 校验并删除数据
 	 * 校验并删除数据
 	 * @param ids 主键集合
 	 * @param ids 主键集合

+ 13 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -627,6 +627,19 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         return add.getGoodsId();
         return add.getGoodsId();
     }
     }
 
 
+    @Override
+    public Boolean updatePointsByEditBo(GoodsEditBo bo) {
+        Goods update = BeanUtil.toBean(bo, Goods.class);
+        validEntityBeforeSave(update);
+        update.setUpdateTime(DateUtils.getNowTime());
+        return this.updateById(update);
+    }
+
+    @Override
+    public List<GoodsVo> queryPointsList(GoodsQueryBo bo) {
+        return baseMapper.queryPointsList(bo);
+    }
+
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     public Boolean updateByEditBo(GoodsEditBo bo) {
     public Boolean updateByEditBo(GoodsEditBo bo) {

+ 37 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -935,4 +935,41 @@
               and g.tenant_id = #{tenantId}
               and g.tenant_id = #{tenantId}
     </select>
     </select>
 
 
+    <select id="queryPointsList" parameterType="com.zhongzheng.modules.goods.bo.GoodsQueryBo"
+            resultMap="GoodsResultVo">
+        SELECT
+        g.*
+        WHERE
+        1 = 1
+        AND g.goods_type = 7
+        <if test="status != null and status.size()!=0 ">
+            AND g.status in
+            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="goodsIds != null and goodsIds.size()!=0 ">
+            AND g.goods_id in
+            <foreach collection="goodsIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="goodsType != null and goodsType != ''">
+            AND g.goods_type = #{goodsType}
+        </if>
+        <if test="goodsName != null and goodsName != ''">
+            AND g.goods_name like concat('%', #{goodsName}, '%')
+        </if>
+        <if test="standPrice != null and standPrice != ''">
+            AND g.stand_price = #{standPrice}
+        </if>
+        <if test="searchKey != null and searchKey != ''">
+            and (g.goods_name like concat('%', #{searchKey}, '%') or g.code like concat('%', #{searchKey}, '%'))
+        </if>
+        <if test="goodsStatus != null ">
+            AND g.goods_status = #{goodsStatus}
+        </if>
+
+    </select>
+
 </mapper>
 </mapper>