feat(view): 新增市场活动-产品列表功能

This commit is contained in:
mzr 2024-11-13 10:04:07 +08:00
parent 7f823b4128
commit bf21c195c2
4 changed files with 215 additions and 4 deletions

View File

@ -13,10 +13,7 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
@ -111,6 +108,28 @@ public class ViewMeetingController extends BaseController {
return AjaxResult.success(viewMeetingService.oneView(params, ".pageList")); return AjaxResult.success(viewMeetingService.oneView(params, ".pageList"));
} }
/**
* 查询市场活动-产品列表
*
* @author mzr
* @date 2024/11/13
*/
@ResponseBody
@PatchMapping(value = "/listDetail")
@ApiOperation(value = "查询市场活动-产品列表")
public Map<String, Object> listDetail(
@ApiParam(required = true, value = "市场活动id") @RequestParam(required = true) String viewId,
HttpServletRequest request) {
Map<String, Object> params = new HashMap<>();
Map<String, Object> result = new HashMap<>();
String token = request.getHeader("token");
if (!redisService.isKey(token)) {
return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录");
}
params.put("viewId", viewId);
return AjaxResult.success(viewMeetingService.listDetail(params, ".findCrmMarketingDetailByCondition"));
}
/** /**
* @description: 市场活动报表-按照区域分组 * @description: 市场活动报表-按照区域分组
* @author: mzr * @author: mzr

View File

@ -0,0 +1,133 @@
<?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">
<!-- 市场活动-产品表(crm_marketing_detail) -->
<mapper namespace="com.yb.lb.webapp.view.view.entity.CrmMarketingDetail">
<!-- 字段映射 -->
<resultMap id="crmMarketingDetailMap" type="com.yb.lb.webapp.view.view.entity.CrmMarketingDetail">
<id column="id" property="id" jdbcType="VARCHAR" />
<result column="view_id" property="viewId" jdbcType="VARCHAR" />
<result column="goods_id" property="goodsId" jdbcType="VARCHAR" />
<result column="goods_no" property="goodsNo" jdbcType="VARCHAR" />
<result column="goods_name" property="goodsName" jdbcType="VARCHAR" />
<result column="spec" property="spec" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="VARCHAR" />
<result column="earnest" property="earnest" jdbcType="VARCHAR" />
<result column="goods_num" property="goodsNum" jdbcType="VARCHAR" />
<result column="reserve_acre" property="reserveAcre" jdbcType="VARCHAR" />
</resultMap>
<!-- 表查询字段 -->
<sql id="allColumns">
a.id, a.view_id, a.goods_id, a.goods_no, a.goods_name, a.spec, a.create_time, a.earnest,
a.goods_num, a.reserve_acre
</sql>
<!-- 根据条件参数查询数据列表 -->
<select id="findCrmMarketingDetailByCondition" resultMap="crmMarketingDetailMap" parameterType="map">
SELECT
<include refid="allColumns" />
FROM crm_marketing_detail a WHERE 1 = 1
<if test="viewId != null and viewId != ''">
AND a.view_id = #{viewId}
</if>
<if test="goodsId != null and goodsId != ''">
AND a.goods_id = #{goodsId}
</if>
<if test="goodsNo != null and goodsNo != ''">
AND a.goods_no LIKE '%' || #{goodsNo} || '%'
</if>
<if test="goodsName != null and goodsName != ''">
AND a.goods_name LIKE '%' || #{goodsName} || '%'
</if>
</select>
<!-- 插入数据 -->
<insert id="insertCrmMarketingDetail" parameterType="map">
INSERT INTO crm_marketing_detail (
id, view_id, goods_id, goods_no, goods_name, spec, create_time, earnest,
goods_num, reserve_acre
) VALUES (
#{id,jdbcType=VARCHAR},
#{viewId,jdbcType=VARCHAR},
#{goodsId,jdbcType=VARCHAR},
#{goodsNo,jdbcType=VARCHAR},
#{goodsName,jdbcType=VARCHAR},
#{spec,jdbcType=VARCHAR},
#{createTime,jdbcType=VARCHAR},
#{earnest,jdbcType=VARCHAR},
#{goodsNum,jdbcType=VARCHAR},
#{reserveAcre,jdbcType=VARCHAR}
)
</insert>
<!-- 批量插入数据 -->
<insert id="insertCrmMarketingDetails" parameterType="list">
INSERT INTO crm_marketing_detail (
id, view_id, goods_id, goods_no, goods_name, spec, create_time, earnest,
goods_num, reserve_acre
)
<foreach collection="list" index="index" item="item" separator="UNION ALL">
SELECT
#{item.id,jdbcType=VARCHAR},
#{item.viewId,jdbcType=VARCHAR},
#{item.goodsId,jdbcType=VARCHAR},
#{item.goodsNo,jdbcType=VARCHAR},
#{item.goodsName,jdbcType=VARCHAR},
#{item.spec,jdbcType=VARCHAR},
#{item.createTime,jdbcType=VARCHAR},
#{item.earnest,jdbcType=VARCHAR},
#{item.goodsNum,jdbcType=VARCHAR},
#{item.reserveAcre,jdbcType=VARCHAR}
FROM DUAL
</foreach>
</insert>
<!-- 修改数据 -->
<update id="updateCrmMarketingDetail" parameterType="map">
UPDATE crm_marketing_detail
<set>
<if test="viewId != null">
view_id = #{viewId,jdbcType=VARCHAR},
</if>
<if test="goodsId != null">
goods_id = #{goodsId,jdbcType=VARCHAR},
</if>
<if test="goodsNo != null">
goods_no = #{goodsNo,jdbcType=VARCHAR},
</if>
<if test="goodsName != null">
goods_name = #{goodsName,jdbcType=VARCHAR},
</if>
<if test="spec != null">
spec = #{spec,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=VARCHAR},
</if>
<if test="earnest != null">
earnest = #{earnest,jdbcType=VARCHAR},
</if>
<if test="goodsNum != null">
goods_num = #{goodsNum,jdbcType=VARCHAR},
</if>
<if test="reserveAcre != null">
reserve_acre = #{reserveAcre,jdbcType=VARCHAR}
</if>
</set>
WHERE id = #{id}
</update>
<!-- 根据主键删除数据 -->
<delete id="deleteCrmMarketingDetailById" parameterType="string">
DELETE FROM crm_marketing_detail WHERE id = #{id}
</delete>
<!-- 根据主键批量删除数据 -->
<delete id="deleteCrmMarketingDetailByIds" parameterType="list">
DELETE FROM crm_marketing_detail WHERE id IN
<foreach collection="list" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,46 @@
package com.yb.lb.webapp.view.view.entity;
import lombok.Data;
/**
* 市场活动-产品表(crm_marketing_detail)
*
* @author mzr
* @version 1.0.0 2024-11-13
*/
@Data
public class CrmMarketingDetail implements java.io.Serializable {
/** 版本号 */
private static final long serialVersionUID = -423516422284485951L;
/** 主键Id */
private String id;
/** 主键Id(市场活动) */
private String viewId;
/** 商品id */
private String goodsId;
/** 商品编码 */
private String goodsNo;
/** 商品名称 */
private String goodsName;
/** 规格 */
private String spec;
/** 制单时间 */
private String createTime;
/** 亩定金(元) */
private String earnest;
/** 件数 */
private String goodsNum;
/** 预定亩数 */
private String reserveAcre;
}

View File

@ -7,6 +7,7 @@ import com.yb.lb.common.utils.StringUtil;
import com.yb.lb.webapp.archives.dictionary.entity.Dictionaryies; import com.yb.lb.webapp.archives.dictionary.entity.Dictionaryies;
import com.yb.lb.webapp.archives.dictionary.service.DictionaryiesService; import com.yb.lb.webapp.archives.dictionary.service.DictionaryiesService;
import com.yb.lb.webapp.redis.service.RedisService; import com.yb.lb.webapp.redis.service.RedisService;
import com.yb.lb.webapp.view.view.entity.CrmMarketingDetail;
import com.yb.lb.webapp.view.view.entity.ViewMeeting; import com.yb.lb.webapp.view.view.entity.ViewMeeting;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -21,6 +22,8 @@ public class ViewMeetingService {
@Autowired @Autowired
BaseOracleDao<ViewMeeting> dao; BaseOracleDao<ViewMeeting> dao;
@Autowired @Autowired
BaseOracleDao<CrmMarketingDetail> detailDao;
@Autowired
RedisService redisService; RedisService redisService;
@Autowired @Autowired
DictionaryiesService dictionaryiesService; DictionaryiesService dictionaryiesService;
@ -80,6 +83,16 @@ public class ViewMeetingService {
return dao.update(ViewMeeting.class.getName() + id, params); return dao.update(ViewMeeting.class.getName() + id, params);
} }
/**
* 查询市场活动-产品
*
* @author mzr
* @date 2024/11/13
*/
public List listDetail(Map<String, Object> params, String id) {
return detailDao.list(CrmMarketingDetail.class.getName() + id, params);
}
/** /**
* @description: 根据条件查询数量 * @description: 根据条件查询数量
*/ */