32 changed files with 865 additions and 50 deletions
			
			
		@ -1,4 +1,4 @@ | 
				
			|||
package com.epmet.common.token.dto.form; | 
				
			|||
package com.epmet.dto.form; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
@ -1,4 +1,4 @@ | 
				
			|||
package com.epmet.common.token.dto.form; | 
				
			|||
package com.epmet.dto.form; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
@ -1,4 +1,4 @@ | 
				
			|||
package com.epmet.common.token.dto.form; | 
				
			|||
package com.epmet.dto.form; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
@ -1,4 +1,4 @@ | 
				
			|||
package com.epmet.common.token.dto.result; | 
				
			|||
package com.epmet.dto.result; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
@ -0,0 +1,127 @@ | 
				
			|||
/** | 
				
			|||
 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			|||
 * <p> | 
				
			|||
 * This program is free software: you can redistribute it and/or modify | 
				
			|||
 * it under the terms of the GNU General Public License as published by | 
				
			|||
 * the Free Software Foundation, either version 3 of the License, or | 
				
			|||
 * (at your option) any later version. | 
				
			|||
 * <p> | 
				
			|||
 * This program is distributed in the hope that it will be useful, | 
				
			|||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			|||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			|||
 * GNU General Public License for more details. | 
				
			|||
 * <p> | 
				
			|||
 * You should have received a copy of the GNU General Public License | 
				
			|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			|||
 */ | 
				
			|||
 | 
				
			|||
package com.epmet.dto; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
import java.util.Date; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 工作人员微信关系表  | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2020-04-18 | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
public class StaffWechatDTO implements Serializable { | 
				
			|||
 | 
				
			|||
    private static final long serialVersionUID = 1L; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 唯一标识 | 
				
			|||
     */ | 
				
			|||
	private String id; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 用户Id user.id | 
				
			|||
     */ | 
				
			|||
	private String userId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * openId | 
				
			|||
     */ | 
				
			|||
	private String wxOpenId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 微信unionId | 
				
			|||
     */ | 
				
			|||
	private String wxUnionId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 手机号 | 
				
			|||
     */ | 
				
			|||
	private String mobile; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 昵称 | 
				
			|||
     */ | 
				
			|||
	private String nickname; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 性别 | 
				
			|||
     */ | 
				
			|||
	private Integer sex; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 头像 | 
				
			|||
     */ | 
				
			|||
	private String headImgUrl; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 国家 | 
				
			|||
     */ | 
				
			|||
	private String country; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 省份 | 
				
			|||
     */ | 
				
			|||
	private String province; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 城市 | 
				
			|||
     */ | 
				
			|||
	private String city; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 语言 | 
				
			|||
     */ | 
				
			|||
	private String language; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 删除标识:0.未删除 1.已删除 | 
				
			|||
     */ | 
				
			|||
	private Integer delFlag; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 乐观锁 | 
				
			|||
     */ | 
				
			|||
	private Integer revision; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 创建人 | 
				
			|||
     */ | 
				
			|||
	private String createdBy; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 创建时间 | 
				
			|||
     */ | 
				
			|||
	private Date createdTime; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 更新人 | 
				
			|||
     */ | 
				
			|||
	private String updatedBy; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 更新时间 | 
				
			|||
     */ | 
				
			|||
	private Date updatedTime; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,28 @@ | 
				
			|||
package com.epmet.dto.form; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import javax.validation.constraints.NotBlank; | 
				
			|||
import java.io.Serializable; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @Description 保存工作人员-微信关系表 入参DTO | 
				
			|||
 * @Author yinzuomei | 
				
			|||
 * @Date 2020/4/18 22:25 | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
public class StaffWechatFormDTO implements Serializable { | 
				
			|||
    private static final long serialVersionUID = -2234700477129260997L; | 
				
			|||
    /** | 
				
			|||
     * 用户Id user.id | 
				
			|||
     */ | 
				
			|||
    @NotBlank(message = "userId不能为空") | 
				
			|||
    private String userId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * openId | 
				
			|||
     */ | 
				
			|||
    @NotBlank(message = "openId不能为空") | 
				
			|||
    private String wxOpenId; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
@ -0,0 +1,57 @@ | 
				
			|||
/** | 
				
			|||
 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			|||
 * <p> | 
				
			|||
 * This program is free software: you can redistribute it and/or modify | 
				
			|||
 * it under the terms of the GNU General Public License as published by | 
				
			|||
 * the Free Software Foundation, either version 3 of the License, or | 
				
			|||
 * (at your option) any later version. | 
				
			|||
 * <p> | 
				
			|||
 * This program is distributed in the hope that it will be useful, | 
				
			|||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			|||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			|||
 * GNU General Public License for more details. | 
				
			|||
 * <p> | 
				
			|||
 * You should have received a copy of the GNU General Public License | 
				
			|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			|||
 */ | 
				
			|||
 | 
				
			|||
package com.epmet.controller; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.utils.Result; | 
				
			|||
import com.epmet.commons.tools.validator.ValidatorUtils; | 
				
			|||
import com.epmet.dto.form.StaffWechatFormDTO; | 
				
			|||
import com.epmet.service.StaffWechatService; | 
				
			|||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			|||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			|||
import org.springframework.web.bind.annotation.RequestBody; | 
				
			|||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			|||
import org.springframework.web.bind.annotation.RestController; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 工作人员微信关系表  | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2020-04-18 | 
				
			|||
 */ | 
				
			|||
@RestController | 
				
			|||
@RequestMapping("staffwechat") | 
				
			|||
public class StaffWechatController { | 
				
			|||
     | 
				
			|||
    @Autowired | 
				
			|||
    private StaffWechatService staffWechatService; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @param formDTO | 
				
			|||
     * @return com.epmet.commons.tools.utils.Result | 
				
			|||
     * @Author yinzuomei | 
				
			|||
     * @Description 手机验证码登录时记录微信openId与当前用户的关系 | 
				
			|||
     * @Date 2020/4/18 22:33 | 
				
			|||
     **/ | 
				
			|||
    @PostMapping(value = "savestaffwechat") | 
				
			|||
    public Result saveStaffWechat(@RequestBody StaffWechatFormDTO formDTO) { | 
				
			|||
        ValidatorUtils.validateEntity(formDTO); | 
				
			|||
        return staffWechatService.savesaveStaffWechat(formDTO); | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
@ -0,0 +1,43 @@ | 
				
			|||
/** | 
				
			|||
 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			|||
 * <p> | 
				
			|||
 * This program is free software: you can redistribute it and/or modify | 
				
			|||
 * it under the terms of the GNU General Public License as published by | 
				
			|||
 * the Free Software Foundation, either version 3 of the License, or | 
				
			|||
 * (at your option) any later version. | 
				
			|||
 * <p> | 
				
			|||
 * This program is distributed in the hope that it will be useful, | 
				
			|||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			|||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			|||
 * GNU General Public License for more details. | 
				
			|||
 * <p> | 
				
			|||
 * You should have received a copy of the GNU General Public License | 
				
			|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			|||
 */ | 
				
			|||
 | 
				
			|||
package com.epmet.dao; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.mybatis.dao.BaseDao; | 
				
			|||
import com.epmet.dto.StaffWechatDTO; | 
				
			|||
import com.epmet.entity.StaffWechatEntity; | 
				
			|||
import org.apache.ibatis.annotations.Mapper; | 
				
			|||
import org.apache.ibatis.annotations.Param; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 工作人员微信关系表 | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2020-04-18 | 
				
			|||
 */ | 
				
			|||
@Mapper | 
				
			|||
public interface StaffWechatDao extends BaseDao<StaffWechatEntity> { | 
				
			|||
    /** | 
				
			|||
     * @param userId | 
				
			|||
     * @param wxOpenId | 
				
			|||
     * @return com.epmet.dto.StaffWechatDTO | 
				
			|||
     * @Author yinzuomei | 
				
			|||
     * @Description 根据userId+wxOpenId查询记录 | 
				
			|||
     * @Date 2020/4/18 22:37 | 
				
			|||
     **/ | 
				
			|||
    StaffWechatDTO selectByUserIdAndOpenId(@Param("userId") String userId, @Param("wxOpenId") String wxOpenId); | 
				
			|||
} | 
				
			|||
@ -0,0 +1,93 @@ | 
				
			|||
/** | 
				
			|||
 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			|||
 * <p> | 
				
			|||
 * This program is free software: you can redistribute it and/or modify | 
				
			|||
 * it under the terms of the GNU General Public License as published by | 
				
			|||
 * the Free Software Foundation, either version 3 of the License, or | 
				
			|||
 * (at your option) any later version. | 
				
			|||
 * <p> | 
				
			|||
 * This program is distributed in the hope that it will be useful, | 
				
			|||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			|||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			|||
 * GNU General Public License for more details. | 
				
			|||
 * <p> | 
				
			|||
 * You should have received a copy of the GNU General Public License | 
				
			|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			|||
 */ | 
				
			|||
 | 
				
			|||
package com.epmet.entity; | 
				
			|||
 | 
				
			|||
import com.baomidou.mybatisplus.annotation.TableName; | 
				
			|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; | 
				
			|||
import lombok.Data; | 
				
			|||
import lombok.EqualsAndHashCode; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 工作人员微信关系表  | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2020-04-18 | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
@EqualsAndHashCode(callSuper=false) | 
				
			|||
@TableName("staff_wechat") | 
				
			|||
public class StaffWechatEntity extends BaseEpmetEntity { | 
				
			|||
 | 
				
			|||
	private static final long serialVersionUID = 1L; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 用户Id user.id | 
				
			|||
     */ | 
				
			|||
	private String userId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * openId | 
				
			|||
     */ | 
				
			|||
	private String wxOpenId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 微信unionId | 
				
			|||
     */ | 
				
			|||
	private String wxUnionId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 手机号 | 
				
			|||
     */ | 
				
			|||
	private String mobile; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 昵称 | 
				
			|||
     */ | 
				
			|||
	private String nickname; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 性别 | 
				
			|||
     */ | 
				
			|||
	private Integer sex; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 头像 | 
				
			|||
     */ | 
				
			|||
	private String headImgUrl; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 国家 | 
				
			|||
     */ | 
				
			|||
	private String country; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 省份 | 
				
			|||
     */ | 
				
			|||
	private String province; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 城市 | 
				
			|||
     */ | 
				
			|||
	private String city; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 语言 | 
				
			|||
     */ | 
				
			|||
	private String language; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,106 @@ | 
				
			|||
/** | 
				
			|||
 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			|||
 * <p> | 
				
			|||
 * This program is free software: you can redistribute it and/or modify | 
				
			|||
 * it under the terms of the GNU General Public License as published by | 
				
			|||
 * the Free Software Foundation, either version 3 of the License, or | 
				
			|||
 * (at your option) any later version. | 
				
			|||
 * <p> | 
				
			|||
 * This program is distributed in the hope that it will be useful, | 
				
			|||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			|||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			|||
 * GNU General Public License for more details. | 
				
			|||
 * <p> | 
				
			|||
 * You should have received a copy of the GNU General Public License | 
				
			|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			|||
 */ | 
				
			|||
 | 
				
			|||
package com.epmet.service; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.mybatis.service.BaseService; | 
				
			|||
import com.epmet.commons.tools.page.PageData; | 
				
			|||
import com.epmet.commons.tools.utils.Result; | 
				
			|||
import com.epmet.dto.StaffWechatDTO; | 
				
			|||
import com.epmet.dto.form.StaffWechatFormDTO; | 
				
			|||
import com.epmet.entity.StaffWechatEntity; | 
				
			|||
 | 
				
			|||
import java.util.List; | 
				
			|||
import java.util.Map; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 工作人员微信关系表  | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2020-04-18 | 
				
			|||
 */ | 
				
			|||
public interface StaffWechatService extends BaseService<StaffWechatEntity> { | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 默认分页 | 
				
			|||
     * | 
				
			|||
     * @param params | 
				
			|||
     * @return PageData<StaffWechatDTO> | 
				
			|||
     * @author generator | 
				
			|||
     * @date 2020-04-18 | 
				
			|||
     */ | 
				
			|||
    PageData<StaffWechatDTO> page(Map<String, Object> params); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 默认查询 | 
				
			|||
     * | 
				
			|||
     * @param params | 
				
			|||
     * @return java.util.List<StaffWechatDTO> | 
				
			|||
     * @author generator | 
				
			|||
     * @date 2020-04-18 | 
				
			|||
     */ | 
				
			|||
    List<StaffWechatDTO> list(Map<String, Object> params); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 单条查询 | 
				
			|||
     * | 
				
			|||
     * @param id | 
				
			|||
     * @return StaffWechatDTO | 
				
			|||
     * @author generator | 
				
			|||
     * @date 2020-04-18 | 
				
			|||
     */ | 
				
			|||
    StaffWechatDTO get(String id); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 默认保存 | 
				
			|||
     * | 
				
			|||
     * @param dto | 
				
			|||
     * @return void | 
				
			|||
     * @author generator | 
				
			|||
     * @date 2020-04-18 | 
				
			|||
     */ | 
				
			|||
    void save(StaffWechatDTO dto); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 默认更新 | 
				
			|||
     * | 
				
			|||
     * @param dto | 
				
			|||
     * @return void | 
				
			|||
     * @author generator | 
				
			|||
     * @date 2020-04-18 | 
				
			|||
     */ | 
				
			|||
    void update(StaffWechatDTO dto); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 批量删除 | 
				
			|||
     * | 
				
			|||
     * @param ids | 
				
			|||
     * @return void | 
				
			|||
     * @author generator | 
				
			|||
     * @date 2020-04-18 | 
				
			|||
     */ | 
				
			|||
    void delete(String[] ids); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @param formDTO | 
				
			|||
     * @return com.epmet.commons.tools.utils.Result | 
				
			|||
     * @Author yinzuomei | 
				
			|||
     * @Description 手机验证码登录时记录微信openId与当前用户的关系 | 
				
			|||
     * @Date 2020/4/18 22:34 | 
				
			|||
     **/ | 
				
			|||
    Result savesaveStaffWechat(StaffWechatFormDTO formDTO); | 
				
			|||
} | 
				
			|||
@ -0,0 +1,125 @@ | 
				
			|||
/** | 
				
			|||
 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			|||
 * <p> | 
				
			|||
 * This program is free software: you can redistribute it and/or modify | 
				
			|||
 * it under the terms of the GNU General Public License as published by | 
				
			|||
 * the Free Software Foundation, either version 3 of the License, or | 
				
			|||
 * (at your option) any later version. | 
				
			|||
 * <p> | 
				
			|||
 * This program is distributed in the hope that it will be useful, | 
				
			|||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			|||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			|||
 * GNU General Public License for more details. | 
				
			|||
 * <p> | 
				
			|||
 * You should have received a copy of the GNU General Public License | 
				
			|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			|||
 */ | 
				
			|||
 | 
				
			|||
package com.epmet.service.impl; | 
				
			|||
 | 
				
			|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			|||
import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			|||
import com.epmet.commons.tools.constant.FieldConstant; | 
				
			|||
import com.epmet.commons.tools.page.PageData; | 
				
			|||
import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			|||
import com.epmet.commons.tools.utils.Result; | 
				
			|||
import com.epmet.dao.StaffWechatDao; | 
				
			|||
import com.epmet.dto.StaffWechatDTO; | 
				
			|||
import com.epmet.dto.form.StaffWechatFormDTO; | 
				
			|||
import com.epmet.entity.StaffWechatEntity; | 
				
			|||
import com.epmet.service.StaffWechatService; | 
				
			|||
import org.apache.commons.lang3.StringUtils; | 
				
			|||
import org.apache.logging.log4j.LogManager; | 
				
			|||
import org.apache.logging.log4j.Logger; | 
				
			|||
import org.springframework.stereotype.Service; | 
				
			|||
import org.springframework.transaction.annotation.Transactional; | 
				
			|||
 | 
				
			|||
import java.util.Arrays; | 
				
			|||
import java.util.List; | 
				
			|||
import java.util.Map; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 工作人员微信关系表  | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2020-04-18 | 
				
			|||
 */ | 
				
			|||
@Service | 
				
			|||
public class StaffWechatServiceImpl extends BaseServiceImpl<StaffWechatDao, StaffWechatEntity> implements StaffWechatService { | 
				
			|||
    private Logger logger = LogManager.getLogger(getClass()); | 
				
			|||
 | 
				
			|||
    @Override | 
				
			|||
    public PageData<StaffWechatDTO> page(Map<String, Object> params) { | 
				
			|||
        IPage<StaffWechatEntity> page = baseDao.selectPage( | 
				
			|||
                getPage(params, FieldConstant.CREATED_TIME, false), | 
				
			|||
                getWrapper(params) | 
				
			|||
        ); | 
				
			|||
        return getPageData(page, StaffWechatDTO.class); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    @Override | 
				
			|||
    public List<StaffWechatDTO> list(Map<String, Object> params) { | 
				
			|||
        List<StaffWechatEntity> entityList = baseDao.selectList(getWrapper(params)); | 
				
			|||
 | 
				
			|||
        return ConvertUtils.sourceToTarget(entityList, StaffWechatDTO.class); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    private QueryWrapper<StaffWechatEntity> getWrapper(Map<String, Object> params){ | 
				
			|||
        String id = (String)params.get(FieldConstant.ID_HUMP); | 
				
			|||
 | 
				
			|||
        QueryWrapper<StaffWechatEntity> wrapper = new QueryWrapper<>(); | 
				
			|||
        wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); | 
				
			|||
 | 
				
			|||
        return wrapper; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    @Override | 
				
			|||
    public StaffWechatDTO get(String id) { | 
				
			|||
        StaffWechatEntity entity = baseDao.selectById(id); | 
				
			|||
        return ConvertUtils.sourceToTarget(entity, StaffWechatDTO.class); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    @Override | 
				
			|||
    @Transactional(rollbackFor = Exception.class) | 
				
			|||
    public void save(StaffWechatDTO dto) { | 
				
			|||
        StaffWechatEntity entity = ConvertUtils.sourceToTarget(dto, StaffWechatEntity.class); | 
				
			|||
        insert(entity); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    @Override | 
				
			|||
    @Transactional(rollbackFor = Exception.class) | 
				
			|||
    public void update(StaffWechatDTO dto) { | 
				
			|||
        StaffWechatEntity entity = ConvertUtils.sourceToTarget(dto, StaffWechatEntity.class); | 
				
			|||
        updateById(entity); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    @Override | 
				
			|||
    @Transactional(rollbackFor = Exception.class) | 
				
			|||
    public void delete(String[] ids) { | 
				
			|||
        // 逻辑删除(@TableLogic 注解)
 | 
				
			|||
        baseDao.deleteBatchIds(Arrays.asList(ids)); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @param formDTO | 
				
			|||
     * @return com.epmet.commons.tools.utils.Result | 
				
			|||
     * @Author yinzuomei | 
				
			|||
     * @Description 手机验证码登录时记录微信openId与当前用户的关系 | 
				
			|||
     * @Date 2020/4/18 22:34 | 
				
			|||
     **/ | 
				
			|||
    @Override | 
				
			|||
    public Result savesaveStaffWechat(StaffWechatFormDTO formDTO) { | 
				
			|||
        StaffWechatDTO staffWechatDTO = baseDao.selectByUserIdAndOpenId(formDTO.getUserId(), formDTO.getWxOpenId()); | 
				
			|||
        if (null == staffWechatDTO) { | 
				
			|||
            StaffWechatDTO staffWechat = ConvertUtils.sourceToTarget(formDTO, StaffWechatDTO.class); | 
				
			|||
            this.save(staffWechat); | 
				
			|||
            logger.info(String.format("staff_Wechat保存成功,userId[%s],wxOpenId[%s]", formDTO.getUserId(), formDTO.getWxOpenId())); | 
				
			|||
        } else { | 
				
			|||
            logger.info(String.format("staff_Wechat记录已存在,userId[%s],wxOpenId[%s]", formDTO.getUserId(), formDTO.getWxOpenId())); | 
				
			|||
            this.update(staffWechatDTO); | 
				
			|||
        } | 
				
			|||
        return new Result(); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,18 @@ | 
				
			|||
<?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.epmet.dao.StaffWechatDao"> | 
				
			|||
    <!-- 根据userId+wxOpenId查询记录 --> | 
				
			|||
    <select id="selectByUserIdAndOpenId" parameterType="map" resultType="com.epmet.dto.StaffWechatDTO"> | 
				
			|||
        SELECT | 
				
			|||
            * | 
				
			|||
        FROM | 
				
			|||
            staff_wechat sw | 
				
			|||
        WHERE | 
				
			|||
            sw.DEL_FLAG = '0' | 
				
			|||
            AND sw.USER_ID = #{userId} | 
				
			|||
            AND sw.WX_OPEN_ID = #{wxOpenId} | 
				
			|||
    </select> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
</mapper> | 
				
			|||
					Loading…
					
					
				
		Reference in new issue