3 changed files with 51 additions and 1 deletions
@ -0,0 +1,31 @@ |
|||||
|
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);
|
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.demo.t20230821.entity; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2023/8/21 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class CodeEntity { |
||||
|
|
||||
|
Long id; |
||||
|
|
||||
|
String code; |
||||
|
|
||||
|
} |
Loading…
Reference in new issue