数据隔离

This commit is contained in:
邱贞招 2024-11-14 20:53:08 +08:00
parent 8ca7e970a8
commit 94e3e45afd
41 changed files with 222 additions and 185 deletions

View File

@ -95,7 +95,7 @@ token:
# 令牌密钥 # 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟 # 令牌有效期默认30分钟
expireTime: 30 expireTime: 65535000
## MyBatis配置 ## MyBatis配置
#mybatis: #mybatis:

View File

@ -17,19 +17,19 @@ import java.lang.annotation.Target;
public @interface DataScope public @interface DataScope
{ {
/** /**
* 代理商的别名 * 的别名
*/ */
public String agentAlias() default ""; public String merchantAlias() default "";
/** /**
* 用户表的别名 * 用户表的别名
*/ */
public String userAlias() default ""; public String userAlias() default "";
/** // /**
* 只是用户隔离 如果是1则只查询当前用户的数据 // * 只是用户隔离 如果是1则只查询当前用户的数据
*/ // */
public String onlyUser() default ""; // public String onlyUser() default "";
/** /**
* 权限字符用于多个角色匹配符合要求的权限默认根据权限注解@ss获取多个权限用逗号分隔开来 * 权限字符用于多个角色匹配符合要求的权限默认根据权限注解@ss获取多个权限用逗号分隔开来

View File

@ -193,7 +193,12 @@ public class ServiceConstants {
/** /**
* 车辆状态: 1-正常 * 车辆状态: 1-正常
*/ */
public static final String VEHICLE_STATUS_NORMAL_STR = "1"; public static final String VEHICLE_STATUS_NORMAL_STR = "待租";
/**
* 车辆状态: 2-已绑定
*/
public static final String VEHICLE_STATUS__BOUND_STR = "已绑定";
/** /**
* 车辆状态: 3-使用中 * 车辆状态: 3-使用中

View File

@ -122,6 +122,9 @@ public class EUser extends BaseEntity
/** 角色组 */ /** 角色组 */
private Long[] roleIds; private Long[] roleIds;
/** 角色ID */
private Long roleId;
/** 服务费比例 */ /** 服务费比例 */
@Excel(name = "服务费比例") @Excel(name = "服务费比例")
private BigDecimal serviceFeeProportion; private BigDecimal serviceFeeProportion;

View File

@ -32,25 +32,15 @@ public class DataScopeAspect
*/ */
public static final String DATA_SCOPE_ALL = "1"; public static final String DATA_SCOPE_ALL = "1";
// /**
// * 自定数据权限
// */
// public static final String DATA_SCOPE_CUSTOM = "2";
/** /**
* 部门数据权限 * 商家数据权限
*/ */
public static final String DATA_SCOPE_DEPT = "3"; public static final String DATA_SCOPE_DEPT = "3";
// /** /**
// * 部门及以下数据权限 * 仅本人数据权限
// */ */
// public static final String DATA_SCOPE_DEPT_AND_CHILD = "4"; public static final String DATA_SCOPE_SELF = "5";
// /**
// * 仅本人数据权限
// */
// public static final String DATA_SCOPE_SELF = "5";
/** /**
* 数据权限过滤关键字 * 数据权限过滤关键字
@ -75,8 +65,7 @@ public class DataScopeAspect
if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin()) if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin())
{ {
String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), PermissionContextHolder.getContext()); String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), PermissionContextHolder.getContext());
dataScopeFilter(joinPoint, currentUser, controllerDataScope.agentAlias(), dataScopeFilter(joinPoint, currentUser, controllerDataScope.merchantAlias(), controllerDataScope.userAlias(), permission);
controllerDataScope.userAlias(), controllerDataScope.onlyUser(),permission);
} }
} }
} }
@ -86,12 +75,10 @@ public class DataScopeAspect
* *
* @param joinPoint 切点 * @param joinPoint 切点
* @param user 用户 * @param user 用户
* @param agentAlias 部门别名
* @param userAlias 用户别名 * @param userAlias 用户别名
* @param onlyUser 只做用户隔离
* @param permission 权限字符 * @param permission 权限字符
*/ */
public static void dataScopeFilter(JoinPoint joinPoint, EUserVO user, String agentAlias, String userAlias, String onlyUser, String permission) public static void dataScopeFilter(JoinPoint joinPoint, EUserVO user, String merchantAlias, String userAlias, String permission)
{ {
StringBuilder sqlString = new StringBuilder(); StringBuilder sqlString = new StringBuilder();
List<String> conditions = new ArrayList<String>(); List<String> conditions = new ArrayList<String>();
@ -112,16 +99,20 @@ public class DataScopeAspect
}else if (DATA_SCOPE_DEPT.equals(dataScope)){ }else if (DATA_SCOPE_DEPT.equals(dataScope)){
// 如果是代理商则用 a 来查询 // 如果是代理商则用 a 来查询
// 如果是商户则用 u 来查询 onlyUser.equals("1") // 如果是商户则用 u 来查询 onlyUser.equals("1")
sqlString.append(StringUtils.format(" OR {}.user_id = {} ", merchantAlias, user.getUserId()));
}else if (DATA_SCOPE_SELF.equals(dataScope)){
// 如果是本人权限 用不同的别名来表示 u2
// 如果是商户则用 u 来查询 onlyUser.equals("1")
sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId())); sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId()));
} }
conditions.add(dataScope); conditions.add(dataScope);
} }
// 角色都不包含传递过来的权限字符这个时候sqlString也会为空所以要限制一下,不查询任何数据 // 角色都不包含传递过来的权限字符这个时候sqlString也会为空所以要限制一下,不查询任何数据
if (StringUtils.isEmpty(conditions)) // if (StringUtils.isEmpty(conditions))
{ // {
sqlString.append(StringUtils.format(" OR {}.user_id = 0 ", agentAlias)); // sqlString.append(StringUtils.format(" OR {}.isolate_id = 0 ", agentAlias));
} // }
if (StringUtils.isNotBlank(sqlString.toString())) if (StringUtils.isNotBlank(sqlString.toString()))
{ {

View File

@ -247,6 +247,12 @@ public class EOrder extends BaseEntity {
@Excel(name = "支付渠道id") @Excel(name = "支付渠道id")
private Long payChannel; private Long payChannel;
/**
* 支付渠道名称
*/
@Excel(name = "支付渠道名称")
private String channelName;
/** /**
* 配送方式 * 配送方式
*/ */

View File

@ -42,7 +42,7 @@ public class EAccessoryServiceImpl implements IEAccessoryService
* @return 配件 * @return 配件
*/ */
@Override @Override
@DataScope(agentAlias = "ag",userAlias = "u") @DataScope(merchantAlias = "m")
public List<EAccessory> selectRlAccessoryList(EAccessory rlAccessory) public List<EAccessory> selectRlAccessoryList(EAccessory rlAccessory)
{ {
return rlAccessoryMapper.selectRlAccessoryList(rlAccessory); return rlAccessoryMapper.selectRlAccessoryList(rlAccessory);

View File

@ -38,7 +38,7 @@ public class EArticleClassifyServiceImpl implements IEArticleClassifyService
* @return 分类信息集合 * @return 分类信息集合
*/ */
@Override @Override
@DataScope(agentAlias = "a") // @DataScope(agentAlias = "a")
public List<AsArticleClassify> selectClassifyListWithIsolate(AsArticleClassify classify) public List<AsArticleClassify> selectClassifyListWithIsolate(AsArticleClassify classify)
{ {
return articleClassifyMapper.selectClassifyList(classify); return articleClassifyMapper.selectClassifyList(classify);
@ -63,7 +63,7 @@ public class EArticleClassifyServiceImpl implements IEArticleClassifyService
* @return 分类树信息集合 * @return 分类树信息集合
*/ */
@Override @Override
@DataScope(agentAlias = "a") // @DataScope(agentAlias = "a")
public List<TreeSelect> selectClassifyTreeList(AsArticleClassify classify) public List<TreeSelect> selectClassifyTreeList(AsArticleClassify classify)
{ {
List<AsArticleClassify> depts = selectClassifyListWithIsolate(classify); List<AsArticleClassify> depts = selectClassifyListWithIsolate(classify);

View File

@ -60,7 +60,7 @@ public class EArticleServiceImpl implements IEArticleService
* @return 文章 * @return 文章
*/ */
@Override @Override
@DataScope(agentAlias = "ag") @DataScope(userAlias = "u")
public List<EtArticle> selectAsArticleListByIsolate(EtArticle etArticle) public List<EtArticle> selectAsArticleListByIsolate(EtArticle etArticle)
{ {
List<EtArticle> etArticles = rlArticleMapper.selectAsArticleList(etArticle); List<EtArticle> etArticles = rlArticleMapper.selectAsArticleList(etArticle);

View File

@ -1,5 +1,6 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.changeBalance.EChangeBalance; import com.ruoyi.system.domain.changeBalance.EChangeBalance;
@ -52,7 +53,7 @@ public class EChangeBalanceServiceImpl implements IEChangeBalanceService
* @return 余额变动 * @return 余额变动
*/ */
@Override @Override
// @DataScope(userAlias = "u",onlyUser = "1") @DataScope(merchantAlias = "u")
public List<EChangeBalance> selectRlChangeBalanceList(EChangeBalance rlChangeBalance) public List<EChangeBalance> selectRlChangeBalanceList(EChangeBalance rlChangeBalance)
{ {
return rlChangeBalanceMapper.selectRlChangeBalanceList(rlChangeBalance); return rlChangeBalanceMapper.selectRlChangeBalanceList(rlChangeBalance);

View File

@ -244,7 +244,7 @@ public class EDeviceServiceImpl extends ServiceImpl<EDeviceMapper, EDevice> impl
* @return 设备 * @return 设备
*/ */
@Override @Override
@DataScope(agentAlias = "d") @DataScope(merchantAlias = "m", userAlias = "u")
public List<EDevice> selectEDeviceListWithIsolate(EDeviceQuery asDevice) public List<EDevice> selectEDeviceListWithIsolate(EDeviceQuery asDevice)
{ {
if(ServiceConstants.VEHICLE_STATUS_NOT_BAND.equals(asDevice.getStatus())){ if(ServiceConstants.VEHICLE_STATUS_NOT_BAND.equals(asDevice.getStatus())){

View File

@ -40,7 +40,7 @@ public class EFeeRuleServiceImpl implements IEFeeRuleService
* @return 收费模板 * @return 收费模板
*/ */
@Override @Override
@DataScope(agentAlias = "a",userAlias = "u") @DataScope(merchantAlias = "m")
public List<EFeeRule> selectRlFeeRuleList(EFeeRule rlFeeRule) public List<EFeeRule> selectRlFeeRuleList(EFeeRule rlFeeRule)
{ {
return rlFeeRuleMapper.selectRlFeeRuleList(rlFeeRule); return rlFeeRuleMapper.selectRlFeeRuleList(rlFeeRule);

View File

@ -1,5 +1,6 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.EFunction; import com.ruoyi.system.domain.EFunction;
import com.ruoyi.system.domain.device.EDevice; import com.ruoyi.system.domain.device.EDevice;
@ -66,7 +67,7 @@ public class EModelServiceImpl implements IEModelService
* @return 车辆型号 * @return 车辆型号
*/ */
@Override @Override
// @DataScope(deptAlias = "d") @DataScope(merchantAlias = "m")
public List<EModelVO> selectEModelList(EModel eModel) public List<EModelVO> selectEModelList(EModel eModel)
{ {
return eModelMapper.selectEModelList(eModel); return eModelMapper.selectEModelList(eModel);

View File

@ -54,7 +54,7 @@ public class EOperatingAreaServiceImpl implements IEOperatingAreaService
* @return 运营区 * @return 运营区
*/ */
@Override @Override
@DataScope(agentAlias = "a",userAlias = "u") @DataScope(merchantAlias = "m", userAlias = "u")
public List<EOperatingArea> selectRlOperatingAreaList(EOperatingArea rlOperatingArea) public List<EOperatingArea> selectRlOperatingAreaList(EOperatingArea rlOperatingArea)
{ {
return rlOperatingAreaMapper.selectRlOperatingAreaList(rlOperatingArea); return rlOperatingAreaMapper.selectRlOperatingAreaList(rlOperatingArea);

View File

@ -252,7 +252,7 @@ public class EOrderServiceImpl implements IEOrderService
* @return 订单 * @return 订单
*/ */
@Override @Override
// @DataScope(userAlias = "u") @DataScope(merchantAlias = "m", userAlias = "u")
public List<EOrderVO> selectRlOrderList(EOrderQuery rlOrder) public List<EOrderVO> selectRlOrderList(EOrderQuery rlOrder)
{ {
return orderMapper.selectRlOrderList(rlOrder); return orderMapper.selectRlOrderList(rlOrder);

View File

@ -79,8 +79,8 @@ public class ERefundServiceImpl implements IERefundService
* @param rlRefund 退款订单 * @param rlRefund 退款订单
* @return 退款订单 * @return 退款订单
*/ */
@DataScope(agentAlias = "a")
@Override @Override
@DataScope(merchantAlias = "m", userAlias = "u")
public List<ERefund> selectEtRefundListWithIsolate(ERefund rlRefund) public List<ERefund> selectEtRefundListWithIsolate(ERefund rlRefund)
{ {
return etRefundMapper.selectEtRefundList(rlRefund); return etRefundMapper.selectEtRefundList(rlRefund);

View File

@ -4,6 +4,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.ServiceConstants; import com.ruoyi.common.constant.ServiceConstants;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -44,6 +45,7 @@ public class EShareKeyServiceImpl implements IEShareKeyService
* @return 共享钥匙 * @return 共享钥匙
*/ */
@Override @Override
@DataScope(merchantAlias = "m", userAlias = "u")
public List<EShareKey> selectEShareKeyList(EShareKey eShareKey) public List<EShareKey> selectEShareKeyList(EShareKey eShareKey)
{ {
return eShareKeyMapper.selectEShareKeyList(eShareKey); return eShareKeyMapper.selectEShareKeyList(eShareKey);

View File

@ -131,7 +131,7 @@ public class EUserServiceImpl implements IEUserService{
* @return 用户信息集合信息 * @return 用户信息集合信息
*/ */
@Override @Override
@DataScope(agentAlias = "a",userAlias = "u") @DataScope(userAlias = "u")
public List<EUserVO> selectUserList(EUserQuery user) public List<EUserVO> selectUserList(EUserQuery user)
{ {
/** 获取设备绑定数量*/ /** 获取设备绑定数量*/
@ -158,7 +158,7 @@ public class EUserServiceImpl implements IEUserService{
* @return 用户信息集合信息 * @return 用户信息集合信息
*/ */
@Override @Override
// @DataScope(deptAlias = "d", userAlias = "u") @DataScope(userAlias = "u")
public List<EUser> selectAllocatedList(EUser user) public List<EUser> selectAllocatedList(EUser user)
{ {
return userMapper.selectAllocatedList(user); return userMapper.selectAllocatedList(user);

View File

@ -43,7 +43,7 @@ public class EWithdrawServiceImpl implements IEWithdrawService
* @return 提现记录 * @return 提现记录
*/ */
@Override @Override
@DataScope(userAlias = "u",onlyUser = "1") @DataScope(merchantAlias = "u")
public List<EWithdraw> selectRlWithdrawList(EWithdraw rlWithdraw) public List<EWithdraw> selectRlWithdrawList(EWithdraw rlWithdraw)
{ {
return rlWithdrawMapper.selectRlWithdrawList(rlWithdraw); return rlWithdrawMapper.selectRlWithdrawList(rlWithdraw);

View File

@ -43,7 +43,7 @@ public class SysDeptServiceImpl implements ISysDeptService
* @return 部门信息集合 * @return 部门信息集合
*/ */
@Override @Override
@DataScope(agentAlias = "d") @DataScope(userAlias = "u")
public List<SysDept> selectDeptList(SysDept dept) public List<SysDept> selectDeptList(SysDept dept)
{ {
return deptMapper.selectDeptList(dept); return deptMapper.selectDeptList(dept);

View File

@ -54,7 +54,7 @@ public class SysRoleServiceImpl implements ISysRoleService
* @return 角色数据集合信息 * @return 角色数据集合信息
*/ */
@Override @Override
@DataScope(agentAlias = "d") @DataScope(userAlias = "u")
public List<SysRole> selectRoleList(SysRole role) public List<SysRole> selectRoleList(SysRole role)
{ {
return roleMapper.selectRoleList(role); return roleMapper.selectRoleList(role);

View File

@ -101,6 +101,7 @@ public class WxPayService implements IWxPayService {
order1.setOrderId(order.getOrderId()); order1.setOrderId(order.getOrderId());
order1.setPayChannel(payChannel); order1.setPayChannel(payChannel);
order1.setChannelName(channelVO.getName());
int updateEtOrder = orderService.updateRlOrder(order1); int updateEtOrder = orderService.updateRlOrder(order1);
if(updateEtOrder == 0){ if(updateEtOrder == 0){
throw new ServiceException("更新订单outTradeNo失败"); throw new ServiceException("更新订单outTradeNo失败");

View File

@ -7,9 +7,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="EAccessoryVO" id="RlAccessoryResult" autoMapping="true" /> <resultMap type="EAccessoryVO" id="RlAccessoryResult" autoMapping="true" />
<sql id="selectRlAccessoryVo"> <sql id="selectRlAccessoryVo">
select a.accessory_id, a.name, a.status, a.create_by, a.create_time, a.update_time, m.model from e_accessory a select a.accessory_id, a.name, a.status, a.create_by, a.create_time, a.update_time, mo.model,a.merchant_id from e_accessory a
left join e_model_accessory ma on a.accessory_id = ma.accessory_id left join e_model_accessory ma on a.accessory_id = ma.accessory_id
left join e_model m on m.model_id = ma.model_id left join e_model mo on mo.model_id = ma.model_id
left join e_user m on m.user_id = a.merchant_id
</sql> </sql>
<select id="selectRlAccessoryList" parameterType="EAccessory" resultMap="RlAccessoryResult"> <select id="selectRlAccessoryList" parameterType="EAccessory" resultMap="RlAccessoryResult">
@ -55,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="merchantId != null">merchant_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="accessoryId != null">#{accessoryId},</if> <if test="accessoryId != null">#{accessoryId},</if>
@ -63,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="merchantId != null">#{merchantId},</if>
</trim> </trim>
</insert> </insert>

View File

@ -38,6 +38,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
de.update_time, de.last_time, de.last_location_time, de.gps, de.remark, de.status, de.lock_status, de.location, de.update_time, de.last_time, de.last_location_time, de.gps, de.remark, de.status, de.lock_status, de.location,
de.remaining_power, de.voltage, de.version, de.qrcode, de.longitude, de.latitude, de.signal_strength, de.satellites, de.quality from e_device de de.remaining_power, de.voltage, de.version, de.qrcode, de.longitude, de.latitude, de.signal_strength, de.satellites, de.quality from e_device de
left join e_hardware_version hv on hv.id = de.hardware_version_id left join e_hardware_version hv on hv.id = de.hardware_version_id
left join e_user u on u.user_id = de.user_id
left join e_user m on m.user_id = de.user_id
where 1 = 1 where 1 = 1
<if test="deviceName != null and deviceName != ''"> and de.device_name like concat('%', #{deviceName}, '%')</if> <if test="deviceName != null and deviceName != ''"> and de.device_name like concat('%', #{deviceName}, '%')</if>
<if test="mac != null and mac != ''"> and de.mac like concat('%', #{mac}, '%')</if> <if test="mac != null and mac != ''"> and de.mac like concat('%', #{mac}, '%')</if>

View File

@ -7,13 +7,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="EFeeRuleVO" id="RlFeeRuleResult" autoMapping="true" /> <resultMap type="EFeeRuleVO" id="RlFeeRuleResult" autoMapping="true" />
<sql id="selectRlFeeRuleVo"> <sql id="selectRlFeeRuleVo">
select r.rule_id, r.rental_unit, r.price, r.`explain`, r.instructions, r.out_unit, r.out_price ,r.agent_id from e_fee_rule r select r.rule_id, r.rental_unit, r.price, r.`explain`, r.instructions, r.out_unit, r.out_price ,r.merchant_id from e_fee_rule r
left join e_fee_rule mr on mr.rule_id = r.rule_id left join e_fee_rule mr on mr.rule_id = r.rule_id
</sql> </sql>
<select id="selectRlFeeRuleList" parameterType="EFeeRule" resultMap="RlFeeRuleResult"> <select id="selectRlFeeRuleList" parameterType="EFeeRule" resultMap="RlFeeRuleResult">
select r.rule_id, r.rental_unit, r.price, r.`explain`, r.instructions, r.out_unit, r.out_price, r.agent_id from e_fee_rule r select r.rule_id, r.rental_unit, r.price, r.`explain`, r.instructions, r.out_unit, r.out_price, r.merchant_id from e_fee_rule r
where del_flag = '0' left join e_user m on m.user_id = r.merchant_id
where r.del_flag = '0'
<if test="rentalUnit != null and rentalUnit != ''"> and r.rental_unit = #{rentalUnit}</if> <if test="rentalUnit != null and rentalUnit != ''"> and r.rental_unit = #{rentalUnit}</if>
<if test="price != null "> and r.price = #{price}</if> <if test="price != null "> and r.price = #{price}</if>
<if test="explain != null and explain != ''"> and r.`explain` = #{explain}</if> <if test="explain != null and explain != ''"> and r.`explain` = #{explain}</if>
@ -50,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="instructions != null">instructions,</if> <if test="instructions != null">instructions,</if>
<if test="outUnit != null">out_unit,</if> <if test="outUnit != null">out_unit,</if>
<if test="outPrice != null">out_price,</if> <if test="outPrice != null">out_price,</if>
<if test="merchantId != null">merchant_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="rentalUnit != null">#{rentalUnit},</if> <if test="rentalUnit != null">#{rentalUnit},</if>
@ -58,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="instructions != null">#{instructions},</if> <if test="instructions != null">#{instructions},</if>
<if test="outUnit != null">#{outUnit},</if> <if test="outUnit != null">#{outUnit},</if>
<if test="outPrice != null">#{outPrice},</if> <if test="outPrice != null">#{outPrice},</if>
<if test="merchantId != null">#{merchantId},</if>
</trim> </trim>
</insert> </insert>
@ -71,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="outUnit != null">out_unit = #{outUnit},</if> <if test="outUnit != null">out_unit = #{outUnit},</if>
<if test="outPrice != null">out_price = #{outPrice},</if> <if test="outPrice != null">out_price = #{outPrice},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if> <if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="merchantId != null">merchant_id = #{merchantId},</if>
</trim> </trim>
where rule_id = #{ruleId} where rule_id = #{ruleId}
</update> </update>

View File

@ -8,40 +8,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectEModelVo"> <sql id="selectEModelVo">
select model_id, model, brand_id, brand_name, full_voltage, low_voltage, full_endurance, create_by, create_time, select model_id, model, brand_id, brand_name, full_voltage, low_voltage, full_endurance, create_by, create_time,
update_by, update_time, remark, intro, deposit, picture, del_flag from e_model update_by, update_time, remark, intro, deposit, merchant_id, picture, del_flag from e_model
</sql> </sql>
<select id="selectEModelList" parameterType="EModel" resultMap="EModelResult"> <select id="selectEModelList" parameterType="EModel" resultMap="EModelResult">
select select
m.model_id, mo.model_id,
m.model, mo.model,
m.brand_id, mo.brand_id,
m.brand_name, mo.brand_name,
m.full_voltage, mo.full_voltage,
m.low_voltage, mo.low_voltage,
m.full_endurance, mo.full_endurance,
m.create_by, mo.create_by,
m.create_time, mo.create_time,
m.update_by, mo.update_by,
m.update_time, mo.update_time,
m.remark, mo.remark,
m.intro, mo.intro,
m.deposit, mo.deposit,
m.picture, mo.merchant_id,
m.del_flag from e_model m mo.picture,
where 1 = 1 and m.del_flag = '0' mo.del_flag from e_model mo
<if test="model != null and model != ''"> and m.model = #{model}</if> left join e_user m on m.user_id = mo.merchant_id
<if test="brandId != null and brandId != ''"> and m.brand_id = #{brandId}</if> where 1 = 1 and mo.del_flag = '0'
<if test="brandName != null and brandName != ''"> and m.brand_name like concat('%', #{brandName}, '%')</if> <if test="model != null and model != ''"> and mo.model = #{model}</if>
<!-- 数据范围过滤 <if test="operator != null and operator != ''"> and m.operator = #{operator}</if> --> <if test="brandId != null and brandId != ''"> and mo.brand_id = #{brandId}</if>
<if test="brandName != null and brandName != ''"> and mo.brand_name like concat('%', #{brandName}, '%')</if>
<!-- 数据范围过滤 <if test="operator != null and operator != ''"> and mo.operator = #{operator}</if> -->
${params.dataScope} ${params.dataScope}
order by mo.create_time desc
</select> </select>
<select id="selectEModelByModelId" parameterType="Long" resultMap="EModelResult"> <select id="selectEModelByModelId" parameterType="Long" resultMap="EModelResult">
select m.model_id, m.model, m.brand_id, m.brand_name, m.brand_name, m.full_voltage, m.low_voltage, select mo.model_id, mo.model, mo.brand_id, mo.brand_name, mo.brand_name, mo.full_voltage, mo.low_voltage,
m.full_endurance, m.create_by, m.create_time,m.deposit,m.picture, mo.full_endurance, mo.create_by, mo.create_time,mo.deposit,mo.picture,
m.update_by, m.update_time, m.remark from e_model m mo.update_by, mo.update_time, mo.remark from e_model m
where m.model_id = #{modelId} where mo.model_id = #{modelId}
</select> </select>
<select id="selectAllCount" resultType="java.lang.Integer"> <select id="selectAllCount" resultType="java.lang.Integer">
@ -65,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="intro != null">intro,</if> <if test="intro != null">intro,</if>
<if test="deposit != null">deposit,</if> <if test="deposit != null">deposit,</if>
<if test="merchantId != null">merchant_id,</if>
<if test="picture != null">picture,</if> <if test="picture != null">picture,</if>
<if test="delFlag != null">del_flag,</if> <if test="delFlag != null">del_flag,</if>
</trim> </trim>
@ -83,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="intro != null">#{intro},</if> <if test="intro != null">#{intro},</if>
<if test="deposit != null">#{deposit},</if> <if test="deposit != null">#{deposit},</if>
<if test="merchantId != null">#{merchantId},</if>
<if test="picture != null">#{picture},</if> <if test="picture != null">#{picture},</if>
<if test="delFlag != null">#{delFlag},</if> <if test="delFlag != null">#{delFlag},</if>
</trim> </trim>
@ -106,6 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deposit != null">deposit = #{deposit},</if> <if test="deposit != null">deposit = #{deposit},</if>
<if test="picture != null">picture = #{picture},</if> <if test="picture != null">picture = #{picture},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if> <if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="merchantId != null">merchant_id = #{merchantId},</if>
</trim> </trim>
where model_id = #{modelId} where model_id = #{modelId}
</update> </update>

View File

@ -8,7 +8,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectRlOperatingAreaVo"> <sql id="selectRlOperatingAreaVo">
select oa.area_id, oa.area_name, oa.boundary_str, oa.longitude, oa.latitude, oa.create_by, oa.create_time, oa.status, oa.area_time, oa.area_out_outage, select oa.area_id, oa.area_name, oa.boundary_str, oa.longitude, oa.latitude, oa.create_by, oa.create_time, oa.status, oa.area_time, oa.area_out_outage,
oa.area_out_dispatch, oa.agreement, oa.area_time_start, oa.area_time_end from e_operating_area oa oa.area_out_dispatch, oa.agreement, oa.area_time_start, oa.area_time_end, oa.e_user_id from e_operating_area oa
left join e_user m on m.user_id = oa.merchant_id
</sql> </sql>
<select id="selectRlOperatingAreaList" parameterType="EOperatingArea" resultMap="RlOperatingAreaResult"> <select id="selectRlOperatingAreaList" parameterType="EOperatingArea" resultMap="RlOperatingAreaResult">

View File

@ -9,7 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectRlOrderVo"> <sql id="selectRlOrderVo">
select order_id, order_no, out_trade_no, user_id, user_name, real_name, phone, rule_id, device_mac, sn, pay_time, pay_type, paid, type, total_fee, pay_fee, deposit, overdue_fee, dispatch_fee,delivery_fee, select order_id, order_no, out_trade_no, user_id, user_name, real_name, phone, rule_id, device_mac, sn, pay_time, pay_type, paid, type, total_fee, pay_fee, deposit, overdue_fee, dispatch_fee,delivery_fee,
lease_fee, mark, duration, status, create_time, return_time, deposit_deduction, deposit_order_no, deduction_amount, used_sn, change_reason, lease_fee, mark, duration, status, create_time, return_time, deposit_deduction, deposit_order_no, deduction_amount, used_sn, change_reason,
auto_refund_deposit, rental_unit, handling_charge, platform_service_fee, operator_dividend, pay_channel, delivery_method, pickup_time, auto_refund_deposit, rental_unit, handling_charge, platform_service_fee, operator_dividend, pay_channel, channel_name, delivery_method, pickup_time,
, store_name, merchant_id, pickup_city, pickup_loc, pickup_lon, pickup_lat, model_id, model, expiry_time, original_order_no, num, price, `explain`, , store_name, merchant_id, pickup_city, pickup_loc, pickup_lon, pickup_lat, model_id, model, expiry_time, original_order_no, num, price, `explain`,
instructions, out_unit, out_price,return_type,return_method,return_address,auto_cancel_time,cost, is_overdue,is_send_msg from e_order instructions, out_unit, out_price,return_type,return_method,return_address,auto_cancel_time,cost, is_overdue,is_send_msg from e_order
</sql> </sql>
@ -55,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
o.platform_service_fee, o.platform_service_fee,
o.operator_dividend, o.operator_dividend,
o.pay_channel, o.pay_channel,
o.channel_name,
o.delivery_method, o.delivery_method,
o.pickup_time, o.pickup_time,
o.store_id, o.store_id,
@ -72,7 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
o.out_unit, o.out_unit,
o.out_price, o.out_price,
u.user_name as userName, u.user_name as userName,
m.model, mo.model,
r.rental_unit as rentalUnit, r.rental_unit as rentalUnit,
o.return_type, o.return_type,
o.return_method, o.return_method,
@ -106,8 +107,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM FROM
e_order o e_order o
left join e_user u on o.user_id = u.user_id left join e_user u on o.user_id = u.user_id
left join e_user m on o.merchant_id = m.user_id
left join e_fee_rule r on o.rule_id = r.rule_id left join e_fee_rule r on o.rule_id = r.rule_id
left join e_model m on o.model_id = m.model_id left join e_model mo on o.model_id = mo.model_id
</sql> </sql>
<select id="selectRlOrderList" parameterType="EOrderQuery" resultMap="RlOrderResult"> <select id="selectRlOrderList" parameterType="EOrderQuery" resultMap="RlOrderResult">
@ -406,6 +408,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="platformServiceFee != null">platform_service_fee = #{platformServiceFee},</if> <if test="platformServiceFee != null">platform_service_fee = #{platformServiceFee},</if>
<if test="operatorDividend != null">operator_dividend = #{operatorDividend},</if> <if test="operatorDividend != null">operator_dividend = #{operatorDividend},</if>
<if test="payChannel != null">pay_channel = #{payChannel},</if> <if test="payChannel != null">pay_channel = #{payChannel},</if>
<if test="channelName != null">channel_name = #{channelName},</if>
<if test="deliveryMethod != null">delivery_method = #{deliveryMethod},</if> <if test="deliveryMethod != null">delivery_method = #{deliveryMethod},</if>
<if test="pickupTime != null">pickup_time = #{pickupTime},</if> <if test="pickupTime != null">pickup_time = #{pickupTime},</if>
<if test="storeId != null">store_id = #{storeId},</if> <if test="storeId != null">store_id = #{storeId},</if>
@ -477,6 +480,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="platformServiceFee != null">platform_service_fee = #{platformServiceFee},</if> <if test="platformServiceFee != null">platform_service_fee = #{platformServiceFee},</if>
<if test="operatorDividend != null">operator_dividend = #{operatorDividend},</if> <if test="operatorDividend != null">operator_dividend = #{operatorDividend},</if>
<if test="payChannel != null">pay_channel = #{payChannel},</if> <if test="payChannel != null">pay_channel = #{payChannel},</if>
<if test="channelName != null">channel_name = #{channelName},</if>
<if test="deliveryMethod != null">delivery_method = #{deliveryMethod},</if> <if test="deliveryMethod != null">delivery_method = #{deliveryMethod},</if>
<if test="pickupTime != null">pickup_time = #{pickupTime},</if> <if test="pickupTime != null">pickup_time = #{pickupTime},</if>
<if test="storeId != null">store_id = #{storeId},</if> <if test="storeId != null">store_id = #{storeId},</if>

View File

@ -7,17 +7,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ERefundVO" id="EtRefundResult" autoMapping="true" /> <resultMap type="ERefundVO" id="EtRefundResult" autoMapping="true" />
<sql id="selectEtRefundVo"> <sql id="selectEtRefundVo">
select id, refund_no, order_no, user_id, amount, dispatch_fee, delivery_fee, lease_fee, deposit, type, reason, create_time, item_desc,refund_result from e_refund select id, refund_no, order_no, user_id, amount, dispatch_fee, delivery_fee, lease_fee, deposit, type, reason, create_time, item_desc,refund_result, merchant_id from e_refund
</sql> </sql>
<select id="selectEtRefundList" parameterType="ERefund" resultMap="EtRefundResult"> <select id="selectEtRefundList" parameterType="ERefund" resultMap="EtRefundResult">
select r.id, r.refund_no, r.order_no, r.user_id, u.user_name userName, r.amount, r.dispatch_fee, r.delivery_fee, select r.id, r.refund_no, r.order_no, r.user_id, u.user_name userName, r.amount, r.dispatch_fee, r.delivery_fee,
r.lease_fee, r.deposit, r.type, r.reason, r.create_time, r.item_desc,r.refund_result from e_refund r r.lease_fee, r.deposit, r.type, r.reason, r.create_time, r.item_desc,r.refund_result,r.merchant_id from e_refund r
INNER JOIN e_order o on o.order_no = r.order_no INNER JOIN e_order o on o.order_no = r.order_no
left join e_user u on u.user_id = r.user_id left join e_user u on u.user_id = r.user_id
-- LEFT JOIN e_operating_area oa ON o.area_id = oa.area_id left join e_user m on m.user_id = r.merchant_id
-- LEFT join et_area_dept ad on ad.area_id = oa.area_id
-- LEFT join sys_dept d on d.dept_id = ad.dept_id
where 1 = 1 where 1 = 1
<if test="refundNo != null and refundNo != ''"> and r.refund_no = #{refundNo}</if> <if test="refundNo != null and refundNo != ''"> and r.refund_no = #{refundNo}</if>
<if test="orderNo != null and orderNo != ''"> and r.order_no like concat('%', #{orderNo}, '%')</if> <if test="orderNo != null and orderNo != ''"> and r.order_no like concat('%', #{orderNo}, '%')</if>
@ -65,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="itemDesc != null">item_desc,</if> <if test="itemDesc != null">item_desc,</if>
<if test="refundResult != null">refund_result,</if> <if test="refundResult != null">refund_result,</if>
<if test="merchantId != null">merchant_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
@ -81,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="itemDesc != null">#{itemDesc},</if> <if test="itemDesc != null">#{itemDesc},</if>
<if test="refundResult != null">#{refund_result},</if> <if test="refundResult != null">#{refund_result},</if>
<if test="merchantId != null">#{merchantId},</if>
</trim> </trim>
</insert> </insert>
@ -100,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="itemDesc != null">item_desc = #{itemDesc},</if> <if test="itemDesc != null">item_desc = #{itemDesc},</if>
<if test="refundResult != null">refund_result = #{refundResult},</if> <if test="refundResult != null">refund_result = #{refundResult},</if>
<if test="merchantId != null">merchant_id = #{merchantId},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
@ -117,6 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="itemDesc != null">item_desc = #{itemDesc},</if> <if test="itemDesc != null">item_desc = #{itemDesc},</if>
<if test="refundResult != null">refund_result = #{refundResult},</if> <if test="refundResult != null">refund_result = #{refundResult},</if>
<if test="merchantId != null">merchant_id = #{merchantId},</if>
</trim> </trim>
where refund_no = #{refundNo} where refund_no = #{refundNo}
</update> </update>

View File

@ -23,7 +23,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectEShareKeyList" parameterType="EShareKey" resultMap="EShareKeyResult"> <select id="selectEShareKeyList" parameterType="EShareKey" resultMap="EShareKeyResult">
select k.key_id, k.key_name, k.share_id, k.share_phone, k.share_user_name, k.owner_id, k.owner_name, k.owner_phone, k.sn, k.status, k.expiration_time from e_share_key k select k.key_id, k.key_name, k.share_id, k.share_phone, k.share_user_name, k.owner_id, k.owner_name, k.owner_phone,
k.sn, k.status, k.expiration_time from e_share_key k
left join e_user u on u.user_id = k.share_id
left join e_user m on m.user_id = k.owner_id
where 1=1 and k.del_flag = '0' where 1=1 and k.del_flag = '0'
<if test="keyName != null and keyName != ''"> and k.key_name like concat('%', #{keyName}, '%')</if> <if test="keyName != null and keyName != ''"> and k.key_name like concat('%', #{keyName}, '%')</if>
<if test="shareUserName != null "> and k.share_user_name like concat('%', #{shareUserName}, '%')</if> <if test="shareUserName != null "> and k.share_user_name like concat('%', #{shareUserName}, '%')</if>
@ -32,6 +35,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ownerName != null "> and k.owner_name like concat('%', #{ownerName}, '%')</if> <if test="ownerName != null "> and k.owner_name like concat('%', #{ownerName}, '%')</if>
<if test="sn != null and sn != ''"> and k.sn like concat('%', #{sn}, '%')</if> <if test="sn != null and sn != ''"> and k.sn like concat('%', #{sn}, '%')</if>
<if test="status != null and status != ''"> and k.status = #{status}</if> <if test="status != null and status != ''"> and k.status = #{status}</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by k.key_id desc
</select> </select>
<select id="selectEShareKeyByKeyId" parameterType="Long" resultMap="EShareKeyResult"> <select id="selectEShareKeyByKeyId" parameterType="Long" resultMap="EShareKeyResult">

View File

@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int"> <select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0' select count(1) from e_user where dept_id = #{deptId} and del_flag = '0'
</select> </select>
<select id="hasChildByDeptId" parameterType="Long" resultType="int"> <select id="hasChildByDeptId" parameterType="Long" resultType="int">

View File

@ -80,7 +80,7 @@
left join sys_role_menu rm on m.menu_id = rm.menu_id left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role ro on ur.role_id = ro.role_id left join sys_role ro on ur.role_id = ro.role_id
left join sys_user u on ur.user_id = u.user_id left join e_user u on ur.user_id = u.user_id
where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0 AND ro.status = 0 where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0 AND ro.status = 0
order by m.parent_id, m.order_num order by m.parent_id, m.order_num
</select> </select>

View File

@ -50,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select p.post_id select p.post_id
from sys_post p from sys_post p
left join sys_user_post up on up.post_id = p.post_id left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id left join e_user u on u.user_id = up.user_id
where u.user_id = #{userId} where u.user_id = #{userId}
</select> </select>
@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select p.post_id, p.post_name, p.post_code select p.post_id, p.post_name, p.post_code
from sys_post p from sys_post p
left join sys_user_post up on up.post_id = p.post_id left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id left join e_user u on u.user_id = up.user_id
where u.user_name = #{userName} where u.user_name = #{userName}
</select> </select>

View File

@ -26,8 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
r.status, r.del_flag, r.create_time, r.remark r.status, r.del_flag, r.create_time, r.remark
from sys_role r from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id left join e_user u on u.user_id = ur.user_id
left join sys_dept d on u.dept_id = d.dept_id
</sql> </sql>
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult"> <select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult">
@ -69,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select r.role_id select r.role_id
from sys_role r from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id left join e_user u on u.user_id = ur.user_id
where u.user_id = #{userId} where u.user_id = #{userId}
</select> </select>