zhubaomin
2025-04-14 f1e8ef7d00fc176d5cba60f3f8b8c10a8541bd71
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/unlock/UnlockSv.java
New file
@@ -0,0 +1,67 @@
package com.dy.pipIrrSell.unlock;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoSe.SeUnlockMapper;
import com.dy.pipIrrGlobal.pojoSe.SeUnlock;
import com.dy.pipIrrGlobal.voSe.VoUnlock;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
/**
 * @author ZhuBaoMin
 * @date 2023/12/6 15:02
 * @LastEditTime 2023/12/6 15:02
 * @Description
 */
@Slf4j
@Service
public class UnlockSv {
    @Autowired
    private SeUnlockMapper seUnlockMapper;
    public QueryResultVo<List<VoUnlock>> getUnlocks(QueryVo queryVo) {
        //完善查询注销记录的起止时间
        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        String unlocklTimeStart = queryVo.unlocklTimeStart;
        String unlockTimeStop = queryVo.unlockTimeStop;
        if(unlocklTimeStart != null) {
            unlocklTimeStart = unlocklTimeStart + " 00:00:00";
            queryVo.setUnlocklTimeStart(unlocklTimeStart);
        }
        if(unlockTimeStop != null) {
            unlockTimeStop = unlockTimeStop + " 23:59:59";
            queryVo.setUnlockTimeStop(unlockTimeStop);
        }
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
        Long itemTotal = seUnlockMapper.getRecordCount(params);
        QueryResultVo<List<VoUnlock>> rsVo = new QueryResultVo<>() ;
        rsVo.pageSize = queryVo.pageSize ;
        rsVo.pageCurr = queryVo.pageCurr ;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = seUnlockMapper.getUnlocks(params);
        return rsVo ;
    }
    /**
     * 添加解锁记录
     * @param po
     * @return
     */
    public Long add(SeUnlock po) {
        seUnlockMapper.insert(po);
        return po.getId();
    }
}