Procházet zdrojové kódy

废弃代码删除

zhijiezhao před 1 rokem
rodič
revize
29fc90b4ea

+ 0 - 32
src/main/java/com/caimei/modules/product/dao/CmActivityDao.java

@@ -1,32 +0,0 @@
-package com.caimei.modules.product.dao;
-
-import com.caimei.modules.product.entity.CmActivity;
-import com.caimei.modules.product.entity.Product;
-import com.thinkgem.jeesite.common.persistence.CrudDao;
-import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
-import org.apache.ibatis.annotations.Param;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-/**
- * 活动列表DAO接口
- *
- * @author plf
- * @version 2020-05-18
- */
-@MyBatisDao
-public interface CmActivityDao extends CrudDao<CmActivity> {
-
-    void insertProductActivity(@Param("activityId") String activityId, @Param("productId") String productId, @Param("price") BigDecimal price);
-
-    void deleteProduct(String id);
-
-    List<Product> findProduct(String id);
-
-    void deleteActivityProduct(@Param("activityId") String activityId, @Param("productId") String productIds);
-
-    List<Product> findAllProduct(Product product);
-
-    List<Integer> findActivityId();
-}

+ 0 - 64
src/main/java/com/caimei/modules/product/service/CmActivityService.java

@@ -1,64 +0,0 @@
-package com.caimei.modules.product.service;
-
-import com.caimei.modules.product.dao.CmActivityDao;
-import com.caimei.modules.product.entity.CmActivity;
-import com.caimei.modules.product.entity.Product;
-import com.foxinmy.weixin4j.util.StringUtil;
-import com.thinkgem.jeesite.common.persistence.Page;
-import com.thinkgem.jeesite.common.service.CrudService;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * 活动列表Service
- *
- * @author plf
- * @version 2020-05-18
- */
-@Service
-@Transactional(readOnly = true)
-public class CmActivityService extends CrudService<CmActivityDao, CmActivity> {
-
-    @Resource
-    private CmActivityDao cmActivityDao;
-
-    public List<Product> findProduct(String id) {
-        List<Product> products = cmActivityDao.findProduct(id);
-        for (Product product : products) {
-            product.setStoreStatus(true);
-        }
-        return products;
-    }
-
-    @Transactional(readOnly = false)
-    public void deleteProduct(CmActivity cmActivity) {
-        cmActivityDao.deleteActivityProduct(cmActivity.getId(), cmActivity.getProductIds());
-    }
-
-    public Page findProductPage(Page<Product> productPage, Product product) {
-        product.setPage(productPage);
-        List<Integer> list = new ArrayList<>();
-        if (StringUtil.isNotBlank(product.getProductIds())) {
-            if (product.getProductIds().contains(",")) {
-                String[] split = product.getProductIds().split(",");
-                for (String productId : split) {
-                    if (StringUtil.isNotBlank(productId)) {
-                        list.add(Integer.valueOf(productId));
-                    }
-                }
-            } else {
-                list.add(Integer.valueOf(product.getProductIds()));
-            }
-        }
-        List<Integer> productId = cmActivityDao.findActivityId();
-        list.addAll(productId);
-        product.setIds(list);
-        List<Product> productList = cmActivityDao.findAllProduct(product);
-        productPage.setList(productList);
-        return productPage;
-    }
-}

+ 0 - 132
src/main/java/com/caimei/modules/product/web/CmActivityController.java

@@ -1,132 +0,0 @@
-package com.caimei.modules.product.web;
-
-import com.caimei.modules.product.entity.CmActivity;
-import com.caimei.modules.product.entity.Product;
-import com.caimei.modules.product.service.CmActivityService;
-import com.caimei.modules.product.service.ProductService;
-import com.foxinmy.weixin4j.util.StringUtil;
-import com.thinkgem.jeesite.common.config.Global;
-import com.thinkgem.jeesite.common.persistence.Page;
-import com.thinkgem.jeesite.common.utils.StringUtils;
-import com.thinkgem.jeesite.common.web.BaseController;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.servlet.mvc.support.RedirectAttributes;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * 活动列表Controller
- *
- * @author plf
- * @version 2020-05-18
- */
-@Controller
-@RequestMapping(value = "${adminPath}/product/cmActivity")
-public class CmActivityController extends BaseController {
-
-    @Autowired
-    private CmActivityService cmActivityService;
-    @Autowired
-    private ProductService productService;
-
-    @ModelAttribute
-    public CmActivity get(@RequestParam(required = false) String id) {
-        CmActivity entity = null;
-        if (StringUtils.isNotBlank(id)) {
-            entity = cmActivityService.get(id);
-        }
-        if (entity == null) {
-            entity = new CmActivity();
-        }
-        return entity;
-    }
-
-    @RequiresPermissions("product:product:view")
-    @RequestMapping(value = {"list", ""})
-    public String list(CmActivity cmActivity, HttpServletRequest request, HttpServletResponse response, Model model) {
-        Page<CmActivity> page = cmActivityService.findPage(new Page<CmActivity>(request, response), cmActivity);
-        model.addAttribute("page", page);
-        return "modules/product/cmActivityList";
-    }
-
-    /**
-     * 页面回显
-     */
-    @RequiresPermissions("product:product:view")
-    @RequestMapping(value = "form")
-    public String form(CmActivity cmActivity, Model model) {
-        List<Product> list = new ArrayList<>();
-        if (StringUtil.isNotBlank(cmActivity.getProductIds())) {
-            if (cmActivity.getProductIds().contains(",")) {
-                String[] split = cmActivity.getProductIds().split(",");
-                for (String productId : split) {
-                    if (StringUtil.isNotBlank(productId)) {
-                        Product product = productService.get(productId);
-                        list.add(product);
-                    }
-                }
-            } else {
-                Product product = productService.get(cmActivity.getProductIds());
-                list.add(product);
-            }
-        }
-        if (StringUtil.isNotBlank(cmActivity.getId())) {
-            List<Product> products = cmActivityService.findProduct(cmActivity.getId());
-            list.addAll(products);
-        }
-        model.addAttribute("productIds", cmActivity.getProductIds());
-        model.addAttribute("list", list);
-        model.addAttribute("cmActivity", cmActivity);
-        return "modules/product/cmActivityForm";
-    }
-
-    /**
-     * 保存活动列表
-     */
-    @RequestMapping(value = "save")
-    public String save(CmActivity cmActivity, Model model, RedirectAttributes redirectAttributes) {
-        if (!beanValidator(model, cmActivity)) {
-            return form(cmActivity, model);
-        }
-        cmActivityService.save(cmActivity);
-        addMessage(redirectAttributes, "保存活动列表成功");
-        return "redirect:" + Global.getAdminPath() + "/product/cmActivity/?repage";
-    }
-
-    /**
-     * 删除活动列表
-     */
-    @RequestMapping(value = "delete")
-    public String delete(CmActivity cmActivity, RedirectAttributes redirectAttributes) {
-        cmActivityService.delete(cmActivity);
-        addMessage(redirectAttributes, "删除活动列表成功");
-        return "redirect:" + Global.getAdminPath() + "/product/cmActivity/?repage";
-    }
-
-    /**
-     * 删除活动商品
-     */
-    @RequestMapping("/deleteProduct")
-    public void deleteProduct(CmActivity cmActivity) {
-        cmActivityService.deleteProduct(cmActivity);
-    }
-
-    /**
-     * 添加商品数据
-     */
-    @RequestMapping(value = "toAdd")
-    public String toAddProduct(Product product, Model model, HttpServletRequest request, HttpServletResponse response) {
-        Page page = cmActivityService.findProductPage(new Page<Product>(request, response), product);
-        model.addAttribute("page", page);
-        return "modules/product-new/actSelectProduct";
-    }
-}

+ 0 - 99
src/main/resources/mappings/modules/product/CmActivityMapper.xml

@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.caimei.modules.product.dao.CmActivityDao">
-
-    <sql id="cmActivityColumns">
-		a.id AS "id",
-		a.activityName AS "activityName",
-		a.startTime AS "startTime",
-		a.endTime AS "endTime",
-		a.addTime AS "addTime",
-		a.delFlag AS "delFlag"
-	</sql>
-
-    <insert id="insertProductActivity">
-		INSERT INTO cm_product_activity(
-			activityId,
-			productId,
-			actPrice,
-			addTime,
-			delFlag
-		) VALUES (
-			#{activityId},
-			#{productId},
-			#{price},
-			now(),
-			0
-		)
-	</insert>
-
-    <delete id="deleteProduct">
-		DELETE FROM cm_product_activity
-		WHERE activityId = #{id}
-	</delete>
-
-    <select id="findProduct" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		  p.*,
-		  s.name AS "shopName",
-		  cpa.actPrice AS "activityPrice"
-		FROM
-		  cm_product_activity cpa
-		  LEFT JOIN product p ON cpa.productId = p.productID
-		  LEFT JOIN shop s ON s.shopID = p.shopID
-		WHERE
-		  cpa.activityId = #{id}
-		  and p.productCategory = 1
-		  AND delFlag = '0'
-	</select>
-
-    <delete id="deleteActivityProduct">
-		DELETE FROM cm_product_activity
-		WHERE activityId = #{activityId}
-		AND productId = #{productId}
-	</delete>
-
-    <select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
-        SELECT
-        a.*,s.name AS "shopName"
-        FROM product a
-        LEFT JOIN shop s on s.shopID = a.shopID
-        <where>
-			<if test="productID != null" >
-				AND a.productID = #{productID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-            <if test="ids != null and ids.size() > 0 ">
-                AND a.productID NOT IN
-				<foreach collection="ids" open="(" close=")" item="id" separator=",">
-					#{id}
-				</foreach>
-            </if>
-			AND a.validFlag = 2
-			and a.productCategory = 1
-        </where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by a.productID desc
-			</otherwise>
-		</choose>
-    </select>
-
-	<select id="findActivityId" resultType="integer">
-		SELECT productId FROM cm_product_activity WHERE delFlag='0'
-	</select>
-</mapper>