添加支付模块
This commit is contained in:
28
ruoyi-pay/pom.xml
Normal file
28
ruoyi-pay/pom.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<version>3.8.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-pay</artifactId>
|
||||
<description>
|
||||
支付模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
@ -0,0 +1,104 @@
|
||||
package com.ruoyi.pay.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.pay.domain.SysPay;
|
||||
import com.ruoyi.pay.service.ISysPayService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 支付相关Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-03-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pay/wxPay")
|
||||
public class SysPayController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysPayService sysPayService;
|
||||
|
||||
/**
|
||||
* 查询支付相关列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pay:wxPay:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysPay sysPay)
|
||||
{
|
||||
startPage();
|
||||
List<SysPay> list = sysPayService.selectSysPayList(sysPay);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出支付相关列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pay:wxPay:export')")
|
||||
@Log(title = "支付相关", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysPay sysPay)
|
||||
{
|
||||
List<SysPay> list = sysPayService.selectSysPayList(sysPay);
|
||||
ExcelUtil<SysPay> util = new ExcelUtil<SysPay>(SysPay.class);
|
||||
util.exportExcel(response, list, "支付相关数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付相关详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pay:wxPay:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(sysPayService.selectSysPayById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增支付相关
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pay:wxPay:add')")
|
||||
@Log(title = "支付相关", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysPay sysPay)
|
||||
{
|
||||
return toAjax(sysPayService.insertSysPay(sysPay));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改支付相关
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pay:wxPay:edit')")
|
||||
@Log(title = "支付相关", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysPay sysPay)
|
||||
{
|
||||
return toAjax(sysPayService.updateSysPay(sysPay));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除支付相关
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pay:wxPay:remove')")
|
||||
@Log(title = "支付相关", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(sysPayService.deleteSysPayByIds(ids));
|
||||
}
|
||||
}
|
84
ruoyi-pay/src/main/java/com/ruoyi/pay/domain/SysPay.java
Normal file
84
ruoyi-pay/src/main/java/com/ruoyi/pay/domain/SysPay.java
Normal file
@ -0,0 +1,84 @@
|
||||
package com.ruoyi.pay.domain;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 支付相关对象 sys_pay
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-03-29
|
||||
*/
|
||||
public class SysPay extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 支付id */
|
||||
private Long id;
|
||||
|
||||
/** 支付名称 */
|
||||
@Excel(name = "支付名称")
|
||||
private String name;
|
||||
|
||||
/** 支付状态 */
|
||||
@Excel(name = "支付状态")
|
||||
private String state;
|
||||
|
||||
/** 金额 */
|
||||
@Excel(name = "金额")
|
||||
private String figure;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setState(String state)
|
||||
{
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getState()
|
||||
{
|
||||
return state;
|
||||
}
|
||||
public void setFigure(String figure)
|
||||
{
|
||||
this.figure = figure;
|
||||
}
|
||||
|
||||
public String getFigure()
|
||||
{
|
||||
return figure;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("state", getState())
|
||||
.append("figure", getFigure())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.pay.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.pay.domain.SysPay;
|
||||
|
||||
/**
|
||||
* 支付相关Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-03-29
|
||||
*/
|
||||
public interface SysPayMapper
|
||||
{
|
||||
/**
|
||||
* 查询支付相关
|
||||
*
|
||||
* @param id 支付相关主键
|
||||
* @return 支付相关
|
||||
*/
|
||||
public SysPay selectSysPayById(Long id);
|
||||
|
||||
/**
|
||||
* 查询支付相关列表
|
||||
*
|
||||
* @param sysPay 支付相关
|
||||
* @return 支付相关集合
|
||||
*/
|
||||
public List<SysPay> selectSysPayList(SysPay sysPay);
|
||||
|
||||
/**
|
||||
* 新增支付相关
|
||||
*
|
||||
* @param sysPay 支付相关
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysPay(SysPay sysPay);
|
||||
|
||||
/**
|
||||
* 修改支付相关
|
||||
*
|
||||
* @param sysPay 支付相关
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysPay(SysPay sysPay);
|
||||
|
||||
/**
|
||||
* 删除支付相关
|
||||
*
|
||||
* @param id 支付相关主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysPayById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除支付相关
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysPayByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.pay.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.pay.domain.SysPay;
|
||||
|
||||
/**
|
||||
* 支付相关Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-03-29
|
||||
*/
|
||||
public interface ISysPayService
|
||||
{
|
||||
/**
|
||||
* 查询支付相关
|
||||
*
|
||||
* @param id 支付相关主键
|
||||
* @return 支付相关
|
||||
*/
|
||||
public SysPay selectSysPayById(Long id);
|
||||
|
||||
/**
|
||||
* 查询支付相关列表
|
||||
*
|
||||
* @param sysPay 支付相关
|
||||
* @return 支付相关集合
|
||||
*/
|
||||
public List<SysPay> selectSysPayList(SysPay sysPay);
|
||||
|
||||
/**
|
||||
* 新增支付相关
|
||||
*
|
||||
* @param sysPay 支付相关
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysPay(SysPay sysPay);
|
||||
|
||||
/**
|
||||
* 修改支付相关
|
||||
*
|
||||
* @param sysPay 支付相关
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysPay(SysPay sysPay);
|
||||
|
||||
/**
|
||||
* 批量删除支付相关
|
||||
*
|
||||
* @param ids 需要删除的支付相关主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysPayByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除支付相关信息
|
||||
*
|
||||
* @param id 支付相关主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysPayById(Long id);
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.ruoyi.pay.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.pay.mapper.SysPayMapper;
|
||||
import com.ruoyi.pay.domain.SysPay;
|
||||
import com.ruoyi.pay.service.ISysPayService;
|
||||
|
||||
/**
|
||||
* 支付相关Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-03-29
|
||||
*/
|
||||
@Service
|
||||
public class SysPayServiceImpl implements ISysPayService
|
||||
{
|
||||
@Autowired
|
||||
private SysPayMapper sysPayMapper;
|
||||
|
||||
/**
|
||||
* 查询支付相关
|
||||
*
|
||||
* @param id 支付相关主键
|
||||
* @return 支付相关
|
||||
*/
|
||||
@Override
|
||||
public SysPay selectSysPayById(Long id)
|
||||
{
|
||||
return sysPayMapper.selectSysPayById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支付相关列表
|
||||
*
|
||||
* @param sysPay 支付相关
|
||||
* @return 支付相关
|
||||
*/
|
||||
@Override
|
||||
public List<SysPay> selectSysPayList(SysPay sysPay)
|
||||
{
|
||||
return sysPayMapper.selectSysPayList(sysPay);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增支付相关
|
||||
*
|
||||
* @param sysPay 支付相关
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysPay(SysPay sysPay)
|
||||
{
|
||||
sysPay.setCreateTime(DateUtils.getNowDate());
|
||||
return sysPayMapper.insertSysPay(sysPay);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改支付相关
|
||||
*
|
||||
* @param sysPay 支付相关
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysPay(SysPay sysPay)
|
||||
{
|
||||
sysPay.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysPayMapper.updateSysPay(sysPay);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除支付相关
|
||||
*
|
||||
* @param ids 需要删除的支付相关主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysPayByIds(Long[] ids)
|
||||
{
|
||||
return sysPayMapper.deleteSysPayByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除支付相关信息
|
||||
*
|
||||
* @param id 支付相关主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysPayById(Long id)
|
||||
{
|
||||
return sysPayMapper.deleteSysPayById(id);
|
||||
}
|
||||
}
|
86
ruoyi-pay/src/main/resources/mapper/pay/SysPayMapper.xml
Normal file
86
ruoyi-pay/src/main/resources/mapper/pay/SysPayMapper.xml
Normal file
@ -0,0 +1,86 @@
|
||||
<?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.pay.mapper.SysPayMapper">
|
||||
|
||||
<resultMap type="SysPay" id="SysPayResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="state" column="state" />
|
||||
<result property="figure" column="figure" />
|
||||
<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" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysPayVo">
|
||||
select id, name, state, figure, create_by, create_time, update_by, update_time, remark from sys_pay
|
||||
</sql>
|
||||
|
||||
<select id="selectSysPayList" parameterType="SysPay" resultMap="SysPayResult">
|
||||
<include refid="selectSysPayVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="state != null and state != ''"> and state = #{state}</if>
|
||||
<if test="figure != null and figure != ''"> and figure = #{figure}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysPayById" parameterType="Long" resultMap="SysPayResult">
|
||||
<include refid="selectSysPayVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysPay" parameterType="SysPay" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_pay
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
<if test="state != null">state,</if>
|
||||
<if test="figure != null">figure,</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>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="state != null">#{state},</if>
|
||||
<if test="figure != null">#{figure},</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>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysPay" parameterType="SysPay">
|
||||
update sys_pay
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="state != null">state = #{state},</if>
|
||||
<if test="figure != null">figure = #{figure},</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>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysPayById" parameterType="Long">
|
||||
delete from sys_pay where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysPayByIds" parameterType="String">
|
||||
delete from sys_pay where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Reference in New Issue
Block a user