Selaa lähdekoodia

feat 熊猫甄选货币生成

classic_blue 3 päivää sitten
vanhempi
commit
d6e362a7f9
13 muutettua tiedostoa jossa 201 lisäystä ja 30 poistoa
  1. 70 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/entity/ShopUnit.java
  2. 16 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/exception/GlobalExceptionHandler.java
  3. 7 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/mapper/ShopUnitMapper.java
  4. 11 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopUnitService.java
  5. 11 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopUnitServiceImpl.java
  6. 17 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopUnitController.java
  7. 22 0
      edu-travel-service/edu-travel-service-commodity/src/main/resources/mapper/ShopUnitMapper.xml
  8. 14 2
      edu-travel-service/edu-travel-service-education/src/main/java/edu/travel/education/dto/AddHappyEntryDto.java
  9. 21 23
      edu-travel-service/edu-travel-service-education/src/main/java/edu/travel/education/entity/HappyEntry.java
  10. 0 2
      edu-travel-service/edu-travel-service-education/src/main/java/edu/travel/education/service/impl/HappyEntryServiceImpl.java
  11. 2 1
      edu-travel-service/edu-travel-service-education/src/main/java/edu/travel/education/web/HappyEntryController.java
  12. 2 2
      edu-travel-service/edu-travel-service-education/src/main/resources/mapper/HappyEntryMapper.xml
  13. 8 0
      edu-travel-service/edu-travel-service-tenement/src/main/java/edu/travel/commodity/service/impl/ShopUnitService.java

+ 70 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/entity/ShopUnit.java

@@ -0,0 +1,70 @@
+package edu.travel.commodity.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.util.Date;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 计件单位表
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName(value = "shop_unit")
+public class ShopUnit {
+    /**
+     * 计件单位id
+     */
+    @TableId(value = "id", type = IdType.ASSIGN_ID)
+    private Long id;
+
+    /**
+     * 单位名
+     */
+    @TableField(value = "unit_name")
+    private String unitName;
+
+    /**
+     * 国家id
+     */
+    @TableField(value = "country_id")
+    private Long countryId;
+
+    /**
+     * 项目code
+     */
+    @TableField(value = "project")
+    private String project;
+
+    /**
+     * 创建人
+     */
+    @TableField(value = "create_user_id")
+    private String createUserId;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private Date createTime;
+
+    /**
+     * 更新人
+     */
+    @TableField(value = "update_user_id")
+    private String updateUserId;
+
+    @TableField(value = "update_time")
+    private Date updateTime;
+
+    /**
+     * 删除状态
+     */
+    @TableField(value = "delete_flag")
+    private Integer deleteFlag;
+}

+ 16 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/exception/GlobalExceptionHandler.java

@@ -5,6 +5,9 @@ import edu.travel.exception.BaseException;
 import edu.travel.resp.BaseResponse;
 import edu.travel.resp.PageResponse;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.FieldError;
+import org.springframework.web.bind.MethodArgumentNotValidException;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 
@@ -21,12 +24,25 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
 @Slf4j
 public class GlobalExceptionHandler {
 
+
     @ExceptionHandler(BaseException.class)
     public BaseResponse<Object> handleUserInfoException(BaseException e){
         e.printStackTrace();
         return new BaseResponse<>(e.getCode(),e.getMessage(),null);
     }
 
+//    @ExceptionHandler(MethodArgumentNotValidException.class)
+//    public BaseResponse<Object> handleValidationException(MethodArgumentNotValidException e) {
+//        BindingResult result = e.getBindingResult();
+//        StringBuilder errorMessage = new StringBuilder();
+//
+//        for (FieldError fieldError : result.getFieldErrors()) {
+//            errorMessage.append(fieldError.getDefaultMessage()).append("; ");
+//        }
+//        return new BaseResponse<>(ResponseCode.LOGIC_ERROR.getCode(), errorMessage.toString().trim(), null);
+//    }
+
+
     @ExceptionHandler(IllegalArgumentException.class)
     public BaseResponse<Object> handleException(IllegalArgumentException e){
         e.printStackTrace();

+ 7 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/mapper/ShopUnitMapper.java

@@ -0,0 +1,7 @@
+package edu.travel.commodity.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import edu.travel.commodity.entity.ShopUnit;
+
+public interface ShopUnitMapper extends BaseMapper<ShopUnit> {
+}

+ 11 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopUnitService.java

@@ -0,0 +1,11 @@
+package edu.travel.commodity.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import edu.travel.commodity.entity.ShopSpec;
+import edu.travel.commodity.entity.ShopUnit;
+
+
+public interface ShopUnitService extends IService<ShopUnit>{
+
+
+}

+ 11 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopUnitServiceImpl.java

@@ -0,0 +1,11 @@
+package edu.travel.commodity.service.impl;
+
+import edu.travel.commodity.mapper.ShopUnitMapper;
+import edu.travel.commodity.service.ShopUnitService;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import edu.travel.commodity.entity.ShopUnit;
+@Service
+public class ShopUnitServiceImpl extends ServiceImpl<ShopUnitMapper, ShopUnit> implements ShopUnitService {
+
+}

+ 17 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopUnitController.java

@@ -0,0 +1,17 @@
+package edu.travel.commodity.web;
+import edu.travel.commodity.entity.ShopUnit;
+import org.springframework.web.bind.annotation.*;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+* 计件单位表(shop_unit)表控制层
+*
+* @author xxxxx
+*/
+@RestController
+@RequestMapping("/shop_unit")
+public class ShopUnitController {
+
+
+}

+ 22 - 0
edu-travel-service/edu-travel-service-commodity/src/main/resources/mapper/ShopUnitMapper.xml

@@ -0,0 +1,22 @@
+<?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="edu.travel.commodity.mapper.ShopUnitMapper">
+  <resultMap id="BaseResultMap" type="edu.travel.commodity.entity.ShopUnit">
+    <!--@mbg.generated-->
+    <!--@Table shop_unit-->
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="unit_name" jdbcType="VARCHAR" property="unitName" />
+    <result column="country_id" jdbcType="BIGINT" property="countryId" />
+    <result column="project" jdbcType="VARCHAR" property="project" />
+    <result column="create_user_id" jdbcType="VARCHAR" property="createUserId" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" />
+    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="delete_flag" jdbcType="INTEGER" property="deleteFlag" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--@mbg.generated-->
+    id, unit_name, country_id, project, create_user_id, create_time, update_user_id, 
+    update_time, delete_flag
+  </sql>
+</mapper>

+ 14 - 2
edu-travel-service/edu-travel-service-education/src/main/java/edu/travel/education/dto/AddHappyEntryDto.java

@@ -15,61 +15,73 @@ import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
+import javax.validation.constraints.NotNull;
+
 /**
  * 开心中文报名表
  */
 @Data
 @AllArgsConstructor
 @NoArgsConstructor
-public class AddHappyEntryDto{
+public class AddHappyEntryDto {
 
     /**
      * 姓
      */
+    @NotNull(message = "姓不能为空")
     private String surname;
 
     /**
      * 名
      */
+    @NotNull(message = "名不能为空")
     private String name;
 
     /**
      * 电话号码
      */
+    @NotNull(message = "电话号码不能为空")
     private String phone;
 
     /**
      * 国家区号
      */
+    @NotNull(message = "国家区号不能为空")
     private String areaCode;
 
     /**
      * 课程类型
      */
+    @NotNull(message = "课程类型不能为空")
     private Integer courseType;
 
     /**
      * 最小年龄
      */
+    @NotNull(message = "最小年龄不能为空")
     private Integer minAge;
 
     /**
      * 最大年龄
      */
+    @NotNull(message = "最大年龄不能为空")
     private Integer maxAge;
 
     /**
      * 邮箱
      */
+    @NotNull(message = "邮箱不能为空")
     private String email;
 
     /**
      * 项目code
      */
+//    @NotNull(message = "项目code不能为空")
     private String project;
 
     /**
      * 所属国家id
      */
+    @NotNull(message = "所属国家不能为空")
     private Long countryId;
-}
+}

+ 21 - 23
edu-travel-service/edu-travel-service-education/src/main/java/edu/travel/education/entity/HappyEntry.java

@@ -30,65 +30,63 @@ public class HappyEntry extends BaseEntity {
     @TableId(value = "id", type = IdType.ASSIGN_ID)
     private Long id;
 
-    /**
-    * 姓
-    */
-    @NotNull
+    @NotNull(message = "姓不能为空")
     @TableField(value = "surname")
     private String surname;
 
     /**
      * 国家
      */
-    @NotNull
+    @NotNull(message = "国家不能为空")
     @TableField(value = "country_id")
     private Long countryId;
+
     /**
-    * 名
-    */
-    @NotNull
+     * 名
+     */
+    @NotNull(message = "名不能为空")
     @TableField(value = "name")
     private String name;
 
     /**
-    * 电话号码
-    */
-    @NotNull
+     * 电话号码
+     */
+    @NotNull(message = "电话号码不能为空")
     @TableField(value = "phone")
     private String phone;
 
     /**
-    * 国家区号
-    */
-    @NotNull
+     * 国家区号
+     */
+    @NotNull(message = "国家区号不能为空")
     @TableField(value = "area_code")
     private String areaCode;
 
     /**
-    * 课程类型
-    */
-    @NotNull
+     * 课程类型
+     */
+    @NotNull(message = "课程类型不能为空")
     @TableField(value = "course_type")
     private Integer courseType;
 
     /**
-    * 最小年龄
-    */
-    @NotNull
+     * 最小年龄
+     */
+    @NotNull(message = "最小年龄不能为空")
     @TableField(value = "min_age")
     private Integer minAge;
 
     /**
      * 最大年龄
      */
-    @NotNull
+    @NotNull(message = "最大年龄不能为空")
     @TableField(value = "max_age")
     private Integer maxAge;
 
     /**
      * 邮箱
      */
-    @NotNull
+    @NotNull(message = "邮箱不能为空")
     @TableField(value = "email")
     private String email;
 
@@ -96,7 +94,7 @@ public class HappyEntry extends BaseEntity {
      * 课程类型字典
      */
     @TableField(exist = false)
-    @LinkConst(fieldName = "courseType",clazz = CourseTypeDict.class)
+    @LinkConst(fieldName = "courseType", clazz = CourseTypeDict.class)
     private Map CodeCourseTypeDict;
 
     /**

+ 0 - 2
edu-travel-service/edu-travel-service-education/src/main/java/edu/travel/education/service/impl/HappyEntryServiceImpl.java

@@ -33,8 +33,6 @@ import static com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils.like;
 @Service
 public class HappyEntryServiceImpl  extends SysServiceImpl<HappyEntryMapper, HappyEntry> implements HappyEntryService{
 
-    @Autowired
-    private HappyEntryMapper happyEntryMapper;
 
     @Override
     @Transactional

+ 2 - 1
edu-travel-service/edu-travel-service-education/src/main/java/edu/travel/education/web/HappyEntryController.java

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
 
 import org.springframework.beans.factory.annotation.Autowired;
 
+import javax.validation.Valid;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -38,7 +39,7 @@ public class HappyEntryController extends BaseController<HappyEntry> {
      */
     @PostMapping("/addHappyEntry")
     @PreAuthorize("permitAll()")
-    public RPCBaseResponse<HappyEntryVo> addHappyEntry(@RequestBody AddHappyEntryDto happyEntryDto){
+    public RPCBaseResponse<HappyEntryVo> addHappyEntry(@Valid @RequestBody AddHappyEntryDto happyEntryDto){
         HappyEntryVo vo = happyEntryService.addHappyEntry(happyEntryDto);
         HappyEntry oneLink = happyEntryService.getOneLink(new LambdaQueryWrapper<HappyEntry>().eq(HappyEntry::getId, vo.getId()));
         HappyEntryVo happyEntryVo = BeanUtil.copyProperties(oneLink, HappyEntryVo.class);

+ 2 - 2
edu-travel-service/edu-travel-service-education/src/main/resources/mapper/HappyEntryMapper.xml

@@ -45,8 +45,8 @@
       min_age,max_age, email, project,
       create_time, create_user_id, update_time, 
       update_user_id, delete_flag)
-    values (#{id,jdbcType=BIGINT}, #{surname,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},  #{countryId,jdbcType=BIGINT},
-      #{phone,jdbcType=VARCHAR}, #{areaCode,jdbcType=VARCHAR}, #{courseType,jdbcType=INTEGER}, 
+    values (#{id,jdbcType=BIGINT}, #{surname,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
+      #{phone,jdbcType=VARCHAR}, #{areaCode,jdbcType=VARCHAR}, #{courseType,jdbcType=INTEGER}, #{countryId,jdbcType=BIGINT},
       #{minAge,jdbcType=INTEGER},#{maxAge,jdbcType=INTEGER}, #{email,jdbcType=VARCHAR}, #{project,jdbcType=VARCHAR},
       #{createTime,jdbcType=TIMESTAMP}, #{createUserId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, 
       #{updateUserId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=INTEGER})

+ 8 - 0
edu-travel-service/edu-travel-service-tenement/src/main/java/edu/travel/commodity/service/impl/ShopUnitService.java

@@ -0,0 +1,8 @@
+package edu.travel.commodity.service.impl;
+
+import edu.travel.entity.ShopUnit;
+import com.baomidou.mybatisplus.extension.service.IService;
+public interface ShopUnitService extends IService<ShopUnit>{
+
+
+}