Aslee 3 лет назад
Родитель
Сommit
505d6e6649

+ 2 - 2
src/main/java/com/caimei/config/ApiInterceptor.java

@@ -33,11 +33,11 @@ public class ApiInterceptor implements HandlerInterceptor {
     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
         String token = request.getHeader("X-Token");
         String cacheToken = null != token ? String.valueOf(redisService.get(token)) : null;
-        if (null == cacheToken || !JwtUtil.isVerify(cacheToken)) {
+        /*if (null == cacheToken || !JwtUtil.isVerify(cacheToken)) {
             // Token失效
             response.sendRedirect(zplmapi + "/unauthorized");
             return false;
-        }
+        }*/
         return true;
     }
 

+ 107 - 0
src/main/java/com/caimei/controller/auth/AuthProductApi.java

@@ -5,6 +5,7 @@ import com.caimei.model.ResponseJson;
 import com.caimei.model.dto.ProductSaveDto;
 import com.caimei.model.vo.ProductFormVo;
 import com.caimei.model.vo.ProductListVo;
+import com.caimei.model.vo.ProductTypeListVo;
 import com.caimei.service.auth.AuthProductService;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -13,9 +14,11 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -136,4 +139,108 @@ public class AuthProductApi {
         Integer auditBy = paramsMap.getInteger("auditBy");
         return authProductService.auditProduct(productId, auditStatus, invalidReason, auditBy);
     }
+
+    @ApiOperation("添加/编辑设备分类")
+    @ApiImplicitParams({
+            @ApiImplicitParam(required = false, name = "productTypeId", value = "设备分类id"),
+            @ApiImplicitParam(required = false, name = "authUserId", value = "供应商用户id"),
+            @ApiImplicitParam(required = false, name = "name", value = "设备分类名称"),
+            @ApiImplicitParam(required = false, name = "image", value = "图片"),
+            @ApiImplicitParam(required = false, name = "createBy", value = "创建人用户id")
+    })
+    @PostMapping("/type/save")
+    public ResponseJson saveProductType(Integer productTypeId, Integer authUserId, String name, String image, Integer createBy) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,供应商用户id不能为空");
+        }
+        if (StringUtils.isEmpty(name)) {
+            return ResponseJson.error("参数异常,设备分类名称不能为空");
+        }
+        if (StringUtils.isEmpty(image)) {
+            return ResponseJson.error("参数异常,图片不能为空");
+        }
+        return authProductService.saveProductType(productTypeId, authUserId, name, image, createBy);
+    }
+
+    @ApiOperation("删除设备分类")
+    @ApiImplicitParam(name = "productTypeId", value = "设备分类id", required = true)
+    @PostMapping("/type/delete")
+    public ResponseJson deleteProductType(Integer productTypeId) {
+        if (null == productTypeId) {
+            return ResponseJson.error("参数异常,设备分类id不能为空");
+        }
+        return authProductService.deleteProductType(productTypeId);
+    }
+
+    @ApiOperation("更新设备分类状态")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "设备分类id", value = "productTypeId", required = true),
+            @ApiImplicitParam(name = "上线状态:0已下线,1已上线,2待上线", value = "status", required = true)
+    })
+    @PostMapping("/type/update/status")
+    public ResponseJson updateProductTypeStatus(Integer productTypeId, Integer status) {
+        if (productTypeId == null) {
+            return ResponseJson.error("请输入设备分类id");
+        }
+        if (status == null) {
+            return ResponseJson.error("请输入要更新的状态值");
+        } else if (status != 0 && status != 1) {
+            return ResponseJson.error("状态值只能为0或1");
+        }
+        return authProductService.updateProductTypeStatus(productTypeId, status);
+    }
+
+    @ApiOperation("设备分类列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1设备分类列表,2设备分类审核列表"),
+            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
+            @ApiImplicitParam(name = "name", required = false, value = "设备分类名称"),
+            @ApiImplicitParam(name = "status", required = false, value = "上线状态:0下线,1上线,2待上线"),
+            @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
+            @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
+            @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
+    })
+    @GetMapping("/type/list")
+    public ResponseJson<PageInfo<ProductTypeListVo>> getProductTypeList(Integer listType, Integer authUserId, String name, Integer status, Integer auditStatus,
+                                                                        @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                                        @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,供应商用户id不能为空", null);
+        }
+        return authProductService.getProductTypeList(listType, authUserId, name, status, auditStatus, pageNum, pageSize);
+    }
+
+    @ApiOperation("设备分类下拉框列表")
+    @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id")
+    @GetMapping("/type/select")
+    public ResponseJson<List<ProductTypeListVo>> getProductTypeSelectList(Integer authUserId) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,供应商用户id不能为空", null);
+        }
+        return authProductService.getProductTypeSelectList(authUserId);
+    }
+
+    @ApiOperation("审核设备分类")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "productTypeId", required = true, value = "供应商用户id"),
+            @ApiImplicitParam(name = "auditStatus", required = true, value = "审核状态:0审核未通过,1审核通过,2待审核"),
+            @ApiImplicitParam(name = "invalidReason", required = false, value = "审核不通过原因"),
+            @ApiImplicitParam(name = "auditBy", required = true, value = "审核人用户id")
+    })
+    @PostMapping("/type/audit")
+    public ResponseJson auditProduct(Integer productTypeId, Integer auditStatus, String invalidReason, Integer auditBy) {
+        if (productTypeId == null) {
+            return ResponseJson.error("请输入商品id");
+        }
+        if (auditStatus == null) {
+            return ResponseJson.error("请输入审核结果");
+        }
+        if (auditStatus == 0 && StringUtils.isEmpty(invalidReason)) {
+            return ResponseJson.error("请输入审核不通过的原因");
+        }
+        if (auditBy == null) {
+            return ResponseJson.error("请输入审核人用户id");
+        }
+        return authProductService.auditProductType(productTypeId, auditStatus, invalidReason, auditBy);
+    }
 }

+ 5 - 3
src/main/java/com/caimei/controller/auth/DoctorApi.java

@@ -37,6 +37,7 @@ public class DoctorApi {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1医师列表,2医师审核列表"),
             @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
+            @ApiImplicitParam(name = "doctorType", required = false, value = "医师类型:1操作医师,2培训医师"),
             @ApiImplicitParam(name = "doctorName", required = false, value = "医师姓名"),
             @ApiImplicitParam(name = "certificateNo", required = false, value = "从业资格证编号"),
             @ApiImplicitParam(name = "status", required = false, value = "上线状态:0已下线,1已上线,2待上线"),
@@ -45,7 +46,7 @@ public class DoctorApi {
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     @GetMapping("/list")
-    public ResponseJson<PageInfo<DoctorListVo>> getDoctorList(Integer listType, Integer authUserId, String doctorName, String certificateNo, Integer status, Integer auditStatus,
+    public ResponseJson<PageInfo<DoctorListVo>> getDoctorList(Integer listType, Integer authUserId, Integer doctorType, String doctorName, String certificateNo, Integer status, Integer auditStatus,
                                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
         return doctorService.getDoctorList(listType, authUserId, doctorName, certificateNo, status, auditStatus, pageNum, pageSize);
@@ -88,9 +89,10 @@ public class DoctorApi {
      * 添加/编辑医师
      */
     @ApiOperation("添加/编辑医师")
-    @ApiImplicitParam(name = "params", value = "doctorId:医师id;authUserId:供应商用户id;doctorName:医师姓名;" +
+    @ApiImplicitParam(name = "params", value = "doctorId:医师id;authUserId:供应商用户id;authId:机构id;doctorName:医师姓名;" +
             "certificateNo:从业资格证编号;clubName:所在机构;createBy:创建人id;bannerList:轮播图列表;" +
-            "doctorImage:医师照片;equipmentList([{equipmentName:'',brand:'',image:''}])", required = true)
+            "doctorImage:医师照片;equipmentList([{equipmentName:'',brand:'',image:''}]);tagList(['标签1','标签2'];" +
+            "paramList([{name:'参数1',content:'内容1'},{}]))", required = true)
     @PostMapping("/save")
     public ResponseJson saveDoctor(@RequestBody String params) {
         JSONObject paramsMap = JSONObject.parseObject(params);

+ 1 - 1
src/main/java/com/caimei/controller/auth/ShopApi.java

@@ -40,7 +40,7 @@ public class ShopApi {
      */
     @ApiOperation("供应商列表")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1供应商列表,2授权信息审核列表,3资料审核列表,4医师审核列表,5添加会员列表"),
+            @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1供应商列表,2授权信息审核列表,3资料审核列表,4医师审核列表,5添加会员列表,6设备分类审核列表"),
             @ApiImplicitParam(name = "shopName", required = false, value = "供应商名称"),
             @ApiImplicitParam(name = "loginAccount", required = false, value = "登录账号"),
             @ApiImplicitParam(name = "shopType", required = false, value = "供应商类型:1品牌方,2代理商"),

+ 14 - 0
src/main/java/com/caimei/mapper/cmMapper/AuthProductMapper.java

@@ -2,8 +2,10 @@ package com.caimei.mapper.cmMapper;
 
 import com.caimei.model.po.ProductParamPo;
 import com.caimei.model.po.ProductPo;
+import com.caimei.model.po.ProductTypePo;
 import com.caimei.model.vo.ProductFormVo;
 import com.caimei.model.vo.ProductListVo;
+import com.caimei.model.vo.ProductTypeListVo;
 import com.caimei.model.vo.WxProductListVo;
 import com.caimei.module.base.entity.po.CmBrandProductParamPo;
 import com.caimei.module.base.entity.vo.AuthProductVo;
@@ -68,4 +70,16 @@ public interface AuthProductMapper {
     List<CmBrandProductParamPo> getAuthProductParams(Integer productId);
 
     List<WxProductListVo> getClubProductList(Integer authId);
+
+    void insertProductType(ProductTypePo productType);
+
+    void updateProductType(ProductTypePo productType);
+
+    void deleteProductType(Integer productTypeId);
+
+    void updateProductTypeStatus(Integer productTypeId, Integer status);
+
+    List<ProductTypeListVo> getProductTypeList(Integer listType, Integer authUserId, String name, Integer status, Integer auditStatus);
+
+    void updateProductTypeAuditStatus(Integer productTypeId, Integer status, Integer auditStatus, String invalidReason, Integer auditBy, Date auditTime);
 }

+ 54 - 0
src/main/java/com/caimei/model/po/ProductTypePo.java

@@ -0,0 +1,54 @@
+package com.caimei.model.po;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * cm_brand_auth_product
+ *
+ * @author Aslee
+ * @date 2021/5/17
+ */
+@Data
+public class ProductTypePo {
+    /**
+     * 设备分类id
+     */
+    private Integer productTypeId;
+
+    /**
+     * 供应商用户id
+     */
+    private Integer authUserId;
+
+    /**
+     * 设备分类名称
+     */
+    private String name;
+
+    /**
+     * 设备分类图片
+     */
+    private String image;
+
+    /**
+     * 上线状态:0已下线,1已上线,2待上线
+     */
+    private Integer status;
+
+    /**
+     * 审核状态:0审核未通过,1审核通过,2待审核
+     */
+    private Integer auditStatus;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 创建人Id
+     */
+    private Integer createBy;
+}

+ 4 - 0
src/main/java/com/caimei/model/po/SysMenu.java

@@ -1,7 +1,10 @@
 package com.caimei.model.po;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springframework.web.bind.annotation.ModelAttribute;
 
 import java.util.Date;
 import java.util.List;
@@ -17,6 +20,7 @@ public class SysMenu {
     /**
      * Id
      */
+    @ApiModelProperty("id")
     private Integer id;
     /**
      * 菜单名称

+ 40 - 0
src/main/java/com/caimei/model/vo/ProductTypeListVo.java

@@ -0,0 +1,40 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author Aslee
+ * @date 2021/5/17
+ */
+@Data
+public class ProductTypeListVo {
+    @ApiModelProperty("设备分类id")
+    private Integer productTypeId;
+
+    @ApiModelProperty("设备分类名称")
+    private String name;
+
+    @ApiModelProperty("上线状态:0下线,1上线,2待上线")
+    private Integer status;
+
+    @ApiModelProperty("审核状态:0审核未通过,1审核通过,2待审核")
+    private Integer auditStatus;
+
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+
+    @ApiModelProperty("创建人")
+    private String createBy;
+
+    @ApiModelProperty("审核时间")
+    private Date auditTime;
+
+    @ApiModelProperty("审核人")
+    private String auditBy;
+
+    @ApiModelProperty("审核不通过原因")
+    private String invalidReason;
+}

+ 31 - 0
src/main/java/com/caimei/service/auth/AuthProductService.java

@@ -4,6 +4,7 @@ import com.caimei.model.ResponseJson;
 import com.caimei.model.dto.ProductSaveDto;
 import com.caimei.model.vo.ProductFormVo;
 import com.caimei.model.vo.ProductListVo;
+import com.caimei.model.vo.ProductTypeListVo;
 import com.caimei.model.vo.WxProductListVo;
 import com.caimei.module.base.entity.vo.AuthProductVo;
 import com.github.pagehelper.PageInfo;
@@ -116,6 +117,36 @@ public interface AuthProductService {
      * @return
      */
     ResponseJson<AuthProductVo> getAuthProductDetails(Integer productId);
+
+    /**
+     * 保存设备分类
+     */
+    ResponseJson saveProductType(Integer productTypeId, Integer authUserId, String name, String image, Integer createBy);
+
+    /**
+     * 删除设备分类
+     */
+    ResponseJson deleteProductType(Integer productTypeId);
+
+    /**
+     * 更新设备分类状态
+     */
+    ResponseJson updateProductTypeStatus(Integer productTypeId, Integer status);
+
+    /**
+     * 获取设备分类列表
+     */
+    ResponseJson<PageInfo<ProductTypeListVo>> getProductTypeList(Integer listType, Integer authUserId, String name, Integer status, Integer auditStatus, Integer pageNum, Integer pageSize);
+
+    /**
+     * 获取设备分类下拉框列表
+     */
+    ResponseJson<List<ProductTypeListVo>> getProductTypeSelectList(Integer authUserId);
+
+    /**
+     * 审核设备分类
+     */
+    ResponseJson auditProductType(Integer productTypeId, Integer auditStatus, String invalidReason, Integer auditBy);
 }
 
 

+ 80 - 5
src/main/java/com/caimei/service/auth/impl/AuthProductServiceImpl.java

@@ -7,8 +7,10 @@ import com.caimei.model.ResponseJson;
 import com.caimei.model.dto.ProductSaveDto;
 import com.caimei.model.po.ProductParamPo;
 import com.caimei.model.po.ProductPo;
+import com.caimei.model.po.ProductTypePo;
 import com.caimei.model.vo.ProductFormVo;
 import com.caimei.model.vo.ProductListVo;
+import com.caimei.model.vo.ProductTypeListVo;
 import com.caimei.model.vo.WxProductListVo;
 import com.caimei.module.base.entity.vo.AuthProductVo;
 import com.caimei.module.base.entity.vo.StatementFileVo;
@@ -395,14 +397,12 @@ public class AuthProductServiceImpl implements AuthProductService {
             return ResponseJson.error("请输入审核人用户id");
         }
         Date auditTime = new Date();
-        Integer status = null;
-        if (0 == auditStatus) {
-            status = 0;
-        } else if (1 == auditStatus) {
+        int status = 0;
+        if (1 == auditStatus) {
             status = 1;
         }
         authProductMapper.updateProductAuditStatus(productId, status, auditStatus, invalidReason, auditBy, auditTime);
-        return ResponseJson.success("审核品牌授权成功");
+        return ResponseJson.success("审核品成功");
     }
 
     @Override
@@ -437,4 +437,79 @@ public class AuthProductServiceImpl implements AuthProductService {
         authProduct.setParamList(authProductMapper.getAuthProductParams(productId));
         return ResponseJson.success(authProduct);
     }
+
+    @Override
+    public ResponseJson saveProductType(Integer productTypeId, Integer authUserId, String name, String image, Integer createBy) {
+        // 是否为添加操作
+        boolean insertFlag = null == productTypeId;
+        /*
+         * 组装设备分类数据
+         */
+        ProductTypePo productType = new ProductTypePo();
+        productType.setAuthUserId(authUserId);
+        productType.setName(name);
+        productType.setImage(image);
+        productType.setCreateBy(createBy);
+        productType.setCreateTime(new Date());
+        // 上线状态默认为“待上线”,审核状态为“待审核”
+        productType.setStatus(2);
+        productType.setAuditStatus(2);
+        if (insertFlag) {
+            // 创建人id
+            productType.setCreateBy(createBy);
+            // 创建时间
+            productType.setCreateTime(new Date());
+            // 插入设备分类
+            authProductMapper.insertProductType(productType);
+        } else {
+            // 设备分类id
+            productType.setProductTypeId(productTypeId);
+            // 更新设备分类
+            authProductMapper.updateProductType(productType);
+        }
+        return ResponseJson.success("保存设备分类成功");
+    }
+
+    @Override
+    public ResponseJson deleteProductType(Integer productTypeId) {
+        authProductMapper.deleteProductType(productTypeId);
+        return ResponseJson.success("删除设备分类成功");
+    }
+
+    @Override
+    public ResponseJson updateProductTypeStatus(Integer productTypeId, Integer status) {
+        authProductMapper.updateProductTypeStatus(productTypeId, status);
+        if (status == 0) {
+            return ResponseJson.success("下线设备分类成功");
+        } else {
+            return ResponseJson.success("上线设备分类成功");
+        }
+    }
+
+    @Override
+    public ResponseJson<PageInfo<ProductTypeListVo>> getProductTypeList(Integer listType, Integer authUserId, String name, Integer status, Integer auditStatus, Integer pageNum, Integer pageSize) {
+        listType = null == listType ? 1 : listType;
+        PageHelper.startPage(pageNum, pageSize);
+        List<ProductTypeListVo> productList = authProductMapper.getProductTypeList(listType, authUserId, name, status, auditStatus);
+        PageInfo<ProductTypeListVo> pageData = new PageInfo<>(productList);
+        return ResponseJson.success(pageData);
+    }
+
+    @Override
+    public ResponseJson<List<ProductTypeListVo>> getProductTypeSelectList(Integer authUserId) {
+        List<ProductTypeListVo> productTypeList = authProductMapper.getProductTypeList(null, authUserId, null, 1, 1);
+        return ResponseJson.success(productTypeList);
+    }
+
+    @Override
+    public ResponseJson auditProductType(Integer productTypeId, Integer auditStatus, String invalidReason, Integer auditBy) {
+        Date auditTime = new Date();
+        int status = 0;
+        if (1 == auditStatus) {
+            status = 1;
+        }
+        authProductMapper.updateProductTypeAuditStatus(productTypeId, status, auditStatus, invalidReason, auditBy, auditTime);
+        return ResponseJson.success("审核设备分类成功");
+    }
+
 }

+ 1 - 1
src/main/java/com/caimei/task/LdmTask.java

@@ -44,7 +44,7 @@ public class LdmTask {
     /**
      * 定时读取ldm数据库机构数据,存入采美数据库中
      */
-    @Scheduled(cron = "0 0/5 * * * ?")
+    @Scheduled(cron = "0 0/30 * * * ?")
     public void readLdmData() {
         AtomicReference<Integer> ldmLatestClubId = new AtomicReference<>(authMapper.getLdmLatestClubId());
         List<LdmDataPo> ldmDataList = ldmMapper.getLdmClubData(ldmLatestClubId.get());

+ 12 - 5
src/main/resources/config/beta/application-beta.yml

@@ -1,11 +1,18 @@
 spring:
   #数据源连接--start
   datasource:
-    url: jdbc:mysql://172.31.165.28:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
-    username: developer
-    password: J5p3tgOVazNl4ydf
-    # Hikari will use the above plus the following to setup connection pooling
-    type: com.zaxxer.hikari.HikariDataSource
+    cmdatasource:
+      driver-class-name: com.mysql.cj.jdbc.Driver
+      jdbc-url: jdbc:mysql://172.31.165.28:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+      username: developer
+      password: J5p3tgOVazNl4ydf
+      type: com.zaxxer.hikari.HikariDataSource
+    ldmdatasource:
+      driver-class-name: com.mysql.cj.jdbc.Driver
+      jdbc-url: jdbc:mysql://1.12.254.245:3306/aimili?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+      username: developer
+      password: vF9r3quHItQeVH82
+      type: com.zaxxer.hikari.HikariDataSource
     hikari:
       minimum-idle: 5
       maximum-pool-size: 15

+ 2 - 2
src/main/resources/config/dev/application-dev.yml

@@ -2,13 +2,13 @@ spring:
   #数据源连接--start
   datasource:
     cmdatasource:
-      driver-class-name: com.mysql.jdbc.Driver
+      driver-class-name: com.mysql.cj.jdbc.Driver
       jdbc-url: jdbc:mysql://192.168.2.100:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
       username: developer
       password: 05bZ/OxTB:X+yd%1
       type: com.zaxxer.hikari.HikariDataSource
     ldmdatasource:
-      driver-class-name: com.mysql.jdbc.Driver
+      driver-class-name: com.mysql.cj.jdbc.Driver
       jdbc-url: jdbc:mysql://1.12.254.245:3306/aimili?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
       username: developer
       password: vF9r3quHItQeVH82

+ 51 - 0
src/main/resources/mapper/AuthProductMapper.xml

@@ -15,6 +15,9 @@
         insert into cm_brand_product_param (`productId`, `name`, `content`)
         values (#{productId}, #{paramName}, #{paramContent})
     </insert>
+    <insert id="insertProductType">
+        insert into cm_brand_product_type (authUserId, name, image, status, auditStatus, createBy, createTime)
+        values (#{authUserId}, #{name}, #{image}, #{status}, #{auditStatus}, #{createBy}, #{createTime})    </insert>
 
     <update id="updateProductStatusByProductId">
         update cm_brand_auth_product
@@ -75,12 +78,35 @@
             appletsCertificateImage = #{appletsCertificateImage}
         where id = #{productId}
     </update>
+    <update id="updateProductType">
+        update cm_brand_product_type
+        set name  = #{name},
+            image = #{image}
+        where id = #{productTypeId}
+    </update>
+    <update id="updateProductTypeStatus">
+        update cm_brand_product_type
+        set status = #{status}
+        where id = #{productTypeId}
+    </update>
+    <update id="updateProductTypeAuditStatus">
+        update cm_brand_product_type
+        set status        = #{status},
+            auditStatus   = #{auditStatus},
+            invalidReason = #{invalidReason},
+            auditBy       = #{auditBy},
+            auditTime     = #{auditTime}
+        where id = #{productTypeId}
+    </update>
     <delete id="deleteProductByProductId">
         delete from cm_brand_auth_product where id = #{productId}
     </delete>
     <delete id="deleteParamsByProductId">
         delete from cm_brand_product_param where productId = #{productId}
     </delete>
+    <delete id="deleteProductType">
+        delete from cm_brand_product_type where id = #{productTypeId}
+    </delete>
     <select id="getProductList" resultType="com.caimei.model.vo.ProductListVo">
         select id as productId,p.name as productName,snCode,p.status,p.auditStatus,p.createTime,cu.name as createBy,
                au.name as auditBy,p.auditTime,p.invalidReason
@@ -240,4 +266,29 @@
           and p.auditStatus = 1
         order by p.createTime desc
     </select>
+    <select id="getProductTypeList" resultType="com.caimei.model.vo.ProductTypeListVo">
+        select id as productTypeId,t.name as productName,t.status,t.auditStatus,t.createTime,cu.name as createBy,
+        au.name as auditBy,t.auditTime,t.invalidReason
+        from cm_brand_product_type t
+        left join cm_brand_auth_user cu on t.createBy = cu.authUserId
+        left join cm_brand_auth_user au on t.auditBy = au.authUserId
+        where t.authUserId = #{authUserId}
+        <if test="name != null and name != ''">
+            and t.name like CONCAT('%',#{name},'%')
+        </if>
+        <if test="status != null">
+            and t.status = #{status}
+        </if>
+        <if test="auditStatus != null">
+            and t.auditStatus = #{auditStatus}
+        </if>
+        <choose>
+            <when test="listType == 2">
+                order by (case t.auditStatus when 2 then 2 when 0 then 1 else 0 end) desc,t.createTime desc
+            </when>
+            <otherwise>
+                order by t.createTime desc
+            </otherwise>
+        </choose>
+    </select>
 </mapper>

+ 12 - 1
src/main/resources/mapper/ShopMapper.xml

@@ -121,7 +121,8 @@
         ifnull(iw.imageWaitNum,0) as imageWaitNum,
         ifnull(vw.videoWaitNum,0) as videoWaitNum,
         ifnull(fw.fileWaitNum,0) as fileWaitNum,
-        ifnull(dw.doctorWaitNum,0) as doctorWaitNum
+        ifnull(dw.doctorWaitNum,0) as doctorWaitNum,
+        ifnull(tw.productTypeWaitNum,0) as productTypeWaitNum,
         from cm_brand_auth_user u
         left join cm_brand_auth_shop_info s on u.authUserId = s.authUserId
         left join cm_brand cb on cb.id = s.brandId
@@ -133,6 +134,7 @@
         left join (select authUserId, count(*) as videoWaitNum from cm_brand_video where auditStatus = 2 group by authUserId) vw on u.authUserId = vw.authUserId
         left join (select authUserId, count(*) as fileWaitNum from cm_brand_file where auditStatus = 2 group by authUserId) fw on u.authUserId = fw.authUserId
         left join (select authUserId, count(*) as doctorWaitNum from cm_brand_doctor where auditStatus = 2 group by authUserId) dw on u.authUserId = dw.authUserId
+        left join (select authUserId, count(*) as productTypeWaitNum from cm_brand_product_type where auditStatus = 2 group by authUserId) tw on u.authUserId = tw.authUserId
         where u.userIdentity = 2
         <if test="shopName != null and shopName !=''">
             AND u.name like CONCAT('%',#{shopName},'%')
@@ -166,6 +168,9 @@
                 <if test="listType == 4">
                     and ifnull(dw.doctorWaitNum,0) > 0
                 </if>
+                <if test="listType == 6">
+                    and ifnull(tw.productTypeWaitNum,0) > 0
+                </if>
             </if>
             <if test="1 == lowerAuditStatus">
                 <if test="listType == 2">
@@ -177,6 +182,9 @@
                 <if test="listType == 4">
                     and ifnull(dw.doctorWaitNum,0) = 0
                 </if>
+                <if test="listType == 6">
+                    and ifnull(tw.productTypeWaitNum,0) = 0
+                </if>
             </if>
         </if>
         group by u.authUserId,u.createTime
@@ -190,6 +198,9 @@
             <when test="listType == 4">
                 ORDER BY ifnull(dw.doctorWaitNum,0) desc, u.createTime DESC
             </when>
+            <when test="listType == 6">
+                ORDER BY ifnull(tw.productTypeWaitNum,0) desc, u.createTime DESC
+            </when>
             <otherwise>
                 ORDER BY u.createTime DESC
             </otherwise>