diff --git a/src/main/java/com/gxwebsoft/booking/controller/TeacherController.java b/src/main/java/com/gxwebsoft/booking/controller/TeacherController.java index c9ec93d..0c9719a 100644 --- a/src/main/java/com/gxwebsoft/booking/controller/TeacherController.java +++ b/src/main/java/com/gxwebsoft/booking/controller/TeacherController.java @@ -1,5 +1,8 @@ package com.gxwebsoft.booking.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.security.JwtUtil; +import com.gxwebsoft.common.core.utils.RequestUtil; import com.gxwebsoft.common.core.web.BaseController; import com.gxwebsoft.booking.service.TeacherService; import com.gxwebsoft.booking.entity.Teacher; @@ -10,12 +13,14 @@ import com.gxwebsoft.common.core.web.PageParam; import com.gxwebsoft.common.core.web.BatchParam; import com.gxwebsoft.common.core.annotation.OperationLog; import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.shop.entity.MerchantAccount; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import java.util.List; /** @@ -55,12 +60,10 @@ public class TeacherController extends BaseController { @ApiOperation("添加老师管理") @PostMapping() - public ApiResult save(@RequestBody Teacher teacher) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // teacher.setUserId(loginUser.getUserId()); - // } + public ApiResult save(@RequestBody Teacher teacher, HttpServletRequest request) { + if (teacherService.count(new LambdaQueryWrapper().eq(Teacher::getPhone,teacher.getPhone())) > 0) { + return fail("手机号码已存在"); + } if (teacherService.save(teacher)) { return success("添加成功"); } diff --git a/src/main/java/com/gxwebsoft/booking/entity/Teacher.java b/src/main/java/com/gxwebsoft/booking/entity/Teacher.java index 210a3dd..563fc40 100644 --- a/src/main/java/com/gxwebsoft/booking/entity/Teacher.java +++ b/src/main/java/com/gxwebsoft/booking/entity/Teacher.java @@ -36,9 +36,15 @@ public class Teacher implements Serializable { @ApiModelProperty(value = "老师介绍") private String content; + @ApiModelProperty(value = "手机号码") + private String phone; + @ApiModelProperty(value = "商户ID") private Integer merchantId; + @ApiModelProperty(value = "用户ID") + private Integer userId; + @ApiModelProperty(value = "备注") private String comments; diff --git a/src/main/java/com/gxwebsoft/common/core/config/MybatisPlusConfig.java b/src/main/java/com/gxwebsoft/common/core/config/MybatisPlusConfig.java index 6dc0ce3..f9d893a 100644 --- a/src/main/java/com/gxwebsoft/common/core/config/MybatisPlusConfig.java +++ b/src/main/java/com/gxwebsoft/common/core/config/MybatisPlusConfig.java @@ -63,8 +63,7 @@ public class MybatisPlusConfig { "sys_tenant", "sys_dictionary", "sys_dictionary_data", - "apps_test_data", - "shop_merchant_account" + "apps_test_data" ).contains(tableName); } }; diff --git a/src/main/java/com/gxwebsoft/common/core/security/SecurityConfig.java b/src/main/java/com/gxwebsoft/common/core/security/SecurityConfig.java index 36f235e..a81613d 100644 --- a/src/main/java/com/gxwebsoft/common/core/security/SecurityConfig.java +++ b/src/main/java/com/gxwebsoft/common/core/security/SecurityConfig.java @@ -64,7 +64,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { "/WW_verify_QMv7HoblYU6z63bb.txt", "/5zbYEPkyV4.txt", "/api/love/user-plan-log/wx-pay/**", - "/api/cms/form-record" + "/api/cms/form-record", + "/api/shop/merchant-account/getMerchantAccountByPhone" ) .permitAll() .anyRequest() diff --git a/src/main/java/com/gxwebsoft/shop/controller/MerchantAccountController.java b/src/main/java/com/gxwebsoft/shop/controller/MerchantAccountController.java index b3b96d3..b760f88 100644 --- a/src/main/java/com/gxwebsoft/shop/controller/MerchantAccountController.java +++ b/src/main/java/com/gxwebsoft/shop/controller/MerchantAccountController.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.gxwebsoft.common.core.security.JwtUtil; import com.gxwebsoft.common.core.utils.RequestUtil; import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.mapper.MerchantAccountMapper; import com.gxwebsoft.shop.service.MerchantAccountService; import com.gxwebsoft.shop.entity.MerchantAccount; import com.gxwebsoft.shop.param.MerchantAccountParam; @@ -34,6 +35,8 @@ import java.util.List; public class MerchantAccountController extends BaseController { @Resource private MerchantAccountService merchantAccountService; + @Resource + private MerchantAccountMapper merchantAccountMapper; @ApiOperation("分页查询商户账号") @GetMapping("/page") @@ -123,4 +126,15 @@ public class MerchantAccountController extends BaseController { return fail("删除失败"); } + @ApiOperation("根据手机号码查询商户账号信息") + @GetMapping("/getMerchantAccountByPhone") + public ApiResult getMerchantAccountByPhone(MerchantAccountParam param){ + param.setTenantId(getTenantId()); + final MerchantAccount merchantAccount = merchantAccountMapper.getMerchantAccountByPhone(param); + if(merchantAccount == null){ + return fail("账号不存在",null); + } + return success(merchantAccount); + } + } diff --git a/src/main/java/com/gxwebsoft/shop/entity/Goods.java b/src/main/java/com/gxwebsoft/shop/entity/Goods.java index 6ee677b..c0de124 100644 --- a/src/main/java/com/gxwebsoft/shop/entity/Goods.java +++ b/src/main/java/com/gxwebsoft/shop/entity/Goods.java @@ -58,8 +58,8 @@ public class Goods implements Serializable { @ApiModelProperty(value = "二级分类") private String categoryChildren; - @ApiModelProperty(value = "规格") - private String specs; + @ApiModelProperty(value = "商品规格 0单规格 1多规格") + private Integer specs; @ApiModelProperty(value = "货架") private String position; @@ -76,6 +76,12 @@ public class Goods implements Serializable { @ApiModelProperty(value = "库存") private Integer stock; + @ApiModelProperty(value = "库存计算方式(10下单减库存 20付款减库存)") + private Integer deductStockType; + + @ApiModelProperty(value = "商品重量") + private Integer goodsWeight; + @ApiModelProperty(value = "推荐") private Integer recommend; @@ -91,6 +97,9 @@ public class Goods implements Serializable { @ApiModelProperty(value = "所有人") private Integer userId; + @ApiModelProperty(value = "商户ID") + private Integer merchantId; + @ApiModelProperty(value = "是否删除, 0否, 1是") @TableLogic private Integer deleted; diff --git a/src/main/java/com/gxwebsoft/shop/entity/Merchant.java b/src/main/java/com/gxwebsoft/shop/entity/Merchant.java index 1ce05e0..f6d6dbf 100644 --- a/src/main/java/com/gxwebsoft/shop/entity/Merchant.java +++ b/src/main/java/com/gxwebsoft/shop/entity/Merchant.java @@ -81,7 +81,7 @@ public class Merchant implements Serializable { private Integer recommend; @ApiModelProperty(value = "是否需要审核") - private Integer goodsReview; + private Boolean goodsReview; @ApiModelProperty(value = "备注") private String comments; diff --git a/src/main/java/com/gxwebsoft/shop/entity/MerchantAccount.java b/src/main/java/com/gxwebsoft/shop/entity/MerchantAccount.java index f559935..9ff3169 100644 --- a/src/main/java/com/gxwebsoft/shop/entity/MerchantAccount.java +++ b/src/main/java/com/gxwebsoft/shop/entity/MerchantAccount.java @@ -72,4 +72,8 @@ public class MerchantAccount implements Serializable { @TableField(exist = false) private String merchantName; + @ApiModelProperty(value = "是否需要审核") + @TableField(exist = false) + private Boolean goodsReview; + } diff --git a/src/main/java/com/gxwebsoft/shop/mapper/MerchantAccountMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/MerchantAccountMapper.java index 1da87ea..a4e1b7b 100644 --- a/src/main/java/com/gxwebsoft/shop/mapper/MerchantAccountMapper.java +++ b/src/main/java/com/gxwebsoft/shop/mapper/MerchantAccountMapper.java @@ -1,7 +1,10 @@ package com.gxwebsoft.shop.mapper; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.param.UserParam; import com.gxwebsoft.shop.entity.MerchantAccount; import com.gxwebsoft.shop.param.MerchantAccountParam; import org.apache.ibatis.annotations.Param; @@ -34,4 +37,7 @@ public interface MerchantAccountMapper extends BaseMapper { */ List selectListRel(@Param("param") MerchantAccountParam param); + @InterceptorIgnore(tenantLine = "true") + MerchantAccount getMerchantAccountByPhone(@Param("param") MerchantAccountParam param); + } diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/GoodsMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/GoodsMapper.xml index a089410..a4b2721 100644 --- a/src/main/java/com/gxwebsoft/shop/mapper/xml/GoodsMapper.xml +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/GoodsMapper.xml @@ -58,6 +58,9 @@ AND a.user_id = #{param.userId} + + AND a.merchant_id = #{param.merchantId} + AND a.deleted = #{param.deleted} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/MerchantAccountMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/MerchantAccountMapper.xml index 3d1939c..59bbb2b 100644 --- a/src/main/java/com/gxwebsoft/shop/mapper/xml/MerchantAccountMapper.xml +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/MerchantAccountMapper.xml @@ -4,7 +4,7 @@ - SELECT a.*,b.merchant_name + SELECT a.*,b.merchant_name,b.goods_review FROM shop_merchant_account a LEFT JOIN shop_merchant b ON a.merchant_id = b.merchant_id @@ -55,4 +55,7 @@ + diff --git a/src/main/java/com/gxwebsoft/shop/param/GoodsParam.java b/src/main/java/com/gxwebsoft/shop/param/GoodsParam.java index 02ad42e..4af83bb 100644 --- a/src/main/java/com/gxwebsoft/shop/param/GoodsParam.java +++ b/src/main/java/com/gxwebsoft/shop/param/GoodsParam.java @@ -51,7 +51,7 @@ public class GoodsParam extends BaseParam { private String categoryChildren; @ApiModelProperty(value = "规格") - private String specs; + private Integer specs; @ApiModelProperty(value = "货架") private String position;