Commit e7178540 by 水库浪子

1.优化匿名接口:将匿名接口所有配置抽取到yml文件中;2:优化企业微信管理模块,将当前功能使用的mybatis替换为mybatis-plus,同时移除无用接口…

…,并且增加当前模块接口的swagger文档;
1 parent 9e668dce
package com.linkwechat.web.controller.wecom;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.wecom.service.IWeCorpAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
......@@ -21,84 +25,76 @@ import java.util.List;
*/
@RestController
@RequestMapping("/wecom/corp")
@Api("企业id配置接口")
public class WeCorpAccountController extends BaseController
{
@Autowired
private IWeCorpAccountService weCorpAccountService;
/**
* 查询企业id相关配置列表
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:list')")
@GetMapping("/list")
@ApiOperation("查询企业id相关配置列表")
public TableDataInfo list(WeCorpAccount weCorpAccount)
{
startPage();
List<WeCorpAccount> list = weCorpAccountService.selectWeCorpAccountList(weCorpAccount);
List<WeCorpAccount> list = weCorpAccountService.list(new LambdaQueryWrapper<WeCorpAccount>()
.eq(WeCorpAccount::getDelFlag,Constants.NORMAL_CODE)
.like(WeCorpAccount::getCompanyName,weCorpAccount.getCompanyName()));
return getDataTable(list);
}
/**
* 获取企业id相关配置详细信息
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(weCorpAccountService.selectWeCorpAccountById(id));
}
/**
* 新增企业id相关配置
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:add')")
@Log(title = "新增企业id相关配置", businessType = BusinessType.INSERT)
@PostMapping
@ApiOperation("新增企业id相关配置")
public AjaxResult add(@Validated @RequestBody WeCorpAccount weCorpAccount)
{
return toAjax(weCorpAccountService.insertWeCorpAccount(weCorpAccount));
weCorpAccountService.save(weCorpAccount);
return AjaxResult.success();
}
/**
* 修改企业id相关配置
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:edit')")
@Log(title = "修改企业id相关配置", businessType = BusinessType.UPDATE)
@PutMapping
@ApiOperation("修改企业id相关配置")
public AjaxResult edit(@Validated @RequestBody WeCorpAccount weCorpAccount)
{
return toAjax(weCorpAccountService.updateWeCorpAccount(weCorpAccount));
weCorpAccountService.updateById(weCorpAccount);
return AjaxResult.success();
}
/**
* 启用有效企业微信账号
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:startVailWeCorpAccount')")
@Log(title = "启用有效企业微信账号", businessType = BusinessType.DELETE)
@PutMapping("/startVailWeCorpAccount/{corpId}")
@ApiOperation("启用有效企业微信账号")
public AjaxResult startWeCorpAccount(@PathVariable String corpId)
{
return toAjax(weCorpAccountService.startVailWeCorpAccount(corpId));
}
/**
* 客户流失通知开关
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:startCustomerChurnNoticeSwitch')")
@Log(title = "客户流失通知开关", businessType = BusinessType.UPDATE)
@PutMapping("/startCustomerChurnNoticeSwitch/{status}")
@ApiOperation("客户流失通知开关")
public AjaxResult startCustomerChurnNoticeSwitch(@PathVariable String status)
{
return toAjax(weCorpAccountService.startCustomerChurnNoticeSwitch(status));
weCorpAccountService.startCustomerChurnNoticeSwitch(status);
return AjaxResult.success();
}
/**
* 客户流失通知开关查询
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:getCustomerChurnNoticeSwitch')")
@Log(title = "客户流失通知开关查询", businessType = BusinessType.OTHER)
@GetMapping("/getCustomerChurnNoticeSwitch")
@ApiOperation("客户流失通知开关查询")
public AjaxResult getCustomerChurnNoticeSwitch()
{
return AjaxResult.success("操作成功",weCorpAccountService.getCustomerChurnNoticeSwitch());
......
......@@ -16,7 +16,36 @@ ruoyi:
captchaType: math
# 企业微信用户首次登录系统默认密码
weUserDefaultPwd: 123456
#匿名访问的URL
anonUrl:
- /login
- /captchaImage
- /findWxQrLoginInfo
- /wxQrLogin
- /profile/**
- /common/download**
- /common/download/resource**
- /common/download/url**
- /swagger-ui.html
- /swagger-resources/**
- /webjars/**
- /*/api-docs
- /druid/**
- /wecom/callback/**
- /wecom/chat/item/list
- /wecom/chat/collection/list
- /wecom/chat/collection/cancleCollection
- /wecom/chat/collection/addCollection
- /wecom/chat/side/h5List
- /wecom/ticket/**
- /wecom/user/getUserInfo
- /wecom/portrait/**
- /wecom/fission/poster
- /wecom/fission/*/progress/*
- /wecom/reward/getRewardByFissionId/**
- /wecom/groupCode/getActualCode/**
- /wecom/community/h5/**
- /weixin/auth/**
# 开发环境配置
server:
# 服务器的HTTP端口,默认为8090
......
......@@ -33,6 +33,11 @@ public class RuoYiConfig
/** 企业微信账号登录系统默认密码 */
private static String weUserDefaultPwd="123456";
/**匿名访问的URL*/
private String[] anonUrl;
public String getName()
{
return name;
......@@ -132,4 +137,12 @@ public class RuoYiConfig
public void setWeUserDefaultPwd(String weUserDefaultPwd) {
RuoYiConfig.weUserDefaultPwd = weUserDefaultPwd;
}
public String[] getAnonUrl() {
return anonUrl;
}
public void setAnonUrl(String[] anonUrl) {
this.anonUrl = anonUrl;
}
}
package com.linkwechat.common.core.domain.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModel;
......@@ -8,7 +11,6 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.constraints.NotBlank;
......@@ -23,11 +25,14 @@ import javax.validation.constraints.NotBlank;
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("企业id配置相关实体")
@TableName("we_corp_account")
public class WeCorpAccount extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@TableId
@ApiModelProperty("主键")
private Long id= SnowFlakeUtil.nextId();
/** 企业名称 */
......@@ -36,12 +41,12 @@ public class WeCorpAccount extends BaseEntity
private String companyName;
/** 企业ID */
@ApiModelProperty("企业ID")
@ApiModelProperty("企业corpId")
@NotBlank(message = "企业ID不能为空")
private String corpId;
/** 应用的密钥凭证 */
@ApiModelProperty("应用的密钥凭证")
@ApiModelProperty("企业为corpSecret")
@NotBlank(message = "应用的密钥凭证不能为空")
private String corpSecret;
......@@ -75,7 +80,7 @@ public class WeCorpAccount extends BaseEntity
private String wxQrLoginRedirectUri;
@ApiModelProperty("客户流失通知开关 0:关闭 1:开启")
private String customerChurnNoticeSwitch = new String("0");
private String customerChurnNoticeSwitch = Constants.NORMAL_CODE;
@ApiModelProperty("企业管理员账号")
......
package com.linkwechat.framework.config;
import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.framework.security.filter.JwtAuthenticationTokenFilter;
import com.linkwechat.framework.security.handle.AuthenticationEntryPointImpl;
import com.linkwechat.framework.security.handle.LogoutSuccessHandlerImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
......@@ -55,6 +57,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private CorsFilter corsFilter;
@Autowired
private RuoYiConfig ruoYiConfig;
/**
* 解决 无法直接注入 AuthenticationManager
*
......@@ -84,6 +91,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
*/
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
System.out.println(
StringUtils.join(ruoYiConfig.getAnonUrl(),",")
);
httpSecurity
// CSRF禁用,因为不使用session
.csrf().disable()
......@@ -93,8 +105,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// 过滤请求
.authorizeRequests()
// 对于登录login 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/captchaImage", "/findWxQrLoginInfo", "/wxQrLogin").anonymous()
.antMatchers(ruoYiConfig.getAnonUrl()).anonymous()
// .antMatchers("/login", "/captchaImage", "/findWxQrLoginInfo", "/wxQrLogin").anonymous()
.antMatchers(
HttpMethod.GET,
"/*.html",
......@@ -102,34 +116,34 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/**/*.css",
"/**/*.js"
).permitAll()
.antMatchers("/profile/**").anonymous()
.antMatchers("/common/download**").anonymous()
.antMatchers("/common/download/resource**").anonymous()
.antMatchers("/common/download/url**").anonymous()
.antMatchers("/swagger-ui.html").anonymous()
.antMatchers("/swagger-resources/**").anonymous()
.antMatchers("/webjars/**").anonymous()
.antMatchers("/*/api-docs").anonymous()
.antMatchers("/druid/**").anonymous()
.antMatchers("/wecom/callback/**").anonymous()
.antMatchers("/wecom/chat/item/list").anonymous()
.antMatchers("/wecom/chat/collection/list").anonymous()
.antMatchers("/wecom/chat/collection/cancleCollection").anonymous()
.antMatchers("/wecom/chat/collection/addCollection").anonymous()
.antMatchers("/wecom/chat/side/h5List").anonymous()
.antMatchers("/wecom/ticket/**").anonymous()
.antMatchers("/wecom/user/getUserInfo").anonymous()
// .antMatchers("/common/uploadFile2Cos").anonymous()
// .antMatchers("/wecom/material/temporaryMaterialMediaId").anonymous()
.antMatchers("/wecom/portrait/**").anonymous()
.antMatchers("/wecom/fission/poster", "/wecom/fission/*/progress/*", "/wecom/reward/getRewardByFissionId/**").anonymous()
// 获取实际群活码和社群运营H5页面不需要登录
.antMatchers("/wecom/groupCode/getActualCode/**").anonymous()
.antMatchers("/wecom/community/h5/**").anonymous()
//微信授权接口
.antMatchers("/weixin/auth/**").anonymous()
// .antMatchers("/profile/**").anonymous()
// .antMatchers("/common/download**").anonymous()
// .antMatchers("/common/download/resource**").anonymous()
// .antMatchers("/common/download/url**").anonymous()
// .antMatchers("/swagger-ui.html").anonymous()
// .antMatchers("/swagger-resources/**").anonymous()
// .antMatchers("/webjars/**").anonymous()
// .antMatchers("/*/api-docs").anonymous()
// .antMatchers("/druid/**").anonymous()
// .antMatchers("/wecom/callback/**").anonymous()
//
// .antMatchers("/wecom/chat/item/list").anonymous()
// .antMatchers("/wecom/chat/collection/list").anonymous()
// .antMatchers("/wecom/chat/collection/cancleCollection").anonymous()
// .antMatchers("/wecom/chat/collection/addCollection").anonymous()
// .antMatchers("/wecom/chat/side/h5List").anonymous()
// .antMatchers("/wecom/ticket/**").anonymous()
//
// .antMatchers("/wecom/user/getUserInfo").anonymous()
// // .antMatchers("/common/uploadFile2Cos").anonymous()
//// .antMatchers("/wecom/material/temporaryMaterialMediaId").anonymous()
// .antMatchers("/wecom/portrait/**").anonymous()
// .antMatchers("/wecom/fission/poster", "/wecom/fission/*/progress/*", "/wecom/reward/getRewardByFissionId/**").anonymous()
// // 获取实际群活码和社群运营H5页面不需要登录
// .antMatchers("/wecom/groupCode/getActualCode/**").anonymous()
// .antMatchers("/wecom/community/h5/**").anonymous()
// //微信授权接口
// .antMatchers("/weixin/auth/**").anonymous()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()
......@@ -141,6 +155,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// 添加CORS filter
httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class);
httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class);
String join = StringUtils.join(ruoYiConfig.getAnonUrl(), ",");
}
......@@ -159,4 +175,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
}
}
......@@ -10,6 +10,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
......@@ -23,7 +24,7 @@ import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@TableName("we_tag")
public class WeTag
public class WeTag implements Serializable
{
/** 标签组id */
......
package com.linkwechat.wecom.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import org.apache.ibatis.annotations.Param;
......@@ -10,47 +10,8 @@ import org.apache.ibatis.annotations.Param;
* @author ruoyi
* @date 2020-08-24
*/
public interface WeCorpAccountMapper
public interface WeCorpAccountMapper extends BaseMapper<WeCorpAccount>
{
/**
* 查询企业id相关配置
*
* @param id 企业id相关配置ID
* @return 企业id相关配置
*/
public WeCorpAccount selectWeCorpAccountById(Long id);
/**
* 查询企业id相关配置列表
*
* @param wxCorpAccount 企业id相关配置
* @return 企业id相关配置集合
*/
public List<WeCorpAccount> selectWeCorpAccountList(WeCorpAccount wxCorpAccount);
/**
* 新增企业id相关配置
*
* @param wxCorpAccount 企业id相关配置
* @return 结果
*/
public int insertWeCorpAccount(WeCorpAccount wxCorpAccount);
/**
* 修改企业id相关配置
*
* @param wxCorpAccount 企业id相关配置
* @return 结果
*/
public int updateWeCorpAccount(WeCorpAccount wxCorpAccount);
/**
* 获取有效cropid
* @return
*/
public WeCorpAccount findValidWeCorpAccount();
/**
......@@ -58,13 +19,7 @@ public interface WeCorpAccountMapper
* @param corpId
* @return
*/
public int startVailWeCorpAccount(@Param("corpId") String corpId);
int startVailWeCorpAccount(@Param("corpId") String corpId);
/**
* 根据企业账号获取企业相关配置
* @param corpAccount
* @return
*/
WeCorpAccount findWeCorpByAccount(@Param("corpAccount") String corpAccount);
}
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import java.util.List;
/**
* 企业id相关配置Service接口
*
* @author ruoyi
* @date 2020-08-24
*/
public interface IWeCorpAccountService
public interface IWeCorpAccountService extends IService<WeCorpAccount>
{
/**
* 查询企业id相关配置
*
* @param id 企业id相关配置ID
* @return 企业id相关配置
*/
public WeCorpAccount selectWeCorpAccountById(Long id);
/**
* 查询企业id相关配置列表
*
* @param wxCorpAccount 企业id相关配置
* @return 企业id相关配置集合
*/
public List<WeCorpAccount> selectWeCorpAccountList(WeCorpAccount wxCorpAccount);
/**
* 新增企业id相关配置
*
* @param wxCorpAccount 企业id相关配置
* @return 结果
*/
public int insertWeCorpAccount(WeCorpAccount wxCorpAccount);
/**
* 修改企业id相关配置
......@@ -42,7 +19,7 @@ public interface IWeCorpAccountService
* @param wxCorpAccount 企业id相关配置
* @return 结果
*/
public int updateWeCorpAccount(WeCorpAccount wxCorpAccount);
void updateWeCorpAccount(WeCorpAccount wxCorpAccount);
......@@ -51,27 +28,27 @@ public interface IWeCorpAccountService
*
* @return 结果
*/
public WeCorpAccount findValidWeCorpAccount();
WeCorpAccount findValidWeCorpAccount();
/**
* 启用有效的企业微信账号
* @param corpId
*/
public int startVailWeCorpAccount(String corpId);
int startVailWeCorpAccount(String corpId);
/**
* 客户流失通知开关
* @param status 开关状态
* @return
*/
public int startCustomerChurnNoticeSwitch(String status);
void startCustomerChurnNoticeSwitch(String status);
/**
* 客户流失通知开关查询
*/
public String getCustomerChurnNoticeSwitch();
String getCustomerChurnNoticeSwitch();
WeCorpAccount findWeCorpByAccount(String corpAccount);
}
package com.linkwechat.wecom.service.impl;
import java.util.List;
import java.util.Optional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.wecom.mapper.WeCorpAccountMapper;
import com.linkwechat.wecom.service.IWeAccessTokenService;
import com.linkwechat.wecom.service.IWeCorpAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.linkwechat.wecom.mapper.WeCorpAccountMapper;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import java.util.Optional;
/**
* 企业id相关配置Service业务层处理
......@@ -19,51 +20,14 @@ import com.linkwechat.common.core.domain.entity.WeCorpAccount;
* @date 2020-08-24
*/
@Service
public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
public class WeCorpAccountServiceImpl extends ServiceImpl<WeCorpAccountMapper,WeCorpAccount> implements IWeCorpAccountService {
@Autowired
private WeCorpAccountMapper weCorpAccountMapper;
@Autowired
private IWeAccessTokenService iWeAccessTokenService;
/**
* 查询企业id相关配置
*
* @param id 企业id相关配置ID
* @return 企业id相关配置
*/
@Override
public WeCorpAccount selectWeCorpAccountById(Long id)
{
return weCorpAccountMapper.selectWeCorpAccountById(id);
}
/**
* 查询企业id相关配置列表
*
* @param wxCorpAccount 企业id相关配置
* @return 企业id相关配置
*/
@Override
public List<WeCorpAccount> selectWeCorpAccountList(WeCorpAccount wxCorpAccount)
{
return weCorpAccountMapper.selectWeCorpAccountList(wxCorpAccount);
}
/**
* 新增企业id相关配置
*
* @param wxCorpAccount 企业id相关配置
* @return 结果
*/
@Override
public int insertWeCorpAccount(WeCorpAccount wxCorpAccount)
{
return weCorpAccountMapper.insertWeCorpAccount(wxCorpAccount);
}
/**
* 修改企业id相关配置
......@@ -72,18 +36,16 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
* @return 结果
*/
@Override
public int updateWeCorpAccount(WeCorpAccount wxCorpAccount)
public void updateWeCorpAccount(WeCorpAccount wxCorpAccount)
{
int returnCode = weCorpAccountMapper.updateWeCorpAccount(wxCorpAccount);
if(Constants.SERVICE_RETURN_SUCCESS_CODE<returnCode){
if(this.updateById(wxCorpAccount)){
iWeAccessTokenService.removeToken();
}
return returnCode;
}
......@@ -95,7 +57,10 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
*/
@Override
public WeCorpAccount findValidWeCorpAccount() {
return weCorpAccountMapper.findValidWeCorpAccount();
return this.getOne(new LambdaQueryWrapper<WeCorpAccount>()
.eq(WeCorpAccount::getDelFlag,Constants.NORMAL_CODE)
.eq(WeCorpAccount::getStatus,Constants.NORMAL_CODE));
}
......@@ -106,7 +71,7 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
@Override
public int startVailWeCorpAccount(String corpId) {
int returnCode = weCorpAccountMapper.startVailWeCorpAccount(corpId);
int returnCode = this.baseMapper.startVailWeCorpAccount(corpId);
if(Constants.SERVICE_RETURN_SUCCESS_CODE<returnCode){
......@@ -120,24 +85,20 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
}
@Override
public int startCustomerChurnNoticeSwitch(String status) {
public void startCustomerChurnNoticeSwitch(String status) {
WeCorpAccount validWeCorpAccount = findValidWeCorpAccount();
validWeCorpAccount.setCustomerChurnNoticeSwitch(status);
return weCorpAccountMapper.updateWeCorpAccount(validWeCorpAccount);
this.updateWeCorpAccount(validWeCorpAccount);
}
@Override
public String getCustomerChurnNoticeSwitch() {
WeCorpAccount validWeCorpAccount = weCorpAccountMapper.findValidWeCorpAccount();
WeCorpAccount validWeCorpAccount = this.findValidWeCorpAccount();
String noticeSwitch = Optional.ofNullable(validWeCorpAccount).map(WeCorpAccount::getCustomerChurnNoticeSwitch)
.orElse(WeConstans.DEL_FOLLOW_USER_SWITCH_CLOSE);
return noticeSwitch;
}
@Override
public WeCorpAccount findWeCorpByAccount(String corpAccount) {
return weCorpAccountMapper.findWeCorpByAccount(corpAccount);
}
}
......@@ -3,125 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WeCorpAccountMapper">
<resultMap type="WeCorpAccount" id="WeCorpAccountResult">
<result property="id" column="id" />
<result property="companyName" column="company_name" />
<result property="corpId" column="corp_id" />
<result property="corpSecret" column="corp_secret" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<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="contactSecret" column="contact_secret" />
<result property="agentId" column="agent_id" />
<result property="agentSecret" column="agent_secret" />
<result property="chatSecret" column="chat_secret" />
<result property="providerSecret" column="provider_secret" />
<result property="customerChurnNoticeSwitch" column="customer_churn_notice_switch" />
<result property="wxQrLoginRedirectUri" column="wx_qr_login_redirect_uri"/>
<result property="corpAccount" column="corp_account"/>
</resultMap>
<sql id="selectWeCorpAccountVo">
select id,chat_secret,provider_secret,company_name, corp_id, corp_secret,agent_id, agent_secret, status, del_flag, create_by, create_time, update_by, update_time,contact_secret, customer_churn_notice_switch,wx_qr_login_redirect_uri,
corp_account
from we_corp_account
</sql>
<select id="selectWeCorpAccountList" parameterType="WeCorpAccount" resultMap="WeCorpAccountResult">
<include refid="selectWeCorpAccountVo"/>
<where>
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
<if test="corpId != null and corpId != ''"> and corp_id = #{corpId}</if>
<if test="corpSecret != null and corpSecret != ''"> and corp_secret = #{corpSecret}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectWeCorpAccountById" parameterType="Long" resultMap="WeCorpAccountResult">
<include refid="selectWeCorpAccountVo"/>
where id = #{id}
</select>
<insert id="insertWeCorpAccount" parameterType="WeCorpAccount" useGeneratedKeys="true" keyProperty="id">
insert into we_corp_account
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="companyName != null">company_name,</if>
<if test="corpId != null">corp_id,</if>
<if test="corpSecret != null">corp_secret,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="contactSecret != null ">contact_secret,</if>
<if test="chatSecret != null ">chat_secret,</if>
<if test="agentId != null ">agent_id,</if>
<if test="agentSecret != null ">agent_secret,</if>
<if test="customerChurnNoticeSwitch != null ">customer_churn_notice_switch,</if>
<if test="providerSecret != null ">provider_secret,</if>
<if test="wxQrLoginRedirectUri != null ">wx_qr_login_redirect_uri,</if>
<if test="corpAccount != null ">corp_account,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyName != null">#{companyName},</if>
<if test="corpId != null">#{corpId},</if>
<if test="corpSecret != null">#{corpSecret},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="contactSecret != null ">#{contactSecret},</if>
<if test="chatSecret != null ">#{chatSecret},</if>
<if test="agentId != null ">#{agentId},</if>
<if test="agentSecret != null ">#{agentSecret},</if>
<if test="customerChurnNoticeSwitch != null ">#{customerChurnNoticeSwitch},</if>
<if test="providerSecret != null ">#{providerSecret},</if>
<if test="wxQrLoginRedirectUri != null ">#{wxQrLoginRedirectUri},</if>
<if test="corpAccount != null ">#{corpAccount},</if>
</trim>
</insert>
<update id="updateWeCorpAccount" parameterType="WeCorpAccount">
update we_corp_account
<trim prefix="SET" suffixOverrides=",">
<if test="companyName != null">company_name = #{companyName},</if>
<if test="corpId != null">corp_id = #{corpId},</if>
<if test="corpSecret != null">corp_secret = #{corpSecret},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="contactSecret != null ">contact_secret = #{contactSecret},</if>
<if test="chatSecret != null ">chat_secret = #{chatSecret},</if>
<if test="agentId != null ">agent_id = #{agentId},</if>
<if test="agentSecret != null ">agent_secret =#{agentSecret},</if>
<if test="customerChurnNoticeSwitch != null ">customer_churn_notice_switch = #{customerChurnNoticeSwitch},</if>
<if test="providerSecret != null ">provider_secret = #{providerSecret},</if>
<if test="wxQrLoginRedirectUri != null ">wx_qr_login_redirect_uri = #{wxQrLoginRedirectUri},</if>
<if test="corpAccount != null ">crop_account = #{corpAccount},</if>
</trim>
where id = #{id}
</update>
<select id="findValidWeCorpAccount" resultMap="WeCorpAccountResult">
<include refid="selectWeCorpAccountVo"/>
WHERE
del_flag = 0
AND STATUS = 0
</select>
<update id="startVailWeCorpAccount">
......@@ -131,12 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="findWeCorpByAccount" resultMap="WeCorpAccountResult">
<include refid="selectWeCorpAccountVo"/>
WHERE
del_flag = 0
AND corp_account = #{corpAccount}
</select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!