联调、取消规则等

This commit is contained in:
邱贞招 2024-09-25 18:11:10 +08:00
parent 6a3a3078fc
commit 10a2b15fc6
35 changed files with 987 additions and 44 deletions

View File

@ -166,7 +166,7 @@ public class AppController extends BaseController
/** /**
* 根据定位获取附近店铺列表 * 根据定位获取附近店铺列表
*/ */
@GetMapping("/getStoreListByLocation") @PostMapping("/getStoreListByLocation")
public AjaxResult getStoreListByLocation(@RequestBody StoreQuery query) public AjaxResult getStoreListByLocation(@RequestBody StoreQuery query)
{ {
logger.info("根据定位获取附近店铺列表【StoreQuery="+ JSON.toJSONString(query)+""); logger.info("根据定位获取附近店铺列表【StoreQuery="+ JSON.toJSONString(query)+"");

View File

@ -0,0 +1,105 @@
package com.ruoyi.web.controller.rl;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.system.domain.cancelRule.RlCancelRule;
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.service.IRlCancelRuleService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 取消规则Controller
*
* @author qzz
* @date 2024-09-25
*/
@RestController
@RequestMapping("/system/cancelRule")
public class RlCancelRuleController extends BaseController
{
@Autowired
private IRlCancelRuleService rlCancelRuleService;
/**
* 查询取消规则列表
*/
@PreAuthorize("@ss.hasPermi('system:cancelRule:list')")
@GetMapping("/list")
public TableDataInfo list(RlCancelRule rlCancelRule)
{
startPage();
List<RlCancelRule> list = rlCancelRuleService.selectRlCancelRuleList(rlCancelRule);
return getDataTable(list);
}
/**
* 导出取消规则列表
*/
@PreAuthorize("@ss.hasPermi('system:cancelRule:export')")
@Log(title = "取消规则", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RlCancelRule rlCancelRule)
{
List<RlCancelRule> list = rlCancelRuleService.selectRlCancelRuleList(rlCancelRule);
ExcelUtil<RlCancelRule> util = new ExcelUtil<RlCancelRule>(RlCancelRule.class);
util.exportExcel(response, list, "取消规则数据");
}
/**
* 获取取消规则详细信息
*/
@PreAuthorize("@ss.hasPermi('system:cancelRule:query')")
@GetMapping(value = "/{cancalId}")
public AjaxResult getInfo(@PathVariable("cancalId") Long cancalId)
{
return success(rlCancelRuleService.selectRlCancelRuleByCancalId(cancalId));
}
/**
* 新增取消规则
*/
@PreAuthorize("@ss.hasPermi('system:cancelRule:add')")
@Log(title = "取消规则", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RlCancelRule rlCancelRule)
{
return toAjax(rlCancelRuleService.insertRlCancelRule(rlCancelRule));
}
/**
* 修改取消规则
*/
@PreAuthorize("@ss.hasPermi('system:cancelRule:edit')")
@Log(title = "取消规则", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RlCancelRule rlCancelRule)
{
return toAjax(rlCancelRuleService.updateRlCancelRule(rlCancelRule));
}
/**
* 删除取消规则
*/
@PreAuthorize("@ss.hasPermi('system:cancelRule:remove')")
@Log(title = "取消规则", businessType = BusinessType.DELETE)
@DeleteMapping("/{cancalIds}")
public AjaxResult remove(@PathVariable Long[] cancalIds)
{
return toAjax(rlCancelRuleService.deleteRlCancelRuleByCancalIds(cancalIds));
}
}

View File

@ -56,6 +56,23 @@ public class SysLoginController
return ajax; return ajax;
} }
/**
* 获取token用于测试
*
* @param userId 用户id
* @return 结果
*/
@PostMapping("/getToken")
public AjaxResult getToken(Long userId)
{
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.getToken(userId);
ajax.put(Constants.TOKEN, token);
return ajax;
}
/** /**
* 获取用户信息 * 获取用户信息
* *

View File

@ -193,7 +193,7 @@ geo:
# 高德地图key web服务 手续费 # 高德地图key web服务 手续费
key: 834f1f029671d84272554528311ff0f1 key: 834f1f029671d84272554528311ff0f1
wx: wx:
appid: wx3428c498d5061192 appid: wx21a50f113c30d41a
appSecret: 398d2cd38583a33233eef897996cc7ca appSecret: 398d2cd38583a33233eef897996cc7ca
et: et:
# 手续费 4/1000 千分之几 # 手续费 4/1000 千分之几
@ -203,3 +203,5 @@ et:
repairAdmin: wx repairAdmin: wx
operateAdmin: root operateAdmin: root
# 用于测试获取token的admin的密码
password: admin123

View File

@ -120,6 +120,7 @@ public class SecurityConfig
"/appCodeLogin", "/appCodeLogin",
"/app/**", "/app/**",
// "/appVerify/**", // "/appVerify/**",
"/getToken",
"/common/upload", "/common/upload",
"/common/receive", "/common/receive",
"/payment/callback/**", "/payment/callback/**",

View File

@ -75,6 +75,9 @@ public class SysLoginService
@Value("${wx.appSecret}") @Value("${wx.appSecret}")
private String appSecret; private String appSecret;
@Value("${password}")
private String password;
/** /**
* 登录验证 * 登录验证
* *
@ -123,6 +126,47 @@ public class SysLoginService
return tokenService.createToken(loginUser); return tokenService.createToken(loginUser);
} }
public String getToken(Long userId) {
if(userId == null){
userId = 1L;
}
SysUser user = userService.selectUserById(userId);
String username = user.getUserName();
// 用户验证
Authentication authentication = null;
try
{
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
AuthenticationContextHolder.setContext(authenticationToken);
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
authentication = authenticationManager.authenticate(authenticationToken);
}
catch (Exception e)
{
if (e instanceof BadCredentialsException)
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
throw new UserPasswordNotMatchException();
}
else
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
throw new ServiceException(e.getMessage());
}
}
finally
{
AuthenticationContextHolder.clearContext();
}
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
recordLoginInfo(loginUser.getUserId());
// 生成token
return tokenService.createToken(loginUser);
}
/** /**
* 校验验证码 * 校验验证码
* *

View File

@ -0,0 +1,43 @@
package com.ruoyi.system.domain.cancelRule;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
/**
* 取消规则对象 rl_cancel_rule
*
* @author qzz
* @date 2024-09-25
*/
@Data
public class RlCancelRule extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 取消规则id */
private Long cancalId;
/** 取消时间说明 */
@Excel(name = "取消时间说明")
private String instructions;
/** 扣款百分比0-免费取消100不可取消 */
@Excel(name = "扣款百分比0-免费取消100不可取消")
private BigDecimal deductPercent;
/** 超出取车时间多少小时 */
@Excel(name = "超出取车时间多少小时")
private Integer frontOutTime;
/** 超过多少到多少 */
@Excel(name = "超过多少到多少")
private String middleOutTime;
/** 超过多少小时以上 */
@Excel(name = "超过多少小时以上")
private Integer afterOutTime;
}

View File

@ -0,0 +1,7 @@
package com.ruoyi.system.domain.cancelRule;
import lombok.Data;
@Data
public class RlCancelRuleQuery extends RlCancelRule{
}

View File

@ -0,0 +1,7 @@
package com.ruoyi.system.domain.cancelRule;
import lombok.Data;
@Data
public class RlCancelRuleVO extends RlCancelRule{
}

View File

@ -36,4 +36,7 @@ public class RlCity extends BaseEntity
@Excel(name = "城市编码") @Excel(name = "城市编码")
private String citycode; private String citycode;
/** 是否开通 */
private Boolean isOpen;
} }

View File

@ -50,4 +50,8 @@ public class RlModel extends BaseEntity
@Excel(name = "押金") @Excel(name = "押金")
private BigDecimal deposit; private BigDecimal deposit;
/** 图片 */
@Excel(name = "图片")
private String picture;
} }

View File

@ -3,6 +3,7 @@ package com.ruoyi.system.domain.model;
import com.ruoyi.system.domain.accessory.RlAccessory; import com.ruoyi.system.domain.accessory.RlAccessory;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
@Data @Data
@ -10,4 +11,10 @@ public class RlModelVO extends RlModel{
/** 配件 */ /** 配件 */
private List<RlAccessory> accessorys; private List<RlAccessory> accessorys;
/** 价格 */
private BigDecimal price;
/** 单位 */
private String rentalUnit;
} }

View File

@ -0,0 +1,23 @@
package com.ruoyi.system.domain.modelStore;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 车型店铺关系对象 rl_model_store
*
* @author qzz
* @date 2024-09-25
*/
@Data
public class RlModelStore extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 车型id */
private Long modeId;
/** 店铺id */
private Long storeId;
}

View File

@ -57,6 +57,9 @@ public class Store extends BaseEntity
@Size(min = 1, max = 200, message = "门店地址长度必须在1~200之间") @Size(min = 1, max = 200, message = "门店地址长度必须在1~200之间")
private String address; private String address;
@ApiModelProperty("简化地址")
private String simpleAddress;
/** 定位经度 */ /** 定位经度 */
@Excel(name = "定位经度") @Excel(name = "定位经度")
@NotNull(message = "定位经度不能为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class}) @NotNull(message = "定位经度不能为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})

View File

@ -1,9 +1,13 @@
package com.ruoyi.system.domain.store; package com.ruoyi.system.domain.store;
import com.ruoyi.system.domain.model.RlModel;
import com.ruoyi.system.domain.modelStore.RlModelStore;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.List;
/** /**
* @author * @author
* 2024/3/5 * 2024/3/5
@ -18,9 +22,12 @@ public class StoreVo extends Store {
@ApiModelProperty("可租车辆") @ApiModelProperty("可租车辆")
private Integer rentalCar; private Integer rentalCar;
@ApiModelProperty("距离") @ApiModelProperty("距离(米)")
private double distance; private double distance;
@ApiModelProperty("车型列表")
private List<RlModel> models;
// @ApiModelProperty("是否免费送取车") // @ApiModelProperty("是否免费送取车")
// private Boolean isFreeCar; // private Boolean isFreeCar;

View File

@ -0,0 +1,62 @@
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.cancelRule.RlCancelRule;
import java.util.List;
/**
* 取消规则Mapper接口
*
* @author qzz
* @date 2024-09-25
*/
public interface RlCancelRuleMapper
{
/**
* 查询取消规则
*
* @param cancalId 取消规则主键
* @return 取消规则
*/
public RlCancelRule selectRlCancelRuleByCancalId(Long cancalId);
/**
* 查询取消规则列表
*
* @param rlCancelRule 取消规则
* @return 取消规则集合
*/
public List<RlCancelRule> selectRlCancelRuleList(RlCancelRule rlCancelRule);
/**
* 新增取消规则
*
* @param rlCancelRule 取消规则
* @return 结果
*/
public int insertRlCancelRule(RlCancelRule rlCancelRule);
/**
* 修改取消规则
*
* @param rlCancelRule 取消规则
* @return 结果
*/
public int updateRlCancelRule(RlCancelRule rlCancelRule);
/**
* 删除取消规则
*
* @param cancalId 取消规则主键
* @return 结果
*/
public int deleteRlCancelRuleByCancalId(Long cancalId);
/**
* 批量删除取消规则
*
* @param cancalIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteRlCancelRuleByCancalIds(Long[] cancalIds);
}

View File

@ -145,4 +145,9 @@ public interface RlDeviceMapper extends BaseMapper<RlDevice>
RlDevice checkSNUnique(String sn); RlDevice checkSNUnique(String sn);
RlDevice checkMACUnique(String mac); RlDevice checkMACUnique(String mac);
/**
* 根据店铺id查询可租车辆数
*/
Integer selectRentalDeviceCountByStoreId(Long storeId);
} }

View File

@ -37,6 +37,14 @@ public interface RlModelMapper
*/ */
public List<RlModel> selectEModelListByAgentId(Long agentId); public List<RlModel> selectEModelListByAgentId(Long agentId);
/**
* 根据店铺id查询车辆型号列表
*
* @param storeId 店铺id
* @return 车辆型号集合
*/
public List<RlModel> selectEModelListByStoreId(Long storeId);
/** /**
* 新增车辆型号 * 新增车辆型号
* *

View File

@ -0,0 +1,63 @@
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.modelStore.RlModelStore;
import java.util.List;
/**
* 车型店铺关系Mapper接口
*
* @author qzz
* @date 2024-09-25
*/
public interface RlModelStoreMapper
{
/**
* 查询车型店铺关系
*
* @param modeId 车型店铺关系主键
* @return 车型店铺关系
*/
public RlModelStore selectRlModelStoreByModeId(Long modeId);
/**
* 查询车型店铺关系列表
*
* @param rlModelStore 车型店铺关系
* @return 车型店铺关系集合
*/
public List<RlModelStore> selectRlModelStoreList(RlModelStore rlModelStore);
/**
* 新增车型店铺关系
*
* @param rlModelStore 车型店铺关系
* @return 结果
*/
public int insertRlModelStore(RlModelStore rlModelStore);
/**
* 修改车型店铺关系
*
* @param rlModelStore 车型店铺关系
* @return 结果
*/
public int updateRlModelStore(RlModelStore rlModelStore);
/**
* 删除车型店铺关系
*
* @param modeId 车型店铺关系主键
* @return 结果
*/
public int deleteRlModelStoreByModeId(Long modeId);
/**
* 批量删除车型店铺关系
*
* @param modeIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteRlModelStoreByModeIds(Long[] modeIds);
}

View File

@ -0,0 +1,62 @@
package com.ruoyi.system.service;
import com.ruoyi.system.domain.cancelRule.RlCancelRule;
import java.util.List;
/**
* 取消规则Service接口
*
* @author qzz
* @date 2024-09-25
*/
public interface IRlCancelRuleService
{
/**
* 查询取消规则
*
* @param cancalId 取消规则主键
* @return 取消规则
*/
public RlCancelRule selectRlCancelRuleByCancalId(Long cancalId);
/**
* 查询取消规则列表
*
* @param rlCancelRule 取消规则
* @return 取消规则集合
*/
public List<RlCancelRule> selectRlCancelRuleList(RlCancelRule rlCancelRule);
/**
* 新增取消规则
*
* @param rlCancelRule 取消规则
* @return 结果
*/
public int insertRlCancelRule(RlCancelRule rlCancelRule);
/**
* 修改取消规则
*
* @param rlCancelRule 取消规则
* @return 结果
*/
public int updateRlCancelRule(RlCancelRule rlCancelRule);
/**
* 批量删除取消规则
*
* @param cancalIds 需要删除的取消规则主键集合
* @return 结果
*/
public int deleteRlCancelRuleByCancalIds(Long[] cancalIds);
/**
* 删除取消规则信息
*
* @param cancalId 取消规则主键
* @return 结果
*/
public int deleteRlCancelRuleByCancalId(Long cancalId);
}

View File

@ -379,6 +379,11 @@ public interface IRlDeviceService extends IService<RlDevice>
*/ */
boolean updateVersion(String sn); boolean updateVersion(String sn);
/**
* 根据店铺id查询可租车辆数
*/
Integer selectRentalDeviceCountByStoreId(Long storeId);
// /** // /**
// * 是否靠近运营区边界 // * 是否靠近运营区边界
// */ // */

View File

@ -39,6 +39,14 @@ public interface IRlModelService
public List<RlModel> selectEModelListByAgentId(Long agentId); public List<RlModel> selectEModelListByAgentId(Long agentId);
/**
* 根据店铺id查询车辆型号列表
*
* @param storeId 店铺id
* @return 车辆型号
*/
public List<RlModel> selectEModelListByStoreId(Long storeId);
/** /**
* 新增车辆型号 * 新增车辆型号
* *

View File

@ -0,0 +1,70 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.model.RlModel;
import com.ruoyi.system.domain.modelStore.RlModelStore;
/**
* 车型店铺关系Service接口
*
* @author qzz
* @date 2024-09-25
*/
public interface IRlModelStoreService
{
/**
* 查询车型店铺关系
*
* @param modeId 车型店铺关系主键
* @return 车型店铺关系
*/
public RlModelStore selectRlModelStoreByModeId(Long modeId);
/**
* 查询车型店铺关系列表
*
* @param rlModelStore 车型店铺关系
* @return 车型店铺关系集合
*/
public List<RlModelStore> selectRlModelStoreList(RlModelStore rlModelStore);
// /**
// * 根据店铺id查询车型店铺关系列表
// *
// * @param storeId 店铺id
// * @return 车型店铺关系集合
// */
// public List<RlModel> selectRlModelStoreListBystoreId(Long storeId);
/**
* 新增车型店铺关系
*
* @param rlModelStore 车型店铺关系
* @return 结果
*/
public int insertRlModelStore(RlModelStore rlModelStore);
/**
* 修改车型店铺关系
*
* @param rlModelStore 车型店铺关系
* @return 结果
*/
public int updateRlModelStore(RlModelStore rlModelStore);
/**
* 批量删除车型店铺关系
*
* @param modeIds 需要删除的车型店铺关系主键集合
* @return 结果
*/
public int deleteRlModelStoreByModeIds(Long[] modeIds);
/**
* 删除车型店铺关系信息
*
* @param modeId 车型店铺关系主键
* @return 结果
*/
public int deleteRlModelStoreByModeId(Long modeId);
}

View File

@ -0,0 +1,94 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.system.domain.cancelRule.RlCancelRule;
import com.ruoyi.system.mapper.RlCancelRuleMapper;
import com.ruoyi.system.service.IRlCancelRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 取消规则Service业务层处理
*
* @author qzz
* @date 2024-09-25
*/
@Service
public class RlCancelRuleServiceImpl implements IRlCancelRuleService
{
@Autowired
private RlCancelRuleMapper rlCancelRuleMapper;
/**
* 查询取消规则
*
* @param cancalId 取消规则主键
* @return 取消规则
*/
@Override
public RlCancelRule selectRlCancelRuleByCancalId(Long cancalId)
{
return rlCancelRuleMapper.selectRlCancelRuleByCancalId(cancalId);
}
/**
* 查询取消规则列表
*
* @param rlCancelRule 取消规则
* @return 取消规则
*/
@Override
public List<RlCancelRule> selectRlCancelRuleList(RlCancelRule rlCancelRule)
{
return rlCancelRuleMapper.selectRlCancelRuleList(rlCancelRule);
}
/**
* 新增取消规则
*
* @param rlCancelRule 取消规则
* @return 结果
*/
@Override
public int insertRlCancelRule(RlCancelRule rlCancelRule)
{
return rlCancelRuleMapper.insertRlCancelRule(rlCancelRule);
}
/**
* 修改取消规则
*
* @param rlCancelRule 取消规则
* @return 结果
*/
@Override
public int updateRlCancelRule(RlCancelRule rlCancelRule)
{
return rlCancelRuleMapper.updateRlCancelRule(rlCancelRule);
}
/**
* 批量删除取消规则
*
* @param cancalIds 需要删除的取消规则主键
* @return 结果
*/
@Override
public int deleteRlCancelRuleByCancalIds(Long[] cancalIds)
{
return rlCancelRuleMapper.deleteRlCancelRuleByCancalIds(cancalIds);
}
/**
* 删除取消规则信息
*
* @param cancalId 取消规则主键
* @return 结果
*/
@Override
public int deleteRlCancelRuleByCancalId(Long cancalId)
{
return rlCancelRuleMapper.deleteRlCancelRuleByCancalId(cancalId);
}
}

View File

@ -1397,6 +1397,7 @@ public class RlDeviceServiceImpl extends ServiceImpl<RlDeviceMapper, RlDevice> i
if (order.getExpiryTime().before(DateUtils.getNowDate())) { if (order.getExpiryTime().before(DateUtils.getNowDate())) {
overdueFee = computeOverdueFee(order, updateOrder); overdueFee = computeOverdueFee(order, updateOrder);
} }
updateOrder.setOverdueFee(overdueFee);
int i = orderService.updateRlOrder(updateOrder); int i = orderService.updateRlOrder(updateOrder);
if(i==0){ if(i==0){
throw new ServiceException("更新订单状态失败"); throw new ServiceException("更新订单状态失败");
@ -1912,6 +1913,14 @@ public class RlDeviceServiceImpl extends ServiceImpl<RlDeviceMapper, RlDevice> i
return false; return false;
} }
/**
* 根据店铺id查询可租车辆数
*/
@Override
public Integer selectRentalDeviceCountByStoreId(Long storeId) {
return deviceMapper.selectRentalDeviceCountByStoreId(storeId);
}
/** /**
* sn和mac号绑定 * sn和mac号绑定

View File

@ -97,6 +97,20 @@ public class RlModelServiceImpl implements IRlModelService
return etModels; return etModels;
} }
/**
* 根据店铺id查询车辆型号列表
*
* @param storeId 店铺id
* @return 车辆型号
*/
@Override
public List<RlModel> selectEModelListByStoreId(Long storeId)
{
List<RlModel> etModels = rlModelMapper.selectEModelListByStoreId(storeId);
return etModels;
}
/** /**
* 新增车辆型号 * 新增车辆型号
* *

View File

@ -0,0 +1,95 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.system.domain.modelStore.RlModelStore;
import com.ruoyi.system.mapper.RlModelStoreMapper;
import com.ruoyi.system.service.IRlModelStoreService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 车型店铺关系Service业务层处理
*
* @author qzz
* @date 2024-09-25
*/
@Service
public class RlModelStoreServiceImpl implements IRlModelStoreService
{
@Resource
private RlModelStoreMapper rlModelStoreMapper;
/**
* 查询车型店铺关系
*
* @param modeId 车型店铺关系主键
* @return 车型店铺关系
*/
@Override
public RlModelStore selectRlModelStoreByModeId(Long modeId)
{
return rlModelStoreMapper.selectRlModelStoreByModeId(modeId);
}
/**
* 查询车型店铺关系列表
*
* @param rlModelStore 车型店铺关系
* @return 车型店铺关系
*/
@Override
public List<RlModelStore> selectRlModelStoreList(RlModelStore rlModelStore)
{
return rlModelStoreMapper.selectRlModelStoreList(rlModelStore);
}
/**
* 新增车型店铺关系
*
* @param rlModelStore 车型店铺关系
* @return 结果
*/
@Override
public int insertRlModelStore(RlModelStore rlModelStore)
{
return rlModelStoreMapper.insertRlModelStore(rlModelStore);
}
/**
* 修改车型店铺关系
*
* @param rlModelStore 车型店铺关系
* @return 结果
*/
@Override
public int updateRlModelStore(RlModelStore rlModelStore)
{
return rlModelStoreMapper.updateRlModelStore(rlModelStore);
}
/**
* 批量删除车型店铺关系
*
* @param modeIds 需要删除的车型店铺关系主键
* @return 结果
*/
@Override
public int deleteRlModelStoreByModeIds(Long[] modeIds)
{
return rlModelStoreMapper.deleteRlModelStoreByModeIds(modeIds);
}
/**
* 删除车型店铺关系信息
*
* @param modeId 车型店铺关系主键
* @return 结果
*/
@Override
public int deleteRlModelStoreByModeId(Long modeId)
{
return rlModelStoreMapper.deleteRlModelStoreByModeId(modeId);
}
}

View File

@ -6,9 +6,15 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServiceUtil; import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.bean.collection.CollectionUtils; import com.ruoyi.common.utils.bean.collection.CollectionUtils;
import com.ruoyi.common.utils.map.GeoUtils; import com.ruoyi.common.utils.map.GeoUtils;
import com.ruoyi.system.domain.store.*; import com.ruoyi.system.domain.model.RlModel;
import com.ruoyi.system.domain.store.Store;
import com.ruoyi.system.domain.store.StoreCountVO;
import com.ruoyi.system.domain.store.StoreQuery;
import com.ruoyi.system.domain.store.StoreVo;
import com.ruoyi.system.domain.store.enums.StoreGroupBy; import com.ruoyi.system.domain.store.enums.StoreGroupBy;
import com.ruoyi.system.mapper.StoreMapper; import com.ruoyi.system.mapper.StoreMapper;
import com.ruoyi.system.service.IRlDeviceService;
import com.ruoyi.system.service.IRlModelService;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.store.RlStoreService; import com.ruoyi.system.service.store.RlStoreService;
import com.ruoyi.system.service.store.StoreAssembler; import com.ruoyi.system.service.store.StoreAssembler;
@ -21,10 +27,7 @@ import org.springframework.transaction.support.TransactionTemplate;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.ArrayList; import java.util.*;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -41,8 +44,8 @@ public class StoreServiceImpl implements RlStoreService
@Resource @Resource
private StoreMapper storeMapper; private StoreMapper storeMapper;
// @Autowired @Autowired
// private DeviceService smDeviceService; private IRlDeviceService deviceService;
@Autowired @Autowired
private StoreAssembler storeAssembler; private StoreAssembler storeAssembler;
@ -59,6 +62,9 @@ public class StoreServiceImpl implements RlStoreService
@Autowired @Autowired
private ISysConfigService sysConfigService; private ISysConfigService sysConfigService;
@Autowired
private IRlModelService modelService;
/** /**
* 查询店铺 * 查询店铺
* *
@ -416,7 +422,7 @@ public class StoreServiceImpl implements RlStoreService
@Override @Override
public List<StoreVo> getStoreListByLocation(StoreQuery query) { public List<StoreVo> getStoreListByLocation(StoreQuery query) {
String nearby = sysConfigService.selectConfigByKey("nearby.store"); String nearby = sysConfigService.selectConfigByKey("nearby.store");
double radiusInKm = Double.parseDouble(nearby); double radiusInMeters = Double.parseDouble(nearby) * 1000; // 将半径转换为米
// 根据定位获取附近方圆X公里的店铺列表 // 根据定位获取附近方圆X公里的店铺列表
double userLon = Double.parseDouble(query.getPhoneLon()); double userLon = Double.parseDouble(query.getPhoneLon());
double userLat = Double.parseDouble(query.getPhoneLat()); double userLat = Double.parseDouble(query.getPhoneLat());
@ -424,15 +430,24 @@ public class StoreServiceImpl implements RlStoreService
List<StoreVo> allStores = storeMapper.selectSmStoreList(query); List<StoreVo> allStores = storeMapper.selectSmStoreList(query);
// 过滤出在方圆X公里内的店铺 // 过滤出在方圆X公里内的店铺
List<StoreVo> nearbyStores = allStores.stream() List<StoreVo> nearbyStores = allStores.stream()
.filter(store -> { .map(store -> {
List<RlModel> list = modelService.selectEModelListByStoreId(store.getStoreId());
store.setModels(list);
/** 多少辆可租 */
Integer integer = deviceService.selectRentalDeviceCountByStoreId(store.getStoreId());
store.setRentalCar(integer);
double storeLon = store.getLng().doubleValue(); double storeLon = store.getLng().doubleValue();
double storeLat = store.getLat().doubleValue(); double storeLat = store.getLat().doubleValue();
double distance = GeoUtils.haversineDistance( double distance = GeoUtils.haversineDistance(
new double[]{userLon, userLat}, new double[]{userLon, userLat},
new double[]{storeLon, storeLat} new double[]{storeLon, storeLat}
) / 1000; // 转换为公里 ); // 转换为公里
return distance <= radiusInKm; double formattedDistance = Math.round(distance * 10) / 10.0;
store.setDistance(formattedDistance); // 设置距离
return store; // 返回更新后的 store
}) })
.filter(store -> store.getDistance() <= radiusInMeters) // 过滤距离
.sorted(Comparator.comparingDouble(StoreVo::getDistance)) // 根据距离排序
.collect(Collectors.toList()); .collect(Collectors.toList());
return nearbyStores; return nearbyStores;
} }

View File

@ -0,0 +1,71 @@
<?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.RlCancelRuleMapper">
<resultMap type="RlCancelRule" id="RlCancelRuleResult" autoMapping="true" />
<sql id="selectRlCancelRuleVo">
select cancal_id, instructions, deduct_percent, front_out_time, middle_out_time, after_out_time from rl_cancel_rule
</sql>
<select id="selectRlCancelRuleList" parameterType="RlCancelRule" resultMap="RlCancelRuleResult">
<include refid="selectRlCancelRuleVo"/>
<where>
<if test="instructions != null and instructions != ''"> and instructions = #{instructions}</if>
<if test="deductPercent != null "> and deduct_percent = #{deductPercent}</if>
<if test="frontOutTime != null "> and front_out_time = #{frontOutTime}</if>
<if test="middleOutTime != null and middleOutTime != ''"> and middle_out_time = #{middleOutTime}</if>
<if test="afterOutTime != null "> and after_out_time = #{afterOutTime}</if>
</where>
</select>
<select id="selectRlCancelRuleByCancalId" parameterType="Long" resultMap="RlCancelRuleResult">
<include refid="selectRlCancelRuleVo"/>
where cancal_id = #{cancalId}
</select>
<insert id="insertRlCancelRule" parameterType="RlCancelRule">
insert into rl_cancel_rule
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="cancalId != null">cancal_id,</if>
<if test="instructions != null">instructions,</if>
<if test="deductPercent != null">deduct_percent,</if>
<if test="frontOutTime != null">front_out_time,</if>
<if test="middleOutTime != null">middle_out_time,</if>
<if test="afterOutTime != null">after_out_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cancalId != null">#{cancalId},</if>
<if test="instructions != null">#{instructions},</if>
<if test="deductPercent != null">#{deductPercent},</if>
<if test="frontOutTime != null">#{frontOutTime},</if>
<if test="middleOutTime != null">#{middleOutTime},</if>
<if test="afterOutTime != null">#{afterOutTime},</if>
</trim>
</insert>
<update id="updateRlCancelRule" parameterType="RlCancelRule">
update rl_cancel_rule
<trim prefix="SET" suffixOverrides=",">
<if test="instructions != null">instructions = #{instructions},</if>
<if test="deductPercent != null">deduct_percent = #{deductPercent},</if>
<if test="frontOutTime != null">front_out_time = #{frontOutTime},</if>
<if test="middleOutTime != null">middle_out_time = #{middleOutTime},</if>
<if test="afterOutTime != null">after_out_time = #{afterOutTime},</if>
</trim>
where cancal_id = #{cancalId}
</update>
<delete id="deleteRlCancelRuleByCancalId" parameterType="Long">
delete from rl_cancel_rule where cancal_id = #{cancalId}
</delete>
<delete id="deleteRlCancelRuleByCancalIds" parameterType="String">
delete from rl_cancel_rule where cancal_id in
<foreach item="cancalId" collection="array" open="(" separator="," close=")">
#{cancalId}
</foreach>
</delete>
</mapper>

View File

@ -10,21 +10,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="pinyin" column="pinyin" /> <result property="pinyin" column="pinyin" />
<result property="adcode" column="adcode" /> <result property="adcode" column="adcode" />
<result property="citycode" column="citycode" /> <result property="citycode" column="citycode" />
<result property="isOpen" column="is_open" />
</resultMap> </resultMap>
<sql id="selectRlCityVo"> <sql id="selectRlCityVo">
select c.city_id, c.name, c.pinyin, c.adcode, c.citycode, cc.name cityName from rl_city c select c.city_id, c.name, c.pinyin, c.adcode, c.citycode, cc.name cityName, c.is_open from rl_city c
left join rl_city_code cc on c.citycode = cc.code left join rl_city_code cc on c.citycode = cc.code
</sql> </sql>
<select id="selectRlCityList" parameterType="RlCity" resultMap="RlCityResult"> <select id="selectRlCityList" parameterType="RlCity" resultMap="RlCityResult">
<include refid="selectRlCityVo"/> <include refid="selectRlCityVo"/>
<where> where is_open = 1
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="pinyin != null and pinyin != ''"> and pinyin = #{pinyin}</if> <if test="pinyin != null and pinyin != ''"> and pinyin = #{pinyin}</if>
<if test="adcode != null and adcode != ''"> and adcode = #{adcode}</if> <if test="adcode != null and adcode != ''"> and adcode = #{adcode}</if>
<if test="citycode != null and citycode != ''"> and citycode = #{citycode}</if> <if test="citycode != null and citycode != ''"> and citycode = #{citycode}</if>
</where>
</select> </select>
<select id="selectRlCityByCityId" parameterType="Long" resultMap="RlCityResult"> <select id="selectRlCityByCityId" parameterType="Long" resultMap="RlCityResult">
@ -44,12 +44,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="pinyin != null">pinyin,</if> <if test="pinyin != null">pinyin,</if>
<if test="adcode != null">adcode,</if> <if test="adcode != null">adcode,</if>
<if test="citycode != null">citycode,</if> <if test="citycode != null">citycode,</if>
<if test="isOpen != null">is_open,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if> <if test="name != null">#{name},</if>
<if test="pinyin != null">#{pinyin},</if> <if test="pinyin != null">#{pinyin},</if>
<if test="adcode != null">#{adcode},</if> <if test="adcode != null">#{adcode},</if>
<if test="citycode != null">#{citycode},</if> <if test="citycode != null">#{citycode},</if>
<if test="isOpen != null">#{isOpen},</if>
</trim> </trim>
</insert> </insert>
@ -60,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="pinyin != null">pinyin = #{pinyin},</if> <if test="pinyin != null">pinyin = #{pinyin},</if>
<if test="adcode != null">adcode = #{adcode},</if> <if test="adcode != null">adcode = #{adcode},</if>
<if test="citycode != null">citycode = #{citycode},</if> <if test="citycode != null">citycode = #{citycode},</if>
<if test="isOpen != null">is_open = #{isOpen},</if>
</trim> </trim>
where city_id = #{cityId} where city_id = #{cityId}
</update> </update>

View File

@ -72,11 +72,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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>
<if test="sn != null and sn != ''"> and de.sn like concat('%', #{sn}, '%')</if> <if test="sn != null and sn != ''"> and de.sn like concat('%', #{sn}, '%')</if>
<if test="vehicleNum != null and vehicleNum != ''"> and de.vehicle_num like concat('%', #{vehicleNum}, '%')</if> <if test="vehicleNum != null and vehicleNum != ''"> and de.vehicle_num like concat('%', #{vehicleNum}, '%')</if>
<if test="deptId != null "> and d.dept_id = #{deptId}</if>
<if test="modelId != null and modelId != ''"> and de.model_id = #{modelId}</if> <if test="modelId != null and modelId != ''"> and de.model_id = #{modelId}</if>
<if test="onlineStatus != null and onlineStatus != ''"> and de.online_status = #{onlineStatus}</if> <if test="onlineStatus != null and onlineStatus != ''"> and de.online_status = #{onlineStatus}</if>
<if test="version != null and version != ''"> and de.version = #{version}</if> <if test="version != null and version != ''"> and de.version = #{version}</if>
<if test="hardwareVersion != null and hardwareVersion != ''"> and hv.version like concat('%', #{hardwareVersion}, '%') </if>
<choose> <choose>
<when test="status == '34'"> <when test="status == '34'">
and (de.status = '3' or de.status = '4') and (de.status = '3' or de.status = '4')
@ -116,6 +114,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select device_id, sn, device_name from rl_device where mac = #{mac} limit 1 select device_id, sn, device_name from rl_device where mac = #{mac} limit 1
</select> </select>
<select id="selectRentalDeviceCountByStoreId" resultType="java.lang.Integer">
select count(1) from rl_device where store_id = #{storeId} and status = '1'
</select>
<insert id="insertDevice" parameterType="RlDeviceQuery" useGeneratedKeys="true" keyProperty="deviceId"> <insert id="insertDevice" parameterType="RlDeviceQuery" useGeneratedKeys="true" keyProperty="deviceId">
insert into rl_device insert into rl_device
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectRlFeeRuleVo"> <sql id="selectRlFeeRuleVo">
select rule_id, num, rental_unit, price, explain, instructions, out_unit, out_price, is_deleted, model_id from rl_fee_rule select rule_id, num, rental_unit, price, `explain`, instructions, out_unit, out_price, is_deleted, model_id from rl_fee_rule
</sql> </sql>
<select id="selectRlFeeRuleList" parameterType="RlFeeRule" resultMap="RlFeeRuleResult"> <select id="selectRlFeeRuleList" parameterType="RlFeeRule" resultMap="RlFeeRuleResult">
@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="num != null "> and num = #{num}</if> <if test="num != null "> and num = #{num}</if>
<if test="rentalUnit != null and rentalUnit != ''"> and rental_unit = #{rentalUnit}</if> <if test="rentalUnit != null and rentalUnit != ''"> and rental_unit = #{rentalUnit}</if>
<if test="price != null "> and price = #{price}</if> <if test="price != null "> and price = #{price}</if>
<if test="explain != null and explain != ''"> and explain = #{explain}</if> <if test="explain != null and explain != ''"> and `explain` = #{explain}</if>
<if test="instructions != null and instructions != ''"> and instructions = #{instructions}</if> <if test="instructions != null and instructions != ''"> and instructions = #{instructions}</if>
<if test="outUnit != null and outUnit != ''"> and out_unit = #{outUnit}</if> <if test="outUnit != null and outUnit != ''"> and out_unit = #{outUnit}</if>
<if test="outPrice != null "> and out_price = #{outPrice}</if> <if test="outPrice != null "> and out_price = #{outPrice}</if>
@ -51,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="num != null">num,</if> <if test="num != null">num,</if>
<if test="rentalUnit != null">rental_unit,</if> <if test="rentalUnit != null">rental_unit,</if>
<if test="price != null">price,</if> <if test="price != null">price,</if>
<if test="explain != null">explain,</if> <if test="explain != null">`explain`,</if>
<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>
@ -77,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="num != null">num = #{num},</if> <if test="num != null">num = #{num},</if>
<if test="rentalUnit != null">rental_unit = #{rentalUnit},</if> <if test="rentalUnit != null">rental_unit = #{rentalUnit},</if>
<if test="price != null">price = #{price},</if> <if test="price != null">price = #{price},</if>
<if test="explain != null">explain = #{explain},</if> <if test="explain != null">`explain` = #{explain},</if>
<if test="instructions != null">instructions = #{instructions},</if> <if test="instructions != null">instructions = #{instructions},</if>
<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>

View File

@ -4,30 +4,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.RlModelMapper"> <mapper namespace="com.ruoyi.system.mapper.RlModelMapper">
<resultMap type="RlModelVO" id="EModelResult"> <resultMap type="RlModelVO" id="EModelResult" autoMapping="true" />
<result property="modelId" column="model_id" />
<result property="model" column="model" />
<result property="fullVoltage" column="full_voltage" />
<result property="lowVoltage" column="low_voltage" />
<result property="fullEndurance" column="full_endurance" />
<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="intro" column="intro" />
<result property="agentId" column="agent_id" />
<result property="deposit" column="deposit" />
</resultMap>
<sql id="selectEModelVo"> <sql id="selectEModelVo">
select model_id, model, full_voltage, low_voltage, full_endurance, create_by, create_time, update_by, update_time, remark, intro, agent_id, deposit from rl_model select model_id, model, full_voltage, low_voltage, full_endurance, create_by, create_time, update_by, update_time, remark, intro, agent_id, deposit, picture from rl_model
</sql> </sql>
<select id="selectEModelList" parameterType="RlModel" resultMap="EModelResult"> <select id="selectEModelList" parameterType="RlModel" resultMap="EModelResult">
select m.model_id, m.model, m.full_voltage, m.low_voltage, select m.model_id, m.model, m.full_voltage, m.low_voltage,
m.full_endurance, m.create_by, m.create_time, m.full_endurance, m.create_by, m.create_time,
m.update_by, m.update_time, m.remark, m.intro, m.agent_id, m.deposit from rl_model m m.update_by, m.update_time, m.remark, m.intro, m.agent_id, m.deposit, m.picture from rl_model m
where 1 = 1 where 1 = 1
<if test="model != null and model != ''"> and m.model = #{model}</if> <if test="model != null and model != ''"> and m.model = #{model}</if>
<!-- 数据范围过滤 <if test="operator != null and operator != ''"> and m.operator = #{operator}</if> --> <!-- 数据范围过滤 <if test="operator != null and operator != ''"> and m.operator = #{operator}</if> -->
@ -37,14 +23,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectEModelListByAgentId" parameterType="RlModel" resultMap="EModelResult"> <select id="selectEModelListByAgentId" parameterType="RlModel" resultMap="EModelResult">
select m.model_id, m.model, m.full_voltage, m.low_voltage, select m.model_id, m.model, m.full_voltage, m.low_voltage,
m.full_endurance, m.create_by, m.create_time, m.full_endurance, m.create_by, m.create_time,
m.update_by, m.update_time, m.remark, m.intro, m.agent_id, m.deposit from rl_model m m.update_by, m.update_time, m.remark, m.intro, m.agent_id, m.deposit, m.picture from rl_model m
where m.agent_id = #{agentId} where m.agent_id = #{agentId}
</select> </select>
<select id="selectEModelByModelId" parameterType="Long" resultMap="EModelResult"> <select id="selectEModelByModelId" parameterType="Long" resultMap="EModelResult">
select m.model_id, m.model, m.full_voltage, m.low_voltage, select m.model_id, m.model, m.full_voltage, m.low_voltage,
m.full_endurance, m.create_by, m.create_time, m.full_endurance, m.create_by, m.create_time,
m.update_by, m.update_time, m.remark, m.intro, m.agent_id, m.deposit from rl_model m m.update_by, m.update_time, m.remark, m.intro, m.agent_id, m.deposit, m.picture from rl_model m
where m.model_id = #{modelId} where m.model_id = #{modelId}
</select> </select>
@ -52,6 +38,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select count(1) from rl_model select count(1) from rl_model
</select> </select>
<select id="selectEModelListByStoreId" parameterType="RlModelVO" resultMap="EModelResult">
SELECT
m.model_id,
m.model,
m.full_voltage,
m.low_voltage,
m.full_endurance,
m.create_by,
m.create_time,
m.update_by,
m.update_time,
m.remark,
m.intro,
m.agent_id,
m.deposit,
m.picture,
fr.price,
fr.rental_unit
FROM
rl_model m
LEFT JOIN rl_model_store ms ON ms.mode_id = m.model_id
LEFT JOIN rl_fee_rule fr ON fr.model_id = m.model_id
WHERE
ms.store_id = #{storeId}
AND fr.price = ( SELECT MIN( fr2.price ) FROM rl_fee_rule fr2 WHERE fr2.model_id = m.model_id )
GROUP BY
m.model_id
</select>
<insert id="insertEModel" parameterType="RlModel" keyProperty="modelId" useGeneratedKeys="true"> <insert id="insertEModel" parameterType="RlModel" keyProperty="modelId" useGeneratedKeys="true">
insert into rl_model insert into rl_model
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -68,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="intro != null">intro,</if> <if test="intro != null">intro,</if>
<if test="agentId != null">agent_id,</if> <if test="agentId != null">agent_id,</if>
<if test="deposit != null">deposit,</if> <if test="deposit != null">deposit,</if>
<if test="picture != null">picture,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="modelId != null">#{modelId},</if> <if test="modelId != null">#{modelId},</if>
@ -83,6 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="intro != null">#{intro},</if> <if test="intro != null">#{intro},</if>
<if test="agentId != null">#{agentId},</if> <if test="agentId != null">#{agentId},</if>
<if test="deposit != null">#{deposit},</if> <if test="deposit != null">#{deposit},</if>
<if test="picture != null">#{picture},</if>
</trim> </trim>
</insert> </insert>
@ -101,6 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="intro != null">intro = #{intro},</if> <if test="intro != null">intro = #{intro},</if>
<if test="agentId != null">agent_id = #{agentId},</if> <if test="agentId != null">agent_id = #{agentId},</if>
<if test="deposit != null">deposit = #{deposit},</if> <if test="deposit != null">deposit = #{deposit},</if>
<if test="picture != null">picture = #{picture},</if>
</trim> </trim>
where model_id = #{modelId} where model_id = #{modelId}
</update> </update>

View File

@ -0,0 +1,62 @@
<?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.RlModelStoreMapper">
<resultMap type="RlModelStore" id="RlModelStoreResult">
<result property="modeId" column="mode_id" />
<result property="storeId" column="store_id" />
</resultMap>
<sql id="selectRlModelStoreVo">
select mode_id, store_id from rl_model_store
</sql>
<select id="selectRlModelStoreList" parameterType="RlModelStore" resultMap="RlModelStoreResult">
<include refid="selectRlModelStoreVo"/>
<where>
</where>
</select>
<select id="selectRlModelStoreListBystoreId" parameterType="RlModelStore" resultMap="RlModelStoreResult">
<include refid="selectRlModelStoreVo"/>
where store_id = #{storeId}
</select>
<select id="selectRlModelStoreByModeId" parameterType="Long" resultMap="RlModelStoreResult">
<include refid="selectRlModelStoreVo"/>
where mode_id = #{modeId}
</select>
<insert id="insertRlModelStore" parameterType="RlModelStore">
insert into rl_model_store
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="modeId != null">mode_id,</if>
<if test="storeId != null">store_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="modeId != null">#{modeId},</if>
<if test="storeId != null">#{storeId},</if>
</trim>
</insert>
<update id="updateRlModelStore" parameterType="RlModelStore">
update rl_model_store
<trim prefix="SET" suffixOverrides=",">
<if test="storeId != null">store_id = #{storeId},</if>
</trim>
where mode_id = #{modeId}
</update>
<delete id="deleteRlModelStoreByModeId" parameterType="Long">
delete from rl_model_store where mode_id = #{modeId}
</delete>
<delete id="deleteRlModelStoreByModeIds" parameterType="String">
delete from rl_model_store where mode_id in
<foreach item="modeId" collection="array" open="(" separator="," close=")">
#{modeId}
</foreach>
</delete>
</mapper>

View File

@ -36,7 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ss.agent_id, ss.agent_id,
a.is_free_car, a.is_free_car,
ss.server_phone, ss.server_phone,
su.user_name as user_name su.user_name as user_name,
ss.simple_address
from rl_store ss from rl_store ss
left join rl_user su on su.user_id = ss.user_id left join rl_user su on su.user_id = ss.user_id
left join rl_agent a on a.agent_id = ss.agent_id left join rl_agent a on a.agent_id = ss.agent_id
@ -163,6 +164,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="enabled != null">`enabled`,</if> <if test="enabled != null">`enabled`,</if>
<if test="agentId != null">agent_id,</if> <if test="agentId != null">agent_id,</if>
<if test="serverPhone != null">server_phone,</if> <if test="serverPhone != null">server_phone,</if>
<if test="simpleAddress != null">simple_address,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if> <if test="name != null">#{name},</if>
@ -188,6 +190,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="enabled != null">#{enabled},</if> <if test="enabled != null">#{enabled},</if>
<if test="agentId != null">#{agentId},</if> <if test="agentId != null">#{agentId},</if>
<if test="serverPhone != null">#{serverPhone},</if> <if test="serverPhone != null">#{serverPhone},</if>
<if test="simpleAddress != null">#{simpleAddress},</if>
</trim> </trim>
</insert> </insert>
@ -222,6 +225,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="data.enabled != null">`enabled` = #{data.enabled},</if> <if test="data.enabled != null">`enabled` = #{data.enabled},</if>
<if test="data.agentId != null">agent_id = #{data.agentId},</if> <if test="data.agentId != null">agent_id = #{data.agentId},</if>
<if test="data.serverPhone != null">server_phone = #{data.serverPhone},</if> <if test="data.serverPhone != null">server_phone = #{data.serverPhone},</if>
<if test="data.simpleAddress != null">simple_address = #{data.simpleAddress},</if>
</sql> </sql>
<update id="updateByQuery"> <update id="updateByQuery">