//package com.crunii.micro.service.sysmgr.jdbc;
//
//import cn.hutool.core.text.StrBuilder;
//import com.crunii.micro.common.dto.PageReq;
//import com.crunii.micro.common.dto.PageRsp;
//import com.crunii.micro.domain.common.jdbc.BaseJdbcTemplate;
//
//import com.crunii.micro.domain.dto.Worker;
//import com.crunii.micro.domain.entity.main.YcqDynamicFormConfig;
//import com.crunii.micro.service.sysmgr.api.domain.dto.form.YcqDynamicFormConfigPageDTO;
//import com.crunii.micro.service.sysmgr.api.domain.dto.form.YcqDynamicFormConfigPageVO;
//import org.springframework.stereotype.Repository;
//import org.springframework.util.StringUtils;
//
//import javax.annotation.Resource;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.stream.Collectors;
//
///**
// * @author gongsongtao
// * @date 2023/10/8 19:44
// */
//@Repository
//public class YcqDynamicFormConfigDao {
//    @Resource(name = "mainJT")
//    protected BaseJdbcTemplate JT;
//
//    public PageRsp<YcqDynamicFormConfigPageVO> pageForm(PageReq<YcqDynamicFormConfigPageDTO> req, Integer loginId) {
//        StrBuilder sb = StrBuilder.create("select a.id,a.name,a.description," +
//                "b.remark floModelDesc,b.name floModelName,a.code" +
//                " from ycq_dynamic_form_config a " +
//                " left join YCQ_COCKPIT_MODEL b on a.flo_model_id = b.id where a.del_flag = 0 and a.create_id =? ");
//        StrBuilder sbCount = StrBuilder.create("select count(1) from ycq_dynamic_form_config a where a.del_flag = 0 and a.create_id =? ");
//        List<Object> params = new ArrayList<>();
//
//        StrBuilder conditSuffix = StrBuilder.create();
//        params.add(loginId);
//        if (StringUtils.hasText(req.getQuery().getName())) {
//            conditSuffix.append(" and a.name like concat('%',?,'%') ");
//            sbCount.append(" and a.name like concat('%',?,'%') ");
//            params.add(req.getQuery().getName());
//        }
////        if (req.getQuery().getStatus() != null) {
////            conditSuffix.append(" and a.status = ? ");
////            sbCount.append(" and a.status = ? ");
////            params.add(req.getQuery().getStatus());
////        }
//        if (req.getQuery().getId() != null) {
//            conditSuffix.append(" and a.id = ? ");
//            sbCount.append(" and a.id = ? ");
//            params.add(req.getQuery().getId());
//        }
//        int total = this.JT.queryForInt(sbCount.append(conditSuffix).toStringAndReset(), params.toArray());
//        List<YcqDynamicFormConfigPageVO> roles = null;
//        if (total > 0) {
//            conditSuffix.append(" order by a.create_time desc limit ?,? ");
//            params.add(req.getMyStart());
//            params.add(req.getPageSize());
//            roles = this.JT.queryForBeans(YcqDynamicFormConfigPageVO.class, sb.append(conditSuffix).toStringAndReset(), params.toArray());
//        } else {
//            roles = new ArrayList<>(0);
//        }
//        PageRsp<YcqDynamicFormConfigPageVO> page = new PageRsp<>();
//        page.setPageNo(req.getPageNo());
//        page.setPageSize(req.getPageSize());
//        page.setTotalNum(total);
//        page.setResult(roles);
//        // 为手机计算是否由下一页
//        page.next();
//        return page;
//    }
//
//    public List<YcqDynamicFormConfig> listByIdList(List<Long> ids){
//        String sql = "select * from ycq_dynamic_form_config where id in(";
//        String collect = ids.stream().map(item -> item + "").collect(Collectors.joining(","));
//        sql += collect + ")";
//        return JT.queryForBeans(YcqDynamicFormConfig.class, sql);
//    }
//}
