生成销售管理-客户管理后端代码
This commit is contained in:
@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -15,18 +16,26 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.pictc.datalog.DataOperationContent;
|
||||
import com.pictc.datalog.DataOperationListener;
|
||||
import com.pictc.enums.BusinessCode;
|
||||
import com.pictc.enums.ExceptionCommonCode;
|
||||
import com.xjrsoft.common.exception.BusinessException;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.page.ConventPage;
|
||||
import com.xjrsoft.common.page.PageOutput;
|
||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||
import com.xjrsoft.module.common.db.utils.CommonCallUtils;
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto;
|
||||
import com.xjrsoft.module.sales.dto.LngCustomerPageDto;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerDto;
|
||||
import com.xjrsoft.module.sales.entity.LngCustomer;
|
||||
import com.xjrsoft.module.sales.service.ICustomerService;
|
||||
import com.xjrsoft.module.sales.vo.LngCustomerPageVo;
|
||||
import com.xjrsoft.module.sales.vo.LngCustomerVo;
|
||||
import com.xjrsoft.module.system.client.ICodeRuleClient;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
@ -42,14 +51,20 @@ import lombok.AllArgsConstructor;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sales" + "/customer")
|
||||
@RequestMapping("/sales/customer")
|
||||
@Api(value = "/sales" + "/customer",tags = "客户代码")
|
||||
@AllArgsConstructor
|
||||
public class CustomerController {
|
||||
|
||||
|
||||
private final ICustomerService customerService;
|
||||
|
||||
private final DatalogService dataService;
|
||||
|
||||
|
||||
private final ICodeRuleClient codeRuleClient;
|
||||
|
||||
private final String CUSTOMER_CODE = "customerCode";
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@ApiOperation(value="LngCustomer列表(分页)")
|
||||
@ -98,9 +113,29 @@ public class CustomerController {
|
||||
@ApiOperation(value = "新增LngCustomer")
|
||||
@SaCheckPermission("customer:add")
|
||||
public R add(@Valid @RequestBody UpdateLngCustomerDto dto){
|
||||
UpdateLngCustomerDto res = dataService.insert(dto);
|
||||
return R.ok(res.getId());
|
||||
|
||||
return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngCustomerDto>() {
|
||||
|
||||
@Override
|
||||
public UpdateLngCustomerDto before(DataOperationContent<UpdateLngCustomerDto> content) {
|
||||
String code = codeRuleClient.genEncode(CUSTOMER_CODE);
|
||||
dto.setCuCode("C"+code);
|
||||
return content.getObj();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UpdateLngCustomerDto after(DataOperationContent<UpdateLngCustomerDto> content) {
|
||||
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
|
||||
if (StringUtils.isNotBlank(msg)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||
}
|
||||
codeRuleClient.useEncode(CUSTOMER_CODE);
|
||||
return content.getObj();
|
||||
}
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改LngCustomer")
|
||||
|
||||
@ -10,6 +10,11 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.yulichang.annotation.EntityMapping;
|
||||
import com.pictc.annotations.datalog.JoinCaseType;
|
||||
import com.pictc.annotations.datalog.JoinType;
|
||||
import com.pictc.annotations.datalog.LogJoin;
|
||||
import com.pictc.annotations.datalog.LogJoinColumn;
|
||||
import com.pictc.annotations.datalog.ValueDirectionType;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -265,6 +270,10 @@ public class LngCustomer implements Serializable {
|
||||
@ApiModelProperty("lngCustomerAttrPower子表")
|
||||
@TableField(exist = false)
|
||||
@EntityMapping(thisField = "cuCode", joinField = "cuCode")
|
||||
@LogJoin(name = "客户业务信息",
|
||||
columns = {
|
||||
@LogJoinColumn(field = "cuCode",relatedField = "cuCode", valueDirection = ValueDirectionType.LEFT)
|
||||
}, caseType = JoinCaseType.NONE, target = LngCustomerAttrPower.class, type = JoinType.MANY)
|
||||
private List<LngCustomerAttrPower> lngCustomerAttrPowerList;
|
||||
/**
|
||||
* lngCustomerBank
|
||||
@ -272,6 +281,11 @@ public class LngCustomer implements Serializable {
|
||||
@ApiModelProperty("lngCustomerBank子表")
|
||||
@TableField(exist = false)
|
||||
@EntityMapping(thisField = "cuCode", joinField = "cuCode")
|
||||
@LogJoin(name = "客户银行信息",
|
||||
columns = {
|
||||
@LogJoinColumn(field = "cuCode",relatedField = "cuCode", valueDirection = ValueDirectionType.LEFT)
|
||||
}, caseType = JoinCaseType.NONE, target = LngCustomerBank.class, type = JoinType.MANY)
|
||||
|
||||
private List<LngCustomerBank> lngCustomerBankList;
|
||||
/**
|
||||
* lngCustomerDoc
|
||||
@ -279,6 +293,11 @@ public class LngCustomer implements Serializable {
|
||||
@ApiModelProperty("lngCustomerDoc子表")
|
||||
@TableField(exist = false)
|
||||
@EntityMapping(thisField = "cuCode", joinField = "cuCode")
|
||||
@LogJoin(name = "客户证书信息",
|
||||
columns = {
|
||||
@LogJoinColumn(field = "cuCode",relatedField = "cuCode", valueDirection = ValueDirectionType.LEFT)
|
||||
}, caseType = JoinCaseType.NONE, target = LngCustomerDoc.class, type = JoinType.MANY)
|
||||
|
||||
private List<LngCustomerDoc> lngCustomerDocList;
|
||||
/**
|
||||
* lngCustomerContact
|
||||
@ -286,6 +305,11 @@ public class LngCustomer implements Serializable {
|
||||
@ApiModelProperty("lngCustomerContact子表")
|
||||
@TableField(exist = false)
|
||||
@EntityMapping(thisField = "cuCode", joinField = "cuCode")
|
||||
@LogJoin(name = "客户联系人信息",
|
||||
columns = {
|
||||
@LogJoinColumn(field = "cuCode",relatedField = "cuCode", valueDirection = ValueDirectionType.LEFT)
|
||||
}, caseType = JoinCaseType.NONE, target = LngCustomerContact.class, type = JoinType.MANY)
|
||||
|
||||
private List<LngCustomerContact> lngCustomerContactList;
|
||||
|
||||
}
|
||||
@ -12,6 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngCustomerAttrPowerMapper extends MPJBaseMapper<LngCustomerAttrPower> {
|
||||
public interface LngCustomerAttrPowerMapper extends MPJBaseMapper<LngCustomerAttrPower>,BaseMapper<LngCustomerAttrPower> {
|
||||
|
||||
}
|
||||
|
||||
@ -12,6 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngCustomerBankMapper extends MPJBaseMapper<LngCustomerBank> {
|
||||
public interface LngCustomerBankMapper extends MPJBaseMapper<LngCustomerBank>,BaseMapper<LngCustomerBank> {
|
||||
|
||||
}
|
||||
|
||||
@ -12,6 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngCustomerContactMapper extends MPJBaseMapper<LngCustomerContact> {
|
||||
public interface LngCustomerContactMapper extends MPJBaseMapper<LngCustomerContact>,BaseMapper<LngCustomerContact> {
|
||||
|
||||
}
|
||||
|
||||
@ -12,6 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngCustomerDocMapper extends MPJBaseMapper<LngCustomerDoc> {
|
||||
public interface LngCustomerDocMapper extends MPJBaseMapper<LngCustomerDoc>,BaseMapper<LngCustomerDoc> {
|
||||
|
||||
}
|
||||
|
||||
@ -12,6 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngCustomerMapper extends MPJBaseMapper<LngCustomer> {
|
||||
public interface LngCustomerMapper extends MPJBaseMapper<LngCustomer>,BaseMapper<LngCustomer>{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user