【update】职级等级部分接口功能合并
This commit is contained in:
parent
735241eae1
commit
66c53b2faa
|
@ -1,7 +1,11 @@
|
||||||
package com.chint.application.dtos;
|
package com.chint.application.dtos;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @Author:nxj
|
* @Author:nxj
|
||||||
|
@ -9,9 +13,13 @@ import lombok.Data;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class RanksDto {
|
public class RanksDto {
|
||||||
|
private Integer rankId;
|
||||||
|
@NotNull
|
||||||
private String rankName;
|
private String rankName;
|
||||||
|
@NotNull
|
||||||
private String industry;
|
private String industry;
|
||||||
|
@NotNull
|
||||||
private String companyCode;
|
private String companyCode;
|
||||||
|
@NotNull
|
||||||
private String standardLevel;
|
private String standardLevel;
|
||||||
private String uniqueWord;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,12 @@ import com.chint.infrastructure.util.PageResult;
|
||||||
import com.chint.infrastructure.util.Result;
|
import com.chint.infrastructure.util.Result;
|
||||||
import com.sun.net.httpserver.Authenticator;
|
import com.sun.net.httpserver.Authenticator;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
@ -68,16 +70,17 @@ public class RankController {
|
||||||
|
|
||||||
@ApiOperation("保存等级")
|
@ApiOperation("保存等级")
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public Result<Ranks> saveRanks(@RequestBody RanksDto dto) {
|
public Result<Ranks> saveRanks(@Valid @RequestBody RanksDto dto) {
|
||||||
Ranks ranks=new Ranks();
|
Ranks ranks=new Ranks();
|
||||||
BeanUtils.copyProperties(dto,ranks);
|
BeanUtils.copyProperties(dto,ranks);
|
||||||
return Result.Success(CommonMessageConstant.SUCCESS, jdbcRanksRepository.save(ranks));
|
ranks.setUniqueWord(dto.getRankName() + "-" + dto.getCompanyCode());
|
||||||
|
Ranks save = null;
|
||||||
|
try {
|
||||||
|
save = ranksRepository.save(ranks);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new DuplicateException(CommonMessageConstant.DUPLICATE_ERROR);
|
||||||
}
|
}
|
||||||
|
return Result.Success(CommonMessageConstant.SUCCESS, save);
|
||||||
@ApiOperation("修改等级")
|
|
||||||
@PostMapping("/update")
|
|
||||||
public Result<Ranks> updateRanks(@RequestBody Ranks ranks) {
|
|
||||||
return Result.Success(CommonMessageConstant.SUCCESS, jdbcRanksRepository.save(ranks));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
|
@ -8,14 +8,14 @@ import com.chint.infrastructure.util.PageResult;
|
||||||
import com.chint.infrastructure.util.Result;
|
import com.chint.infrastructure.util.Result;
|
||||||
import com.chint.route.service.UserDepartmentInfoBasicService;
|
import com.chint.route.service.UserDepartmentInfoBasicService;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -28,27 +28,21 @@ public class StaffRankController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserDepartmentInfoBasicService userDepartmentInfoBasicService;
|
private UserDepartmentInfoBasicService userDepartmentInfoBasicService;
|
||||||
|
|
||||||
@ApiOperation("新增职级")
|
@ApiOperation("保存职级")
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public Result<Object> save(@RequestBody @Valid StaffRankData staffRankData) {
|
public Result<Object> save(@Valid @RequestBody StaffRankData staffRankData) {
|
||||||
StaffRank staffRank = new StaffRank();
|
StaffRank staffRank = new StaffRank();
|
||||||
BeanUtils.copyProperties(staffRankData,staffRank);
|
BeanUtils.copyProperties(staffRankData,staffRank);
|
||||||
return Result.Success(SUCCESS, jdbcStaffRankRepository.save(staffRank));
|
return Result.Success(SUCCESS, jdbcStaffRankRepository.save(staffRank));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("新增职级")
|
@ApiOperation("删除职级")
|
||||||
@PostMapping("/delete/{id}")
|
@PostMapping("/delete/{id}")
|
||||||
public Result<Object> delete(@PathVariable("id")Integer id) {
|
public Result<Object> delete(@PathVariable("id")Integer id) {
|
||||||
jdbcStaffRankRepository.deleteById(id);
|
jdbcStaffRankRepository.deleteById(id);
|
||||||
return Result.Success(SUCCESS);
|
return Result.Success(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改职级")
|
|
||||||
@PostMapping("/update")
|
|
||||||
public Result<Object> save(@RequestBody @Valid StaffRank staffRank) {
|
|
||||||
return Result.Success(SUCCESS, jdbcStaffRankRepository.save(staffRank));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("职级分页查询")
|
@ApiOperation("职级分页查询")
|
||||||
@PostMapping("/pageQuery")
|
@PostMapping("/pageQuery")
|
||||||
public Result<PageResult<?>> save(@RequestBody StaffRankQuery staffRankQuery) {
|
public Result<PageResult<?>> save(@RequestBody StaffRankQuery staffRankQuery) {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class StaffRankData {
|
public class StaffRankData {
|
||||||
|
private Integer id;
|
||||||
@NotNull
|
@NotNull
|
||||||
private String employeeNo;
|
private String employeeNo;
|
||||||
//员工名称
|
//员工名称
|
||||||
|
|
Loading…
Reference in New Issue