You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
990 B

package com.demo.t20230821;
import com.demo.cost.TbsMapper;
import com.demo.cost.TbsServiceImpl;
import com.demo.jsl.entity.costapply.JslCostApply;
import com.demo.t20230821.entity.CodeEntity;
import lombok.SneakyThrows;
import org.junit.Test;
import org.noear.wood.DbContext;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author YenHex
* @since 2023/8/21
**/
public class DeleteRepeatCostApply {
@Test
@SneakyThrows
public void doAction(){
DbContext jslContext = TbsMapper.getJslDbContext();
String repeat_code_sql = "select `code`,min(id) as id from tbs_cost_apply where xlt_sync = 2 GROUP BY `code` HAVING count(*) >1";
List<CodeEntity> selectByCodeList = jslContext.sql(repeat_code_sql).getList(CodeEntity.class);
List<String> ids = selectByCodeList.stream().map(a->a.getId()+"").collect(Collectors.toList());
//System.out.println(ids.size());
//new TbsServiceImpl().removeByCostIds(ids);
}
}