新增mybatisplus代码生成器
This commit is contained in:
1 parent
4ae8d364b9
commit
60a95160fe
198 files changed
+12403
-95
No files matched your search
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.api;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* REST API 响应码
|
||||
* </p>
|
||||
*
|
||||
* @author geekidea
|
||||
* @since 2018-11-08
|
||||
*/
|
||||
public enum ApiCode {
|
||||
|
||||
SUCCESS(200, "操作成功"),
|
||||
|
||||
UNAUTHORIZED(401, "非法访问"),
|
||||
|
||||
NOT_PERMISSION(403, "没有权限"),
|
||||
|
||||
NOT_FOUND(404, "你请求的路径不存在"),
|
||||
|
||||
FAIL(500, "操作失败"),
|
||||
|
||||
SYSTEM_EXCEPTION(5000,"系统异常!"),
|
||||
|
||||
PARAMETER_EXCEPTION(5001,"请求参数校验异常"),
|
||||
|
||||
PARAMETER_PARSE_EXCEPTION(5002,"请求参数解析异常"),
|
||||
|
||||
HTTP_MEDIA_TYPE_EXCEPTION(5003,"HTTP Media 类型异常"),
|
||||
|
||||
SYSTEM_LOGIN_EXCEPTION(5005,"系统登录异常")
|
||||
|
||||
;
|
||||
|
||||
private final int code;
|
||||
private final String msg;
|
||||
|
||||
ApiCode(final int code, final String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static ApiCode getApiCode(int code) {
|
||||
ApiCode[] ecs = ApiCode.values();
|
||||
for (ApiCode ec : ecs) {
|
||||
if (ec.getCode() == code) {
|
||||
return ec;
|
||||
}
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.api;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* ApiResultEST API 公共控制器
|
||||
* </p>
|
||||
*
|
||||
* @author geekidea
|
||||
* @since 2018-11-08
|
||||
*/
|
||||
@Slf4j
|
||||
public class ApiController {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 请求成功
|
||||
* </p>
|
||||
*
|
||||
* @param data 数据内容
|
||||
* @param <T> 对象泛型
|
||||
* @return
|
||||
*/
|
||||
protected <T> ApiResult<T> ok(T data) {
|
||||
return ApiResult.ok(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 请求失败
|
||||
* </p>
|
||||
*
|
||||
* @param msg 提示内容
|
||||
* @return
|
||||
*/
|
||||
protected ApiResult<Object> fail(String msg) {
|
||||
return ApiResult.fail(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 请求失败
|
||||
* </p>
|
||||
*
|
||||
* @param apiCode 请求错误码
|
||||
* @return
|
||||
*/
|
||||
protected ApiResult<Object> fail(ApiCode apiCode) {
|
||||
return ApiResult.fail(apiCode);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.api;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* REST API 返回结果
|
||||
* </p>
|
||||
*
|
||||
* @author geekidea
|
||||
* @since 2018-11-08
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
public class ApiResult<T> implements Serializable {
|
||||
|
||||
private int code;
|
||||
|
||||
private T data;
|
||||
|
||||
private String msg;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date time;
|
||||
|
||||
public ApiResult() {
|
||||
|
||||
}
|
||||
|
||||
public static ApiResult result(boolean flag){
|
||||
if (flag){
|
||||
return ok();
|
||||
}
|
||||
return fail("");
|
||||
}
|
||||
|
||||
public static ApiResult result(ApiCode apiCode){
|
||||
return result(apiCode,null);
|
||||
}
|
||||
|
||||
public static ApiResult result(ApiCode apiCode,Object data){
|
||||
return result(apiCode,null,data);
|
||||
}
|
||||
|
||||
public static ApiResult result(ApiCode apiCode,String msg,Object data){
|
||||
String message = apiCode.getMsg();
|
||||
if (StringUtils.isNotBlank(msg)){
|
||||
message = msg;
|
||||
}
|
||||
return ApiResult.builder()
|
||||
.code(apiCode.getCode())
|
||||
.msg(message)
|
||||
.data(data)
|
||||
.time(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static ApiResult ok(){
|
||||
return ok(null);
|
||||
}
|
||||
|
||||
public static ApiResult ok(Object data){
|
||||
return result(ApiCode.SUCCESS,data);
|
||||
}
|
||||
|
||||
public static ApiResult ok(String key,Object value){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put(key,value);
|
||||
return ok(map);
|
||||
}
|
||||
|
||||
public static ApiResult fail(ApiCode apiCode){
|
||||
return result(apiCode,null);
|
||||
}
|
||||
|
||||
public static ApiResult fail(String msg){
|
||||
return result(ApiCode.FAIL,msg,null);
|
||||
|
||||
}
|
||||
|
||||
public static ApiResult fail(ApiCode apiCode,Object data){
|
||||
if (ApiCode.SUCCESS == apiCode){
|
||||
throw new RuntimeException("失败结果状态码不能为" + ApiCode.SUCCESS.getCode());
|
||||
}
|
||||
return result(apiCode,data);
|
||||
|
||||
}
|
||||
|
||||
public static ApiResult fail(String key,Object value){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put(key,value);
|
||||
return result(ApiCode.FAIL,map);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.api;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.extension.api.IErrorCode;
|
||||
import com.baomidou.mybatisplus.extension.exceptions.ApiException;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* REST API 业务断言<br>
|
||||
* 参考:org.junit.Assert
|
||||
* </p>
|
||||
*
|
||||
* @author geekidea
|
||||
* @since 2018-11-08
|
||||
*/
|
||||
public class Assert {
|
||||
|
||||
protected Assert() {
|
||||
// to do noting
|
||||
}
|
||||
|
||||
/**
|
||||
* 大于O
|
||||
*/
|
||||
public static void gtZero(Integer num, IErrorCode errorCode) {
|
||||
if (num == null || num <= 0) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 大于等于O
|
||||
*/
|
||||
public static void geZero(Integer num, IErrorCode errorCode) {
|
||||
if (num == null || num < 0) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* num1大于num2
|
||||
*/
|
||||
public static void gt(Integer num1, Integer num2, IErrorCode errorCode) {
|
||||
if (num1 <= num2) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* num1大于等于num2
|
||||
*/
|
||||
public static void ge(Integer num1, Integer num2, IErrorCode errorCode) {
|
||||
if (num1 < num2) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* obj1 eq obj2
|
||||
*/
|
||||
public static void eq(Object obj1, Object obj2, IErrorCode errorCode) {
|
||||
if (!obj1.equals(obj2)) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isTrue(boolean condition, IErrorCode errorCode) {
|
||||
if (!condition) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isFalse(boolean condition, IErrorCode errorCode) {
|
||||
if (condition) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isNull(IErrorCode errorCode, Object... conditions) {
|
||||
if (ObjectUtils.isNotNull(conditions)) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
public static void notNull(IErrorCode errorCode, Object... conditions) {
|
||||
if (ObjectUtils.isNull(conditions)) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 失败结果
|
||||
* </p>
|
||||
*
|
||||
* @param errorCode 异常错误码
|
||||
*/
|
||||
public static void fail(IErrorCode errorCode) {
|
||||
throw new ApiException(errorCode);
|
||||
}
|
||||
|
||||
public static void fail(boolean condition, IErrorCode errorCode) {
|
||||
if (condition) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
public static void fail(String message) {
|
||||
throw new ApiException(message);
|
||||
}
|
||||
|
||||
public static void fail(boolean condition, String message) {
|
||||
if (condition) {
|
||||
Assert.fail(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void notEmpty(Object[] array, IErrorCode errorCode) {
|
||||
if (ObjectUtils.isEmpty(array)) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
public static void noNullElements(Object[] array, IErrorCode errorCode) {
|
||||
if (array != null) {
|
||||
for (Object element : array) {
|
||||
if (element == null) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void notEmpty(Collection<?> collection, IErrorCode errorCode) {
|
||||
if (CollectionUtils.isNotEmpty(collection)) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
public static void notEmpty(Map<?, ?> map, IErrorCode errorCode) {
|
||||
if (ObjectUtils.isEmpty(map)) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isInstanceOf(Class<?> type, Object obj, IErrorCode errorCode) {
|
||||
Assert.notNull(errorCode, type);
|
||||
if (!type.isInstance(obj)) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isAssignable(Class<?> superType, Class<?> subType, IErrorCode errorCode) {
|
||||
Assert.notNull(errorCode, superType);
|
||||
if (subType == null || !superType.isAssignableFrom(subType)) {
|
||||
Assert.fail(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.constant;
|
||||
|
||||
|
||||
public interface CacheKey {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.constant;
|
||||
|
||||
/**
|
||||
* 常量
|
||||
* @author geekidea
|
||||
* @date 2018-11-08
|
||||
*/
|
||||
public interface CommonConstant {
|
||||
|
||||
/**
|
||||
* 默认页码为1
|
||||
*/
|
||||
Integer DEFAULT_PAGE_INDEX = 1;
|
||||
|
||||
/**
|
||||
* 默认页大小为10
|
||||
*/
|
||||
Integer DEFAULT_PAGE_SIZE = 10;
|
||||
|
||||
/**
|
||||
* 登录用户
|
||||
*/
|
||||
String LOGIN_SYS_USER = "loginSysUser";
|
||||
|
||||
/**
|
||||
* 登陆token
|
||||
*/
|
||||
String TOKEN = "token";
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
String REFRESH_TOKEN = "refresh_token";
|
||||
|
||||
/**
|
||||
* 初始密码
|
||||
*/
|
||||
String INIT_PWD = "123456";
|
||||
|
||||
/**
|
||||
* 默认头像
|
||||
*/
|
||||
String DEFAULT_HEAD_URL = "";
|
||||
|
||||
/**
|
||||
* 管理员角色名称
|
||||
*/
|
||||
String ADMIN_ROLE_NAME = "管理员";
|
||||
|
||||
String ADMIN_LOGIN = "adminLogin";
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.constant;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* redis key 常量
|
||||
* </p>
|
||||
* @author geekidea
|
||||
* @date 2019-05-23
|
||||
**/
|
||||
public interface CommonRedisKey {
|
||||
|
||||
/**
|
||||
* 系统登录用户
|
||||
*/
|
||||
String LOGIN_SYS_USER = "login:sys:user:%s";
|
||||
/**
|
||||
* 系统登录token
|
||||
*/
|
||||
String LOGIN_TOKEN = "login:token";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.constant;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 日期格式常量
|
||||
* </p>
|
||||
* @author geekidea
|
||||
* @date 2018-11-08
|
||||
*/
|
||||
public interface DatePattern {
|
||||
|
||||
/**
|
||||
* 年-月-日
|
||||
*/
|
||||
String yyyy_MM_dd = "yyyy-MM-dd";
|
||||
/**
|
||||
* 年-月-日 时:分
|
||||
*/
|
||||
String yyyy_MM_dd_HH_mm = "yyyy-MM-dd HH:mm";
|
||||
/**
|
||||
* 年-月-日 时:分:秒
|
||||
*/
|
||||
String yyyy_MM_dd_HH_mm_ss = "yyyy-MM-dd HH:mm:ss";
|
||||
/**
|
||||
* 年-月-日 时:分:秒:毫秒
|
||||
*/
|
||||
String yyyy_MM_dd_HH_mm_ss_S = "yyyy-MM-dd HH:mm:ss.S";
|
||||
|
||||
/**
|
||||
* 时:分
|
||||
*/
|
||||
String HH_mm = "HH:mm";
|
||||
/**
|
||||
* 时:分:秒
|
||||
*/
|
||||
String HH_mm_ss = "HH:mm:ss";
|
||||
/**
|
||||
* 时:分:秒:毫秒
|
||||
*/
|
||||
String HH_mm_ss_S = "HH:mm:ss:S";
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
package com.ruoyi.app.common.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author geekidea
|
||||
* @date 2018-11-08
|
||||
*/
|
||||
@ApiModel("BaseEntity")
|
||||
public abstract class BaseEntity implements Serializable{
|
||||
}
|
||||
@@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.app.common.service.BaseService;
|
||||
import com.ruoyi.app.common.web.param.OrderQueryParam;
|
||||
import com.ruoyi.app.common.web.param.QueryParam;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -32,7 +34,33 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class BaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> implements BaseService<T> {
|
||||
|
||||
protected Page setPageParam(QueryParam queryParam) {
|
||||
return setPageParam(queryParam,null);
|
||||
}
|
||||
|
||||
protected Page setPageParam(QueryParam queryParam, OrderItem defaultOrder) {
|
||||
Page page = new Page();
|
||||
// 设置当前页码
|
||||
page.setCurrent(queryParam.getCurrent());
|
||||
// 设置页大小
|
||||
page.setSize(queryParam.getSize());
|
||||
/**
|
||||
* 如果是queryParam是OrderQueryParam,并且不为空,则使用前端排序
|
||||
* 否则使用默认排序
|
||||
*/
|
||||
if (queryParam instanceof OrderQueryParam){
|
||||
OrderQueryParam orderQueryParam = (OrderQueryParam) queryParam;
|
||||
List<OrderItem> orderItems = orderQueryParam.getOrders();
|
||||
if (CollectionUtils.isEmpty(orderItems)){
|
||||
page.setOrders(Arrays.asList(defaultOrder));
|
||||
}else{
|
||||
page.setOrders(orderItems);
|
||||
}
|
||||
}else{
|
||||
page.setOrders(Arrays.asList(defaultOrder));
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.web.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Api文档
|
||||
* </p>
|
||||
*
|
||||
* @author geekidea
|
||||
* @date 2018-11-08
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/docs")
|
||||
@ApiIgnore
|
||||
public class ApiDocController extends BaseController {
|
||||
|
||||
/**
|
||||
* swaggerUI
|
||||
*/
|
||||
@GetMapping("")
|
||||
public String swaggerUI(){
|
||||
return "redirect:/swagger-ui.html";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.web.controller;
|
||||
|
||||
import com.ruoyi.app.common.api.ApiController;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author geekidea
|
||||
* @date 2018-11-08
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class BaseController extends ApiController {
|
||||
|
||||
/**
|
||||
* 获取当前请求
|
||||
*
|
||||
* @return request
|
||||
*/
|
||||
public HttpServletRequest getRequest() {
|
||||
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
}
|
||||
/**
|
||||
* 获取当前请求
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public HttpServletResponse getResponse() {
|
||||
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.web.controller;
|
||||
|
||||
import com.ruoyi.app.common.api.ApiResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 项目根路径提示信息
|
||||
* </p>
|
||||
* @author geekidea
|
||||
* @date 2018/11/12
|
||||
*/
|
||||
@RestController
|
||||
@ApiIgnore
|
||||
@Slf4j
|
||||
public class IndexController {
|
||||
|
||||
@RequestMapping("/index")
|
||||
public ApiResult<String> index(){
|
||||
log.debug("index...");
|
||||
return ApiResult.ok("Welcome to Spring Boot Plus Project...");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.web.param;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author geekidea
|
||||
* @date 2018-11-08
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("ID参数")
|
||||
public class IdParam implements Serializable {
|
||||
private static final long serialVersionUID = -5353973980674510450L;
|
||||
|
||||
@NotBlank(message="ID不能为空")
|
||||
private String id;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.web.param;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author geekidea
|
||||
* @date 2018-11-08
|
||||
*/
|
||||
@ApiModel("主键状态VO")
|
||||
public class IdStatusParam implements Serializable {
|
||||
private static final long serialVersionUID = -7581307955242965701L;
|
||||
|
||||
@ApiModelProperty("主键ID")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("状态,1:启用 0:禁用")
|
||||
private Integer status;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IdStatusVo{" +
|
||||
"id='" + id + '\'' +
|
||||
", status=" + status +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.web.param;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 名称参数
|
||||
* @author geekidea
|
||||
* @date 2018-11-08
|
||||
*/
|
||||
@ApiModel("名称参数")
|
||||
public class NameParam implements Serializable {
|
||||
private static final long serialVersionUID = -3710501706034574149L;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NameParam{" +
|
||||
"name='" + name + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.web.param;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 可排序查询参数对象
|
||||
* @author geekidea
|
||||
* @since 2019-08-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("可排序查询参数对象")
|
||||
public abstract class OrderQueryParam extends QueryParam{
|
||||
private static final long serialVersionUID = 57714391204790143L;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private List<OrderItem> orders;
|
||||
|
||||
public void defaultOrder(OrderItem orderItem){
|
||||
this.defaultOrders(Arrays.asList(orderItem));
|
||||
}
|
||||
|
||||
public void defaultOrders(List<OrderItem> orderItems){
|
||||
if (CollectionUtils.isEmpty(orderItems)){
|
||||
return;
|
||||
}
|
||||
this.orders = orderItems;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.web.param;
|
||||
|
||||
import com.ruoyi.app.common.constant.CommonConstant;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 查询参数
|
||||
* @author geekidea
|
||||
* @since 2018-11-08
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("查询参数对象")
|
||||
public abstract class QueryParam implements Serializable{
|
||||
private static final long serialVersionUID = -3263921252635611410L;
|
||||
|
||||
@ApiModelProperty(value = "页码,默认为1")
|
||||
private Integer current = CommonConstant.DEFAULT_PAGE_INDEX;
|
||||
@ApiModelProperty(value = "页大小,默认为10")
|
||||
private Integer size = CommonConstant.DEFAULT_PAGE_SIZE;
|
||||
@ApiModelProperty(value = "搜索字符串")
|
||||
private String keyword;
|
||||
|
||||
public void setCurrent(Integer current) {
|
||||
if (current == null || current <= 0){
|
||||
this.current = CommonConstant.DEFAULT_PAGE_INDEX;
|
||||
}else{
|
||||
this.current = current;
|
||||
}
|
||||
}
|
||||
|
||||
public void setSize(Integer size) {
|
||||
if (size == null || size <= 0){
|
||||
this.size = CommonConstant.DEFAULT_PAGE_SIZE;
|
||||
}else{
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.web.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 公共ID-NAME-VO对象
|
||||
* </p>
|
||||
* @author geekidea
|
||||
* @since 2018-11-08
|
||||
*/
|
||||
@ApiModel("ID-NAME-VO")
|
||||
public class CommonIdName {
|
||||
|
||||
@ApiModelProperty("id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public CommonIdName(String id, String name) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public CommonIdName() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CommonIdName [id=" + id + ", name=" + name + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.ruoyi.app.common.web.vo;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author geekidea
|
||||
* @date 2018-11-08
|
||||
*/
|
||||
@ApiModel("分页")
|
||||
public class Paging<T> implements Serializable {
|
||||
private static final long serialVersionUID = -1683800405530086022L;
|
||||
|
||||
@ApiModelProperty("总行数")
|
||||
@JSONField(name = "total")
|
||||
@JsonProperty("total")
|
||||
private long total = 0;
|
||||
|
||||
@ApiModelProperty("数据列表")
|
||||
@JSONField(name = "records")
|
||||
@JsonProperty("records")
|
||||
private List<T> records = Collections.emptyList();
|
||||
|
||||
public Paging() {
|
||||
}
|
||||
|
||||
public Paging(IPage page) {
|
||||
this.total = page.getTotal();
|
||||
this.records = page.getRecords();
|
||||
}
|
||||
|
||||
public long getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(long total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public List<T> getRecords() {
|
||||
return records;
|
||||
}
|
||||
|
||||
public void setRecords(List<T> records) {
|
||||
this.records = records;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Paging{" +
|
||||
"total=" + total +
|
||||
", records=" + records +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package com.ruoyi.app.modular.distribution.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.ruoyi.app.common.entity.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代发货表
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value="StoreSubstitute对象", description="代发货表")
|
||||
public class StoreSubstitute extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "收货人姓名")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "收货手机号")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "城市信息")
|
||||
private String cityInfo;
|
||||
|
||||
@ApiModelProperty(value = "收货详细地址")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty(value = "产品明细")
|
||||
private String productInfo;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Integer createTime;
|
||||
|
||||
private Date updatedAt;
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.ruoyi.app.modular.distribution.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.app.modular.distribution.entity.StoreSubstitute;
|
||||
import com.ruoyi.app.distribution.web.param.StoreSubstituteQueryParam;
|
||||
import com.ruoyi.app.distribution.web.vo.StoreSubstituteQueryVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代发货表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-30
|
||||
*/
|
||||
@Repository
|
||||
public interface StoreSubstituteMapper extends BaseMapper<StoreSubstitute> {
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
StoreSubstituteQueryVo getStoreSubstituteById(Serializable id);
|
||||
|
||||
/**
|
||||
* 获取分页对象
|
||||
* @param page
|
||||
* @param storeSubstituteQueryParam
|
||||
* @return
|
||||
*/
|
||||
IPage<StoreSubstituteQueryVo> getStoreSubstitutePageList(@Param("page") Page page, @Param("param") StoreSubstituteQueryParam storeSubstituteQueryParam);
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.ruoyi.app.modular.distribution.service;
|
||||
|
||||
import com.ruoyi.app.modular.distribution.entity.StoreSubstitute;
|
||||
import com.ruoyi.app.common.service.BaseService;
|
||||
import com.ruoyi.app.distribution.web.param.StoreSubstituteQueryParam;
|
||||
import com.ruoyi.app.distribution.web.vo.StoreSubstituteQueryVo;
|
||||
import com.ruoyi.app.common.web.vo.Paging;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代发货表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-30
|
||||
*/
|
||||
public interface StoreSubstituteService extends BaseService<StoreSubstitute> {
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
StoreSubstituteQueryVo getStoreSubstituteById(Serializable id) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取分页对象
|
||||
* @param storeSubstituteQueryParam
|
||||
* @return
|
||||
*/
|
||||
Paging<StoreSubstituteQueryVo> getStoreSubstitutePageList(StoreSubstituteQueryParam storeSubstituteQueryParam) throws Exception;
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.ruoyi.app.modular.distribution.service.impl;
|
||||
|
||||
import com.ruoyi.app.modular.distribution.entity.StoreSubstitute;
|
||||
import com.ruoyi.app.modular.distribution.mapper.StoreSubstituteMapper;
|
||||
import com.ruoyi.app.modular.distribution.service.StoreSubstituteService;
|
||||
import com.ruoyi.app.distribution.web.param.StoreSubstituteQueryParam;
|
||||
import com.ruoyi.app.distribution.web.vo.StoreSubstituteQueryVo;
|
||||
import com.ruoyi.app.common.service.impl.BaseServiceImpl;
|
||||
import com.ruoyi.app.common.web.vo.Paging;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代发货表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-30
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class StoreSubstituteServiceImpl extends BaseServiceImpl<StoreSubstituteMapper, StoreSubstitute> implements StoreSubstituteService {
|
||||
|
||||
@Autowired
|
||||
private StoreSubstituteMapper storeSubstituteMapper;
|
||||
|
||||
@Override
|
||||
public StoreSubstituteQueryVo getStoreSubstituteById(Serializable id) throws Exception{
|
||||
return storeSubstituteMapper.getStoreSubstituteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<StoreSubstituteQueryVo> getStoreSubstitutePageList(StoreSubstituteQueryParam storeSubstituteQueryParam) throws Exception{
|
||||
Page page = setPageParam(storeSubstituteQueryParam,OrderItem.desc("create_time"));
|
||||
IPage<StoreSubstituteQueryVo> iPage = storeSubstituteMapper.getStoreSubstitutePageList(page,storeSubstituteQueryParam);
|
||||
return new Paging(iPage);
|
||||
}
|
||||
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package com.ruoyi.app.modular.distribution.web.controller;
|
||||
|
||||
import com.ruoyi.app.modular.distribution.entity.StoreSubstitute;
|
||||
import com.ruoyi.app.modular.distribution.service.StoreSubstituteService;
|
||||
import com.ruoyi.app.distribution.web.param.StoreSubstituteQueryParam;
|
||||
import com.ruoyi.app.distribution.web.vo.StoreSubstituteQueryVo;
|
||||
import com.ruoyi.app.common.web.controller.BaseController;
|
||||
import com.ruoyi.app.common.api.ApiResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.ruoyi.app.common.web.vo.Paging;
|
||||
import com.ruoyi.app.common.web.param.IdParam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代发货表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-30
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/storeSubstitute")
|
||||
@Api("代发货表 API")
|
||||
public class StoreSubstituteController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private StoreSubstituteService storeSubstituteService;
|
||||
|
||||
/**
|
||||
* 添加代发货表
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value = "添加StoreSubstitute对象",notes = "添加代发货表",response = ApiResult.class)
|
||||
public ApiResult<Boolean> addStoreSubstitute(@Valid @RequestBody StoreSubstitute storeSubstitute) throws Exception{
|
||||
boolean flag = storeSubstituteService.save(storeSubstitute);
|
||||
return ApiResult.result(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改代发货表
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperation(value = "修改StoreSubstitute对象",notes = "修改代发货表",response = ApiResult.class)
|
||||
public ApiResult<Boolean> updateStoreSubstitute(@Valid @RequestBody StoreSubstitute storeSubstitute) throws Exception{
|
||||
boolean flag = storeSubstituteService.updateById(storeSubstitute);
|
||||
return ApiResult.result(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除代发货表
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation(value = "删除StoreSubstitute对象",notes = "删除代发货表",response = ApiResult.class)
|
||||
public ApiResult<Boolean> deleteStoreSubstitute(@Valid @RequestBody IdParam idParam) throws Exception{
|
||||
boolean flag = storeSubstituteService.removeById(idParam.getId());
|
||||
return ApiResult.result(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取代发货表
|
||||
*/
|
||||
@PostMapping("/info")
|
||||
@ApiOperation(value = "获取StoreSubstitute对象详情",notes = "查看代发货表",response = StoreSubstituteQueryVo.class)
|
||||
public ApiResult<StoreSubstituteQueryVo> getStoreSubstitute(@Valid @RequestBody IdParam idParam) throws Exception{
|
||||
StoreSubstituteQueryVo storeSubstituteQueryVo = storeSubstituteService.getStoreSubstituteById(idParam.getId());
|
||||
return ApiResult.ok(storeSubstituteQueryVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 代发货表分页列表
|
||||
*/
|
||||
@PostMapping("/getPageList")
|
||||
@ApiOperation(value = "获取StoreSubstitute分页列表",notes = "代发货表分页列表",response = StoreSubstituteQueryVo.class)
|
||||
public ApiResult<Paging<StoreSubstituteQueryVo>> getStoreSubstitutePageList(@Valid @RequestBody(required = false) StoreSubstituteQueryParam storeSubstituteQueryParam) throws Exception{
|
||||
Paging<StoreSubstituteQueryVo> paging = storeSubstituteService.getStoreSubstitutePageList(storeSubstituteQueryParam);
|
||||
return ApiResult.ok(paging);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.app.distribution.web.param;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import com.ruoyi.app.common.web.param.QueryParam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代发货表 查询参数对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2019-09-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value="StoreSubstituteQueryParam对象", description="代发货表查询参数")
|
||||
public class StoreSubstituteQueryParam extends QueryParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.ruoyi.app.distribution.web.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代发货表 查询结果对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2019-09-30
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="StoreSubstituteQueryVo对象", description="代发货表查询参数")
|
||||
public class StoreSubstituteQueryVo implements Serializable{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "收货人姓名")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "收货手机号")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "城市信息")
|
||||
private String cityInfo;
|
||||
|
||||
@ApiModelProperty(value = "收货详细地址")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty(value = "产品明细")
|
||||
private String productInfo;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Integer createTime;
|
||||
|
||||
private Date updatedAt;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?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.app.modular.distribution.mapper.StoreSubstituteMapper">
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, user_id, username, phone, city_info, address, product_info, create_time, updated_at
|
||||
</sql>
|
||||
|
||||
<select id="getStoreSubstituteById" resultType="com.ruoyi.app.distribution.web.vo.StoreSubstituteQueryVo">
|
||||
select <include refid="Base_Column_List"/> from store_substitute where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getStoreSubstitutePageList" resultType="com.ruoyi.app.distribution.web.vo.StoreSubstituteQueryVo">
|
||||
select <include refid="Base_Column_List"/> from store_substitute
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?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.app.modular.distribution.mapper.StoreSubstituteMapper">
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, user_id, username, phone, city_info, address, product_info, create_time, updated_at
|
||||
</sql>
|
||||
|
||||
<select id="getStoreSubstituteById" resultType="com.ruoyi.app.modular.distribution.web.vo.StoreSubstituteQueryVo">
|
||||
select <include refid="Base_Column_List"/> from store_substitute where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getStoreSubstitutePageList" resultType="com.ruoyi.app.modular.distribution.web.vo.StoreSubstituteQueryVo">
|
||||
select <include refid="Base_Column_List"/> from store_substitute
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in new issue
Block a user