/** * 更新北京社保账户的大病医疗个人附加(3元/月) */ import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() async function main() { // 北京社保账户:医疗个人附加3元(大病医疗) const beijingSocial = await prisma.socialAccount.findMany({ where: { type: 'SOCIAL', city: '北京' }, select: { id: true, name: true } }) for (const a of beijingSocial) { const result = await prisma.socialYearStandard.updateMany({ where: { accountId: a.id, isCurrent: true }, data: { medicalEmpExtra: 3 }, }) console.log(`[更新] ${a.name} → medicalEmpExtra=3,影响 ${result.count} 条`) } // 验证 for (const a of beijingSocial) { const std = await prisma.socialYearStandard.findFirst({ where: { accountId: a.id, isCurrent: true }, select: { medicalEmpExtra: true, effectiveFrom: true } }) console.log(`[验证] ${a.name} | effective=${std?.effectiveFrom} | medicalEmpExtra=${std?.medicalEmpExtra}`) } } main().then(() => process.exit(0)).catch(e => { console.error(e); process.exit(1) })