| @@ -0,0 +1,49 @@ | |||||
| package com.iformall.controller.sm; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.domain.dto.neuver.SaveServiceInfoDTO; | |||||
| import com.iformall.domain.dto.neuver.UpdateServiceInfoDTO; | |||||
| import com.iformall.domain.dto.neuver.UpdateServiceInfoStatusDTO; | |||||
| import com.iformall.domain.po.sm.ServiceInfo; | |||||
| import com.iformall.service.sm.ServiceInfoService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| @RestController | |||||
| @RequestMapping("/serviceInfo") | |||||
| @Api(tags = "合作商接口") | |||||
| public class ServiceInfoController extends BaseController { | |||||
| @Autowired | |||||
| private ServiceInfoService serviceInfoService; | |||||
| @ApiOperation("分页查询合作商") | |||||
| @GetMapping("/page") | |||||
| public ResultData pageServiceInfo(ServiceInfo serviceInfo, Integer pageNum, Integer pageSize) { | |||||
| return new ResultData(serviceInfoService.pageServiceInfo(serviceInfo, pageNum, pageSize)); | |||||
| } | |||||
| @ApiOperation("新增合作商") | |||||
| @PostMapping("/save") | |||||
| public ResultData saveServiceInfo(@RequestBody SaveServiceInfoDTO dto) { | |||||
| serviceInfoService.saveServiceInfo(dto); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("修改合作商") | |||||
| @PostMapping("/update") | |||||
| public ResultData updateServiceInfo(@RequestBody UpdateServiceInfoDTO dto) { | |||||
| serviceInfoService.updateServiceInfo(dto); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("修改合作商状态") | |||||
| @PostMapping("/updateStatus") | |||||
| public ResultData updateServiceInfoStatus(@RequestBody UpdateServiceInfoStatusDTO dto) { | |||||
| serviceInfoService.updateServiceInfoStatus(dto); | |||||
| return new ResultData(); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,32 @@ | |||||
| package com.iformall.controller.sm; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.dto.neuver.UpdateThirdPartyApiStatusDTO; | |||||
| import com.iformall.domain.po.WxThirdPartyApi; | |||||
| import com.iformall.service.WxThirdPartyApiService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| @RestController | |||||
| @RequestMapping("/thirdPartyApi") | |||||
| @Api(tags = "秘钥接口") | |||||
| public class ThirdPartyApiController { | |||||
| @Autowired | |||||
| private WxThirdPartyApiService thirdPartyApiService; | |||||
| @ApiOperation("分页查询秘钥") | |||||
| @GetMapping("/page") | |||||
| public ResultData pageThirdPartyApi(WxThirdPartyApi thirdPartyApi, Integer pageNum, Integer pageSize) { | |||||
| return new ResultData(thirdPartyApiService.pageThirdPartyApi(thirdPartyApi, pageNum, pageSize)); | |||||
| } | |||||
| @ApiOperation("修改秘钥状态") | |||||
| @PostMapping("/updateStatus") | |||||
| public ResultData updateThirdPartyApiStatus(@RequestBody UpdateThirdPartyApiStatusDTO dto) { | |||||
| thirdPartyApiService.updateThirdPartyApiStatus(dto); | |||||
| return new ResultData(); | |||||
| } | |||||
| } | |||||
| @@ -200,4 +200,12 @@ ueditor: | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| com.iformall: debug | com.iformall: debug | ||||
| path: ./logs/admin | |||||
| path: ./logs/admin | |||||
| suimang: | |||||
| oral_broadcasting: xxx | |||||
| photo_speak: xxx | |||||
| photo_speak_hy: xxx | |||||
| digital_avatar: xxx | |||||
| digital_avatar_hy: xxx | |||||
| callbackUrl: xxx | |||||
| @@ -156,4 +156,12 @@ ueditor: | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| com.iformall.mapper: debug | com.iformall.mapper: debug | ||||
| path: ./logs/admin | |||||
| path: ./logs/admin | |||||
| suimang: | |||||
| oral_broadcasting: xxx | |||||
| photo_speak: xxx | |||||
| photo_speak_hy: xxx | |||||
| digital_avatar: xxx | |||||
| digital_avatar_hy: xxx | |||||
| callbackUrl: xxx | |||||
| @@ -16,7 +16,7 @@ public class SaveServiceInfoDTO { | |||||
| private String name; | private String name; | ||||
| @ApiModelProperty("所在地址") | @ApiModelProperty("所在地址") | ||||
| private String address; | private String address; | ||||
| @ApiModelProperty("客户唯一凭证,api接入需提供") | |||||
| @ApiModelProperty("客户唯一凭证") | |||||
| private String code; | private String code; | ||||
| @ApiModelProperty("接入方式(1:api接入,2:私有化接入)") | @ApiModelProperty("接入方式(1:api接入,2:私有化接入)") | ||||
| private Integer type; | private Integer type; | ||||
| @@ -0,0 +1,18 @@ | |||||
| package com.iformall.domain.dto.neuver; | |||||
| import io.swagger.annotations.ApiModel; | |||||
| import io.swagger.annotations.ApiModelProperty; | |||||
| import lombok.Builder; | |||||
| import lombok.Data; | |||||
| @ApiModel(value = "新增开放接口秘钥") | |||||
| @Data | |||||
| @Builder | |||||
| public class SaveThirdPartyApiDTO { | |||||
| @ApiModelProperty("第三方类型(1:API接入,2:私有化接入)") | |||||
| private Integer type; | |||||
| @ApiModelProperty("名称") | |||||
| private String name; | |||||
| @ApiModelProperty("接入商id") | |||||
| private Long serviceId; | |||||
| } | |||||
| @@ -0,0 +1,29 @@ | |||||
| package com.iformall.domain.dto.neuver; | |||||
| import com.iformall.common.CommonConstants; | |||||
| import com.iformall.domain.po.sm.ServiceInfo; | |||||
| import io.swagger.annotations.ApiModel; | |||||
| import io.swagger.annotations.ApiModelProperty; | |||||
| import lombok.Data; | |||||
| import java.util.Date; | |||||
| @ApiModel(value = "修改接入商") | |||||
| @Data | |||||
| public class UpdateServiceInfoDTO { | |||||
| @ApiModelProperty("id") | |||||
| private Long id; | |||||
| @ApiModelProperty("客户名称") | |||||
| private String name; | |||||
| @ApiModelProperty("所在地址") | |||||
| private String address; | |||||
| public static ServiceInfo mapping(UpdateServiceInfoDTO dto) { | |||||
| ServiceInfo serviceInfo = new ServiceInfo(); | |||||
| serviceInfo.setId(dto.getId()); | |||||
| serviceInfo.setUpdateTime(new Date()); | |||||
| serviceInfo.setName(dto.getName()); | |||||
| serviceInfo.setAddress(dto.getAddress()); | |||||
| return serviceInfo; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| package com.iformall.domain.dto.neuver; | |||||
| import io.swagger.annotations.ApiModel; | |||||
| import io.swagger.annotations.ApiModelProperty; | |||||
| import lombok.Data; | |||||
| @ApiModel(value = "更新接入商状态") | |||||
| @Data | |||||
| public class UpdateServiceInfoStatusDTO { | |||||
| @ApiModelProperty("接入商id") | |||||
| private Long id; | |||||
| @ApiModelProperty("状态(0:正常,1:失效)") | |||||
| private Integer status; | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| package com.iformall.domain.dto.neuver; | |||||
| import io.swagger.annotations.ApiModel; | |||||
| import io.swagger.annotations.ApiModelProperty; | |||||
| import lombok.Data; | |||||
| @ApiModel(value = "更新开放接口秘钥状态") | |||||
| @Data | |||||
| public class UpdateThirdPartyApiStatusDTO { | |||||
| @ApiModelProperty("开放接口秘钥id") | |||||
| private Long id; | |||||
| @ApiModelProperty("状态(0:正常,1:失效)") | |||||
| private Integer status; | |||||
| } | |||||
| @@ -44,7 +44,7 @@ public class ServiceInfo { | |||||
| @TableField("address") | @TableField("address") | ||||
| private String address; | private String address; | ||||
| /** | /** | ||||
| * 客户唯一凭证,api接入需提供 | |||||
| * 客户唯一凭证 | |||||
| */ | */ | ||||
| @TableField("code") | @TableField("code") | ||||
| private String code; | private String code; | ||||
| @@ -0,0 +1,31 @@ | |||||
| package com.iformall.enums.sm; | |||||
| public enum EnumThirdPartyType { | |||||
| API_JOIN(1, "API接入"), | |||||
| PRIVATE_JOIN(2, "私有化接入"); | |||||
| public static EnumThirdPartyType getEnum(Integer code) { | |||||
| for (EnumThirdPartyType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumThirdPartyType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -3,5 +3,21 @@ package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.sm.ServiceInfo; | import com.iformall.domain.po.sm.ServiceInfo; | ||||
| import java.util.List; | |||||
| /** | |||||
| * 合作商service | |||||
| * | |||||
| * @author xmzhao71 | |||||
| * @date 2023-10-24 | |||||
| */ | |||||
| public interface ServiceInfoMapper extends CommonMapper<ServiceInfo, Long> { | public interface ServiceInfoMapper extends CommonMapper<ServiceInfo, Long> { | ||||
| /** | |||||
| * 全查询合作商 | |||||
| * | |||||
| * @param serviceInfo | |||||
| * @return {@link List}<{@link ServiceInfo}> | |||||
| */ | |||||
| List<ServiceInfo> listServiceInfo(ServiceInfo serviceInfo); | |||||
| } | } | ||||
| @@ -9,4 +9,11 @@ public interface WxThirdPartyApiMapper extends CommonMapper<WxThirdPartyApi, Lon | |||||
| List<WxThirdPartyApi> findList(WxThirdPartyApi apiConfig); | List<WxThirdPartyApi> findList(WxThirdPartyApi apiConfig); | ||||
| /** | |||||
| * 全查询秘钥 | |||||
| * | |||||
| * @param thirdPartyApi | |||||
| * @return {@link List}<{@link WxThirdPartyApi}> | |||||
| */ | |||||
| List<WxThirdPartyApi> listThirdPartyApi(WxThirdPartyApi thirdPartyApi); | |||||
| } | } | ||||
| @@ -1,5 +1,8 @@ | |||||
| package com.iformall.service; | package com.iformall.service; | ||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.dto.neuver.SaveThirdPartyApiDTO; | |||||
| import com.iformall.domain.dto.neuver.UpdateThirdPartyApiStatusDTO; | |||||
| import com.iformall.domain.po.WxThirdPartyApi; | import com.iformall.domain.po.WxThirdPartyApi; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -18,4 +21,27 @@ public interface WxThirdPartyApiService { | |||||
| WxThirdPartyApi findByApp(String appId, String appKey); | WxThirdPartyApi findByApp(String appId, String appKey); | ||||
| /** | |||||
| * 分页查询秘钥 | |||||
| * | |||||
| * @param thirdPartyApi | |||||
| * @param pageNum | |||||
| * @param pageSize | |||||
| * @return {@link PageInfo}<{@link WxThirdPartyApi}> | |||||
| */ | |||||
| PageInfo<WxThirdPartyApi> pageThirdPartyApi(WxThirdPartyApi thirdPartyApi, Integer pageNum, Integer pageSize); | |||||
| /** | |||||
| * 新增秘钥 | |||||
| * | |||||
| * @param dto | |||||
| */ | |||||
| void saveThirdPartyApi(SaveThirdPartyApiDTO dto); | |||||
| /** | |||||
| * 修改秘钥状态 | |||||
| * | |||||
| * @param dto | |||||
| */ | |||||
| void updateThirdPartyApiStatus(UpdateThirdPartyApiStatusDTO dto); | |||||
| } | } | ||||
| @@ -1,12 +1,19 @@ | |||||
| package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.iformall.domain.po.WxAppinfo; | |||||
| import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.CommonConstants; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.dto.neuver.SaveThirdPartyApiDTO; | |||||
| import com.iformall.domain.dto.neuver.UpdateThirdPartyApiStatusDTO; | |||||
| import com.iformall.domain.po.WxThirdPartyApi; | import com.iformall.domain.po.WxThirdPartyApi; | ||||
| import com.iformall.mapper.WxThirdPartyApiMapper; | import com.iformall.mapper.WxThirdPartyApiMapper; | ||||
| import com.iformall.service.WxThirdPartyApiService; | import com.iformall.service.WxThirdPartyApiService; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import com.iformall.utils.RedisCacheUtils; | import com.iformall.utils.RedisCacheUtils; | ||||
| import com.iformall.utils.sign.AppUtils; | |||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -52,4 +59,44 @@ public class WxThirdPartyApiServiceImpl implements WxThirdPartyApiService { | |||||
| RedisCacheUtils.cache(redisTemplate, Constant.publicApi + appId, apiConfig,0l); | RedisCacheUtils.cache(redisTemplate, Constant.publicApi + appId, apiConfig,0l); | ||||
| return apiConfig; | return apiConfig; | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxThirdPartyApi> pageThirdPartyApi(WxThirdPartyApi thirdPartyApi, Integer pageNum, Integer pageSize) { | |||||
| return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxThirdPartyApiMapper.listThirdPartyApi(thirdPartyApi)); | |||||
| } | |||||
| @Override | |||||
| public void saveThirdPartyApi(SaveThirdPartyApiDTO dto) { | |||||
| WxThirdPartyApi thirdPartyApi = buildThirdPartyApi(dto); | |||||
| wxThirdPartyApiMapper.insert(thirdPartyApi); | |||||
| } | |||||
| @Override | |||||
| public void updateThirdPartyApiStatus(UpdateThirdPartyApiStatusDTO dto) { | |||||
| wxThirdPartyApiMapper.update(null, new LambdaUpdateWrapper<WxThirdPartyApi>() | |||||
| .set(WxThirdPartyApi::getStatus, dto.getStatus()) | |||||
| .eq(WxThirdPartyApi::getId, dto.getId())); | |||||
| } | |||||
| /** | |||||
| * 构建秘钥实体 | |||||
| * | |||||
| * @param dto | |||||
| * @return {@link WxThirdPartyApi} | |||||
| */ | |||||
| private WxThirdPartyApi buildThirdPartyApi(SaveThirdPartyApiDTO dto) { | |||||
| WxThirdPartyApi thirdPartyApi = new WxThirdPartyApi(); | |||||
| thirdPartyApi.setId(IdWorker.get().nextId()); | |||||
| thirdPartyApi.setType(dto.getType()); | |||||
| thirdPartyApi.setName(dto.getName()); | |||||
| thirdPartyApi.setServiceId(dto.getServiceId()); | |||||
| String appId = AppUtils.getAppId(); | |||||
| String appKey = AppUtils.getAppKey(appId); | |||||
| String signKey = AppUtils.getSignKey(appId, appKey); | |||||
| thirdPartyApi.setAppId(appId); | |||||
| thirdPartyApi.setAppKey(appKey); | |||||
| thirdPartyApi.setSignKey(signKey); | |||||
| thirdPartyApi.setStatus(CommonConstants.STATUS_NORMAL); | |||||
| return thirdPartyApi; | |||||
| } | |||||
| } | } | ||||
| @@ -2,6 +2,9 @@ package com.iformall.service.sm; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.dto.neuver.SaveServiceInfoDTO; | import com.iformall.domain.dto.neuver.SaveServiceInfoDTO; | ||||
| import com.iformall.domain.dto.neuver.UpdateServiceInfoDTO; | |||||
| import com.iformall.domain.dto.neuver.UpdateServiceInfoStatusDTO; | |||||
| import com.iformall.domain.po.sm.ServiceInfo; | |||||
| import com.iformall.domain.vo.neuver.PageServiceInfoVO; | import com.iformall.domain.vo.neuver.PageServiceInfoVO; | ||||
| /** | /** | ||||
| @@ -26,5 +29,19 @@ public interface ServiceInfoService { | |||||
| * @param pageSize | * @param pageSize | ||||
| * @return {@link PageInfo}<{@link PageServiceInfoVO}> | * @return {@link PageInfo}<{@link PageServiceInfoVO}> | ||||
| */ | */ | ||||
| PageInfo<PageServiceInfoVO> pageServiceInfo(Integer pageNum, Integer pageSize); | |||||
| PageInfo<ServiceInfo> pageServiceInfo(ServiceInfo serviceInfo, Integer pageNum, Integer pageSize); | |||||
| /** | |||||
| * 修改接入商 | |||||
| * | |||||
| * @param dto | |||||
| */ | |||||
| void updateServiceInfo(UpdateServiceInfoDTO dto); | |||||
| /** | |||||
| * 修改接入商状态 | |||||
| * | |||||
| * @param dto | |||||
| */ | |||||
| void updateServiceInfoStatus(UpdateServiceInfoStatusDTO dto); | |||||
| } | } | ||||
| @@ -1,18 +1,23 @@ | |||||
| package com.iformall.service.sm.impl; | package com.iformall.service.sm.impl; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.CommonConstants; | import com.iformall.common.CommonConstants; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.domain.dto.neuver.SaveServiceInfoDTO; | import com.iformall.domain.dto.neuver.SaveServiceInfoDTO; | ||||
| import com.iformall.domain.dto.neuver.SaveThirdPartyApiDTO; | |||||
| import com.iformall.domain.dto.neuver.UpdateServiceInfoDTO; | |||||
| import com.iformall.domain.dto.neuver.UpdateServiceInfoStatusDTO; | |||||
| import com.iformall.domain.po.sm.ServiceInfo; | import com.iformall.domain.po.sm.ServiceInfo; | ||||
| import com.iformall.domain.vo.neuver.PageServiceInfoVO; | |||||
| import com.iformall.exception.BizException; | import com.iformall.exception.BizException; | ||||
| import com.iformall.mapper.ServiceInfoMapper; | import com.iformall.mapper.ServiceInfoMapper; | ||||
| import com.iformall.service.WxThirdPartyApiService; | |||||
| import com.iformall.service.sm.ServiceInfoService; | import com.iformall.service.sm.ServiceInfoService; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| import java.util.Optional; | import java.util.Optional; | ||||
| @@ -21,20 +26,46 @@ public class ServiceInfoServiceImpl implements ServiceInfoService { | |||||
| @Autowired | @Autowired | ||||
| private ServiceInfoMapper serviceInfoMapper; | private ServiceInfoMapper serviceInfoMapper; | ||||
| @Autowired | |||||
| private WxThirdPartyApiService thirdPartyApiService; | |||||
| @Transactional(rollbackFor = Exception.class) | |||||
| @Override | @Override | ||||
| public void saveServiceInfo(SaveServiceInfoDTO dto) { | public void saveServiceInfo(SaveServiceInfoDTO dto) { | ||||
| // 校验 | // 校验 | ||||
| ServiceInfo serviceInfo = serviceInfoMapper.selectOne(new LambdaQueryWrapper<ServiceInfo>() | ServiceInfo serviceInfo = serviceInfoMapper.selectOne(new LambdaQueryWrapper<ServiceInfo>() | ||||
| .eq(ServiceInfo::getDelFlag, CommonConstants.DEL_FLAG_NORMAL) | .eq(ServiceInfo::getDelFlag, CommonConstants.DEL_FLAG_NORMAL) | ||||
| .eq(ServiceInfo::getCode, dto.getCode())); | .eq(ServiceInfo::getCode, dto.getCode())); | ||||
| Optional.ofNullable(serviceInfo).orElseThrow(() -> new BizException(ErrorCode.CODE_ALREADY_EXISTS)); | |||||
| if (serviceInfo != null) { | |||||
| throw new BizException(ErrorCode.CODE_ALREADY_EXISTS); | |||||
| } | |||||
| ServiceInfo mapping = SaveServiceInfoDTO.mapping(dto); | |||||
| serviceInfoMapper.insert(mapping); | |||||
| // 生成秘钥 | |||||
| SaveThirdPartyApiDTO thirdPartyApi = SaveThirdPartyApiDTO.builder() | |||||
| .type(mapping.getType()) | |||||
| .name(mapping.getName()) | |||||
| .serviceId(mapping.getId()) | |||||
| .build(); | |||||
| thirdPartyApiService.saveThirdPartyApi(thirdPartyApi); | |||||
| } | |||||
| serviceInfoMapper.insert(SaveServiceInfoDTO.mapping(dto)); | |||||
| @Override | |||||
| public PageInfo<ServiceInfo> pageServiceInfo(ServiceInfo serviceInfo, Integer pageNum, Integer pageSize) { | |||||
| return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> serviceInfoMapper.listServiceInfo(serviceInfo)); | |||||
| } | |||||
| @Override | |||||
| public void updateServiceInfo(UpdateServiceInfoDTO dto) { | |||||
| serviceInfoMapper.updateById(UpdateServiceInfoDTO.mapping(dto)); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public PageInfo<PageServiceInfoVO> pageServiceInfo(Integer pageNum, Integer pageSize) { | |||||
| return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> serviceInfoMapper.selectList(null)); | |||||
| public void updateServiceInfoStatus(UpdateServiceInfoStatusDTO dto) { | |||||
| serviceInfoMapper.update(null, new LambdaUpdateWrapper<ServiceInfo>() | |||||
| .set(ServiceInfo::getStatus, dto.getStatus()) | |||||
| .eq(ServiceInfo::getId, dto.getId())); | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,41 @@ | |||||
| <?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.iformall.mapper.ServiceInfoMapper"> | |||||
| <sql id="allColumns"> | |||||
| `id`, `create_time`, `update_time`, `name`, `address`, `code`, `type`, `status`, `del_flag` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != name and '' != name"> | |||||
| and `name` LIKE CONCAT('%', #{name},'%') | |||||
| </if> | |||||
| <if test=" null != code and '' != code"> | |||||
| and `code` = #{code} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != delFlag "> | |||||
| and `del_flag` = #{delFlag} | |||||
| </if> | |||||
| </sql> | |||||
| <select id="listServiceInfo" resultType="com.iformall.domain.po.sm.ServiceInfo"> | |||||
| SELECT | |||||
| <include refid="allColumns"/> | |||||
| FROM service_info | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -21,8 +21,33 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`type`,`name`,`app_id`,`app_key`,`sign_key`,`api_url`, `token`,`token_expired_time`,`user_name`,`password`,`version`,`remark`,`tp_id` | |||||
| `id`, `tenant_id`, `parent_tenant_id`, `type`, `name`, `service_id`, `app_id`, `app_key`, `sign_key`, `api_url`, `token`, `token_expired_time`, `user_name`, `password`, `version`, `tp_id`, `remark`, `status` | |||||
| </sql> | </sql> | ||||
| <sql id="generalWhereConditions"> | |||||
| WHERE 1 = 1 | |||||
| <if test=" null != id "> | |||||
| AND `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| AND `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != name and '' != name "> | |||||
| AND `name` = #{name} | |||||
| </if> | |||||
| <if test=" null != serviceId "> | |||||
| AND `service_id` = #{serviceId} | |||||
| </if> | |||||
| <if test=" null != appId "> | |||||
| AND `app_id` = #{appId} | |||||
| </if> | |||||
| <if test=" null != appKey "> | |||||
| AND `app_key` = #{appKey} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| AND `status` = #{status} | |||||
| </if> | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1 = 1 | where 1 = 1 | ||||
| @@ -62,6 +87,10 @@ | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="listThirdPartyApi" resultType="com.iformall.domain.po.WxThirdPartyApi"> | |||||
| SELECT | |||||
| <include refid="allColumns"/> | |||||
| FROM wx_third_party_api | |||||
| <include refid="generalWhereConditions"></include> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||