Selaa lähdekoodia

Merge branch 'dev' of liubing/wlyy2.0 into dev

liubing 3 vuotta sitten
vanhempi
commit
638c74147b

+ 6 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/voluntary/VoluntaryRecruitmentPeopleDao.java

@ -2,8 +2,11 @@ package com.yihu.jw.base.dao.voluntary;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentPeopleDO;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentPeopleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
/**
 * @Author: yeshijie
 * @Author: yeshijie
 * @Date: 2021/8/1
 * @Date: 2021/8/1
@ -12,5 +15,8 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface VoluntaryRecruitmentPeopleDao extends PagingAndSortingRepository<VoluntaryRecruitmentPeopleDO, String>, JpaSpecificationExecutor<VoluntaryRecruitmentPeopleDO> {
public interface VoluntaryRecruitmentPeopleDao extends PagingAndSortingRepository<VoluntaryRecruitmentPeopleDO, String>, JpaSpecificationExecutor<VoluntaryRecruitmentPeopleDO> {
    List<VoluntaryRecruitmentPeopleDO> queryByIdIn(String[] id);
    @Query("select count(1) from VoluntaryRecruitmentPeopleDO where companyId = ?1 ")
    Integer findByCompanyId(String CompanyId);
}
}

+ 20 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/voluntary/VoluntaryRecruitmentPeopleEndpoint.java

@ -1,6 +1,8 @@
package com.yihu.jw.base.endpoint.voluntary;
package com.yihu.jw.base.endpoint.voluntary;
import com.yihu.jw.base.dao.voluntary.VoluntaryRecruitmentCompanyDao;
import com.yihu.jw.base.service.voluntary.VoluntaryRecruitmentPeopleService;
import com.yihu.jw.base.service.voluntary.VoluntaryRecruitmentPeopleService;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentCompanyDO;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentPeopleDO;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentPeopleDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -29,14 +31,25 @@ public class VoluntaryRecruitmentPeopleEndpoint extends EnvelopRestEndpoint {
    @Autowired
    @Autowired
    private VoluntaryRecruitmentPeopleService peopleService;
    private VoluntaryRecruitmentPeopleService peopleService;
    @Autowired
    private VoluntaryRecruitmentCompanyDao companyDao;
    @PostMapping(value = "delete")
    @PostMapping(value = "delete")
    @ApiOperation(value = "删除")
    @ApiOperation(value = "删除")
    public Envelop delete(
    public Envelop delete(
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
            @RequestParam(value = "ids") String ids) {
        String[] idsTmp = ids.split(",");
        List<VoluntaryRecruitmentPeopleDO> List = peopleService.getRepository().queryByIdIn(idsTmp);
        peopleService.delete(ids.split(","));
        peopleService.delete(ids.split(","));
        for (VoluntaryRecruitmentPeopleDO tmp:List){
            VoluntaryRecruitmentCompanyDO companyDO = companyDao.findOne(tmp.getCompanyId());
            if (null !=companyDO ){
                Integer count = peopleService.getRepository().findByCompanyId(tmp.getCompanyId());
                companyDO.setNum(count);
                companyDao.save(companyDO);
            }
        }
        return success("删除成功");
        return success("删除成功");
    }
    }
@ -50,6 +63,12 @@ public class VoluntaryRecruitmentPeopleEndpoint extends EnvelopRestEndpoint {
            return failed("ID不能为空", ObjEnvelop.class);
            return failed("ID不能为空", ObjEnvelop.class);
        }
        }
        appVersion = peopleService.save(appVersion);
        appVersion = peopleService.save(appVersion);
        VoluntaryRecruitmentCompanyDO companyDO = companyDao.findOne(appVersion.getCompanyId());
        if (null !=companyDO ){
            Integer count = peopleService.getRepository().findByCompanyId(appVersion.getCompanyId());
            companyDO.setNum(count);
            companyDao.save(companyDO);
        }
        return success(appVersion, VoluntaryRecruitmentPeopleDO.class);
        return success(appVersion, VoluntaryRecruitmentPeopleDO.class);
    }
    }