2
0

feat: payment module add alipay and wechatpay framework

This commit is contained in:
2024-12-05 09:53:53 +08:00
parent daf62f7527
commit 62f82f2224
15 changed files with 1168 additions and 6 deletions

View File

@@ -0,0 +1,73 @@
package org.wfc.payment.controller;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.payment.domain.AliPay;
import org.wfc.payment.service.IAliPayService;
/**
* Paypal controller
*
* @author wfc
*/
@RestController
@RequestMapping("/alipay")
public class AliPayController extends BaseController
{
@Autowired
private IAliPayService alipayService;
/**
* AliPay
*/
@RequiresPermissions("payment:alipayInfo:query")
@Log(title = "alipay info management", businessType = BusinessType.OTHER)
@GetMapping("/{userId}")
public AjaxResult query(@PathVariable Long userId) {
return success(alipayService.selectAliPayInfoByUserId(userId));
}
/**
* AliPay
*/
@RequiresPermissions("payment:alipayInfo:add")
@Log(title = "alipay info management", businessType = BusinessType.INSERT)
@PostMapping("/{alipay}")
public AjaxResult add(@PathVariable AliPay alipay)
{
return toAjax(alipayService.insertAliPayInfo(alipay));
}
/**
* AliPay
*/
@RequiresPermissions("payment:alipayInfo:edit")
@Log(title = "alipay info management", businessType = BusinessType.UPDATE)
@PutMapping("/{id}")
public AjaxResult edit(@PathVariable Long id) {
return toAjax(alipayService.updateAliPayInfoById(id));
}
/**
* AliPay
*/
@RequiresPermissions("payment:alipayInfo:remove")
@Log(title = "alipay info management", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id) {
alipayService.deleteAliPayInfoById(id);
return success();
}
}

View File

@@ -56,7 +56,7 @@ public class CreditCardController extends BaseController
/**
* 新增参数配置
*/
@RequiresPermissions("pay:creditCard:add")
@RequiresPermissions("payment:creditCard:add")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody CreditCard creditCardInfo)

View File

@@ -32,7 +32,7 @@ public class PayPalController extends BaseController
/**
* PayPal
*/
@RequiresPermissions("pay:paypalInfo:query")
@RequiresPermissions("payment:paypalInfo:query")
@Log(title = "paypal info management", businessType = BusinessType.OTHER)
@GetMapping("/{userId}")
public AjaxResult query(@PathVariable Long userId) {
@@ -42,7 +42,7 @@ public class PayPalController extends BaseController
/**
* PayPal
*/
@RequiresPermissions("pay:paypalInfo:add")
@RequiresPermissions("payment:paypalInfo:add")
@Log(title = "paypal info management", businessType = BusinessType.INSERT)
@PostMapping("/{paypal}")
public AjaxResult add(@PathVariable PayPal paypal)
@@ -53,7 +53,7 @@ public class PayPalController extends BaseController
/**
* PayPal
*/
@RequiresPermissions("pay:paypalInfo:edit")
@RequiresPermissions("payment:paypalInfo:edit")
@Log(title = "paypal info management", businessType = BusinessType.UPDATE)
@PutMapping("/{id}")
public AjaxResult edit(@PathVariable Long id) {
@@ -63,7 +63,7 @@ public class PayPalController extends BaseController
/**
* PayPal
*/
@RequiresPermissions("pay:paypalInfo:remove")
@RequiresPermissions("payment:paypalInfo:remove")
@Log(title = "paypal info management", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id) {

View File

@@ -0,0 +1,73 @@
package org.wfc.payment.controller;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.payment.domain.WechatPay;
import org.wfc.payment.service.IWechatPayService;
/**
* Paypal controller
*
* @author wfc
*/
@RestController
@RequestMapping("/wechatpay")
public class WechatPayController extends BaseController
{
@Autowired
private IWechatPayService wechatpayService;
/**
* WechatPay
*/
@RequiresPermissions("payment:wechatpayInfo:query")
@Log(title = "wechatpay info management", businessType = BusinessType.OTHER)
@GetMapping("/{userId}")
public AjaxResult query(@PathVariable Long userId) {
return success(wechatpayService.selectWechatPayInfoByUserId(userId));
}
/**
* WechatPay
*/
@RequiresPermissions("payment:wechatpayInfo:add")
@Log(title = "wechatpay info management", businessType = BusinessType.INSERT)
@PostMapping("/{wechatpay}")
public AjaxResult add(@PathVariable WechatPay wechatpay)
{
return toAjax(wechatpayService.insertWechatPayInfo(wechatpay));
}
/**
* WechatPay
*/
@RequiresPermissions("payment:wechatpayInfo:edit")
@Log(title = "wechatpay info management", businessType = BusinessType.UPDATE)
@PutMapping("/{id}")
public AjaxResult edit(@PathVariable Long id) {
return toAjax(wechatpayService.updateWechatPayInfoById(id));
}
/**
* WechatPay
*/
@RequiresPermissions("payment:wechatpayInfo:remove")
@Log(title = "wechatpay info management", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id) {
wechatpayService.deleteWechatPayInfoById(id);
return success();
}
}

View File

@@ -0,0 +1,256 @@
package org.wfc.payment.domain;
import org.wfc.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* 菜单权限表 sys_menu
*
* @author wfc
*/
public class AliPay extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 菜单ID */
private Long menuId;
/** 菜单名称 */
private String menuName;
/** 父菜单名称 */
private String parentName;
/** 父菜单ID */
private Long parentId;
/** 显示顺序 */
private Integer orderNum;
/** 路由地址 */
private String path;
/** 组件路径 */
private String component;
/** 路由参数 */
private String query;
/** 是否为外链0是 1否 */
private String isFrame;
/** 是否缓存0缓存 1不缓存 */
private String isCache;
/** 类型M目录 C菜单 F按钮 */
private String menuType;
/** 显示状态0显示 1隐藏 */
private String visible;
/** 菜单状态0正常 1停用 */
private String status;
/** 权限字符串 */
private String perms;
/** 菜单图标 */
private String icon;
/** 菜单key */
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getMenuId()
{
return menuId;
}
public void setMenuId(Long menuId)
{
this.menuId = menuId;
}
@NotBlank(message = "菜单名称不能为空")
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
public String getMenuName()
{
return menuName;
}
public void setMenuName(String menuName)
{
this.menuName = menuName;
}
public String getParentName()
{
return parentName;
}
public void setParentName(String parentName)
{
this.parentName = parentName;
}
public Long getParentId()
{
return parentId;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
@NotNull(message = "显示顺序不能为空")
public Integer getOrderNum()
{
return orderNum;
}
public void setOrderNum(Integer orderNum)
{
this.orderNum = orderNum;
}
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
public String getPath()
{
return path;
}
public void setPath(String path)
{
this.path = path;
}
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
public String getComponent()
{
return component;
}
public void setComponent(String component)
{
this.component = component;
}
public String getQuery()
{
return query;
}
public void setQuery(String query)
{
this.query = query;
}
public String getIsFrame()
{
return isFrame;
}
public void setIsFrame(String isFrame)
{
this.isFrame = isFrame;
}
public String getIsCache()
{
return isCache;
}
public void setIsCache(String isCache)
{
this.isCache = isCache;
}
@NotBlank(message = "菜单类型不能为空")
public String getMenuType()
{
return menuType;
}
public void setMenuType(String menuType)
{
this.menuType = menuType;
}
public String getVisible()
{
return visible;
}
public void setVisible(String visible)
{
this.visible = visible;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
public String getPerms()
{
return perms;
}
public void setPerms(String perms)
{
this.perms = perms;
}
public String getIcon()
{
return icon;
}
public void setIcon(String icon)
{
this.icon = icon;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("menuId", getMenuId())
.append("menuName", getMenuName())
.append("parentId", getParentId())
.append("orderNum", getOrderNum())
.append("path", getPath())
.append("component", getComponent())
.append("isFrame", getIsFrame())
.append("IsCache", getIsCache())
.append("menuType", getMenuType())
.append("visible", getVisible())
.append("status ", getStatus())
.append("perms", getPerms())
.append("icon", getIcon())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("name", getName())
.toString();
}
}

View File

@@ -0,0 +1,256 @@
package org.wfc.payment.domain;
import org.wfc.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* 菜单权限表 sys_menu
*
* @author wfc
*/
public class WechatPay extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 菜单ID */
private Long menuId;
/** 菜单名称 */
private String menuName;
/** 父菜单名称 */
private String parentName;
/** 父菜单ID */
private Long parentId;
/** 显示顺序 */
private Integer orderNum;
/** 路由地址 */
private String path;
/** 组件路径 */
private String component;
/** 路由参数 */
private String query;
/** 是否为外链0是 1否 */
private String isFrame;
/** 是否缓存0缓存 1不缓存 */
private String isCache;
/** 类型M目录 C菜单 F按钮 */
private String menuType;
/** 显示状态0显示 1隐藏 */
private String visible;
/** 菜单状态0正常 1停用 */
private String status;
/** 权限字符串 */
private String perms;
/** 菜单图标 */
private String icon;
/** 菜单key */
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getMenuId()
{
return menuId;
}
public void setMenuId(Long menuId)
{
this.menuId = menuId;
}
@NotBlank(message = "菜单名称不能为空")
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
public String getMenuName()
{
return menuName;
}
public void setMenuName(String menuName)
{
this.menuName = menuName;
}
public String getParentName()
{
return parentName;
}
public void setParentName(String parentName)
{
this.parentName = parentName;
}
public Long getParentId()
{
return parentId;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
@NotNull(message = "显示顺序不能为空")
public Integer getOrderNum()
{
return orderNum;
}
public void setOrderNum(Integer orderNum)
{
this.orderNum = orderNum;
}
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
public String getPath()
{
return path;
}
public void setPath(String path)
{
this.path = path;
}
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
public String getComponent()
{
return component;
}
public void setComponent(String component)
{
this.component = component;
}
public String getQuery()
{
return query;
}
public void setQuery(String query)
{
this.query = query;
}
public String getIsFrame()
{
return isFrame;
}
public void setIsFrame(String isFrame)
{
this.isFrame = isFrame;
}
public String getIsCache()
{
return isCache;
}
public void setIsCache(String isCache)
{
this.isCache = isCache;
}
@NotBlank(message = "菜单类型不能为空")
public String getMenuType()
{
return menuType;
}
public void setMenuType(String menuType)
{
this.menuType = menuType;
}
public String getVisible()
{
return visible;
}
public void setVisible(String visible)
{
this.visible = visible;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
public String getPerms()
{
return perms;
}
public void setPerms(String perms)
{
this.perms = perms;
}
public String getIcon()
{
return icon;
}
public void setIcon(String icon)
{
this.icon = icon;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("menuId", getMenuId())
.append("menuName", getMenuName())
.append("parentId", getParentId())
.append("orderNum", getOrderNum())
.append("path", getPath())
.append("component", getComponent())
.append("isFrame", getIsFrame())
.append("IsCache", getIsCache())
.append("menuType", getMenuType())
.append("visible", getVisible())
.append("status ", getStatus())
.append("perms", getPerms())
.append("icon", getIcon())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("name", getName())
.toString();
}
}

View File

@@ -15,7 +15,7 @@ public class MetaVo
private String title;
/**
* 设置该路由的图标对应路径src/assets/icons/svg
* 设置该路由的图标对应路径src/assets/icons/sv
*/
private String icon;

View File

@@ -0,0 +1,43 @@
package org.wfc.payment.mapper;
import org.wfc.payment.domain.AliPay;
/**
* Paypal mapper
*
* @author wfc
*/
public interface AliPayMapper
{
/**
* select alipay info by user id
*
* @param userId user id
* @return alipay information
*/
public AliPay selectAliPayInfoByUserId(Long userId);
/**
* select AliPay pay information by user ID
*
* @param userId user ID
* @return AliPay pay information
*/
public int insertAliPayInfo(AliPay alipay);
/**
* select AliPay pay information by user ID
*
* @param userId user ID
* @return AliPay pay information
*/
public int updateAliPayInfoById(Long id);
/**
* select AliPay pay information by user ID
*
* @param userId user ID
* @return AliPay pay information
*/
public void deleteAliPayInfoById(Long id);
}

View File

@@ -0,0 +1,43 @@
package org.wfc.payment.mapper;
import org.wfc.payment.domain.WechatPay;
/**
* Paypal mapper
*
* @author wfc
*/
public interface WechatPayMapper
{
/**
* select wechatpay info by user id
*
* @param userId user id
* @return wechatpay information
*/
public WechatPay selectWechatPayInfoByUserId(Long userId);
/**
* select WechatPay pay information by user ID
*
* @param userId user ID
* @return WechatPay pay information
*/
public int insertWechatPayInfo(WechatPay wechatpay);
/**
* select WechatPay pay information by user ID
*
* @param userId user ID
* @return WechatPay pay information
*/
public int updateWechatPayInfoById(Long id);
/**
* select WechatPay pay information by user ID
*
* @param userId user ID
* @return WechatPay pay information
*/
public void deleteWechatPayInfoById(Long id);
}

View File

@@ -0,0 +1,43 @@
package org.wfc.payment.service;
import org.wfc.payment.domain.AliPay;
/**
* Paypal pay service layer
*
* @author wfc
*/
public interface IAliPayService
{
/**
* select AliPay pay information by user ID
*
* @param userId user ID
* @return AliPay pay information
*/
public AliPay selectAliPayInfoByUserId(Long userId);
/**
* select AliPay pay information by user ID
*
* @param userId user ID
* @return AliPay pay information
*/
public int insertAliPayInfo(AliPay alipay);
/**
* select AliPay pay information by user ID
*
* @param userId user ID
* @return AliPay pay information
*/
public int updateAliPayInfoById(Long id);
/**
* select AliPay pay information by user ID
*
* @param userId user ID
* @return AliPay pay information
*/
public void deleteAliPayInfoById(Long id);
}

View File

@@ -0,0 +1,43 @@
package org.wfc.payment.service;
import org.wfc.payment.domain.WechatPay;
/**
* Paypal pay service layer
*
* @author wfc
*/
public interface IWechatPayService
{
/**
* select WechatPay pay information by user ID
*
* @param userId user ID
* @return WechatPay pay information
*/
public WechatPay selectWechatPayInfoByUserId(Long userId);
/**
* select WechatPay pay information by user ID
*
* @param userId user ID
* @return WechatPay pay information
*/
public int insertWechatPayInfo(WechatPay wechatpay);
/**
* select WechatPay pay information by user ID
*
* @param userId user ID
* @return WechatPay pay information
*/
public int updateWechatPayInfoById(Long id);
/**
* select WechatPay pay information by user ID
*
* @param userId user ID
* @return WechatPay pay information
*/
public void deleteWechatPayInfoById(Long id);
}

View File

@@ -0,0 +1,63 @@
package org.wfc.payment.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wfc.payment.mapper.AliPayMapper;
import org.wfc.payment.service.IAliPayService;
import org.wfc.payment.domain.AliPay;
/**
* AliPay service implementation
*
* @author wfc
*/
@Service
public class AliPayServiceImpl implements IAliPayService
{
@Autowired
private AliPayMapper alipayMapper;
/**
* Select Paypal information by user ID
*
* @param userId user ID
* @return 结果
*/
@Override
public AliPay selectAliPayInfoByUserId(Long userId) {
return alipayMapper.selectAliPayInfoByUserId(userId);
}
/**
* Select Paypal information by user ID
*
* @param userId user ID
* @return 结果
*/
@Override
public int insertAliPayInfo(AliPay alipay) {
return alipayMapper.insertAliPayInfo(alipay);
}
/**
* Select Paypal information by user ID
*
* @param userId user ID
* @return 结果
*/
@Override
public int updateAliPayInfoById(Long id) {
return alipayMapper.updateAliPayInfoById(id);
}
/**
* update credit card
*
* @param creditCard User ID
* @return void
*/
@Override
public void deleteAliPayInfoById(Long id) {
alipayMapper.deleteAliPayInfoById(id);
}
}

View File

@@ -0,0 +1,63 @@
package org.wfc.payment.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wfc.payment.mapper.WechatPayMapper;
import org.wfc.payment.service.IWechatPayService;
import org.wfc.payment.domain.WechatPay;
/**
* WechatPay service implementation
*
* @author wfc
*/
@Service
public class WechatPayServiceImpl implements IWechatPayService
{
@Autowired
private WechatPayMapper wechatpayMapper;
/**
* Select Paypal information by user ID
*
* @param userId user ID
* @return 结果
*/
@Override
public WechatPay selectWechatPayInfoByUserId(Long userId) {
return wechatpayMapper.selectWechatPayInfoByUserId(userId);
}
/**
* Select Paypal information by user ID
*
* @param userId user ID
* @return 结果
*/
@Override
public int insertWechatPayInfo(WechatPay wechatpay) {
return wechatpayMapper.insertWechatPayInfo(wechatpay);
}
/**
* Select Paypal information by user ID
*
* @param userId user ID
* @return 结果
*/
@Override
public int updateWechatPayInfoById(Long id) {
return wechatpayMapper.updateWechatPayInfoById(id);
}
/**
* update credit card
*
* @param creditCard User ID
* @return void
*/
@Override
public void deleteWechatPayInfoById(Long id) {
wechatpayMapper.deleteWechatPayInfoById(id);
}
}

View File

@@ -0,0 +1,103 @@
<?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="org.wfc.payment.mapper.AliPayMapper">
<resultMap type="AliPay" id="AliPayResult">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="parentName" column="parent_name" />
<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="selectAliPayInfoVo">
select d.dept_id, d.parent_id, d.ancestors, d.remark, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
from sys_dept d
</sql>
<select id="selectAliPayInfoByUserId" parameterType="AliPay" resultMap="AliPayResult">
<include refid="selectAliPayInfoVo"/>
where d.del_flag = '0'
<if test="deptId != null and deptId != 0">
AND dept_id = #{deptId}
</if>
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
</select>
<insert id="insertAliPayInfo" parameterType="AliPay">
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null">order_num,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)values(
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<update id="updateAliPayInfoById" parameterType="AliPay">
update sys_dept
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
update_time = sysdate()
</set>
where dept_id = #{id}
</update>
<delete id="deleteAliPayInfoById" parameterType="Long">
update sys_dept set del_flag = '2' where dept_id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,103 @@
<?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="org.wfc.payment.mapper.WechatPayMapper">
<resultMap type="WechatPay" id="WechatPayResult">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="parentName" column="parent_name" />
<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="selectWechatPayInfoVo">
select d.dept_id, d.parent_id, d.ancestors, d.remark, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
from sys_dept d
</sql>
<select id="selectWechatPayInfoByUserId" parameterType="WechatPay" resultMap="WechatPayResult">
<include refid="selectWechatPayInfoVo"/>
where d.del_flag = '0'
<if test="deptId != null and deptId != 0">
AND dept_id = #{deptId}
</if>
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
</select>
<insert id="insertWechatPayInfo" parameterType="WechatPay">
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null">order_num,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)values(
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<update id="updateWechatPayInfoById" parameterType="WechatPay">
update sys_dept
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
update_time = sysdate()
</set>
where dept_id = #{id}
</update>
<delete id="deleteWechatPayInfoById" parameterType="Long">
update sys_dept set del_flag = '2' where dept_id = #{id}
</delete>
</mapper>