Merge remote-tracking branch 'origin/master'
| | |
| | | public class PointAddDto implements Serializable { |
| | | @ApiModelProperty(value = "电子围栏区域id") |
| | | private Long electronicAreaId; |
| | | |
| | | @ApiModelProperty(value = "电子围栏id") |
| | | private String fenceId; |
| | | @ApiModelProperty(value = "点位名称") |
| | | @NotEmpty(message = "点位名称不能为空") |
| | | private String pointName; |
| | |
| | | private Long id; |
| | | @ApiModelProperty(value = "电子围栏区域id") |
| | | private Long electronicAreaId; |
| | | |
| | | @ApiModelProperty(value = "围栏id") |
| | | private String fenceId; |
| | | |
| | | @ApiModelProperty(value = "点位名称") |
| | | @NotBlank(message = "点位名称不能为空") |
| | | |
| | |
| | | @ApiModelProperty(value = "更新结束时间") |
| | | private String updateEndTime; |
| | | @ApiModelProperty(value = "开始时间 1正序 2倒序") |
| | | private String createSort; |
| | | private Integer createSort; |
| | | @ApiModelProperty(value = "更新时间 1正序 2倒序") |
| | | private String updateSort; |
| | | private Integer updateSort; |
| | | } |
| | |
| | | /** |
| | | * 缓存有效期,默认720(分钟) |
| | | */ |
| | | public final static long EXPIRATION = 720; |
| | | public final static long EXPIRATION = 720 * 2; //24小时 |
| | | public final static long EXPIRATION_APPLET = 365 * 24 * 60; |
| | | |
| | | /** |
| | |
| | | public static final String OPERATION_USER_KEY = "operation_user_key"; |
| | | |
| | | /** |
| | | * 用户类型(system/applet) |
| | | * 用户类型(system/operation) |
| | | */ |
| | | public static final String USER_TYPE = "user_type"; |
| | | /** |
| | |
| | | * 角色权限 |
| | | */ |
| | | public static final String ROLE_PERMISSION = "role_permission"; |
| | | |
| | | /** |
| | | * 登录运维人员 |
| | | */ |
| | | public static final String LOGIN_OPERATION_USER = "login_oeeration_user"; |
| | | } |
| | |
| | | return get(SecurityConstants.USER_KEY); |
| | | } |
| | | |
| | | public static String getOperationUserKey() |
| | | { |
| | | return get(SecurityConstants.OPERATION_USER_KEY); |
| | | } |
| | | |
| | | public static void setUserKey(String userKey) |
| | | { |
| | | set(SecurityConstants.USER_KEY, userKey); |
| | | } |
| | | |
| | | public static void setOperationUserKey(String userKey) |
| | | { |
| | | set(SecurityConstants.OPERATION_USER_KEY, userKey); |
| | | } |
| | | public static String getPermission() |
| | | { |
| | | return get(SecurityConstants.ROLE_PERMISSION); |
| | |
| | | { |
| | | return getValue(claims, SecurityConstants.USER_KEY); |
| | | } |
| | | |
| | | /** |
| | | * 根据令牌获取运维用户标识 |
| | | * |
| | | * @param claims 身份信息 |
| | | * @return 用户ID |
| | | */ |
| | | public static String getOperationUserKey(Claims claims) |
| | | { |
| | | return getValue(claims, SecurityConstants.OPERATION_USER_KEY); |
| | | } |
| | | |
| | | /** |
| | | * 根据令牌获取用户类型 |
| | |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | |
| | | import com.xiaopeng.api.vo.account.LoginOperationUser; |
| | | import com.xiaopeng.common.core.utils.JwtUtils; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import io.jsonwebtoken.Claims; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取当前运维用户缓存信息, 如果未登录,则抛出异常 |
| | | * |
| | | * @param token 前端传递的认证信息 |
| | | * @return 用户缓存信息 |
| | | */ |
| | | public LoginOperationUser getOperationLoginUser(String token) |
| | | { |
| | | return tokenService.getLoginOperationUser(token); |
| | | } |
| | | /** |
| | | * 验证当前用户有效期, 如果相差不足120分钟,自动刷新缓存 |
| | | * |
| | | * @param loginUser 当前用户信息 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户有效期, 如果相差不足120分钟,自动刷新缓存 |
| | | * |
| | | * @param loginOperationUser 当前用户信息 |
| | | */ |
| | | public void verifyOperationLoginUserExpire(LoginOperationUser loginOperationUser) |
| | | { |
| | | tokenService.verifyToken(loginOperationUser); |
| | | } |
| | | |
| | | /** |
| | | * 验证用户是否具备某权限 |
| | | * |
| | | * @param permission 权限字符串 |
| | |
| | | package com.xiaopeng.common.security.auth; |
| | | |
| | | import com.xiaopeng.api.vo.account.LoginOperationUser; |
| | | import com.xiaopeng.common.security.annotation.RequiresPermissions; |
| | | import com.xiaopeng.common.security.annotation.RequiresRoles; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取当前登录用户信息 |
| | | * |
| | | * @param token 指定token |
| | | * @return 用户信息 |
| | | */ |
| | | public static LoginOperationUser getOperationLoginUser(String token) |
| | | { |
| | | return authLogic.getOperationLoginUser(token); |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户有效期 |
| | | * |
| | | * @param loginUser 用户信息 |
| | |
| | | { |
| | | authLogic.verifyLoginUserExpire(loginUser); |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户有效期 |
| | | * |
| | | * @param loginOperationUser 用户信息 |
| | | */ |
| | | public static void verifyOperationLoginUserExpire(LoginOperationUser loginOperationUser) |
| | | { |
| | | authLogic.verifyOperationLoginUserExpire(loginOperationUser); |
| | | } |
| | | /** |
| | | * 当前账号是否含有指定角色标识, 返回true或false |
| | | * |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.xiaopeng.api.vo.account.LoginOperationUser; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.common.core.utils.JwtUtils; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.springframework.web.method.HandlerMethod; |
| | | import org.springframework.web.servlet.AsyncHandlerInterceptor; |
| | | import com.xiaopeng.common.core.constant.SecurityConstants; |
| | |
| | | SecurityContextHolder.setUserId(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USER_ID)); |
| | | SecurityContextHolder.setUserName(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USERNAME)); |
| | | SecurityContextHolder.setUserKey(ServletUtils.getHeader(request, SecurityConstants.USER_KEY)); |
| | | SecurityContextHolder.setOperationUserKey(ServletUtils.getHeader(request, SecurityConstants.OPERATION_USER_KEY)); |
| | | |
| | | String token = SecurityUtils.getToken(); |
| | | if (StringUtils.isNotEmpty(token)) |
| | | { |
| | | LoginUser loginUser = AuthUtil.getLoginUser(token); |
| | | if (StringUtils.isNotNull(loginUser)) |
| | | { |
| | | AuthUtil.verifyLoginUserExpire(loginUser); |
| | | SecurityContextHolder.set(SecurityConstants.LOGIN_USER, loginUser); |
| | | String userType = JwtUtils.getUserType(token); |
| | | if ("system".equals(userType)) { |
| | | LoginUser loginUser = AuthUtil.getLoginUser(token); |
| | | if (StringUtils.isNotNull(loginUser)) |
| | | { |
| | | AuthUtil.verifyLoginUserExpire(loginUser); |
| | | SecurityContextHolder.set(SecurityConstants.LOGIN_USER, loginUser); |
| | | } |
| | | } |
| | | if ("operation".equals(userType)) { |
| | | LoginOperationUser operationLoginUser = AuthUtil.getOperationLoginUser(token); |
| | | if (StringUtils.isNotNull(operationLoginUser)) |
| | | { |
| | | AuthUtil.verifyOperationLoginUserExpire(operationLoginUser); |
| | | SecurityContextHolder.set(SecurityConstants.LOGIN_OPERATION_USER, operationLoginUser); |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | |
| | | refreshToken(loginUser); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验证令牌有效期,相差不足120分钟,自动刷新缓存 |
| | | * |
| | | * @param loginOperationUser |
| | | */ |
| | | public void verifyToken(LoginOperationUser loginOperationUser) { |
| | | long expireTime = loginOperationUser.getExpireTime(); |
| | | long currentTime = System.currentTimeMillis(); |
| | | if (expireTime - currentTime <= MILLIS_MINUTE_TEN) { |
| | | refreshTokenOperationUser(loginOperationUser); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 刷新令牌有效期 |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.xiaopeng.api.vo.account.LoginOperationUser; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import com.xiaopeng.common.core.constant.SecurityConstants; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取登录运维人员信息 |
| | | */ |
| | | public static LoginOperationUser getLoginOperationUser() |
| | | { |
| | | return SecurityContextHolder.get(SecurityConstants.LOGIN_OPERATION_USER, LoginOperationUser.class); |
| | | } |
| | | /** |
| | | * 获取请求token |
| | | */ |
| | | public static String getToken() |
| | |
| | | }catch (Exception e){ |
| | | return unauthorizedResponse(exchange, e.getMessage()); |
| | | } |
| | | |
| | | |
| | | String token = getToken(request); |
| | | Claims claims = JwtUtils.parseToken(token); |
| | | String userkey = JwtUtils.getUserKey(claims); |
| | | String userid = JwtUtils.getUserId(claims); |
| | | String username = JwtUtils.getUserName(claims); |
| | | String userType = JwtUtils.getUserType(claims); |
| | | |
| | | String operationUserKey = JwtUtils.getOperationUserKey(claims); |
| | | String redisKey = ""; |
| | | if ("system".equals(userType)) { |
| | | redisKey = StringUtils.isNotBlank(userkey) ? getTokenKey(userkey) : ""; |
| | | } |
| | | if ("operation".equals(userType)) { |
| | | redisKey = StringUtils.isNotBlank(operationUserKey) ? getTokenKey(operationUserKey) : ""; |
| | | } |
| | | if (StringUtils.isBlank(redisKey)) { |
| | | return unauthorizedResponse(exchange, "登录状态已过期"); |
| | | } |
| | | |
| | | boolean islogin = redisService.hasKey(redisKey); |
| | | if (!islogin) |
| | | { |
| | | return unauthorizedResponse(exchange, "登录状态已过期"); |
| | | } |
| | | // 设置用户信息到请求 |
| | | addHeader(mutate, SecurityConstants.USER_KEY, userkey); |
| | | addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid); |
| | | addHeader(mutate, SecurityConstants.DETAILS_USERNAME, username); |
| | | addHeader(mutate, SecurityConstants.USER_TYPE, userType); |
| | | addHeader(mutate, SecurityConstants.OPERATION_USER_KEY, operationUserKey); |
| | | // 内部请求来源参数清除 |
| | | removeHeader(mutate, SecurityConstants.FROM_SOURCE); |
| | | return chain.filter(exchange.mutate().request(mutate.build()).build()); |
| | |
| | | |
| | | String TASK_NOT_EXIST = "task.not.exist"; |
| | | String VEHICLE_NOT_EXIST = "vehicle.not.exist"; |
| | | String REPAIR_MONEY_TOO_LONG = "repair.money.too.long"; |
| | | } |
| | |
| | | |
| | | import com.xiaopeng.api.model.maintenance.XpVehicleRepair; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.maintenance.constant.I18nKeyConstant; |
| | | import com.xiaopeng.maintenance.dto.XpVehicleRepairReturnDTO; |
| | | import com.xiaopeng.maintenance.dto.XpVehicleRepairStartDTO; |
| | | import com.xiaopeng.maintenance.model.query.XpVehicleRepairPageQuery; |
| | |
| | | */ |
| | | @ApiOperation(value = "车辆运维-车辆运维-车辆取回", tags = {"运维APP-车辆管理"}) |
| | | @PostMapping("/api/v1/vehicleRepair/saveReturnRepair") |
| | | public R<String> saveReturnRepair(@Validated @RequestBody XpVehicleRepairReturnDTO dto) { |
| | | public R<String> saveReturnRepair(@RequestBody XpVehicleRepairReturnDTO dto) { |
| | | |
| | | Long id = tokenService.getLoginOperationUser().getId(); |
| | | |
| | | if (dto.getRepairMoney().toString().length() > 200) { |
| | | throw new ServiceException("维修费用不能超过200字符", I18nKeyConstant.REPAIR_MONEY_TOO_LONG); |
| | | } |
| | | XpVehicleRepair xpVehicleRepair = xpVehicleRepairService.getById(dto.getId()); |
| | | xpVehicleRepair.setVehicleId(null); |
| | | // 修改车辆取回信息 |
| | |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import javax.validation.constraints.Max; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | |
| | | @ApiModelProperty(value = "维修id") |
| | | private Long id; |
| | | |
| | | @Length(max = 200, message = "维修费用长度不能超过200字") |
| | | @ApiModelProperty(value = "维修费用") |
| | | private Double repairMoney; |
| | | |
| | |
| | | # 中文 |
| | | welcome.message=欢迎来到我们的应用程序! |
| | | task.not.exist=任务不存在 |
| | | vehicle.not.exist=车辆不存在 |
| | | vehicle.not.exist=车辆不存在 |
| | | repair.money.too.long=维修费用不能超过200字符 |
| | |
| | | welcome.message=Welcome to our application! |
| | | task.not.exist=The task does not exist. |
| | | vehicle.not.exist=The vehicle does not exist. |
| | | repair.money.too.long=The maintenance cost cannot exceed 200 characters |
| | | task.rule.not.config=The vehicle accident task allocation rules have not been configured |
| | |
| | | welcome.message=欢迎来到我们的应用程序! |
| | | task.not.exist=任务不存在 |
| | | vehicle.not.exist=车辆不存在 |
| | | repair.money.too.long=维修费用不能超过200字符 |
| | | task.rule.not.config=未配置车辆事故任务分配规则 |
| | |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.api.dto.map.XpPointExportExcelQuery; |
| | | import com.xiaopeng.map.exportExcel.XpPointExportExcel; |
| | | import com.xiaopeng.map.mangodb.service.XpGeoFencingPolygonService; |
| | | import com.xiaopeng.map.service.XpElectronicFenceAreaService; |
| | | import com.xiaopeng.map.service.XpElectronicFenceService; |
| | | import com.xiaopeng.map.service.XpPointService; |
| | |
| | | private XpElectronicFenceAreaService xpElectronicFenceAreaService; |
| | | @Resource |
| | | private XpElectronicFenceService xpElectronicFenceService; |
| | | @Resource |
| | | private XpGeoFencingPolygonService xpGeoFencingPolygonService; |
| | | |
| | | |
| | | @ApiOperation(value = "获取所有运营中的区域", response = XpElectronicFenceArea.class) |
| | |
| | | @ResponseBody |
| | | @ApiOperation(value = "新增点位") |
| | | public R<XpPoint> add(@Validated @RequestBody PointAddDto pointAddDto) { |
| | | if (!xpGeoFencingPolygonService.isInFence(pointAddDto.getPointLon(), pointAddDto.getPointLat(), pointAddDto.getFenceId(), "prohibited_area")) { |
| | | return R.fail("in_prohibited_area"); |
| | | } |
| | | return R.ok(xpPointService.addPointWithGeneratedNumber(pointAddDto)); |
| | | } |
| | | |
| | |
| | | XpPoint xpPoint = xpPointService.getById(pointAddDto.getId()); |
| | | if (!xpPoint.getElectronicAreaId().equals(pointAddDto.getElectronicAreaId())) { |
| | | BeanUtils.copyProperties(pointAddDto, xpPoint); |
| | | |
| | | if (!xpGeoFencingPolygonService.isInFence(pointAddDto.getPointLon(), pointAddDto.getPointLat(), pointAddDto.getFenceId(), "prohibited_area")) { |
| | | return R.fail("in_prohibited_area"); |
| | | } |
| | | |
| | | xpPointService.updateById(xpPoint); |
| | | } else { |
| | | if (!xpGeoFencingPolygonService.isInFence(pointAddDto.getPointLon(), pointAddDto.getPointLat(), pointAddDto.getFenceId(), "prohibited_area")) { |
| | | return R.fail("in_prohibited_area"); |
| | | } |
| | | |
| | | //先删除原有的数据,因为会存在点位的从属区域变化的情况,所以先删除原有的数据后添加新的数据重新分片到新的库中 |
| | | BeanUtils.copyProperties(pointAddDto, xpPoint); |
| | | xpPointService.removeById(pointAddDto.getId()); |
| | |
| | | } |
| | | normalizeProhibitedAreaCountFilter(query); |
| | | PageInfo<XpElectronicFence> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | if (StringUtils.isEmpty(query.getCreateSort())&& StringUtils.isEmpty(query.getUpdateSort())){ |
| | | query.setCreateSort("2"); |
| | | } |
| | | List<XpElectronicFence> list = this.baseMapper.pageList(pageInfo, query); |
| | | if (list.isEmpty()) { |
| | | return new PageInfo<>(); |
| | |
| | | from xp_electronic_fence ef |
| | | left join xp_electronic_fence_area efa on efa.electronic_id = ef.id and efa.is_deleted = 0 |
| | | where ef.is_deleted = 0 |
| | | <if test="query.electronicNumberOrName != null"> |
| | | <if test="query.electronicNumberOrName != null and query.electronicNumberOrName != ''"> |
| | | and( ef.electronic_name like concat('%',#{query.electronicNumberOrName},'%') |
| | | or ef.electronic_number like concat('%',#{query.electronicNumberOrName},'%') |
| | | ) |
| | |
| | | having sum(case when efa.area_type = 2 then 1 else 0 end) <= #{query.prohibitedAreaCountMax} |
| | | </when> |
| | | </choose> |
| | | <if test="query.createSort != null and query.updateSort != null"> |
| | | order by |
| | | <if test="query.createSort == 1"> |
| | | ef.create_time asc, |
| | | </if> |
| | | <if test="query.createSort == 2"> |
| | | ef.create_time desc, |
| | | </if> |
| | | <if test="query.updateSort == 1"> |
| | | ef.update_time asc |
| | | </if> |
| | | <if test="query.updateSort == 2"> |
| | | ef.update_time desc |
| | | </if> |
| | | </if> |
| | | <if test="query.createSort != null"> |
| | | order by |
| | | <if test="query.createSort == 1"> |
| | | ef.create_time asc |
| | | </if> |
| | | <if test="query.createSort == 2"> |
| | | ef.create_time desc |
| | | </if> |
| | | </if> |
| | | <if test="query.updateSort != null"> |
| | | order by |
| | | <if test="query.updateSort == 1"> |
| | | ef.update_time asc |
| | | </if> |
| | | <if test="query.updateSort == 2"> |
| | | ef.update_time desc |
| | | </if> |
| | | </if> |
| | | <choose> |
| | | <when test="query.createSort == 1 or query.createSort == 2 or query.updateSort == 1 or query.updateSort == 2"> |
| | | <trim prefix="order by" suffixOverrides=","> |
| | | <if test="query.createSort == 1"> |
| | | ef.create_time asc, |
| | | </if> |
| | | <if test="query.createSort == 2"> |
| | | ef.create_time desc, |
| | | </if> |
| | | <if test="query.updateSort == 1"> |
| | | ef.update_time asc, |
| | | </if> |
| | | <if test="query.updateSort == 2"> |
| | | ef.update_time desc, |
| | | </if> |
| | | </trim> |
| | | </when> |
| | | <otherwise> |
| | | order by ef.update_time desc |
| | | </otherwise> |
| | | </choose> |
| | | |
| | | |
| | | </select> |
| | |
| | | |
| | | |
| | | @PostMapping("/base/v1/mini-program/navigation/route-and-fare") |
| | | @ApiOperation(value = "导航-获取路线和费用", tags = {"小程序-获取路线和费用"}, response = RouteAndFareVo.class) |
| | | @ApiOperation(value = "导航-获取路线和费用(弃用)", tags = {"小程序-获取路线和费用(弃用)"}, response = RouteAndFareVo.class) |
| | | @XpClientCheck(checkToken = false, checkOtpToken = true) |
| | | public R<RouteAndFareVo> getRouteAndFare(@RequestBody @Valid RouteAndFareDto routeAndFareDto, HttpServletRequest request) { |
| | | // uid已通过拦截器otp校验,可以直接使用 |
| | |
| | | |
| | | |
| | | @GetMapping("/base/v1/mini-program/pricing/rules/{openCityId}") |
| | | @ApiOperation(value = "获取费用规则", tags = {"小程序-根据开通城市获取费用规则"}, response = String.class) |
| | | @ApiOperation(value = "获取费用规则(弃用)", tags = {"小程序-根据开通城市获取费用规则(弃用)"}, response = String.class) |
| | | public R<?> getPricingRules(@PathVariable Long openCityId) { |
| | | XpPricing xpPricing = xpPricingService.getOne(new LambdaQueryWrapper<XpPricing>().eq(XpPricing::getCityId, openCityId).eq(XpPricing::getPricingType, 1).last("limit 1")); |
| | | if (xpPricing != null) { |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/v1/mini-program/pricing/getWaitTime") |
| | | @ApiOperation(value = "获取等待时间", tags = {"小程序-获取等待时间"}, response = Integer.class) |
| | | @ApiOperation(value = "获取等待时间(弃用)", tags = {"小程序-获取等待时间(弃用)"}, response = Integer.class) |
| | | public R<Integer> getWaitTime(@RequestBody LonLatDto dto) { |
| | | return R.ok(xpPricingService.getWaitTime(dto.getLongitude(), dto.getLatitude())); |
| | | } |
| | |
| | | * 播单 |
| | | */ |
| | | @PostMapping("/base/v1/mini-program/order/save") |
| | | @ApiOperation(value = "保存订单", tags = {"小程序-保存订单"}) |
| | | @ApiOperation(value = "保存订单(弃用)", tags = {"小程序-保存订单(弃用)"}) |
| | | @XpClientCheck(checkToken = false, checkOtpToken = true) |
| | | public R<SaveOrderVo> saveOrder(@RequestBody @Validated XpOrderDto dto, HttpServletRequest request) { |
| | | String uid = request.getHeader("XP-Uid"); |
| | |
| | | from xp_electronic_fence ef |
| | | left join xp_electronic_fence_area efa on efa.electronic_id = ef.id |
| | | where ef.is_deleted = 0 |
| | | <if test="query.electronicNumberOrName != null"> |
| | | <if test="query.electronicNumberOrName != null and query.electronicNumberOrName != ''"> |
| | | and( ef.electronic_name like concat('%',#{query.electronicNumberOrName},'%') |
| | | or ef.electronic_number like concat('%',#{query.electronicNumberOrName},'%') |
| | | ) |
| | |
| | | and #{query.updateEndTime} >= ef.update_time |
| | | </if> |
| | | group by ef.id |
| | | <if test="query.createSort != null and query.updateSort != null"> |
| | | order by |
| | | <if test="query.createSort == 1"> |
| | | ef.create_time asc, |
| | | </if> |
| | | <if test="query.createSort == 2"> |
| | | ef.create_time desc, |
| | | </if> |
| | | <if test="query.updateSort == 1"> |
| | | ef.update_time asc |
| | | </if> |
| | | <if test="query.updateSort == 2"> |
| | | ef.update_time desc |
| | | </if> |
| | | </if> |
| | | <if test="query.createSort != null"> |
| | | order by |
| | | <if test="query.createSort == 1"> |
| | | ef.create_time asc |
| | | </if> |
| | | <if test="query.createSort == 2"> |
| | | ef.create_time desc |
| | | </if> |
| | | </if> |
| | | <if test="query.updateSort != null"> |
| | | order by |
| | | <if test="query.updateSort == 1"> |
| | | ef.update_time asc |
| | | </if> |
| | | <if test="query.updateSort == 2"> |
| | | ef.update_time desc |
| | | </if> |
| | | </if> |
| | | <choose> |
| | | <when test="query.createSort == 1 or query.createSort == 2 or query.updateSort == 1 or query.updateSort == 2"> |
| | | <trim prefix="order by" suffixOverrides=","> |
| | | <if test="query.createSort == 1"> |
| | | ef.create_time asc, |
| | | </if> |
| | | <if test="query.createSort == 2"> |
| | | ef.create_time desc, |
| | | </if> |
| | | <if test="query.updateSort == 1"> |
| | | ef.update_time asc, |
| | | </if> |
| | | <if test="query.updateSort == 2"> |
| | | ef.update_time desc, |
| | | </if> |
| | | </trim> |
| | | </when> |
| | | <otherwise> |
| | | order by ef.update_time desc |
| | | </otherwise> |
| | | </choose> |
| | | |
| | | |
| | | </select> |
| | |
| | | } |
| | | this.setFieldValByName("createTime", LocalDateTime.now(), metaObject); |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | this.setFieldValByName("createBy", userName, metaObject); |
| | | } |
| | | |
| | | /** |