feat: crud初始化
parent
2b75ff4d11
commit
10b32ade57
|
|
@ -0,0 +1,64 @@
|
|||
package org.qinan.safetyeval.adapter.web;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.qinan.safetyeval.client.api.AccountApi;
|
||||
import org.qinan.safetyeval.client.co.AccountCO;
|
||||
import org.qinan.safetyeval.client.dto.AccountAddCmd;
|
||||
import org.qinan.safetyeval.client.dto.AccountModifyCmd;
|
||||
import org.qinan.safetyeval.client.dto.AccountPageQuery;
|
||||
import org.qinan.safetyeval.client.dto.PageResponse;
|
||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 用户适配层(Controller)
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Api(tags = "用户管理")
|
||||
@RestController
|
||||
@RequestMapping("/account")
|
||||
public class AccountController {
|
||||
|
||||
@Resource
|
||||
private AccountApi accountApi;
|
||||
|
||||
@ApiOperation("新增用户")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<AccountCO> add(@Validated @RequestBody AccountAddCmd cmd) {
|
||||
return accountApi.add(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("查询用户详情")
|
||||
@GetMapping("/get")
|
||||
public SingleResponse<AccountCO> get(@RequestParam Long id) {
|
||||
return accountApi.get(id);
|
||||
}
|
||||
|
||||
@ApiOperation("修改用户")
|
||||
@PostMapping("/modify")
|
||||
public SingleResponse<AccountCO> modify(@Validated @RequestBody AccountModifyCmd cmd) {
|
||||
return accountApi.modify(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户")
|
||||
@PostMapping("/delete")
|
||||
public SingleResponse<Void> delete(@RequestParam Long id) {
|
||||
return accountApi.delete(id);
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询用户")
|
||||
@GetMapping("/page")
|
||||
public PageResponse<AccountCO> page(@Validated AccountPageQuery query) {
|
||||
return accountApi.page(query);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package org.qinan.safetyeval.adapter.web;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.qinan.safetyeval.client.api.QualFilingExpertApi;
|
||||
import org.qinan.safetyeval.client.co.QualFilingExpertCO;
|
||||
import org.qinan.safetyeval.client.dto.PageResponse;
|
||||
import org.qinan.safetyeval.client.dto.QualFilingExpertAddCmd;
|
||||
import org.qinan.safetyeval.client.dto.QualFilingExpertModifyCmd;
|
||||
import org.qinan.safetyeval.client.dto.QualFilingExpertPageQuery;
|
||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 审核专家适配层(Controller)
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Api(tags = "审核专家管理")
|
||||
@RestController
|
||||
@RequestMapping("/qual-filing-expert")
|
||||
public class QualFilingExpertController {
|
||||
|
||||
@Resource
|
||||
private QualFilingExpertApi qualFilingExpertApi;
|
||||
|
||||
@ApiOperation("新增审核专家")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<QualFilingExpertCO> add(@Validated @RequestBody QualFilingExpertAddCmd cmd) {
|
||||
return qualFilingExpertApi.add(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("查询审核专家详情")
|
||||
@GetMapping("/get")
|
||||
public SingleResponse<QualFilingExpertCO> get(@RequestParam Long id) {
|
||||
return qualFilingExpertApi.get(id);
|
||||
}
|
||||
|
||||
@ApiOperation("修改审核专家")
|
||||
@PostMapping("/modify")
|
||||
public SingleResponse<QualFilingExpertCO> modify(@Validated @RequestBody QualFilingExpertModifyCmd cmd) {
|
||||
return qualFilingExpertApi.modify(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("删除审核专家")
|
||||
@PostMapping("/delete")
|
||||
public SingleResponse<Void> delete(@RequestParam Long id) {
|
||||
return qualFilingExpertApi.delete(id);
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询审核专家")
|
||||
@GetMapping("/page")
|
||||
public PageResponse<QualFilingExpertCO> page(@Validated QualFilingExpertPageQuery query) {
|
||||
return qualFilingExpertApi.page(query);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package org.qinan.safetyeval.app.executor;
|
||||
|
||||
import org.qinan.safetyeval.client.api.AccountApi;
|
||||
import org.qinan.safetyeval.client.co.AccountCO;
|
||||
import org.qinan.safetyeval.client.dto.AccountAddCmd;
|
||||
import org.qinan.safetyeval.client.dto.AccountModifyCmd;
|
||||
import org.qinan.safetyeval.client.dto.AccountPageQuery;
|
||||
import org.qinan.safetyeval.client.dto.PageResponse;
|
||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||
import org.qinan.safetyeval.domain.entity.AccountEntity;
|
||||
import org.qinan.safetyeval.domain.query.AccountQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.AccountDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 用户执行器(App层)
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Service
|
||||
public class AccountExecutor implements AccountApi {
|
||||
|
||||
@Lazy
|
||||
@Autowired(required = false)
|
||||
private AccountDomainService accountDomainService;
|
||||
|
||||
@Override
|
||||
public SingleResponse<AccountCO> add(AccountAddCmd cmd) {
|
||||
AccountEntity entity = new AccountEntity();
|
||||
entity.setUserName(cmd.getUserName());
|
||||
entity.setAccount(cmd.getAccount());
|
||||
entity.setPhone(cmd.getPhone());
|
||||
entity.setPassword(cmd.getPassword());
|
||||
entity.setProfileUrl(cmd.getProfileUrl());
|
||||
entity.setType(cmd.getType());
|
||||
|
||||
AccountEntity result = accountDomainService.add(entity);
|
||||
return SingleResponse.success(toCO(result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<AccountCO> get(Long id) {
|
||||
AccountEntity entity = accountDomainService.get(id);
|
||||
return SingleResponse.success(toCO(entity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<AccountCO> modify(AccountModifyCmd cmd) {
|
||||
AccountEntity entity = new AccountEntity();
|
||||
entity.setId(cmd.getId());
|
||||
entity.setUserName(cmd.getUserName());
|
||||
entity.setAccount(cmd.getAccount());
|
||||
entity.setPhone(cmd.getPhone());
|
||||
entity.setPassword(cmd.getPassword());
|
||||
entity.setProfileUrl(cmd.getProfileUrl());
|
||||
entity.setType(cmd.getType());
|
||||
|
||||
AccountEntity result = accountDomainService.modify(entity);
|
||||
return SingleResponse.success(toCO(result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<Void> delete(Long id) {
|
||||
accountDomainService.delete(id);
|
||||
return SingleResponse.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResponse<AccountCO> page(AccountPageQuery query) {
|
||||
AccountQuery domainQuery = new AccountQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setUserName(query.getUserName());
|
||||
domainQuery.setAccount(query.getAccount());
|
||||
domainQuery.setPhone(query.getPhone());
|
||||
domainQuery.setType(query.getType());
|
||||
|
||||
PageResult<AccountEntity> pageResult = accountDomainService.page(domainQuery);
|
||||
|
||||
return PageResponse.of(
|
||||
pageResult.getRecords().stream()
|
||||
.map(this::toCO)
|
||||
.collect(java.util.stream.Collectors.toList()),
|
||||
pageResult.getTotal());
|
||||
}
|
||||
|
||||
private AccountCO toCO(AccountEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
AccountCO co = new AccountCO();
|
||||
co.setId(entity.getId());
|
||||
co.setUserName(entity.getUserName());
|
||||
co.setAccount(entity.getAccount());
|
||||
co.setPhone(entity.getPhone());
|
||||
co.setProfileUrl(entity.getProfileUrl());
|
||||
co.setType(entity.getType());
|
||||
co.setTenantId(entity.getTenantId());
|
||||
return co;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
package org.qinan.safetyeval.app.executor;
|
||||
|
||||
import org.qinan.safetyeval.client.api.QualFilingExpertApi;
|
||||
import org.qinan.safetyeval.client.co.QualFilingExpertCO;
|
||||
import org.qinan.safetyeval.client.dto.PageResponse;
|
||||
import org.qinan.safetyeval.client.dto.QualFilingExpertAddCmd;
|
||||
import org.qinan.safetyeval.client.dto.QualFilingExpertModifyCmd;
|
||||
import org.qinan.safetyeval.client.dto.QualFilingExpertPageQuery;
|
||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||
import org.qinan.safetyeval.domain.entity.QualFilingExpertEntity;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.query.QualFilingExpertQuery;
|
||||
import org.qinan.safetyeval.domain.service.QualFilingExpertDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 审核专家执行器(App层)
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Service
|
||||
public class QualFilingExpertExecutor implements QualFilingExpertApi {
|
||||
|
||||
@Lazy
|
||||
@Autowired(required = false)
|
||||
private QualFilingExpertDomainService qualFilingExpertDomainService;
|
||||
|
||||
@Override
|
||||
public SingleResponse<QualFilingExpertCO> add(QualFilingExpertAddCmd cmd) {
|
||||
QualFilingExpertEntity entity = new QualFilingExpertEntity();
|
||||
entity.setUserName(cmd.getUserName());
|
||||
entity.setAccount(cmd.getAccount());
|
||||
entity.setGenderCode(cmd.getGenderCode());
|
||||
entity.setGenderName(cmd.getGenderName());
|
||||
entity.setIdCardNo(cmd.getIdCardNo());
|
||||
entity.setCertificate(cmd.getCertificate());
|
||||
|
||||
QualFilingExpertEntity result = qualFilingExpertDomainService.add(entity);
|
||||
return SingleResponse.success(toCO(result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<QualFilingExpertCO> get(Long id) {
|
||||
QualFilingExpertEntity entity = qualFilingExpertDomainService.get(id);
|
||||
return SingleResponse.success(toCO(entity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<QualFilingExpertCO> modify(QualFilingExpertModifyCmd cmd) {
|
||||
QualFilingExpertEntity entity = new QualFilingExpertEntity();
|
||||
entity.setId(cmd.getId());
|
||||
entity.setUserName(cmd.getUserName());
|
||||
entity.setAccount(cmd.getAccount());
|
||||
entity.setGenderCode(cmd.getGenderCode());
|
||||
entity.setGenderName(cmd.getGenderName());
|
||||
entity.setIdCardNo(cmd.getIdCardNo());
|
||||
entity.setCertificate(cmd.getCertificate());
|
||||
|
||||
QualFilingExpertEntity result = qualFilingExpertDomainService.modify(entity);
|
||||
return SingleResponse.success(toCO(result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<Void> delete(Long id) {
|
||||
qualFilingExpertDomainService.delete(id);
|
||||
return SingleResponse.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResponse<QualFilingExpertCO> page(QualFilingExpertPageQuery query) {
|
||||
QualFilingExpertQuery domainQuery = new QualFilingExpertQuery();
|
||||
domainQuery.setPageNum(query.getCurrent());
|
||||
domainQuery.setPageSize(query.getSize());
|
||||
domainQuery.setTenantId(AuthUserContextAdapter.getCurrentTenantId());
|
||||
domainQuery.setUserName(query.getUserName());
|
||||
domainQuery.setAccount(query.getAccount());
|
||||
domainQuery.setGenderCode(query.getGenderCode());
|
||||
domainQuery.setIdCardNo(query.getIdCardNo());
|
||||
|
||||
PageResult<QualFilingExpertEntity> pageResult = qualFilingExpertDomainService.page(domainQuery);
|
||||
|
||||
return PageResponse.of(
|
||||
pageResult.getRecords().stream()
|
||||
.map(this::toCO)
|
||||
.collect(java.util.stream.Collectors.toList()),
|
||||
pageResult.getTotal());
|
||||
}
|
||||
|
||||
private QualFilingExpertCO toCO(QualFilingExpertEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
QualFilingExpertCO co = new QualFilingExpertCO();
|
||||
co.setId(entity.getId());
|
||||
co.setUserName(entity.getUserName());
|
||||
co.setAccount(entity.getAccount());
|
||||
co.setGenderCode(entity.getGenderCode());
|
||||
co.setGenderName(entity.getGenderName());
|
||||
co.setIdCardNo(entity.getIdCardNo());
|
||||
co.setCertificate(entity.getCertificate());
|
||||
co.setTenantId(entity.getTenantId());
|
||||
return co;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package org.qinan.safetyeval.client.api;
|
||||
|
||||
import org.qinan.safetyeval.client.co.AccountCO;
|
||||
import org.qinan.safetyeval.client.dto.AccountAddCmd;
|
||||
import org.qinan.safetyeval.client.dto.AccountModifyCmd;
|
||||
import org.qinan.safetyeval.client.dto.AccountPageQuery;
|
||||
import org.qinan.safetyeval.client.dto.PageResponse;
|
||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||
|
||||
/**
|
||||
* 用户接口定义(Client层)
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
public interface AccountApi {
|
||||
|
||||
SingleResponse<AccountCO> add(AccountAddCmd cmd);
|
||||
|
||||
SingleResponse<AccountCO> get(Long id);
|
||||
|
||||
SingleResponse<AccountCO> modify(AccountModifyCmd cmd);
|
||||
|
||||
SingleResponse<Void> delete(Long id);
|
||||
|
||||
PageResponse<AccountCO> page(AccountPageQuery query);
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package org.qinan.safetyeval.client.api;
|
||||
|
||||
import org.qinan.safetyeval.client.co.QualFilingExpertCO;
|
||||
import org.qinan.safetyeval.client.dto.PageResponse;
|
||||
import org.qinan.safetyeval.client.dto.QualFilingExpertAddCmd;
|
||||
import org.qinan.safetyeval.client.dto.QualFilingExpertModifyCmd;
|
||||
import org.qinan.safetyeval.client.dto.QualFilingExpertPageQuery;
|
||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||
|
||||
/**
|
||||
* 审核专家接口定义(Client层)
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
public interface QualFilingExpertApi {
|
||||
|
||||
SingleResponse<QualFilingExpertCO> add(QualFilingExpertAddCmd cmd);
|
||||
|
||||
SingleResponse<QualFilingExpertCO> get(Long id);
|
||||
|
||||
SingleResponse<QualFilingExpertCO> modify(QualFilingExpertModifyCmd cmd);
|
||||
|
||||
SingleResponse<Void> delete(Long id);
|
||||
|
||||
PageResponse<QualFilingExpertCO> page(QualFilingExpertPageQuery query);
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package org.qinan.safetyeval.client.co;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户CO(Client Object)
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Data
|
||||
public class AccountCO {
|
||||
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "用户名称/姓名")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(value = "账号")
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "头像地址")
|
||||
private String profileUrl;
|
||||
|
||||
@ApiModelProperty(value = "类型: 1-机构端,2监管端")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "租户ID")
|
||||
private Long tenantId;
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package org.qinan.safetyeval.client.co;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 审核专家CO(Client Object)
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Data
|
||||
public class QualFilingExpertCO {
|
||||
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "用户名称/姓名")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(value = "账号")
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty(value = "性别编码")
|
||||
private Integer genderCode;
|
||||
|
||||
@ApiModelProperty(value = "性别名称")
|
||||
private String genderName;
|
||||
|
||||
@ApiModelProperty(value = "身份证号")
|
||||
private String idCardNo;
|
||||
|
||||
@ApiModelProperty(value = "证书")
|
||||
private String certificate;
|
||||
|
||||
@ApiModelProperty(value = "租户ID")
|
||||
private Long tenantId;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package org.qinan.safetyeval.client.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户新增命令
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Data
|
||||
public class AccountAddCmd {
|
||||
|
||||
/** userName */
|
||||
private String userName;
|
||||
|
||||
/** account */
|
||||
private String account;
|
||||
|
||||
/** phone */
|
||||
private String phone;
|
||||
|
||||
/** password */
|
||||
private String password;
|
||||
|
||||
/** profileUrl */
|
||||
private String profileUrl;
|
||||
|
||||
/** type: 1-机构端,2监管端 */
|
||||
private Integer type;
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package org.qinan.safetyeval.client.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户修改命令
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Data
|
||||
public class AccountModifyCmd {
|
||||
|
||||
/** 主键ID(必填) */
|
||||
private Long id;
|
||||
|
||||
/** userName */
|
||||
private String userName;
|
||||
|
||||
/** account */
|
||||
private String account;
|
||||
|
||||
/** phone */
|
||||
private String phone;
|
||||
|
||||
/** password(可选,为空时不更新) */
|
||||
private String password;
|
||||
|
||||
/** profileUrl */
|
||||
private String profileUrl;
|
||||
|
||||
/** type: 1-机构端,2监管端 */
|
||||
private Integer type;
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package org.qinan.safetyeval.client.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户分页查询参数
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AccountPageQuery extends BasePageQuery {
|
||||
|
||||
/** 用户名称/姓名 */
|
||||
private String userName;
|
||||
|
||||
/** 账号 */
|
||||
private String account;
|
||||
|
||||
/** 手机号 */
|
||||
private String phone;
|
||||
|
||||
/** 类型: 1-机构端,2监管端 */
|
||||
private Integer type;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package org.qinan.safetyeval.client.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 审核专家新增命令
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Data
|
||||
public class QualFilingExpertAddCmd {
|
||||
|
||||
/** userName */
|
||||
private String userName;
|
||||
|
||||
/** account */
|
||||
private String account;
|
||||
|
||||
/** genderCode */
|
||||
private Integer genderCode;
|
||||
|
||||
/** genderName */
|
||||
private String genderName;
|
||||
|
||||
/** idCardNo */
|
||||
private String idCardNo;
|
||||
|
||||
/** certificate */
|
||||
private String certificate;
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package org.qinan.safetyeval.client.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 审核专家修改命令
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Data
|
||||
public class QualFilingExpertModifyCmd {
|
||||
|
||||
/** 主键ID(必填) */
|
||||
private Long id;
|
||||
|
||||
/** userName */
|
||||
private String userName;
|
||||
|
||||
/** account */
|
||||
private String account;
|
||||
|
||||
/** genderCode */
|
||||
private Integer genderCode;
|
||||
|
||||
/** genderName */
|
||||
private String genderName;
|
||||
|
||||
/** idCardNo */
|
||||
private String idCardNo;
|
||||
|
||||
/** certificate */
|
||||
private String certificate;
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package org.qinan.safetyeval.client.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 审核专家分页查询参数
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class QualFilingExpertPageQuery extends BasePageQuery {
|
||||
|
||||
/** 用户名称/姓名 */
|
||||
private String userName;
|
||||
|
||||
/** 账号 */
|
||||
private String account;
|
||||
|
||||
/** 性别编码 */
|
||||
private Integer genderCode;
|
||||
|
||||
/** 身份证号 */
|
||||
private String idCardNo;
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package org.qinan.safetyeval.domain.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户领域实体
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Data
|
||||
public class AccountEntity {
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 用户名称/姓名 */
|
||||
private String userName;
|
||||
|
||||
/** 账号 */
|
||||
private String account;
|
||||
|
||||
/** 手机号 */
|
||||
private String phone;
|
||||
|
||||
/** 密码 */
|
||||
private String password;
|
||||
|
||||
/** 头像地址 */
|
||||
private String profileUrl;
|
||||
|
||||
/** 类型: 1-机构端,2监管端 */
|
||||
private Integer type;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package org.qinan.safetyeval.domain.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 审核专家领域实体
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Data
|
||||
public class QualFilingExpertEntity {
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 用户名称/姓名 */
|
||||
private String userName;
|
||||
|
||||
/** 账号 */
|
||||
private String account;
|
||||
|
||||
/** 性别编码 */
|
||||
private Integer genderCode;
|
||||
|
||||
/** 性别名称 */
|
||||
private String genderName;
|
||||
|
||||
/** 身份证号 */
|
||||
private String idCardNo;
|
||||
|
||||
/** 证书 */
|
||||
private String certificate;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package org.qinan.safetyeval.domain.gateway;
|
||||
|
||||
import org.qinan.safetyeval.domain.entity.AccountEntity;
|
||||
import org.qinan.safetyeval.domain.query.AccountQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
|
||||
/**
|
||||
* 用户Gateway接口(Domain层定义)
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
public interface AccountGateway {
|
||||
|
||||
AccountEntity save(AccountEntity entity);
|
||||
|
||||
AccountEntity get(Long id);
|
||||
|
||||
AccountEntity getByAccount(String account);
|
||||
|
||||
AccountEntity modify(AccountEntity entity);
|
||||
|
||||
void delete(Long id);
|
||||
|
||||
PageResult<AccountEntity> page(AccountQuery query);
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package org.qinan.safetyeval.domain.gateway;
|
||||
|
||||
import org.qinan.safetyeval.domain.entity.QualFilingExpertEntity;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.query.QualFilingExpertQuery;
|
||||
|
||||
/**
|
||||
* 审核专家Gateway接口(Domain层定义)
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
public interface QualFilingExpertGateway {
|
||||
|
||||
QualFilingExpertEntity save(QualFilingExpertEntity entity);
|
||||
|
||||
QualFilingExpertEntity get(Long id);
|
||||
|
||||
QualFilingExpertEntity getByAccount(String account);
|
||||
|
||||
QualFilingExpertEntity modify(QualFilingExpertEntity entity);
|
||||
|
||||
void delete(Long id);
|
||||
|
||||
PageResult<QualFilingExpertEntity> page(QualFilingExpertQuery query);
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package org.qinan.safetyeval.domain.query;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户领域查询对象
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Data
|
||||
public class AccountQuery {
|
||||
|
||||
/** 当前页 */
|
||||
private Long pageNum;
|
||||
|
||||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 用户名称/姓名 */
|
||||
private String userName;
|
||||
|
||||
/** 账号 */
|
||||
private String account;
|
||||
|
||||
/** 手机号 */
|
||||
private String phone;
|
||||
|
||||
/** 类型: 1-机构端,2监管端 */
|
||||
private Integer type;
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package org.qinan.safetyeval.domain.query;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 审核专家领域查询对象
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Data
|
||||
public class QualFilingExpertQuery {
|
||||
|
||||
/** 当前页 */
|
||||
private Long pageNum;
|
||||
|
||||
/** 每页条数 */
|
||||
private Long pageSize;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 用户名称/姓名 */
|
||||
private String userName;
|
||||
|
||||
/** 账号 */
|
||||
private String account;
|
||||
|
||||
/** 性别编码 */
|
||||
private Integer genderCode;
|
||||
|
||||
/** 身份证号 */
|
||||
private String idCardNo;
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package org.qinan.safetyeval.domain.service;
|
||||
|
||||
import org.qinan.safetyeval.domain.entity.AccountEntity;
|
||||
import org.qinan.safetyeval.domain.exception.BizException;
|
||||
import org.qinan.safetyeval.domain.exception.ErrorCode;
|
||||
import org.qinan.safetyeval.domain.gateway.AccountGateway;
|
||||
import org.qinan.safetyeval.domain.query.AccountQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 用户领域服务
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Service
|
||||
public class AccountDomainService {
|
||||
|
||||
@Resource
|
||||
private AccountGateway accountGateway;
|
||||
|
||||
public AccountEntity add(AccountEntity entity) {
|
||||
assertAccountUnique(entity.getAccount(), null);
|
||||
return accountGateway.save(entity);
|
||||
}
|
||||
|
||||
public AccountEntity get(Long id) {
|
||||
return accountGateway.get(id);
|
||||
}
|
||||
|
||||
public AccountEntity modify(AccountEntity entity) {
|
||||
AccountEntity existing = accountGateway.get(entity.getId());
|
||||
if (existing == null) {
|
||||
throw new BizException(ErrorCode.ACCOUNT_NOT_FOUND);
|
||||
}
|
||||
assertAccountUnique(entity.getAccount(), entity.getId());
|
||||
return accountGateway.modify(entity);
|
||||
}
|
||||
|
||||
public void delete(Long id) {
|
||||
AccountEntity existing = accountGateway.get(id);
|
||||
if (existing == null) {
|
||||
throw new BizException(ErrorCode.ACCOUNT_NOT_FOUND);
|
||||
}
|
||||
accountGateway.delete(id);
|
||||
}
|
||||
|
||||
public PageResult<AccountEntity> page(AccountQuery query) {
|
||||
return accountGateway.page(query);
|
||||
}
|
||||
|
||||
private void assertAccountUnique(String account, Long excludeId) {
|
||||
if (!StringUtils.hasText(account)) {
|
||||
return;
|
||||
}
|
||||
AccountEntity found = accountGateway.getByAccount(account);
|
||||
if (found != null && (excludeId == null || !excludeId.equals(found.getId()))) {
|
||||
throw new BizException(ErrorCode.ACCOUNT_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package org.qinan.safetyeval.domain.service;
|
||||
|
||||
import org.qinan.safetyeval.domain.entity.QualFilingExpertEntity;
|
||||
import org.qinan.safetyeval.domain.exception.BizException;
|
||||
import org.qinan.safetyeval.domain.exception.ErrorCode;
|
||||
import org.qinan.safetyeval.domain.gateway.QualFilingExpertGateway;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.query.QualFilingExpertQuery;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 审核专家领域服务
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Service
|
||||
public class QualFilingExpertDomainService {
|
||||
|
||||
@Resource
|
||||
private QualFilingExpertGateway qualFilingExpertGateway;
|
||||
|
||||
public QualFilingExpertEntity add(QualFilingExpertEntity entity) {
|
||||
assertAccountUnique(entity.getAccount(), null);
|
||||
return qualFilingExpertGateway.save(entity);
|
||||
}
|
||||
|
||||
public QualFilingExpertEntity get(Long id) {
|
||||
return qualFilingExpertGateway.get(id);
|
||||
}
|
||||
|
||||
public QualFilingExpertEntity modify(QualFilingExpertEntity entity) {
|
||||
QualFilingExpertEntity existing = qualFilingExpertGateway.get(entity.getId());
|
||||
if (existing == null) {
|
||||
throw new BizException(ErrorCode.QUAL_FILING_EXPERT_NOT_FOUND);
|
||||
}
|
||||
assertAccountUnique(entity.getAccount(), entity.getId());
|
||||
return qualFilingExpertGateway.modify(entity);
|
||||
}
|
||||
|
||||
public void delete(Long id) {
|
||||
QualFilingExpertEntity existing = qualFilingExpertGateway.get(id);
|
||||
if (existing == null) {
|
||||
throw new BizException(ErrorCode.QUAL_FILING_EXPERT_NOT_FOUND);
|
||||
}
|
||||
qualFilingExpertGateway.delete(id);
|
||||
}
|
||||
|
||||
public PageResult<QualFilingExpertEntity> page(QualFilingExpertQuery query) {
|
||||
return qualFilingExpertGateway.page(query);
|
||||
}
|
||||
|
||||
private void assertAccountUnique(String account, Long excludeId) {
|
||||
if (!StringUtils.hasText(account)) {
|
||||
return;
|
||||
}
|
||||
QualFilingExpertEntity found = qualFilingExpertGateway.getByAccount(account);
|
||||
if (found != null && (excludeId == null || !excludeId.equals(found.getId()))) {
|
||||
throw new BizException(ErrorCode.QUAL_FILING_EXPERT_ACCOUNT_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package org.qinan.safetyeval.infrastructure.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 用户数据对象
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Data
|
||||
@TableName("account")
|
||||
public class AccountDO {
|
||||
|
||||
private Long id;
|
||||
private String userName;
|
||||
private String account;
|
||||
private String phone;
|
||||
private String password;
|
||||
private String profileUrl;
|
||||
private Integer type;
|
||||
|
||||
// ---- GBS默认字段 ----
|
||||
private String deleteEnum;
|
||||
private String remarks;
|
||||
private String createName;
|
||||
private String updateName;
|
||||
private Long tenantId;
|
||||
private Integer version;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
private Long createId;
|
||||
private Long updateId;
|
||||
private String env;
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package org.qinan.safetyeval.infrastructure.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 审核专家数据对象
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Data
|
||||
@TableName("qual_filing_expert")
|
||||
public class QualFilingExpertDO {
|
||||
|
||||
private Long id;
|
||||
private String userName;
|
||||
private String account;
|
||||
private Integer genderCode;
|
||||
private String genderName;
|
||||
private String idCardNo;
|
||||
private String certificate;
|
||||
|
||||
// ---- GBS默认字段 ----
|
||||
private String deleteEnum;
|
||||
private String remarks;
|
||||
private String createName;
|
||||
private String updateName;
|
||||
private Long tenantId;
|
||||
private Integer version;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
private Long createId;
|
||||
private Long updateId;
|
||||
private String env;
|
||||
}
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
package org.qinan.safetyeval.infrastructure.gatewayimpl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.qinan.safetyeval.domain.entity.AccountEntity;
|
||||
import org.qinan.safetyeval.domain.gateway.AccountGateway;
|
||||
import org.qinan.safetyeval.domain.query.AccountQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.AccountDO;
|
||||
import org.qinan.safetyeval.infrastructure.mapper.AccountMapper;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户Gateway实现(Infrastructure层)
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Component
|
||||
public class AccountGatewayImpl implements AccountGateway {
|
||||
|
||||
@Resource
|
||||
private AccountMapper accountMapper;
|
||||
|
||||
@Override
|
||||
public AccountEntity save(AccountEntity entity) {
|
||||
AccountDO dataObject = toDO(entity);
|
||||
InsertFieldDefaults.applyIgnoreOrgId(dataObject);
|
||||
accountMapper.insert(dataObject);
|
||||
entity.setId(dataObject.getId());
|
||||
entity.setTenantId(dataObject.getTenantId());
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountEntity get(Long id) {
|
||||
AccountDO dataObject = accountMapper.selectById(id);
|
||||
return toEntity(dataObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountEntity getByAccount(String account) {
|
||||
LambdaQueryWrapper<AccountDO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(AccountDO::getAccount, account);
|
||||
wrapper.eq(AccountDO::getDeleteEnum, "false");
|
||||
AccountDO dataObject = accountMapper.selectOne(wrapper);
|
||||
return toEntity(dataObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountEntity modify(AccountEntity entity) {
|
||||
AccountDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
accountMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
accountMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AccountEntity> page(AccountQuery query) {
|
||||
LambdaQueryWrapper<AccountDO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(AccountDO::getDeleteEnum, "false");
|
||||
if (StringUtils.hasText(query.getUserName())) {
|
||||
wrapper.like(AccountDO::getUserName, query.getUserName());
|
||||
}
|
||||
if (StringUtils.hasText(query.getAccount())) {
|
||||
wrapper.like(AccountDO::getAccount, query.getAccount());
|
||||
}
|
||||
if (StringUtils.hasText(query.getPhone())) {
|
||||
wrapper.like(AccountDO::getPhone, query.getPhone());
|
||||
}
|
||||
if (query.getType() != null) {
|
||||
wrapper.eq(AccountDO::getType, query.getType());
|
||||
}
|
||||
|
||||
Page<AccountDO> page = new Page<>(query.getPageNum(), query.getPageSize());
|
||||
IPage<AccountDO> result = accountMapper.selectPage(page, wrapper);
|
||||
|
||||
List<AccountEntity> entities = result.getRecords().stream()
|
||||
.map(this::toEntity)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return PageResult.of(entities, result.getTotal(), result.getCurrent(), result.getSize());
|
||||
}
|
||||
|
||||
private AccountDO toDO(AccountEntity entity) {
|
||||
AccountDO dataObject = new AccountDO();
|
||||
dataObject.setUserName(entity.getUserName());
|
||||
dataObject.setAccount(entity.getAccount());
|
||||
dataObject.setPhone(entity.getPhone());
|
||||
dataObject.setPassword(entity.getPassword());
|
||||
dataObject.setProfileUrl(entity.getProfileUrl());
|
||||
dataObject.setType(entity.getType());
|
||||
dataObject.setTenantId(entity.getTenantId());
|
||||
return dataObject;
|
||||
}
|
||||
|
||||
private AccountEntity toEntity(AccountDO dataObject) {
|
||||
if (dataObject == null) {
|
||||
return null;
|
||||
}
|
||||
AccountEntity entity = new AccountEntity();
|
||||
entity.setId(dataObject.getId());
|
||||
entity.setUserName(dataObject.getUserName());
|
||||
entity.setAccount(dataObject.getAccount());
|
||||
entity.setPhone(dataObject.getPhone());
|
||||
entity.setPassword(dataObject.getPassword());
|
||||
entity.setProfileUrl(dataObject.getProfileUrl());
|
||||
entity.setType(dataObject.getType());
|
||||
entity.setTenantId(dataObject.getTenantId());
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
package org.qinan.safetyeval.infrastructure.gatewayimpl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.qinan.safetyeval.domain.entity.QualFilingExpertEntity;
|
||||
import org.qinan.safetyeval.domain.gateway.QualFilingExpertGateway;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.query.QualFilingExpertQuery;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.QualFilingExpertDO;
|
||||
import org.qinan.safetyeval.infrastructure.mapper.QualFilingExpertMapper;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 审核专家Gateway实现(Infrastructure层)
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Component
|
||||
public class QualFilingExpertGatewayImpl implements QualFilingExpertGateway {
|
||||
|
||||
@Resource
|
||||
private QualFilingExpertMapper qualFilingExpertMapper;
|
||||
|
||||
@Override
|
||||
public QualFilingExpertEntity save(QualFilingExpertEntity entity) {
|
||||
QualFilingExpertDO dataObject = toDO(entity);
|
||||
InsertFieldDefaults.applyIgnoreOrgId(dataObject);
|
||||
qualFilingExpertMapper.insert(dataObject);
|
||||
entity.setId(dataObject.getId());
|
||||
entity.setTenantId(dataObject.getTenantId());
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QualFilingExpertEntity get(Long id) {
|
||||
QualFilingExpertDO dataObject = qualFilingExpertMapper.selectById(id);
|
||||
return toEntity(dataObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QualFilingExpertEntity getByAccount(String account) {
|
||||
LambdaQueryWrapper<QualFilingExpertDO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(QualFilingExpertDO::getAccount, account);
|
||||
wrapper.eq(QualFilingExpertDO::getDeleteEnum, "false");
|
||||
QualFilingExpertDO dataObject = qualFilingExpertMapper.selectOne(wrapper);
|
||||
return toEntity(dataObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QualFilingExpertEntity modify(QualFilingExpertEntity entity) {
|
||||
QualFilingExpertDO dataObject = toDO(entity);
|
||||
dataObject.setId(entity.getId());
|
||||
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||
qualFilingExpertMapper.updateById(dataObject);
|
||||
return get(entity.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
qualFilingExpertMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<QualFilingExpertEntity> page(QualFilingExpertQuery query) {
|
||||
LambdaQueryWrapper<QualFilingExpertDO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(QualFilingExpertDO::getDeleteEnum, "false");
|
||||
if (StringUtils.hasText(query.getUserName())) {
|
||||
wrapper.like(QualFilingExpertDO::getUserName, query.getUserName());
|
||||
}
|
||||
if (StringUtils.hasText(query.getAccount())) {
|
||||
wrapper.like(QualFilingExpertDO::getAccount, query.getAccount());
|
||||
}
|
||||
if (query.getGenderCode() != null) {
|
||||
wrapper.eq(QualFilingExpertDO::getGenderCode, query.getGenderCode());
|
||||
}
|
||||
if (StringUtils.hasText(query.getIdCardNo())) {
|
||||
wrapper.like(QualFilingExpertDO::getIdCardNo, query.getIdCardNo());
|
||||
}
|
||||
|
||||
Page<QualFilingExpertDO> page = new Page<>(query.getPageNum(), query.getPageSize());
|
||||
IPage<QualFilingExpertDO> result = qualFilingExpertMapper.selectPage(page, wrapper);
|
||||
|
||||
List<QualFilingExpertEntity> entities = result.getRecords().stream()
|
||||
.map(this::toEntity)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return PageResult.of(entities, result.getTotal(), result.getCurrent(), result.getSize());
|
||||
}
|
||||
|
||||
private QualFilingExpertDO toDO(QualFilingExpertEntity entity) {
|
||||
QualFilingExpertDO dataObject = new QualFilingExpertDO();
|
||||
dataObject.setUserName(entity.getUserName());
|
||||
dataObject.setAccount(entity.getAccount());
|
||||
dataObject.setGenderCode(entity.getGenderCode());
|
||||
dataObject.setGenderName(entity.getGenderName());
|
||||
dataObject.setIdCardNo(entity.getIdCardNo());
|
||||
dataObject.setCertificate(entity.getCertificate());
|
||||
dataObject.setTenantId(entity.getTenantId());
|
||||
return dataObject;
|
||||
}
|
||||
|
||||
private QualFilingExpertEntity toEntity(QualFilingExpertDO dataObject) {
|
||||
if (dataObject == null) {
|
||||
return null;
|
||||
}
|
||||
QualFilingExpertEntity entity = new QualFilingExpertEntity();
|
||||
entity.setId(dataObject.getId());
|
||||
entity.setUserName(dataObject.getUserName());
|
||||
entity.setAccount(dataObject.getAccount());
|
||||
entity.setGenderCode(dataObject.getGenderCode());
|
||||
entity.setGenderName(dataObject.getGenderName());
|
||||
entity.setIdCardNo(dataObject.getIdCardNo());
|
||||
entity.setCertificate(dataObject.getCertificate());
|
||||
entity.setTenantId(dataObject.getTenantId());
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package org.qinan.safetyeval.infrastructure.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.AccountDO;
|
||||
|
||||
@Mapper
|
||||
public interface AccountMapper extends BaseMapper<AccountDO> {
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package org.qinan.safetyeval.infrastructure.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.QualFilingExpertDO;
|
||||
|
||||
@Mapper
|
||||
public interface QualFilingExpertMapper extends BaseMapper<QualFilingExpertDO> {
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.qinan.safetyeval.infrastructure.mapper.AccountMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="org.qinan.safetyeval.infrastructure.dataobject.AccountDO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="user_name" property="userName"/>
|
||||
<result column="account" property="account"/>
|
||||
<result column="phone" property="phone"/>
|
||||
<result column="password" property="password"/>
|
||||
<result column="profile_url" property="profileUrl"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="delete_enum" property="deleteEnum"/>
|
||||
<result column="remarks" property="remarks"/>
|
||||
<result column="create_name" property="createName"/>
|
||||
<result column="update_name" property="updateName"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="version" property="version"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="create_id" property="createId"/>
|
||||
<result column="update_id" property="updateId"/>
|
||||
<result column="env" property="env"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
`id`, `user_name`, `account`, `phone`, `password`, `profile_url`, `type`, `delete_enum`, `remarks`, `create_name`, `update_name`, `tenant_id`, `version`, `create_time`, `update_time`, `create_id`, `update_id`, `env`
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.qinan.safetyeval.infrastructure.mapper.QualFilingExpertMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="org.qinan.safetyeval.infrastructure.dataobject.QualFilingExpertDO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="user_name" property="userName"/>
|
||||
<result column="account" property="account"/>
|
||||
<result column="gender_code" property="genderCode"/>
|
||||
<result column="gender_name" property="genderName"/>
|
||||
<result column="id_card_no" property="idCardNo"/>
|
||||
<result column="certificate" property="certificate"/>
|
||||
<result column="delete_enum" property="deleteEnum"/>
|
||||
<result column="remarks" property="remarks"/>
|
||||
<result column="create_name" property="createName"/>
|
||||
<result column="update_name" property="updateName"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="version" property="version"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="create_id" property="createId"/>
|
||||
<result column="update_id" property="updateId"/>
|
||||
<result column="env" property="env"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
`id`, `user_name`, `account`, `gender_code`, `gender_name`, `id_card_no`, `certificate`, `delete_enum`, `remarks`, `create_name`, `update_name`, `tenant_id`, `version`, `create_time`, `update_time`, `create_id`, `update_id`, `env`
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue