Merge branch 'lisb_dev' of codeup.aliyun.com:pig/pigx/pigx into leng_dev
This commit is contained in:
commit
2b5deed723
23 files changed
+301
-84
No files matched your search
+21
@@ -1,7 +1,11 @@
|
||||
package com.pig4cloud.pigx.common.data.mybatis;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -22,24 +26,41 @@ public class BaseEntity implements Serializable {
|
||||
* 创建者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@ApiModelProperty(value = "创建人", example = "admin")
|
||||
@ExcelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@ApiModelProperty(value = "创建时间", example = "2021-12-20 13:27:44")
|
||||
@ExcelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@ApiModelProperty(value = "更新人", example = "admin")
|
||||
@ExcelIgnore
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@ApiModelProperty(value = "更新时间", example = "2021-12-20 13:27:44")
|
||||
@ExcelIgnore
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除 1:已删除 0:正常
|
||||
*/
|
||||
@TableLogic
|
||||
@ApiModelProperty(value = "删除标记,1:已删除,0:正常")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@ExcelIgnore
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
+2
@@ -18,6 +18,7 @@ package com.pig4cloud.pigx.admin.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -55,6 +56,7 @@ public class SysDictItem extends Model<SysDictItem> {
|
||||
* 数据值
|
||||
*/
|
||||
@ApiModelProperty(value = "数据值")
|
||||
@JsonProperty(value = "value")
|
||||
private String itemValue;
|
||||
|
||||
/**
|
||||
|
||||
+1
-18
@@ -24,8 +24,6 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 公共参数配置
|
||||
*
|
||||
@@ -84,26 +82,11 @@ public class SysPublicParam extends Model<SysPublicParam> {
|
||||
@ApiModelProperty(value = "编码", example = "^(PIG|PIGX)$")
|
||||
private String validateCode;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@ApiModelProperty(value = "创建时间", example = "2019-03-21 12:28:48")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
@ApiModelProperty(value = "修改时间", example = "2019-03-21 12:28:48")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否是系统内置
|
||||
*/
|
||||
@TableField(value = "`system`")
|
||||
@ApiModelProperty(value = "是否是系统内置")
|
||||
private String system;
|
||||
private String systemFlag;
|
||||
|
||||
/**
|
||||
* 配置类型:0-默认;1-检索;2-原文;3-报表;4-安全;5-文档;6-消息;9-其他
|
||||
|
||||
@@ -33,10 +33,10 @@
|
||||
<description>pigx 通用用户权限管理系统业务处理模块</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 数据库驱动 -->
|
||||
<!-- mysql -->
|
||||
<dependency>
|
||||
<groupId>com.oracle.database.jdbc</groupId>
|
||||
<artifactId>ojdbc8</artifactId>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<!--upms api、model 模块-->
|
||||
<dependency>
|
||||
|
||||
+10
@@ -125,4 +125,14 @@ public class SysClientController {
|
||||
return R.ok(clientDetailsService.list());
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步缓存字典
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("同步终端")
|
||||
@PutMapping("/sync")
|
||||
public R sync() {
|
||||
return clientDetailsService.syncClientCache();
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -125,7 +125,7 @@ public class SysPublicParamController {
|
||||
@SysLog("同步参数")
|
||||
@PutMapping("/sync")
|
||||
public R sync() {
|
||||
return sysPublicParamService.syncDictCache();
|
||||
return sysPublicParamService.syncParamCache();
|
||||
}
|
||||
|
||||
}
|
||||
+7
@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pigx.admin.api.dto.SysOauthClientDetailsDTO;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysOauthClientDetails;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -63,4 +64,10 @@ public interface SysOauthClientDetailsService extends IService<SysOauthClientDet
|
||||
*/
|
||||
Page queryPage(Page page, SysOauthClientDetails query);
|
||||
|
||||
/**
|
||||
* 同步缓存 (清空缓存)
|
||||
* @return R
|
||||
*/
|
||||
R syncClientCache();
|
||||
|
||||
}
|
||||
+1
-1
@@ -54,6 +54,6 @@ public interface SysPublicParamService extends IService<SysPublicParam> {
|
||||
* 同步缓存
|
||||
* @return R
|
||||
*/
|
||||
R syncDictCache();
|
||||
R syncParamCache();
|
||||
|
||||
}
|
||||
+7
@@ -31,6 +31,7 @@ import com.pig4cloud.pigx.admin.mapper.SysOauthClientDetailsMapper;
|
||||
import com.pig4cloud.pigx.admin.service.SysOauthClientDetailsService;
|
||||
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.core.util.SpringContextHolder;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -151,4 +152,10 @@ public class SysOauthClientDetailsServiceImpl extends ServiceImpl<SysOauthClient
|
||||
return dtoPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = CacheConstants.CLIENT_DETAILS_KEY, allEntries = true)
|
||||
public R syncClientCache() {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -63,7 +63,7 @@ public class SysPublicParamServiceImpl extends ServiceImpl<SysPublicParamMapper,
|
||||
public R updateParam(SysPublicParam sysPublicParam) {
|
||||
SysPublicParam param = this.getById(sysPublicParam.getPublicId());
|
||||
// 系统内置
|
||||
if (DictTypeEnum.SYSTEM.getType().equals(param.getSystem())) {
|
||||
if (DictTypeEnum.SYSTEM.getType().equals(param.getSystemFlag())) {
|
||||
return R.failed("系统内置参数不能删除");
|
||||
}
|
||||
return R.ok(this.updateById(sysPublicParam));
|
||||
@@ -79,7 +79,7 @@ public class SysPublicParamServiceImpl extends ServiceImpl<SysPublicParamMapper,
|
||||
public R removeParam(Long publicId) {
|
||||
SysPublicParam param = this.getById(publicId);
|
||||
// 系统内置
|
||||
if (DictTypeEnum.SYSTEM.getType().equals(param.getSystem())) {
|
||||
if (DictTypeEnum.SYSTEM.getType().equals(param.getSystemFlag())) {
|
||||
return R.failed("系统内置参数不能删除");
|
||||
}
|
||||
return R.ok(this.removeById(publicId));
|
||||
@@ -91,7 +91,7 @@ public class SysPublicParamServiceImpl extends ServiceImpl<SysPublicParamMapper,
|
||||
*/
|
||||
@Override
|
||||
@CacheEvict(value = CacheConstants.PARAMS_DETAILS, allEntries = true)
|
||||
public R syncDictCache() {
|
||||
public R syncParamCache() {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?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.pig4cloud.pigx.daemon.quartz.mapper.SysJobLogMapper">
|
||||
<resultMap id="sysJobLogMap" type="com.pig4cloud.pigx.daemon.quartz.entity.SysJobLog">
|
||||
<id property="jobLogId" column="job_log_id"/>
|
||||
<result property="jobId" column="job_id"/>
|
||||
<result property="jobName" column="job_name"/>
|
||||
<result property="jobGroup" column="job_group"/>
|
||||
<result property="jobOrder" column="job_order"/>
|
||||
<result property="jobType" column="job_type"/>
|
||||
<result property="executePath" column="execute_path"/>
|
||||
<result property="className" column="class_name"/>
|
||||
<result property="methodName" column="method_name"/>
|
||||
<result property="methodParamsValue" column="method_params_value"/>
|
||||
<result property="cronExpression" column="cron_expression"/>
|
||||
<result property="jobMessage" column="job_message"/>
|
||||
<result property="jobLogStatus" column="job_log_status"/>
|
||||
<result property="executeTime" column="execute_time"/>
|
||||
<result property="exceptionInfo" column="exception_info"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -1,29 +0,0 @@
|
||||
<?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.pig4cloud.pigx.daemon.quartz.mapper.SysJobMapper">
|
||||
<resultMap id="sysJobMap" type="com.pig4cloud.pigx.daemon.quartz.entity.SysJob">
|
||||
<id property="jobId" column="job_id"/>
|
||||
<result property="jobName" column="job_name"/>
|
||||
<result property="jobGroup" column="job_group"/>
|
||||
<result property="jobOrder" column="job_order"/>
|
||||
<result property="jobType" column="job_type"/>
|
||||
<result property="executePath" column="execute_path"/>
|
||||
<result property="className" column="class_name"/>
|
||||
<result property="methodName" column="method_name"/>
|
||||
<result property="methodParamsValue" column="method_params_value"/>
|
||||
<result property="cronExpression" column="cron_expression"/>
|
||||
<result property="misfirePolicy" column="misfire_policy"/>
|
||||
<result property="jobTenantType" column="job_tenant_type"/>
|
||||
<result property="jobStatus" column="job_status"/>
|
||||
<result property="jobExecuteStatus" column="job_execute_status"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="startTime" column="start_time"/>
|
||||
<result property="previousTime" column="previous_time"/>
|
||||
<result property="nextTime" column="next_time"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+1
-1
@@ -36,7 +36,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wxaccount")
|
||||
@RequestMapping("/wx-account")
|
||||
public class WxAccountController {
|
||||
|
||||
private final WxAccountService wxAccountService;
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wxaccountfans")
|
||||
@RequestMapping("/wx-account-fans")
|
||||
public class WxAccountFansController {
|
||||
|
||||
private final WxAccountFansService wxAccountFansService;
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.pig4cloud.pigx.mp.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.mp.entity.WxAccountTag;
|
||||
import com.pig4cloud.pigx.mp.entity.WxAutoReply;
|
||||
import com.pig4cloud.pigx.mp.service.WxAccountTagService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信账户标签
|
||||
*
|
||||
* @author lishangbu
|
||||
* @date 2021/12/31
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wx-account-tag")
|
||||
public class WxAccountTagController {
|
||||
|
||||
private final WxAccountTagService wxAccountTagService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param wxAccountTag 账户标签查询条件
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<IPage<WxAccountTag>> getWxAccountTagPage(Page page, WxAccountTag wxAccountTag) {
|
||||
return R.ok(wxAccountTagService.page(page, Wrappers.query(wxAccountTag)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
* @param wxAccountTag 账户标签查询条件
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public R<List<WxAccountTag>> listWxAccountTags(WxAccountTag wxAccountTag) {
|
||||
return R.ok(wxAccountTagService.list(Wrappers.query(wxAccountTag)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存账户标签
|
||||
* @param wxAccountTag 待保存的账户标签
|
||||
* @return 包含保存成功后的账户标签的API调用结果
|
||||
*/
|
||||
@PostMapping
|
||||
public R<WxAccountTag> saveAccountTag(@RequestBody @Valid WxAccountTag wxAccountTag) {
|
||||
return R.ok(wxAccountTagService.saveAccountTag(wxAccountTag));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改账户标签
|
||||
* @param wxAccountTag 待修改的账户标签
|
||||
* @return 包含修改成功后的账户标签的API调用结果
|
||||
*/
|
||||
@PutMapping
|
||||
public R<WxAccountTag> updateAccountTag(@RequestBody @Valid WxAccountTag wxAccountTag) {
|
||||
return R.ok(wxAccountTagService.updateAccountTag(wxAccountTag));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id:\\d+}")
|
||||
public R<Boolean> removeAccountTagById(@PathVariable Long id) {
|
||||
return R.ok(wxAccountTagService.removeAccountTagById(id));
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wxautoreply")
|
||||
@RequestMapping("/wx-auto-reply")
|
||||
public class WxAutoReplyController {
|
||||
|
||||
private final WxAutoReplyService wxAutoReplyService;
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wxfansmsg")
|
||||
@RequestMapping("/wx-fans-msg")
|
||||
public class WxFansMsgController {
|
||||
|
||||
private final WxMsgService wxMsgService;
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wxmaterial")
|
||||
@RequestMapping("/wx-material")
|
||||
public class WxMaterialController {
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wxmenu")
|
||||
@RequestMapping("/wx-menu")
|
||||
public class WxMenuController {
|
||||
|
||||
private final WxMenuService wxMenuService;
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.pig4cloud.pigx.mp.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.pig4cloud.pigx.common.data.mybatis.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 微信公众号账号标签
|
||||
*
|
||||
* @author lishangbu
|
||||
* @date 2021/12/31
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WxAccountTag extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
@NotBlank(message = "标签不能为空")
|
||||
private String tag;
|
||||
|
||||
}
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
package com.pig4cloud.pigx.mp.mapper;
|
||||
|
||||
import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper;
|
||||
import com.pig4cloud.pigx.mp.entity.WxAccount;
|
||||
import com.pig4cloud.pigx.mp.entity.WxAccountTag;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 公众号账户
|
||||
*
|
||||
* @author lengleng
|
||||
* @date 2019-03-26 22:07:53
|
||||
*/
|
||||
@Mapper
|
||||
public interface WxAccountTagMapper extends PigxBaseMapper<WxAccountTag> {
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.pig4cloud.pigx.mp.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pigx.mp.entity.WxAccountTag;
|
||||
|
||||
/**
|
||||
* 微信账户标签服务
|
||||
*
|
||||
* @author lishangbu
|
||||
* @date 2021/12/31
|
||||
*/
|
||||
public interface WxAccountTagService extends IService<WxAccountTag> {
|
||||
|
||||
/**
|
||||
* 保存账户标签
|
||||
* @param accountTag 账户标签
|
||||
* @return 保存成功后的账户标签
|
||||
*/
|
||||
WxAccountTag saveAccountTag(WxAccountTag accountTag);
|
||||
|
||||
/**
|
||||
* 更新账户标签
|
||||
* @param accountTag 待更新的账户标签
|
||||
* @return 修改成功后的账户标签
|
||||
*/
|
||||
WxAccountTag updateAccountTag(WxAccountTag accountTag);
|
||||
|
||||
/**
|
||||
* 删除账户标签
|
||||
* @param id 待删除的账户标签主键
|
||||
* @return 删除成功返回true,删除失败返回false
|
||||
*/
|
||||
Boolean removeAccountTagById(Long id);
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.pig4cloud.pigx.mp.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.mp.entity.WxAccountTag;
|
||||
import com.pig4cloud.pigx.mp.mapper.WxAccountTagMapper;
|
||||
import com.pig4cloud.pigx.mp.service.WxAccountTagService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* 微信账户标签服务实现类
|
||||
*
|
||||
* @author lishangbu
|
||||
* @date 2021/12/31
|
||||
*/
|
||||
@Service
|
||||
public class WxAccountTagServiceImpl extends ServiceImpl<WxAccountTagMapper, WxAccountTag>
|
||||
implements WxAccountTagService {
|
||||
|
||||
/**
|
||||
* 保存账户标签
|
||||
* @param accountTag 账户标签
|
||||
* @return 保存成功true保存失败false
|
||||
*/
|
||||
@Override
|
||||
public WxAccountTag saveAccountTag(WxAccountTag accountTag) {
|
||||
WxAccountTag wxAccountTag = baseMapper
|
||||
.selectOne(Wrappers.<WxAccountTag>lambdaQuery().eq(WxAccountTag::getTag, accountTag.getTag()));
|
||||
Assert.isNull(wxAccountTag, StrUtil.format("名称为[{}]的标签已经存在", accountTag.getTag()));
|
||||
baseMapper.insert(accountTag);
|
||||
return accountTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新账户标签
|
||||
* @param accountTag 待更新的账户标签
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public WxAccountTag updateAccountTag(WxAccountTag accountTag) {
|
||||
WxAccountTag wxAccountTag = baseMapper.selectOne(Wrappers.<WxAccountTag>lambdaQuery()
|
||||
.eq(WxAccountTag::getTag, accountTag.getTag()).ne(WxAccountTag::getId, accountTag.getId()));
|
||||
Assert.isNull(wxAccountTag, StrUtil.format("名称为[{}]的标签已经存在", accountTag.getTag()));
|
||||
baseMapper.updateById(accountTag);
|
||||
return accountTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean removeAccountTagById(Long id) {
|
||||
WxAccountTag wxAccountTag = baseMapper.selectById(id);
|
||||
Assert.notNull(wxAccountTag, "要删除的标签不存在");
|
||||
return removeById(wxAccountTag.getId());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user