diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/ApiconfigController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/ApiconfigController.java new file mode 100644 index 000000000..b4798a4f5 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/ApiconfigController.java @@ -0,0 +1,125 @@ +package cn.iocoder.yudao.module.system.controller.admin.apiconfig; + +import com.mzt.logapi.starter.annotation.LogRecord; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + + +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.system.controller.admin.apiconfig.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.apiconfig.ApiconfigDO; +import cn.iocoder.yudao.module.system.service.apiconfig.ApiconfigService; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +@Tag(name = "管理后台 - 接口配置") +@RestController +@RequestMapping("/system/apiconfig") +@Validated +public class ApiconfigController { + + @Resource + private ApiconfigService apiconfigService; + + @PostMapping("/create") + @Operation(summary = "创建接口配置") + @PreAuthorize("@ss.hasPermission('system:apiconfig:create')") + @LogRecord(type = "接口配置", subType = "创建", bizNo ="{{#createReqVO.getId}}" , success = "创建ID为{{#createReqVO.getId}}的接口配置") + public CommonResult createApiconfig(@Valid @RequestBody ApiconfigSaveReqVO createReqVO) { + String msg=""; + if (!apiconfigService.GetApiCodeIsExist(createReqVO.getApiCode())) + { + UUID guid = UUID.randomUUID(); + createReqVO.setId(guid.toString()); + msg= apiconfigService.createApiconfig(createReqVO); + } + else + { + msg="Api代码重复"; + } + + return success(msg); + } + + @PutMapping("/update") + @Operation(summary = "更新接口配置") + @PreAuthorize("@ss.hasPermission('system:apiconfig:update')") + @LogRecord(type = "接口配置", subType = "更新", bizNo ="{{#createReqVO.getId}}" , success = "更新ID为{{#createReqVO.getId}}的接口配置") + public CommonResult updateApiconfig(@Valid @RequestBody ApiconfigSaveReqVO updateReqVO) { + boolean bol=true; + if (!apiconfigService.GetApiCodeIsExist(updateReqVO.getApiCode())) + { + apiconfigService.updateApiconfig(updateReqVO); + } + else + { + bol=false; + } + + return success(bol); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除接口配置") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('system:apiconfig:delete')") + @LogRecord(type = "接口配置", subType = "删除", bizNo ="{{#id}}" , success = "删除ID为{{#id}}的接口配置") + public CommonResult deleteApiconfig(@RequestParam("id") String id) { + ApiconfigSaveReqVO updateReqVO=new ApiconfigSaveReqVO(); + updateReqVO.setId(id); + updateReqVO.setIsdelete("1"); + apiconfigService.updateApiconfig(updateReqVO); + //apiconfigService.deleteApiconfig(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得接口配置") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:apiconfig:query')") + public CommonResult getApiconfig(@RequestParam("id") String id) { + ApiconfigDO apiconfig = apiconfigService.getApiconfig(id); + return success(BeanUtils.toBean(apiconfig, ApiconfigRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得接口配置分页") + @PreAuthorize("@ss.hasPermission('system:apiconfig:query')") + public CommonResult> getApiconfigPage(@Valid ApiconfigPageReqVO pageReqVO) { + PageResult pageResult = apiconfigService.getApiconfigPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, ApiconfigRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出接口配置 Excel") + @PreAuthorize("@ss.hasPermission('system:apiconfig:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportApiconfigExcel(@Valid ApiconfigPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = apiconfigService.getApiconfigPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "接口配置.xls", "数据", ApiconfigRespVO.class, + BeanUtils.toBean(list, ApiconfigRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/vo/ApiconfigPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/vo/ApiconfigPageReqVO.java new file mode 100644 index 000000000..be3728f77 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/vo/ApiconfigPageReqVO.java @@ -0,0 +1,53 @@ +package cn.iocoder.yudao.module.system.controller.admin.apiconfig.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +@Schema(description = "管理后台 - 接口配置分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ApiconfigPageReqVO extends PageParam { + + @Schema(description = "机构ID", example = "22500") + private String orgId; + + @Schema(description = "接口类别:下拉选项:HIS接口 ,体检接口,LIS接口,EMR接口", example = "1") + private String apiType; + + @Schema(description = "接口名称:HIS登记信息同步,体检的登记信息同步,检查项目同步", example = "李四") + private String apiName; + + @Schema(description = "接口地址", example = "https://www.iocoder.cn") + private String apiUrl; + + @Schema(description = "sqlserver , mysql ,oracle", example = "2") + private String databaseType; + + @Schema(description = "第三方数据库的IP") + private String databaseIP; + + @Schema(description = "第三方数据库的端口") + private String databasePort; + + @Schema(description = "第三方数据库的登录用户名", example = "李四") + private String databaseUserName; + + @Schema(description = "第三方数据库的登录密码") + private String databasePwd; + + @Schema(description = "第三方软件的制造商") + private String softwareManufacturer; + + @Schema(description = "是否删除:1为删除") + private String isdelete; + + @Schema(description = "备注信息", example = "随便") + private String remark; + + @Schema(description = "api代码:his01,his02,tj01,tj02 ,此为接口代码,唯一,每条接口一个api代码") + private String apiCode; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/vo/ApiconfigRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/vo/ApiconfigRespVO.java new file mode 100644 index 000000000..7b402489e --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/vo/ApiconfigRespVO.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.system.controller.admin.apiconfig.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 接口配置 Response VO") +@Data +@ExcelIgnoreUnannotated +public class ApiconfigRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "10797") + @ExcelProperty("主键") + private String id; + + @Schema(description = "机构ID", example = "22500") + @ExcelProperty("机构ID") + private String orgId; + + @Schema(description = "接口类别:下拉选项:HIS接口 ,体检接口,LIS接口,EMR接口", example = "1") + @ExcelProperty("接口类别:下拉选项:HIS接口 ,体检接口,LIS接口,EMR接口") + private String apiType; + + @Schema(description = "接口名称:HIS登记信息同步,体检的登记信息同步,检查项目同步", example = "李四") + @ExcelProperty("接口名称:HIS登记信息同步,体检的登记信息同步,检查项目同步") + private String apiName; + + @Schema(description = "接口地址", example = "https://www.iocoder.cn") + @ExcelProperty("接口地址") + private String apiUrl; + + @Schema(description = "sqlserver , mysql ,oracle", example = "2") + @ExcelProperty("sqlserver , mysql ,oracle") + private String databaseType; + + @Schema(description = "第三方数据库的IP") + @ExcelProperty("第三方数据库的IP") + private String databaseIP; + + @Schema(description = "第三方数据库的端口") + @ExcelProperty("第三方数据库的端口") + private String databasePort; + + @Schema(description = "第三方数据库的登录用户名", example = "李四") + @ExcelProperty("第三方数据库的登录用户名") + private String databaseUserName; + + @Schema(description = "第三方数据库的登录密码") + @ExcelProperty("第三方数据库的登录密码") + private String databasePwd; + + @Schema(description = "第三方软件的制造商") + @ExcelProperty("第三方软件的制造商") + private String softwareManufacturer; + + @Schema(description = "是否删除:1为删除") + @ExcelProperty("是否删除:1为删除") + private String isdelete; + + @Schema(description = "备注信息", example = "随便") + @ExcelProperty("备注信息") + private String remark; + + @Schema(description = "api代码:his01,his02,tj01,tj02 ,此为接口代码,唯一,每条接口一个api代码", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("api代码:his01,his02,tj01,tj02 ,此为接口代码,唯一,每条接口一个api代码") + private String apiCode; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/vo/ApiconfigSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/vo/ApiconfigSaveReqVO.java new file mode 100644 index 000000000..d55313529 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/vo/ApiconfigSaveReqVO.java @@ -0,0 +1,54 @@ +package cn.iocoder.yudao.module.system.controller.admin.apiconfig.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; + + +@Schema(description = "管理后台 - 接口配置新增/修改 Request VO") +@Data +public class ApiconfigSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "10797") + private String id; + + @Schema(description = "机构ID", example = "22500") + private String orgId; + + @Schema(description = "接口类别:下拉选项:HIS接口 ,体检接口,LIS接口,EMR接口", example = "1") + private String apiType; + + @Schema(description = "接口名称:HIS登记信息同步,体检的登记信息同步,检查项目同步", example = "李四") + private String apiName; + + @Schema(description = "接口地址", example = "https://www.iocoder.cn") + private String apiUrl; + + @Schema(description = "sqlserver , mysql ,oracle", example = "2") + private String databaseType; + + @Schema(description = "第三方数据库的IP") + private String databaseIP; + + @Schema(description = "第三方数据库的端口") + private String databasePort; + + @Schema(description = "第三方数据库的登录用户名", example = "李四") + private String databaseUserName; + + @Schema(description = "第三方数据库的登录密码") + private String databasePwd; + + @Schema(description = "第三方软件的制造商") + private String softwareManufacturer; + + @Schema(description = "是否删除:1为删除") + private String isdelete; + + @Schema(description = "备注信息", example = "随便") + private String remark; + + @Schema(description = "api代码:his01,his02,tj01,tj02 ,此为接口代码,唯一,每条接口一个api代码", requiredMode = Schema.RequiredMode.REQUIRED) + private String apiCode; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/apiconfig/ApiconfigDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/apiconfig/ApiconfigDO.java new file mode 100644 index 000000000..6ce06af37 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/apiconfig/ApiconfigDO.java @@ -0,0 +1,93 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.apiconfig; + +import lombok.*; +import java.util.*; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 接口配置 DO + * + * @author 李晓东 + */ +@TableName("tb_apiconfig") +@KeySequence("tb_apiconfig_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ApiconfigDO { + + /** + * 主键 + */ + @TableId(type = IdType.INPUT) + private String id; + /** + * 机构ID + */ + @TableField("orgId") + private String orgId; + /** + * 接口类别:下拉选项:HIS接口 ,体检接口,LIS接口,EMR接口 + */ + @TableField("apiType") + private String apiType; + /** + * 接口名称:HIS登记信息同步,体检的登记信息同步,检查项目同步 + */ + @TableField("apiName") + private String apiName; + /** + * 接口地址 + */ + @TableField("apiUrl") + private String apiUrl; + /** + * sqlserver , mysql ,oracle + */ + @TableField("databaseType") + private String databaseType; + /** + * 第三方数据库的IP + */ + @TableField("databaseIP") + private String databaseIP; + /** + * 第三方数据库的端口 + */ + @TableField("databasePort") + private String databasePort; + /** + * 第三方数据库的登录用户名 + */ + @TableField("databaseUserName") + private String databaseUserName; + /** + * 第三方数据库的登录密码 + */ + @TableField("databasePwd") + private String databasePwd; + /** + * 第三方软件的制造商 + */ + @TableField("softwareManufacturer") + private String softwareManufacturer; + /** + * 是否删除:1为删除 + */ + @TableField("isdelete") + private String isdelete; + /** + * 备注信息 + */ + @TableField("remark") + private String remark; + /** + * api代码:his01,his02,tj01,tj02 ,此为接口代码,唯一,每条接口一个api代码 + */ + @TableField("apiCode") + private String apiCode; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/apiconfig/ApiconfigMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/apiconfig/ApiconfigMapper.java new file mode 100644 index 000000000..00b798743 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/apiconfig/ApiconfigMapper.java @@ -0,0 +1,45 @@ +package cn.iocoder.yudao.module.system.dal.mysql.apiconfig; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.system.dal.dataobject.apiconfig.ApiconfigDO; +import cn.iocoder.yudao.module.system.dal.dataobject.org.OrgUnitDO; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.system.controller.admin.apiconfig.vo.*; +import org.apache.ibatis.annotations.Param; + +/** + * 接口配置 Mapper + * + * @author 李晓东 + */ +@InterceptorIgnore(tenantLine = "true") +@Mapper +public interface ApiconfigMapper extends BaseMapperX { + + default PageResult selectPage(ApiconfigPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + //.eqIfPresent(ApiconfigDO::getOrgId, reqVO.getOrgId()) + .eqIfPresent(ApiconfigDO::getApiType, reqVO.getApiType()) + .likeIfPresent(ApiconfigDO::getApiName, reqVO.getApiName()) + // .eqIfPresent(ApiconfigDO::getApiUrl, reqVO.getApiUrl()) + // .eqIfPresent(ApiconfigDO::getDatabaseType, reqVO.getDatabaseType()) + // .eqIfPresent(ApiconfigDO::getDatabaseIP, reqVO.getDatabaseIP()) + // .eqIfPresent(ApiconfigDO::getDatabasePort, reqVO.getDatabasePort()) + // .likeIfPresent(ApiconfigDO::getDatabaseUserName, reqVO.getDatabaseUserName()) + // .eqIfPresent(ApiconfigDO::getDatabasePwd, reqVO.getDatabasePwd()) + // .eqIfPresent(ApiconfigDO::getSoftwareManufacturer, reqVO.getSoftwareManufacturer()) + // .eqIfPresent(ApiconfigDO::getIsdelete, reqVO.getIsdelete()) + // .eqIfPresent(ApiconfigDO::getRemark, reqVO.getRemark()) + .likeIfPresent(ApiconfigDO::getApiCode, reqVO.getApiCode()) + .eq(ApiconfigDO::getIsdelete, '0') + .orderByDesc(ApiconfigDO::getId)); + } + + ///验证APICode是否存在 + int getAPICodeIsExist(@Param("apiCode") String apiCode); +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/doctor/DoctorMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/doctor/DoctorMapper.java index 80ed93029..2c42482f3 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/doctor/DoctorMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/doctor/DoctorMapper.java @@ -5,7 +5,9 @@ import java.util.*; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.system.dal.dataobject.apiconfig.ApiconfigDO; import cn.iocoder.yudao.module.system.dal.dataobject.doctor.DoctorDO; +import cn.iocoder.yudao.module.system.dal.dataobject.wx.WxDO; import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import org.apache.ibatis.annotations.Mapper; import cn.iocoder.yudao.module.system.controller.admin.doctor.vo.*; @@ -23,8 +25,7 @@ public interface DoctorMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(DoctorDO::getDoctorName, reqVO.getDoctorName()) .likeIfPresent(DoctorDO::getDepartmentName, reqVO.getDepartmentName()) - .or(wrapper -> wrapper.eq(DoctorDO::getIsdelete, 0)) - .or(wrapper -> wrapper.isNull(DoctorDO::getIsdelete)) + .eq(DoctorDO::getIsdelete, '0') .orderByDesc(DoctorDO::getDoctorID)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/org/OrgUnitMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/org/OrgUnitMapper.java index 168a2887e..d4c272c82 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/org/OrgUnitMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/org/OrgUnitMapper.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.org; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.system.dal.dataobject.apiconfig.ApiconfigDO; import cn.iocoder.yudao.module.system.dal.dataobject.doctor.DoctorDO; import cn.iocoder.yudao.module.system.dal.dataobject.org.OrgUnitDO; import com.baomidou.mybatisplus.annotation.InterceptorIgnore; @@ -32,8 +33,7 @@ public interface OrgUnitMapper extends BaseMapperX { .betweenIfPresent(OrgUnitDO::getCreateDate, reqVO.getCreateDate()) .likeIfPresent(OrgUnitDO::getHighLevelOrgName, reqVO.getHighLevelOrgName()) .eqIfPresent(OrgUnitDO::getOrgLogoUrl, reqVO.getOrgLogoUrl()) - .or(wrapper -> wrapper.eq(OrgUnitDO::getIsdelete, 0)) - .or(wrapper -> wrapper.isNull(OrgUnitDO::getIsdelete)) + .eq(OrgUnitDO::getIsdelete, '0') .orderByDesc(OrgUnitDO::getOrgID)); } //查询当前ID 是否存在 diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/wx/WxMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/wx/WxMapper.java index 651a687f8..7b25a08c5 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/wx/WxMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/wx/WxMapper.java @@ -25,8 +25,7 @@ public interface WxMapper extends BaseMapperX { .likeIfPresent(WxDO::getWxUserid, reqVO.getWxUserid()) .likeIfPresent(WxDO::getBindTel, reqVO.getBindTel()) .likeIfPresent(WxDO::getPersonName, reqVO.getPersonName()) - .or(wrapper -> wrapper.eq(WxDO::getIsdelete, 0)) - .or(wrapper -> wrapper.isNull(WxDO::getIsdelete)) + .eq(WxDO::getIsdelete, '0') .orderByDesc(WxDO::getId)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/apiconfig/ApiconfigService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/apiconfig/ApiconfigService.java new file mode 100644 index 000000000..717b48c5b --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/apiconfig/ApiconfigService.java @@ -0,0 +1,58 @@ +package cn.iocoder.yudao.module.system.service.apiconfig; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.apiconfig.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.apiconfig.ApiconfigDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +import javax.validation.Valid; + +/** + * 接口配置 Service 接口 + * + * @author 李晓东 + */ +public interface ApiconfigService { + + /** + * 创建接口配置 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + String createApiconfig(@Valid ApiconfigSaveReqVO createReqVO); + + /** + * 更新接口配置 + * + * @param updateReqVO 更新信息 + */ + void updateApiconfig(@Valid ApiconfigSaveReqVO updateReqVO); + + /** + * 删除接口配置 + * + * @param id 编号 + */ + void deleteApiconfig(String id); + + /** + * 获得接口配置 + * + * @param id 编号 + * @return 接口配置 + */ + ApiconfigDO getApiconfig(String id); + + /** + * 获得接口配置分页 + * + * @param pageReqVO 分页查询 + * @return 接口配置分页 + */ + PageResult getApiconfigPage(ApiconfigPageReqVO pageReqVO); + + boolean GetApiCodeIsExist(String AppCode); + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/apiconfig/ApiconfigServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/apiconfig/ApiconfigServiceImpl.java new file mode 100644 index 000000000..d27b61267 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/apiconfig/ApiconfigServiceImpl.java @@ -0,0 +1,87 @@ +package cn.iocoder.yudao.module.system.service.apiconfig; + +import cn.iocoder.yudao.framework.common.exception.ErrorCode; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; + +import cn.iocoder.yudao.module.system.controller.admin.apiconfig.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.apiconfig.ApiconfigDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + +import cn.iocoder.yudao.module.system.dal.mysql.apiconfig.ApiconfigMapper; + +import javax.annotation.Resource; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; + +/** + * 接口配置 Service 实现类 + * + * @author 李晓东 + */ +@Service +@Validated +public class ApiconfigServiceImpl implements ApiconfigService { + + @Resource + private ApiconfigMapper apiconfigMapper; + + @Override + public String createApiconfig(ApiconfigSaveReqVO createReqVO) { + // 插入 + ApiconfigDO apiconfig = BeanUtils.toBean(createReqVO, ApiconfigDO.class); + apiconfigMapper.insert(apiconfig); + // 返回 + return apiconfig.getId(); + } + + @Override + public void updateApiconfig(ApiconfigSaveReqVO updateReqVO) { + // 校验存在 + validateApiconfigExists(updateReqVO.getId()); + // 更新 + ApiconfigDO updateObj = BeanUtils.toBean(updateReqVO, ApiconfigDO.class); + apiconfigMapper.updateById(updateObj); + } + + @Override + public void deleteApiconfig(String id) { + // 校验存在 + validateApiconfigExists(id); + // 删除 + apiconfigMapper.deleteById(id); + } + + private void validateApiconfigExists(String id) { + if (apiconfigMapper.selectById(id) == null) { + throw exception(new ErrorCode(1, "ID为空")); + } + } + + @Override + public ApiconfigDO getApiconfig(String id) { + return apiconfigMapper.selectById(id); + } + + @Override + public PageResult getApiconfigPage(ApiconfigPageReqVO pageReqVO) { + return apiconfigMapper.selectPage(pageReqVO); + } + + @Override + public boolean GetApiCodeIsExist(String AppCode) { + boolean bol = false; + int count = apiconfigMapper.getAPICodeIsExist(AppCode); + if (count > 0) { + bol = true; + } + return bol; + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/apiconfig/ApiconfigMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/apiconfig/ApiconfigMapper.xml new file mode 100644 index 000000000..f515d9f72 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/apiconfig/ApiconfigMapper.xml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file