补充
This commit is contained in:
parent
94064a5cea
commit
7435484984
@ -0,0 +1,104 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.EventPromotion;
|
||||
import com.ruoyi.system.service.IEventPromotionService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 推广活动Controller
|
||||
*
|
||||
* @author zy
|
||||
* @date 2024-03-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/promotion")
|
||||
public class EventPromotionController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IEventPromotionService eventPromotionService;
|
||||
|
||||
/**
|
||||
* 查询推广活动列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:promotion:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EventPromotion eventPromotion)
|
||||
{
|
||||
startPage();
|
||||
List<EventPromotion> list = eventPromotionService.selectEventPromotionList(eventPromotion);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出推广活动列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:promotion:export')")
|
||||
@Log(title = "推广活动", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EventPromotion eventPromotion)
|
||||
{
|
||||
List<EventPromotion> list = eventPromotionService.selectEventPromotionList(eventPromotion);
|
||||
ExcelUtil<EventPromotion> util = new ExcelUtil<EventPromotion>(EventPromotion.class);
|
||||
util.exportExcel(response, list, "推广活动数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取推广活动详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:promotion:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(eventPromotionService.selectEventPromotionById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增推广活动
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:promotion:add')")
|
||||
@Log(title = "推广活动", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EventPromotion eventPromotion)
|
||||
{
|
||||
return toAjax(eventPromotionService.insertEventPromotion(eventPromotion));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改推广活动
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:promotion:edit')")
|
||||
@Log(title = "推广活动", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EventPromotion eventPromotion)
|
||||
{
|
||||
return toAjax(eventPromotionService.updateEventPromotion(eventPromotion));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除推广活动
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:promotion:remove')")
|
||||
@Log(title = "推广活动", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(eventPromotionService.deleteEventPromotionByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,172 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 推广活动对象 event_promotion
|
||||
*
|
||||
* @author zy
|
||||
* @date 2024-03-23
|
||||
*/
|
||||
public class EventPromotion extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 活动推广id */
|
||||
private Long id;
|
||||
|
||||
/** 活动名称 */
|
||||
@Excel(name = "活动名称")
|
||||
private String activityName;
|
||||
|
||||
/** 活动类型 */
|
||||
@Excel(name = "活动类型")
|
||||
private Integer activityType;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
private Integer status;
|
||||
|
||||
/** 活动开始时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "活动开始时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date activityBeginTime;
|
||||
|
||||
/** 活动结束时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "活动结束时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date activityEndTime;
|
||||
|
||||
/** 付款交易数 */
|
||||
@Excel(name = "付款交易数")
|
||||
private Long numberOfPaymentTransactions;
|
||||
|
||||
/** 实付金额(单位:分) */
|
||||
@Excel(name = "实付金额", readConverterExp = "单=位:分")
|
||||
private Long actualAmountPaid;
|
||||
|
||||
/** 优惠金额(单位:分) */
|
||||
@Excel(name = "优惠金额", readConverterExp = "单=位:分")
|
||||
private Long discountAmount;
|
||||
|
||||
/** 删除标志 */
|
||||
@Excel(name = "删除标志")
|
||||
private Integer isDelete;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setActivityName(String activityName)
|
||||
{
|
||||
this.activityName = activityName;
|
||||
}
|
||||
|
||||
public String getActivityName()
|
||||
{
|
||||
return activityName;
|
||||
}
|
||||
public void setActivityType(Integer activityType)
|
||||
{
|
||||
this.activityType = activityType;
|
||||
}
|
||||
|
||||
public Integer getActivityType()
|
||||
{
|
||||
return activityType;
|
||||
}
|
||||
public void setStatus(Integer status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setActivityBeginTime(Date activityBeginTime)
|
||||
{
|
||||
this.activityBeginTime = activityBeginTime;
|
||||
}
|
||||
|
||||
public Date getActivityBeginTime()
|
||||
{
|
||||
return activityBeginTime;
|
||||
}
|
||||
public void setActivityEndTime(Date activityEndTime)
|
||||
{
|
||||
this.activityEndTime = activityEndTime;
|
||||
}
|
||||
|
||||
public Date getActivityEndTime()
|
||||
{
|
||||
return activityEndTime;
|
||||
}
|
||||
public void setNumberOfPaymentTransactions(Long numberOfPaymentTransactions)
|
||||
{
|
||||
this.numberOfPaymentTransactions = numberOfPaymentTransactions;
|
||||
}
|
||||
|
||||
public Long getNumberOfPaymentTransactions()
|
||||
{
|
||||
return numberOfPaymentTransactions;
|
||||
}
|
||||
public void setActualAmountPaid(Long actualAmountPaid)
|
||||
{
|
||||
this.actualAmountPaid = actualAmountPaid;
|
||||
}
|
||||
|
||||
public Long getActualAmountPaid()
|
||||
{
|
||||
return actualAmountPaid;
|
||||
}
|
||||
public void setDiscountAmount(Long discountAmount)
|
||||
{
|
||||
this.discountAmount = discountAmount;
|
||||
}
|
||||
|
||||
public Long getDiscountAmount()
|
||||
{
|
||||
return discountAmount;
|
||||
}
|
||||
public void setIsDelete(Integer isDelete)
|
||||
{
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
public Integer getIsDelete()
|
||||
{
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("activityName", getActivityName())
|
||||
.append("activityType", getActivityType())
|
||||
.append("status", getStatus())
|
||||
.append("activityBeginTime", getActivityBeginTime())
|
||||
.append("activityEndTime", getActivityEndTime())
|
||||
.append("numberOfPaymentTransactions", getNumberOfPaymentTransactions())
|
||||
.append("actualAmountPaid", getActualAmountPaid())
|
||||
.append("discountAmount", getDiscountAmount())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("isDelete", getIsDelete())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.EventPromotion;
|
||||
|
||||
/**
|
||||
* 推广活动Mapper接口
|
||||
*
|
||||
* @author zy
|
||||
* @date 2024-03-23
|
||||
*/
|
||||
public interface EventPromotionMapper
|
||||
{
|
||||
/**
|
||||
* 查询推广活动
|
||||
*
|
||||
* @param id 推广活动主键
|
||||
* @return 推广活动
|
||||
*/
|
||||
public EventPromotion selectEventPromotionById(Long id);
|
||||
|
||||
/**
|
||||
* 查询推广活动列表
|
||||
*
|
||||
* @param eventPromotion 推广活动
|
||||
* @return 推广活动集合
|
||||
*/
|
||||
public List<EventPromotion> selectEventPromotionList(EventPromotion eventPromotion);
|
||||
|
||||
/**
|
||||
* 新增推广活动
|
||||
*
|
||||
* @param eventPromotion 推广活动
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEventPromotion(EventPromotion eventPromotion);
|
||||
|
||||
/**
|
||||
* 修改推广活动
|
||||
*
|
||||
* @param eventPromotion 推广活动
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEventPromotion(EventPromotion eventPromotion);
|
||||
|
||||
/**
|
||||
* 删除推广活动
|
||||
*
|
||||
* @param id 推广活动主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEventPromotionById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除推广活动
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEventPromotionByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.EventPromotion;
|
||||
|
||||
/**
|
||||
* 推广活动Service接口
|
||||
*
|
||||
* @author zy
|
||||
* @date 2024-03-23
|
||||
*/
|
||||
public interface IEventPromotionService
|
||||
{
|
||||
/**
|
||||
* 查询推广活动
|
||||
*
|
||||
* @param id 推广活动主键
|
||||
* @return 推广活动
|
||||
*/
|
||||
public EventPromotion selectEventPromotionById(Long id);
|
||||
|
||||
/**
|
||||
* 查询推广活动列表
|
||||
*
|
||||
* @param eventPromotion 推广活动
|
||||
* @return 推广活动集合
|
||||
*/
|
||||
public List<EventPromotion> selectEventPromotionList(EventPromotion eventPromotion);
|
||||
|
||||
/**
|
||||
* 新增推广活动
|
||||
*
|
||||
* @param eventPromotion 推广活动
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEventPromotion(EventPromotion eventPromotion);
|
||||
|
||||
/**
|
||||
* 修改推广活动
|
||||
*
|
||||
* @param eventPromotion 推广活动
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEventPromotion(EventPromotion eventPromotion);
|
||||
|
||||
/**
|
||||
* 批量删除推广活动
|
||||
*
|
||||
* @param ids 需要删除的推广活动主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEventPromotionByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除推广活动信息
|
||||
*
|
||||
* @param id 推广活动主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEventPromotionById(Long id);
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.EventPromotionMapper;
|
||||
import com.ruoyi.system.domain.EventPromotion;
|
||||
import com.ruoyi.system.service.IEventPromotionService;
|
||||
|
||||
/**
|
||||
* 推广活动Service业务层处理
|
||||
*
|
||||
* @author zy
|
||||
* @date 2024-03-23
|
||||
*/
|
||||
@Service
|
||||
public class EventPromotionServiceImpl implements IEventPromotionService
|
||||
{
|
||||
@Autowired
|
||||
private EventPromotionMapper eventPromotionMapper;
|
||||
|
||||
/**
|
||||
* 查询推广活动
|
||||
*
|
||||
* @param id 推广活动主键
|
||||
* @return 推广活动
|
||||
*/
|
||||
@Override
|
||||
public EventPromotion selectEventPromotionById(Long id)
|
||||
{
|
||||
return eventPromotionMapper.selectEventPromotionById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询推广活动列表
|
||||
*
|
||||
* @param eventPromotion 推广活动
|
||||
* @return 推广活动
|
||||
*/
|
||||
@Override
|
||||
public List<EventPromotion> selectEventPromotionList(EventPromotion eventPromotion)
|
||||
{
|
||||
return eventPromotionMapper.selectEventPromotionList(eventPromotion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增推广活动
|
||||
*
|
||||
* @param eventPromotion 推广活动
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEventPromotion(EventPromotion eventPromotion)
|
||||
{
|
||||
eventPromotion.setCreateTime(DateUtils.getNowDate());
|
||||
return eventPromotionMapper.insertEventPromotion(eventPromotion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改推广活动
|
||||
*
|
||||
* @param eventPromotion 推广活动
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEventPromotion(EventPromotion eventPromotion)
|
||||
{
|
||||
eventPromotion.setUpdateTime(DateUtils.getNowDate());
|
||||
return eventPromotionMapper.updateEventPromotion(eventPromotion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除推广活动
|
||||
*
|
||||
* @param ids 需要删除的推广活动主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEventPromotionByIds(Long[] ids)
|
||||
{
|
||||
return eventPromotionMapper.deleteEventPromotionByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除推广活动信息
|
||||
*
|
||||
* @param id 推广活动主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEventPromotionById(Long id)
|
||||
{
|
||||
return eventPromotionMapper.deleteEventPromotionById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
<?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.ruoyi.system.mapper.EventPromotionMapper">
|
||||
|
||||
<resultMap type="EventPromotion" id="EventPromotionResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="activityName" column="activity_name" />
|
||||
<result property="activityType" column="activity_type" />
|
||||
<result property="status" column="status" />
|
||||
<result property="activityBeginTime" column="activity_begin_time" />
|
||||
<result property="activityEndTime" column="activity_end_time" />
|
||||
<result property="numberOfPaymentTransactions" column="number_of_payment_transactions" />
|
||||
<result property="actualAmountPaid" column="actual_amount_paid" />
|
||||
<result property="discountAmount" column="discount_amount" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="isDelete" column="is_delete" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEventPromotionVo">
|
||||
select id, activity_name, activity_type, status, activity_begin_time, activity_end_time, number_of_payment_transactions, actual_amount_paid, discount_amount, create_by, create_time, update_by, update_time, remark, is_delete from event_promotion
|
||||
</sql>
|
||||
|
||||
<select id="selectEventPromotionList" parameterType="EventPromotion" resultMap="EventPromotionResult">
|
||||
<include refid="selectEventPromotionVo"/>
|
||||
<where>
|
||||
<if test="activityName != null and activityName != ''"> and activity_name like concat('%', #{activityName}, '%')</if>
|
||||
<if test="activityType != null "> and activity_type = #{activityType}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="activityBeginTime != null "> and activity_begin_time = #{activityBeginTime}</if>
|
||||
<if test="activityEndTime != null "> and activity_end_time = #{activityEndTime}</if>
|
||||
<if test="numberOfPaymentTransactions != null "> and number_of_payment_transactions = #{numberOfPaymentTransactions}</if>
|
||||
<if test="actualAmountPaid != null "> and actual_amount_paid = #{actualAmountPaid}</if>
|
||||
<if test="discountAmount != null "> and discount_amount = #{discountAmount}</if>
|
||||
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEventPromotionById" parameterType="Long" resultMap="EventPromotionResult">
|
||||
<include refid="selectEventPromotionVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEventPromotion" parameterType="EventPromotion">
|
||||
insert into event_promotion
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="activityName != null">activity_name,</if>
|
||||
<if test="activityType != null">activity_type,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="activityBeginTime != null">activity_begin_time,</if>
|
||||
<if test="activityEndTime != null">activity_end_time,</if>
|
||||
<if test="numberOfPaymentTransactions != null">number_of_payment_transactions,</if>
|
||||
<if test="actualAmountPaid != null">actual_amount_paid,</if>
|
||||
<if test="discountAmount != null">discount_amount,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="activityName != null">#{activityName},</if>
|
||||
<if test="activityType != null">#{activityType},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="activityBeginTime != null">#{activityBeginTime},</if>
|
||||
<if test="activityEndTime != null">#{activityEndTime},</if>
|
||||
<if test="numberOfPaymentTransactions != null">#{numberOfPaymentTransactions},</if>
|
||||
<if test="actualAmountPaid != null">#{actualAmountPaid},</if>
|
||||
<if test="discountAmount != null">#{discountAmount},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEventPromotion" parameterType="EventPromotion">
|
||||
update event_promotion
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="activityName != null">activity_name = #{activityName},</if>
|
||||
<if test="activityType != null">activity_type = #{activityType},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="activityBeginTime != null">activity_begin_time = #{activityBeginTime},</if>
|
||||
<if test="activityEndTime != null">activity_end_time = #{activityEndTime},</if>
|
||||
<if test="numberOfPaymentTransactions != null">number_of_payment_transactions = #{numberOfPaymentTransactions},</if>
|
||||
<if test="actualAmountPaid != null">actual_amount_paid = #{actualAmountPaid},</if>
|
||||
<if test="discountAmount != null">discount_amount = #{discountAmount},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEventPromotionById" parameterType="Long">
|
||||
delete from event_promotion where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEventPromotionByIds" parameterType="String">
|
||||
delete from event_promotion where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
44
ruoyi-ui/src/api/system/promotion.js
Normal file
44
ruoyi-ui/src/api/system/promotion.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询推广活动列表
|
||||
export function listPromotion(query) {
|
||||
return request({
|
||||
url: '/system/promotion/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询推广活动详细
|
||||
export function getPromotion(id) {
|
||||
return request({
|
||||
url: '/system/promotion/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增推广活动
|
||||
export function addPromotion(data) {
|
||||
return request({
|
||||
url: '/system/promotion',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改推广活动
|
||||
export function updatePromotion(data) {
|
||||
return request({
|
||||
url: '/system/promotion',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除推广活动
|
||||
export function delPromotion(id) {
|
||||
return request({
|
||||
url: '/system/promotion/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
411
ruoyi-ui/src/views/crm/promotion/index.vue
Normal file
411
ruoyi-ui/src/views/crm/promotion/index.vue
Normal file
@ -0,0 +1,411 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="活动名称" prop="activityName">
|
||||
<el-input
|
||||
v-model="queryParams.activityName"
|
||||
placeholder="请输入活动名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="活动类型" prop="activityType">
|
||||
<el-select v-model="queryParams.activityType" placeholder="请选择活动类型" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.activity_tye"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.activity_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="活动开始时间" prop="activityBeginTime">-->
|
||||
<!-- <el-date-picker clearable-->
|
||||
<!-- v-model="queryParams.activityBeginTime"-->
|
||||
<!-- type="date"-->
|
||||
<!-- value-format="yyyy-MM-dd"-->
|
||||
<!-- placeholder="请选择活动开始时间">-->
|
||||
<!-- </el-date-picker>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="活动结束时间" prop="activityEndTime">-->
|
||||
<!-- <el-date-picker clearable-->
|
||||
<!-- v-model="queryParams.activityEndTime"-->
|
||||
<!-- type="date"-->
|
||||
<!-- value-format="yyyy-MM-dd"-->
|
||||
<!-- placeholder="请选择活动结束时间">-->
|
||||
<!-- </el-date-picker>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="付款交易数" prop="numberOfPaymentTransactions">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.numberOfPaymentTransactions"-->
|
||||
<!-- placeholder="请输入付款交易数"-->
|
||||
<!-- clearable-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="实付金额" prop="actualAmountPaid">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.actualAmountPaid"-->
|
||||
<!-- placeholder="请输入实付金额"-->
|
||||
<!-- clearable-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="优惠金额" prop="discountAmount">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.discountAmount"-->
|
||||
<!-- placeholder="请输入优惠金额"-->
|
||||
<!-- clearable-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="删除标志" prop="isDelete">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.isDelete"-->
|
||||
<!-- placeholder="请输入删除标志"-->
|
||||
<!-- clearable-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:promotion:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:promotion:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:promotion:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:promotion:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="promotionList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="活动推广id" align="center" prop="id" />-->
|
||||
<el-table-column label="活动名称" align="center" prop="activityName" />
|
||||
<el-table-column label="活动类型" align="center" prop="activityType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.activity_tye" :value="scope.row.activityType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.activity_status" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="活动开始时间" align="center" prop="activityBeginTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.activityBeginTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="活动结束时间" align="center" prop="activityEndTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.activityEndTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="付款交易数" align="center" prop="numberOfPaymentTransactions" />
|
||||
<el-table-column label="实付金额" align="center" prop="actualAmountPaid" />
|
||||
<el-table-column label="优惠金额" align="center" prop="discountAmount" />
|
||||
<!-- <el-table-column label="备注" align="center" prop="remark" />-->
|
||||
<!-- <el-table-column label="删除标志" align="center" prop="isDelete" />-->
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:promotion:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:promotion:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改推广活动对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="活动名称" prop="activityName">
|
||||
<el-input v-model="form.activityName" placeholder="请输入活动名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="活动类型" prop="activityType">
|
||||
<el-select v-model="form.activityType" placeholder="请选择活动类型">
|
||||
<el-option
|
||||
v-for="dict in dict.type.activity_tye"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="parseInt(dict.value)"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="form.status" placeholder="请选择状态">
|
||||
<el-option
|
||||
v-for="dict in dict.type.activity_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="parseInt(dict.value)"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="活动开始时间" prop="activityBeginTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.activityBeginTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择活动开始时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="活动结束时间" prop="activityEndTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.activityEndTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择活动结束时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="付款交易数" prop="numberOfPaymentTransactions">
|
||||
<el-input v-model="form.numberOfPaymentTransactions" placeholder="请输入付款交易数" />
|
||||
</el-form-item>
|
||||
<el-form-item label="实付金额" prop="actualAmountPaid">
|
||||
<el-input v-model="form.actualAmountPaid" placeholder="请输入实付金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠金额" prop="discountAmount">
|
||||
<el-input v-model="form.discountAmount" placeholder="请输入优惠金额" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="备注" prop="remark">-->
|
||||
<!-- <el-input v-model="form.remark" placeholder="请输入备注" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="删除标志" prop="isDelete">-->
|
||||
<!-- <el-input v-model="form.isDelete" placeholder="请输入删除标志" />-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listPromotion, getPromotion, delPromotion, addPromotion, updatePromotion } from "@/api/system/promotion";
|
||||
|
||||
export default {
|
||||
name: "Promotion",
|
||||
dicts: ['activity_status', 'activity_tye'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 推广活动表格数据
|
||||
promotionList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
activityName: null,
|
||||
activityType: '',
|
||||
status: '',
|
||||
activityBeginTime: null,
|
||||
activityEndTime: null,
|
||||
numberOfPaymentTransactions: null,
|
||||
actualAmountPaid: null,
|
||||
discountAmount: null,
|
||||
isDelete: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询推广活动列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listPromotion(this.queryParams).then(response => {
|
||||
this.promotionList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
activityName: null,
|
||||
activityType: '',
|
||||
status: '',
|
||||
activityBeginTime: null,
|
||||
activityEndTime: null,
|
||||
numberOfPaymentTransactions: null,
|
||||
actualAmountPaid: null,
|
||||
discountAmount: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
remark: null,
|
||||
isDelete: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加推广活动";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getPromotion(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改推广活动";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updatePromotion(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addPromotion(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除推广活动编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delPromotion(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/promotion/export', {
|
||||
...this.queryParams
|
||||
}, `promotion_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user