FrontVxServiceImpl.java 3.01 KB
package com.lhcredit.project.business.frontVx.service;

import java.util.List;
import java.util.ArrayList;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lhcredit.project.business.frontVx.mapper.FrontVxMapper;
import com.lhcredit.project.business.frontVx.domain.FrontVx;
import com.lhcredit.common.utils.text.Convert;

/**
 * 微信用户注册 服务层实现
 *
 * @author lhcredit
 * @date 2025-09-28
 */
@Service
public class FrontVxServiceImpl implements IFrontVxService {
    @Autowired
    private FrontVxMapper frontVxMapper;

    /**
     * 查询微信用户注册信息
     *
     * @param id 微信用户注册ID
     * @return 微信用户注册信息
     */
    @Override
    public FrontVx selectFrontVxById(Integer id) {
        return frontVxMapper.selectFrontVxById(id);
    }

    /**
     * 查询微信用户注册列表
     *
     * @param frontVx 微信用户注册信息
     * @return 微信用户注册集合
     */
    @Override
    public List<FrontVx> selectFrontVxList(FrontVx frontVx) {
        return frontVxMapper.selectFrontVxList(frontVx);
    }

    /**
     * 字段转换
     * @param frontVx 微信用户注册信息
     * @return 微信用户注册信息
     */
    @Override
    public FrontVx changeModel(FrontVx frontVx) {
//        //这里写各字段转换逻辑
//        if(frontVx!=null){
//            if(StringUtils.isNotEmpty(frontVx.getXXX())){
//               frontVx.setXXX(frontVx.getXXX());
//            }
//        }
        return frontVx;
    }

    /**
     * 列表转换
     *
     * @param frontVxList 微信用户注册集合
     * @return 微信用户注册集合
     */
    @Override
    public List<FrontVx> changeModel(List<FrontVx> frontVxList) {
        List<FrontVx> result = new ArrayList<FrontVx>();
        if (frontVxList.size() > 0) {
            for (FrontVx frontVx:frontVxList){
                result.add(changeModel(frontVx));
            }
        }
        return result;
    }

    /**
     * 新增微信用户注册
     *
     * @param frontVx 微信用户注册信息
     * @return 结果
     */
    @Override
    public int insertFrontVx(FrontVx frontVx) {
        FrontVx frontVx1 = new FrontVx();
        frontVx1.setOpenId(frontVx.getOpenId());
        List<FrontVx> frontVxes = frontVxMapper.selectFrontVxList(frontVx1);
        if (!frontVxes.isEmpty()) {
            return 0;
        }
        frontVx.setVxStatus("0");
        return frontVxMapper.insertFrontVx(frontVx);
    }

    /**
     * 修改微信用户注册
     *
     * @param frontVx 微信用户注册信息
     * @return 结果
     */
    @Override
    public int updateFrontVx(FrontVx frontVx) {
        return frontVxMapper.updateFrontVx(frontVx);
    }

    /**
     * 删除微信用户注册对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteFrontVxByIds(String ids) {
        return frontVxMapper.deleteFrontVxByIds(Convert.toStrArray(ids));
    }

}