Merge branch 'feature/resource' of https://gitea.qinmian.online/CY/mcwl-ai into preview

# Conflicts:
#	mcwl-admin/src/main/resources/application.yml
feature/comment
ChenYan 2025-01-02 14:21:26 +08:00
commit 1f05411e72
16 changed files with 124 additions and 870 deletions

View File

@ -67,6 +67,12 @@
<artifactId>mcwl-myInvitation</artifactId> <artifactId>mcwl-myInvitation</artifactId>
<version>3.8.8</version> <version>3.8.8</version>
</dependency> </dependency>
<!-- 公共模块-->
<dependency>
<groupId>com.mcwl</groupId>
<artifactId>mcwl-common</artifactId>
<version>3.8.8</version>
</dependency>
<!-- 资源中心模块--> <!-- 资源中心模块-->
<dependency> <dependency>
<groupId>com.mcwl</groupId> <groupId>com.mcwl</groupId>

View File

@ -1,16 +1,11 @@
package com.mcwl.web.controller.resource; package com.mcwl.web.controller.resource;
import com.mcwl.common.annotation.Anonymous;
import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.resource.domain.MallProduct; import com.mcwl.resource.domain.MallProduct;
import com.mcwl.resource.service.MallProductService; import com.mcwl.resource.service.MallProductService;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@ -22,6 +17,7 @@ import java.util.List;
* @Description * @Description
* @Date2024/12/31 10:48 * @Date2024/12/31 10:48
*/ */
@RestController @RestController
@RequestMapping("/MallProduct") @RequestMapping("/MallProduct")
public class MallProductController extends BaseController { public class MallProductController extends BaseController {
@ -34,6 +30,56 @@ public class MallProductController extends BaseController {
} }
/**
*
*/
@GetMapping("/list")
public TableDataInfo list(MallProduct sysJob)
{
startPage();
List<MallProduct> list = mallProductRuleInfoService.selectMallProductList(sysJob);
return getDataTable(list);
}
/**
*
*/
@GetMapping(value = "/{jobId}")
public AjaxResult getInfo(@PathVariable("jobId") Long jobId)
{
return success(mallProductRuleInfoService.selectMallProductById(jobId));
}
/**
*
*/
@PostMapping("/add")
public AjaxResult add(@RequestBody MallProduct mallProduct)
{
mallProduct.setCreateBy(getUsername());
return toAjax(mallProductRuleInfoService.insertMallProduct(mallProduct));
}
/**
*
*/
@PutMapping("/upda")
public AjaxResult edit(@RequestBody MallProduct mallProduct)
{
mallProduct.setUpdateBy(getUsername());
return toAjax(mallProductRuleInfoService.updateMallProduct(mallProduct));
}
/**
*
*/
@DeleteMapping("/{ids}")
public AjaxResult remove(@RequestBody Long[] ids)
{
mallProductRuleInfoService.deleteMallProductByIds(ids);
return success();
}
} }

View File

@ -121,8 +121,6 @@ mybatis-plus:
# 关闭日志记录 (可单纯使用 p6spy 分析) org.apache.ibatis.logging.nologging.NoLoggingImpl # 关闭日志记录 (可单纯使用 p6spy 分析) org.apache.ibatis.logging.nologging.NoLoggingImpl
# 默认日志输出 org.apache.ibatis.logging.slf4j.Slf4jImpl # 默认日志输出 org.apache.ibatis.logging.slf4j.Slf4jImpl
logImpl: org.apache.ibatis.logging.slf4j.Slf4jImpl logImpl: org.apache.ibatis.logging.slf4j.Slf4jImpl
# 枚举处理器
default-enum-type-handler: com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler
global-config: global-config:
# 是否打印 Logo banner # 是否打印 Logo banner
banner: false banner: false

View File

@ -20,6 +20,7 @@ public class BaseEntity implements Serializable
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 搜索值 */ /** 搜索值 */
@TableField(exist = false)
@JsonIgnore @JsonIgnore
@TableField(exist = false) @TableField(exist = false)
private String searchValue; private String searchValue;
@ -42,6 +43,7 @@ public class BaseEntity implements Serializable
private String remark; private String remark;
/** 请求参数 */ /** 请求参数 */
@TableField(exist = false)
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonInclude(JsonInclude.Include.NON_EMPTY)
@TableField(exist = false) @TableField(exist = false)
private Map<String, Object> params; private Map<String, Object> params;

View File

@ -1,220 +0,0 @@
/*
* Copyright (c) 2018-2999 广 All rights reserved.
*
* https://www.mall4j.com/
*
*
*
*
*/
package com.mcwl.common.domain.response;
import com.mcwl.common.i18n.I18nMessage;
/**
* @author FrozenWatermelon
* @date 2020/7/9
*/
public enum ResponseEnum {
/**
* ok
*/
OK("00000", "ok"),
/**
*
*/
SHOW_FAIL("A00001", ""),
/**
*
*/
SHOW_SUCCESS("A00002", ""),
/**
*
*/
UNAUTHORIZED("A00004", "Unauthorized"),
/**
*
*/
EXCEPTION("A00005", "服务器出了点小差"),
/**
* TempUid
*
* 1. tempUid
* 2. localstorage tempUid
* codetempUid
*/
TEMP_UID_ERROR("A00012", "TempUid Error"),
/**
*
*/
NOT_FOUND("A00013", "接口不存在"),
/**
*
*/
METHOD_ARGUMENT_NOT_VALID("A00014", "方法参数没有校验"),
/**
*
*/
PAY_PASSWORD_ERROR("A00015", I18nMessage.getMessage("yami.user.pay.password.error")),
SCANCODE_PAY_ERROR("A00016", "扫描支付发生错误"),
NEW_USER_NO_INVITOR_ERROR("A00017", "新注册用户必须填写邀请码"),
NEW_USER_INVITOR_ERROR("A00018", "邀请码错误"),
/**
* 01
*
*/
// SPU_NOT_EXIST("A01000", "商品不存在"),
/**
* 02
*/
// SHOP_CART_NOT_EXIST("A02000", "商品已下架"),
/**
* 03
*/
API_ORDER_NOT_EXIST("A03000", "订单不存在"),
ORDER_BUSY("A03001", "订单繁忙,请稍后再试"),
/**
*
*/
ORDER_DELIVERY_NOT_SUPPORTED("A03001", "The delivery method is not supported"),
/**
*
* 1.
* 2.
*/
REPEAT_ORDER("A03002", "订单已过期,请重新下单"),
/**
*
*/
COUPON_CANNOT_USE_TOGETHER("A03003", "优惠券不能共用"),
/**
*
*/
COUPON_OF_RMRT_GT_ORDER("A03004", "代金券金额超过了订单金额"),
/**
* bodyskuidskuId
*/
NOT_STOCK("A03010", "not stock"),
/**
*
*/
SOCIAL_ACCOUNT_BIND_BY_OTHER("A04002", "social account bind by other"),
/**
*
*/
DESTROY_USER_FAIL("A05000", "您的账户当前有未完成的订单,请待所有订单完成后再注销账户"),
/**
*
*/
DELIVERY_OVER("A07001", ""),
/**
*
*/
ACCOUNT_REPEAT("P01001", "账号已经被使用"),
ACCOUNT_NOT_EXIT("P01002", "账号不存在"),
ACCOUNT_NOT_ROLE("P01003", "账号不存在角色"),
ACCOUNT_STATUS_ERROR("P01004", "账号被锁"),
ACCOUNT_NOT_AREA("P01005", "账号没绑定经营地区"),
ACCOUNT_CREATE_ERROR("P01006", "账号创建失败"),
ACCOUNT_NO_MENU("P01007", "账号无菜单权限"),
PUSH_ID_NO_ACCOUNT("P01008", "该id无账号"),
ACCOUNT_ERROR("P01009", "账号权限错误"),
QUERY_TYPE_ERROR("P01010", "分页查询用户类型有误"),
// P02 钱包类
PUSH_USER_WALLET_NOT_EXIST("P02001", "用户钱包不存在"),
ORDER_NOT_EXIST("P02002", "订单不存在"),
NOT_SCANCODE_ORDER("P02003", "订单不是扫码下单"),
NOT_PAY_ORDER("P02004", "订单为未支付完成"),
ACTUAL_PAY_LITTLE_ORDER("P02005", "订单支付金额小于1元不进行分成"),
NOT_BIND_ORDER("P02006", "订单商家未被推客绑定,不进行分成"),
PUSH_ERR("P02007", "分成失败"),
ACCOUNT_WX_BIND("P02101","改用户已经绑定openid" ),
WX_APPID_SECRET_ERR("P02102","获取配置的appid错误" ),
WITHDRAW_EXCESS_ERROR("P02005", "提现金额超出可提现额度"),
SHOP_BANK_CARD_NOT_EXIST("P02006", "银行卡不存在"),
SHOP_BANK_CARD_STATE_ERROR("P02007", "申请提现银行卡状态错误"),
SHOP_BANK_ACCOUNT_ERROR("P02008", "注册新生账号异常"),
SHOP_BANK_BIND_CONFIRM("P02010", "请输入验证码绑定银行卡"),
/**
* C
*/
ACCESS_TOKEN_ERR("C01001", "获取access_token失败"),
TICKET_ERR("C01002", "获取ticket失败"),
GENERATE_URL_LINK_ERR("C01003", "创建URLLink失败"),
GET_WX_CODE_SESSION_ERR("C01004", "微信登录凭证校验败"),
DATA_EXISTS("C01009", "数据已存在"),
DATA_NOT_CHANGE_ABLE("C01010", "数据不可变更"),
/**
*
*/
RPC_CALL_EXCEPTION("A08001", ""),
/**
*
*/
RPC_CALL_HTTP_EXCEPTION("A08002", ""),
BAIDU_MAP_CONVERT_ERROR("A08003","百度地图接口调用错误" ),
/**
* T
*/
REPEAT_ACTIVITY_SUB_ITEM("T00001", "重复的活动子项目"),;
private final String code;
private final String msg;
public String value() {
return code;
}
public String getMsg() {
return msg;
}
ResponseEnum(String code, String msg) {
this.code = code;
this.msg = msg;
}
@Override
public String toString() {
return "ResponseEnum{" + "code='" + code + '\'' + ", msg='" + msg + '\'' + "} " + super.toString();
}
}

View File

@ -1,215 +0,0 @@
/*
* Copyright (c) 2018-2999 广 All rights reserved.
*
* https://www.mall4j.com/
*
*
*
*
*/
package com.mcwl.common.domain.response;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.mcwl.common.config.serializer.SensitiveJsonSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
import java.util.Objects;
/**
*
* @author mcwl
*/
public class ServerResponseEntity<T> implements Serializable {
private static final Logger log = LoggerFactory.getLogger(ServerResponseEntity.class);
/**
*
*/
@Schema(description = "状态码" ) private String code;
/**
*
*/
@Schema(description = "信息" ) private String msg;
/**
*
*/
@Schema(description = "数据" )
@JsonSerialize(using = SensitiveJsonSerializer.class)
private T data;
/**
*
*/
private String version;
/**
*
*/
private Long timestamp;
private String sign;
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public ServerResponseEntity setData(T data) {
this.data = data;
return this;
}
public Long getTimestamp() {
return timestamp;
}
public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public boolean isSuccess() {
return Objects.equals(ResponseEnum.OK.value(), this.code);
}
public boolean isFail() {
return !Objects.equals(ResponseEnum.OK.value(), this.code);
}
public ServerResponseEntity() {
// 版本号
this.version = "mall4j.v231204";
}
public static <T> ServerResponseEntity<T> success(T data) {
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
serverResponseEntity.setData(data);
serverResponseEntity.setCode(ResponseEnum.OK.value());
return serverResponseEntity;
}
public static <T> ServerResponseEntity<T> success() {
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
serverResponseEntity.setCode(ResponseEnum.OK.value());
serverResponseEntity.setMsg(ResponseEnum.OK.getMsg());
return serverResponseEntity;
}
public static <T> ServerResponseEntity<T> success(Integer code, T data) {
return success(String.valueOf(code), data);
}
public static <T> ServerResponseEntity<T> success(String code, T data) {
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
serverResponseEntity.setCode(code);
serverResponseEntity.setData(data);
return serverResponseEntity;
}
/**
*
* @param msg
* @return
*/
public static <T> ServerResponseEntity<T> showFailMsg(String msg) {
log.error(msg);
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
serverResponseEntity.setMsg(msg);
serverResponseEntity.setCode(ResponseEnum.SHOW_FAIL.value());
return serverResponseEntity;
}
public static <T> ServerResponseEntity<T> fail(ResponseEnum responseEnum) {
log.error(responseEnum.toString());
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
serverResponseEntity.setMsg(responseEnum.getMsg());
serverResponseEntity.setCode(responseEnum.value());
return serverResponseEntity;
}
public static <T> ServerResponseEntity<T> fail(ResponseEnum responseEnum, T data) {
log.error(responseEnum.toString());
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
serverResponseEntity.setMsg(responseEnum.getMsg());
serverResponseEntity.setCode(responseEnum.value());
serverResponseEntity.setData(data);
return serverResponseEntity;
}
public static <T> ServerResponseEntity<T> fail(String code, String msg, T data) {
log.error(msg);
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
serverResponseEntity.setMsg(msg);
serverResponseEntity.setCode(code);
serverResponseEntity.setData(data);
return serverResponseEntity;
}
public static <T> ServerResponseEntity<T> fail(String code, String msg) {
return fail(code, msg, null);
}
public static <T> ServerResponseEntity<T> fail(Integer code, T data) {
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
serverResponseEntity.setCode(String.valueOf(code));
serverResponseEntity.setData(data);
return serverResponseEntity;
}
@SuppressWarnings("unchecked")
public static <T> ServerResponseEntity<T> transform(ServerResponseEntity<?> oldServerResponseEntity) {
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
serverResponseEntity.setMsg(oldServerResponseEntity.getMsg());
serverResponseEntity.setCode(oldServerResponseEntity.getCode());
serverResponseEntity.setData((T) oldServerResponseEntity.getData());
log.error(serverResponseEntity.toString());
return serverResponseEntity;
}
@Override
public String toString() {
return "ServerResponseEntity{" +
"code='" + code + '\'' +
", msg='" + msg + '\'' +
", data=" + data +
", version='" + version + '\'' +
", timestamp=" + timestamp +
", sign='" + sign + '\'' +
'}';
}
}

View File

@ -1,60 +0,0 @@
/*
* Copyright (c) 2018-2999 广 All rights reserved.
*
* https://www.mall4j.com/
*
*
*
*
*/
package com.mcwl.common.exception;
import com.mcwl.common.domain.response.ResponseEnum;
import lombok.Getter;
/**
*
* @author mcwl
*/
@Getter
public class YamiBizException extends RuntimeException{
/**
*
*/
private static final long serialVersionUID = -4137688758944857209L;
/**
* http
*/
private String code;
/**
* @param responseEnum http
*/
public YamiBizException(ResponseEnum responseEnum) {
super(responseEnum.getMsg());
this.code = responseEnum.value();
}
/**
* @param responseEnum http
*/
public YamiBizException(ResponseEnum responseEnum, String msg) {
super(msg);
this.code = responseEnum.value();
}
public YamiBizException(String msg) {
// super(msg);
super(msg);
this.code = ResponseEnum.SHOW_FAIL.value();
}
public YamiBizException(String code,String msg) {
// super(msg);
super(msg);
this.code = code;
}
}

View File

@ -1,74 +0,0 @@
/*
* Copyright (c) 2018-2999 广 All rights reserved.
*
* https://www.mall4j.com/
*
*
*
*
*/
package com.mcwl.common.exception;
import com.mcwl.common.domain.response.ResponseEnum;
import com.mcwl.common.domain.response.ServerResponseEntity;
import com.mcwl.common.i18n.I18nMessage;
import lombok.Getter;
/**
*
* @author mcwl
*/
@Getter
public class YamiShopBindException extends RuntimeException{
/**
*
*/
private static final long serialVersionUID = -4137688758944857209L;
/**
* http
*/
private String code;
private Object object;
private ServerResponseEntity<?> serverResponseEntity;
/**
* @param responseEnum http
*/
public YamiShopBindException(ResponseEnum responseEnum) {
super(responseEnum.getMsg());
this.code = responseEnum.value();
}
/**
* @param responseEnum http
*/
public YamiShopBindException(ResponseEnum responseEnum, String msg) {
super(I18nMessage.getMessage(msg));
this.code = responseEnum.value();
}
public YamiShopBindException(ServerResponseEntity<?> serverResponseEntity) {
this.serverResponseEntity = serverResponseEntity;
}
public YamiShopBindException(String msg) {
// super(msg);
super(I18nMessage.getMessage(msg));
this.code = ResponseEnum.SHOW_FAIL.value();
}
public YamiShopBindException(String msg, Object object) {
super(I18nMessage.getMessage(msg));
this.code = ResponseEnum.SHOW_FAIL.value();
this.object = object;
}
public YamiShopBindException(String code, String msg) {
super(I18nMessage.getMessage(msg));
this.code = code;
}
}

View File

@ -1,144 +0,0 @@
/*
* Copyright (c) 2018-2999 广 All rights reserved.
*
* https://www.mall4j.com/
*
*
*
*
*/
package com.mcwl.common.i18n;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import java.io.IOException;
import java.util.Locale;
import java.util.Objects;
/**
*
* @author mcwl
*/
@Slf4j
public class I18nMessage {
private static MessageSourceAccessor accessor;
// private static final String BASE_FOLDE = "i18n";
private static final String BASE_NAME = "i18n/messages";
static{
ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource = new ReloadableResourceBundleMessageSource();
reloadableResourceBundleMessageSource.setBasenames(BASE_NAME);
reloadableResourceBundleMessageSource.setCacheSeconds(5);
reloadableResourceBundleMessageSource.setDefaultEncoding("UTF-8");
accessor = new MessageSourceAccessor(reloadableResourceBundleMessageSource);
}
// /**
// * 获取一条语言配置信息
// *
// * @param message 配置信息属性名,eg: api.response.code.user.signUp
// * @return
// */
// public static String getMessage(String message) {
// Locale locale = LocaleContextHolder.getLocale();
// return I18nMessage.accessor.getMessage(message,locale);
// }
/**
*
*
* @param message ,eg: api.response.code.user.signUp
* @return
*/
public static String getMessage(String message) {
Locale locale = LocaleContextHolder.getLocale();
try {
return accessor.getMessage(message,locale);
}catch (Exception e){
return message;
}
}
/**
*
*
* @return
* @throws IOException
*/
public static Integer getLang() {
Locale locale = LocaleContextHolder.getLocale();
return LanguageEnum.valueOf(locale).getLang();
}
/**
* (pc)
*
* @return
* @throws IOException
*/
public static Integer getDbLang() {
Integer lang = getLang();
if (Objects.equals(lang, 0)) {
return LanguageEnum.LANGUAGE_ZH_CN.getLang();
}
return lang;
}
// /**
// * 获取文件夹下所有的国际化文件名
// *
// * @param folderName 文件名
// * @return
// * @throws IOException
// */
// private static String[] getAllBaseNames(final String folderName) throws IOException {
// URL url = Thread.currentThread().getContextClassLoader()
// .getResource(folderName);
// if (null == url) {
// throw new RuntimeException("无法获取资源文件路径");
// }
//
// List<String> baseNames = new ArrayList<>();
// if (url.getProtocol().equalsIgnoreCase("file")) {
// // 文件夹形式,用File获取资源路径
// File file = new File(url.getFile());
// if (file.exists() && file.isDirectory()) {
// baseNames = Files.walk(file.toPath())
// .filter(path -> path.toFile().isFile())
// .map(Path::toString)
// .map(path -> path.substring(path.indexOf(folderName)))
// .map(I18nMessage::getI18FileName)
// .distinct()
// .collect(Collectors.toList());
// } else {
// log.error("指定的baseFile不存在或者不是文件夹");
// }
// }
// return baseNames.toArray(new String[0]);
// }
//
// /**
// * 把普通文件名转换成国际化文件名
// *
// * @param filename
// * @return
// */
// private static String getI18FileName(String filename) {
// filename = filename.replace(".properties", "");
//// for (int i = 0; i < 2; i++) {
//// int index = filename.lastIndexOf("_");
//// if (index != -1) {
//// filename = filename.substring(0, index);
//// }
//// }
// return filename.replace("\\", "/");
// }
}

View File

@ -1,99 +0,0 @@
/*
* Copyright (c) 2018-2999 广 All rights reserved.
*
* https://www.mall4j.com/
*
*
*
*
*/
package com.mcwl.common.utils;
import cn.hutool.core.util.StrUtil;
import com.mcwl.common.exception.YamiShopBindException;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;
/**
*
*/
public class ImageUtil {
private static final String JPG = "jpg";
private static final String JPEG = "jpeg";
/**
*
* @param imgUrl
* @return
*/
public static byte[] imgToBinary(String imgUrl) {
try {
BufferedImage bufferedImage = ImageIO.read(new URL(imgUrl));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
String suffix = imgUrlFileType(imgUrl);
//ImageIO无法写入jpeg文件 报Invalid argument to native writeImage需重画
if(StrUtil.equals(suffix, JPG) || StrUtil.equals(suffix,JPEG)){
BufferedImage tag;
tag = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), BufferedImage.TYPE_INT_BGR);
Graphics g = tag.getGraphics();
g.drawImage(bufferedImage, 0, 0, null);
g.dispose();
bufferedImage = tag;
}
ImageIO.write(bufferedImage, suffix, baos);
byte[] bytes = baos.toByteArray();
return bytes;
} catch (IOException e) {
// 图片丢失,请重新上传图片
throw new YamiShopBindException("yami.img.lose");
}
}
/**
* @param imgUrl
* @return jpg , png , ...
*/
public static String imgUrlFileType(String imgUrl) {
if (StrUtil.isBlank(imgUrl)) {
return imgUrl;
}
imgUrl.trim();
String[] split = imgUrl.split("\\.");
String s = split[split.length - 1];
return s;
}
/**
* @param imgUrl
* @return
*/
public static String imgUrlFileName(String imgUrl) {
if (StrUtil.isBlank(imgUrl)) {
return imgUrl;
}
imgUrl.trim();
String[] split = imgUrl.split("/");
String s = split[split.length - 1];
return s;
}
/**
* @param imgUrl
* @return 45d3631e97d8438d80f9db1369595b8c
*/
public static String imgUrlFileNameNoSuffix(String imgUrl) {
if (StrUtil.isBlank(imgUrl)) {
return imgUrl;
}
imgUrl.trim();
String[] split = imgUrl.split("/");
String s = split[split.length - 1];
String[] split1 = s.split("\\.");
return split1[0];
}
}

View File

@ -1,43 +0,0 @@
package com.mcwl.framework.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
import com.mcwl.common.constant.Constants;
/**
*
*
* @author mcwl
*/
@Configuration
public class I18nConfig implements WebMvcConfigurer
{
@Bean
public LocaleResolver localeResolver()
{
SessionLocaleResolver slr = new SessionLocaleResolver();
// 默认语言
slr.setDefaultLocale(Constants.DEFAULT_LOCALE);
return slr;
}
@Bean
public LocaleChangeInterceptor localeChangeInterceptor()
{
LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
// 参数名
lci.setParamName("lang");
return lci;
}
@Override
public void addInterceptors(InterceptorRegistry registry)
{
registry.addInterceptor(localeChangeInterceptor());
}
}

View File

@ -24,7 +24,6 @@ import java.math.BigDecimal;
public class MallProduct extends BaseEntity { public class MallProduct extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* ID * ID
*/ */

View File

@ -3,6 +3,7 @@ package com.mcwl.resource.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mcwl.resource.domain.MallProduct; import com.mcwl.resource.domain.MallProduct;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* @AuthorChenYan * @AuthorChenYan
@ -14,4 +15,6 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface MallProductMapper extends BaseMapper<MallProduct> { public interface MallProductMapper extends BaseMapper<MallProduct> {
String selectMallProductById(@Param("mallProductId") Long mallProductId);
} }

View File

@ -16,8 +16,16 @@ import java.util.List;
*/ */
public interface MallProductService extends IService<MallProduct> { public interface MallProductService extends IService<MallProduct> {
List<MallProduct> selectMallProductList(MallProduct sysJob);
List<MallProduct> selectMallProductRuleInfoList(MallProduct mallProductRuleInfo); String selectMallProductById(Long mallProductId);
int insertMallProduct(MallProduct mallProduct);
int updateMallProduct(MallProduct mallProduct);
void deleteMallProductByIds(Long[] ids);
} }

View File

@ -28,14 +28,34 @@ public class MallProductServiceImpl extends ServiceImpl<MallProductMapper,MallPr
@Autowired @Autowired
private MallProductMapper postMapper; private MallProductMapper postMapper;
@Override @Override
public List<MallProduct> selectMallProductRuleInfoList(MallProduct mallProduct) { public List<MallProduct> selectMallProductList(MallProduct mallProduct) {
QueryWrapper<MallProduct> queryWrapper = new QueryWrapper<>(); QueryWrapper<MallProduct> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(MallProduct::getProductName, mallProduct.getProductName()); queryWrapper.lambda().eq(MallProduct::getProductName, mallProduct.getProductName());
queryWrapper.lambda().eq(MallProduct::getName, mallProduct.getName()); queryWrapper.lambda().eq(MallProduct::getName, mallProduct.getName());
queryWrapper.lambda().eq(MallProduct::getAmount, mallProduct.getAmount()); queryWrapper.lambda().eq(MallProduct::getAmount, mallProduct.getAmount());
MallProduct mallProducts = postMapper.selectOne(queryWrapper); return postMapper.selectList(queryWrapper);
return (List<MallProduct>) mallProducts; }
@Override
public String selectMallProductById(Long mallProductId) {
return postMapper.selectMallProductById(mallProductId);
}
@Override
public int insertMallProduct(MallProduct mallProduct) {
return postMapper.insert(mallProduct);
}
@Override
public int updateMallProduct(MallProduct mallProduct) {
return postMapper.updateById(mallProduct);
}
@Override
public void deleteMallProductByIds(Long[] ids) {
postMapper.deleteBatchIds(ids);
} }

View File

@ -0,0 +1,27 @@
<?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.mcwl.resource.mapper.MallProductMapper">
<select id="selectMallProductById" resultType="java.lang.String">
select id,
user_id,
product_id,
product_name,
detail,
model,
amount,
name,
zip_url,
url,
create_by,
create_time,
update_by,
update_time,
remark,
del_flag
from mall_product where product_id =#{mallProductId}
</select>
</mapper>