Commit 9d6ec49a by Water Wang

optimzie--practitioner rank and polciy list query

parent cc2174be
package com.yd.api.practitioner;
import com.yd.api.practitioner.service.PractitionerPolicyService;
import com.yd.api.practitioner.service.PractitionerService;
import com.yd.api.practitioner.vo.login.PractitionerLoginRequestVO;
import com.yd.api.practitioner.vo.login.PractitionerLoginResponseVO;
import com.yd.api.practitioner.vo.media.MediaGetReqVO;
import com.yd.api.practitioner.vo.media.MediaGetRespVO;
import com.yd.api.practitioner.vo.opportunity.*;
import com.yd.api.practitioner.vo.policy.PolicyListQueryRequestVO;
import com.yd.api.practitioner.vo.policy.PolicyListQueryResponseVO;
import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO;
import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO;
import com.yd.api.practitioner.vo.recruit.*;
......@@ -27,6 +30,8 @@ public class PractitionerController {
@Autowired
private PractitionerService practitionerService;
@Autowired
private PractitionerPolicyService practitionerPolicyService;
/**
* 经纪人登录
......@@ -395,4 +400,18 @@ public class PractitionerController {
result.addResult(responseVO);
return result;
}
/**
* 经纪人保单列表查询接口
* @param requestVO 请求信息
* @return PolicyListQueryResponseVO
*/
@RequestMapping("/policyListQuery")
public Object practitionerPolicyListQuery(@RequestBody PolicyListQueryRequestVO requestVO){
JsonResult result = new JsonResult();
PolicyListQueryResponseVO responseVO = practitionerPolicyService.policyListQuery(requestVO);
result.setData(responseVO);
result.addResult(responseVO);
return result;
}
}
package com.yd.api.practitioner.service;
import com.yd.api.practitioner.vo.policy.PolicyListQueryRequestVO;
import com.yd.api.practitioner.vo.policy.PolicyListQueryResponseVO;
import org.springframework.stereotype.Service;
@Service("practitionerPolicyService")
public interface PractitionerPolicyService {
/**
* 经纪人保单列表查询
* @param requestVO 请求信息
* @return PolicyListQueryResponseVO
*/
PolicyListQueryResponseVO policyListQuery(PolicyListQueryRequestVO requestVO);
}
......@@ -202,4 +202,6 @@ public interface PractitionerService {
* @return 响应数据
*/
PotentialActivityQueryResponseVO potentialActivityQuery(PotentialActivityQueryRequestVO requestVO);
}
package com.yd.api.practitioner.service.impl;
import com.google.common.base.Strings;
import com.yd.api.practitioner.service.PractitionerPolicyService;
import com.yd.api.practitioner.vo.policy.PolicyInfo;
import com.yd.api.practitioner.vo.policy.PolicyListQueryRequestVO;
import com.yd.api.practitioner.vo.policy.PolicyListQueryResponseVO;
import com.yd.api.result.CommonResult;
import com.yd.dal.entity.customer.AclPractitioner;
import com.yd.dal.entity.order.CustomerPolicyInfo;
import com.yd.dal.entity.product.Product;
import com.yd.dal.entity.product.ProductE;
import com.yd.dal.entity.product.ProductPlan;
import com.yd.dal.service.customer.AclPractitionerDALService;
import com.yd.dal.service.order.PoOrderDALService;
import com.yd.dal.service.product.ProductDALService;
import com.yd.dal.service.product.ProductPlanDALService;
import com.yd.util.config.ZHBErrorConfig;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service("practitionerPolicyService")
public class PractitionerPolicyServiceImpl implements PractitionerPolicyService {
@Autowired
private AclPractitionerDALService aclPractitionerDALService;
@Autowired
private PoOrderDALService poOrderDALService;
@Autowired
private ProductPlanDALService productPlanDALService;
@Autowired
private ProductDALService productDALService;
@Override
public PolicyListQueryResponseVO policyListQuery(PolicyListQueryRequestVO requestVO) {
PolicyListQueryResponseVO responseVO = new PolicyListQueryResponseVO();
Long practitionerId = requestVO.getPractitionerId();
if(practitionerId !=null){
String mobileNo = aclPractitionerDALService.findMobileNoByPractitionerId(practitionerId);
if(!Strings.isNullOrEmpty(mobileNo) && mobileNo.length() == 11){
List<PolicyInfo> policyInfoList = new ArrayList<>();
Integer time = requestVO.getTime();
time = (time == null) ? 1 : time;
//1、线上
getPolicyListForYD(policyInfoList,practitionerId,time);
//2、线下
getPolicyListForEGolden(policyInfoList,mobileNo,time);
responseVO.setPolicyInfoList(policyInfoList);
Collections.sort(policyInfoList);
responseVO.setCommonResult(new CommonResult(true,ZHBErrorConfig.getErrorInfo("800000")));
}else{
responseVO.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("820001")));
}
}else{
String[] params = {"practitionerId"};
responseVO.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("610001", params)));
}
return responseVO;
}
/**
* EGolden--查询经纪人保单列表
* @param policyInfoList 保单列表
* @param mobileNo 手机号码
* @param time 时间段
*/
private void getPolicyListForEGolden(List<PolicyInfo> policyInfoList, String mobileNo, Integer time) {
if(!Strings.isNullOrEmpty(mobileNo)){
PolicyInfo policyInfo ;
List<CustomerPolicyInfo> policyInfos = poOrderDALService.findPolicyInfoByMobileNoE(mobileNo,time);
if(!policyInfos.isEmpty()){
String productId ;
Map<String,String> productNameMap = new HashMap<>();
List<ProductE> products = productDALService.findAllE();
products.forEach(i->productNameMap.put(i.getProductId(),i.getProductName()));
for(CustomerPolicyInfo item : policyInfos){
policyInfo = new PolicyInfo();
productId = item.getProductName();
BeanUtils.copyProperties(item,policyInfo);
policyInfo.setProductName(productNameMap.get(productId));
policyInfo.setPlatform(2);
policyInfoList.add(policyInfo);
}
}
}
}
/**
* 银盾保险在线--查询经纪人保单列表
* @param policyInfoList 保单列表
* @param practitionerId 经纪人id
* @param time 时间段
*/
private void getPolicyListForYD(List<PolicyInfo> policyInfoList, Long practitionerId, Integer time) {
if(practitionerId != null ){
AclPractitioner practitioner = aclPractitionerDALService.findById(practitionerId);
Long customerId = practitioner.getCustomerId();
if(customerId != null){
List<CustomerPolicyInfo> policyInfos = poOrderDALService.findPolicyInfoByCustomerId(customerId,time);
if(!policyInfos.isEmpty()){
PolicyInfo policyInfo ;
Map<Long,String> planNameMap = new HashMap<>();
Map<Long,String> productNameMap = new HashMap<>();
List<ProductPlan> plans = productPlanDALService.findAll();
List<Product> products = productDALService.findAll();
products.forEach(i->productNameMap.put(i.getId(),i.getName()));
plans.forEach(i->planNameMap.put(i.getId(),i.getName()));
Long planId ;
for(CustomerPolicyInfo item : policyInfos){
planId = item.getPlanId();
policyInfo = new PolicyInfo();
BeanUtils.copyProperties(item,policyInfo);
if(planId != null){
policyInfo.setPlanName(planNameMap.get(planId));
policyInfo.setNoPlanProduct(false);
}else{
policyInfo.setProductName(productNameMap.get(item.getProductId()));
policyInfo.setNoPlanProduct(true);
}
policyInfo.setPlatform(1);
policyInfoList.add(policyInfo);
}
}
}
}
}
}
package com.yd.api.practitioner.vo.policy;
import com.yd.dal.entity.order.CustomerPolicyInfo;
public class PolicyInfo extends CustomerPolicyInfo {
}
\ No newline at end of file
package com.yd.api.practitioner.vo.policy;
public class PolicyListQueryRequestVO {
private Long practitionerId;
private Integer time;
public Long getPractitionerId() {
return practitionerId;
}
public void setPractitionerId(Long practitionerId) {
this.practitionerId = practitionerId;
}
public Integer getTime() {
return time;
}
public void setTime(Integer time) {
this.time = time;
}
}
package com.yd.api.practitioner.vo.policy;
import com.yd.api.result.CommonResult;
import java.util.List;
public class PolicyListQueryResponseVO {
private List<PolicyInfo> policyInfoList;
private CommonResult commonResult;
public List<PolicyInfo> getPolicyInfoList() {
return policyInfoList;
}
public void setPolicyInfoList(List<PolicyInfo> policyInfoList) {
this.policyInfoList = policyInfoList;
}
public CommonResult getCommonResult() {
return commonResult;
}
public void setCommonResult(CommonResult commonResult) {
this.commonResult = commonResult;
}
}
package com.yd.dal.entity.order;
import com.google.common.base.Strings;
import com.yd.util.CommonUtil;
import java.util.Date;
public class CustomerPolicyInfo implements Comparable<CustomerPolicyInfo>{
private Long orderId;
private String orderNo;
private String policyNo;
private String holderName;
private String destination;
private String planName;
private String productName;
private String orderDate;
private String startDate;
private String endDate;
private Double referralAmount;
private Double orderPrice;
private boolean noPlanProduct;
private Integer platform;//1、银盾在线,2、EGolden
private Long planId;
private Long productId;
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getPolicyNo() {
return policyNo;
}
public void setPolicyNo(String policyNo) {
this.policyNo = policyNo;
}
public String getHolderName() {
return holderName;
}
public void setHolderName(String holderName) {
this.holderName = holderName;
}
public String getDestination() {
return destination;
}
public void setDestination(String destination) {
this.destination = destination;
}
public String getPlanName() {
return planName;
}
public void setPlanName(String planName) {
this.planName = planName;
}
public String getOrderDate() {
return orderDate;
}
public void setOrderDate(String orderDate) {
this.orderDate = orderDate;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public Double getReferralAmount() {
return referralAmount;
}
public void setReferralAmount(Double referralAmount) {
this.referralAmount = referralAmount;
}
public Double getOrderPrice() {
return orderPrice;
}
public void setOrderPrice(Double orderPrice) {
this.orderPrice = orderPrice;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public boolean isNoPlanProduct() {
return noPlanProduct;
}
public void setNoPlanProduct(boolean noPlanProduct) {
this.noPlanProduct = noPlanProduct;
}
public Integer getPlatform() {
return platform;
}
public void setPlatform(Integer platform) {
this.platform = platform;
}
public Long getPlanId() {
return planId;
}
public void setPlanId(Long planId) {
this.planId = planId;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
@Override
public int compareTo(CustomerPolicyInfo o) {
String orderDate1 = o.getOrderDate();
if(!Strings.isNullOrEmpty(orderDate) && !Strings.isNullOrEmpty(orderDate1)){
Date orderDateDT = CommonUtil.stringParseDate(orderDate,"yyyy-MM-dd HH:mm:ss");
Date orderDate1DT = CommonUtil.stringParseDate(orderDate1,"yyyy-MM-dd HH:mm:ss");
if(orderDate1DT != null && orderDateDT != null){
return orderDate1DT.compareTo(orderDateDT);
}else{
return 0;
}
}else{
return 0;
}
}
}
package com.yd.dal.entity.product;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* ag_product
* @author
*/
@Data
public class Product implements Serializable {
/**
* serial id
*/
private Long id;
/**
* FK ag_acl_insurer.id
*/
private Long insurerId;
private String insurerName;
/**
* FK ag_acl_insurer_branch.id
*/
private Long insurerBranchId;
/**
* FK ag_product_category.id
*/
private Long productCategoryId;
/**
* Product#
*/
private String no;
/**
* Product Chinese name/Description
*/
private String name;
/**
* Product English name
*/
private String nameEn;
private String description;
/**
* 0000-00-00
*/
private Date effectiveStartDate;
/**
* 0000-00-00
*/
private Date effectiveEndDate;
private BigDecimal salePrice;
/**
* 0=No, 1=Yes
*/
private Integer isActive;
/**
* 保单生效起始日计算 T+X
*/
private Integer policyEffCount;
/**
* 保单生效起始日计算单位 H=时 D=天 W=周 M=月 Y=年
*/
private String policyEffCountUnit;
/**
* 最小保障期限
*/
private Integer minCoverTerm;
/**
* 最小保障期限单位 H=时 D=天 W=周 M=月 Y=年
*/
private String minCoverTermUnit;
/**
* 犹豫期,该产品订单的财富,只有过了犹豫期才能体现(H5)
*/
private Integer hesitatePeroid;
/**
* 1人/天、1人/年
*/
private String uiDisplayUnit;
/**
* 评测icon文章的url
*/
private String articleUrl;
/**
* 是否银盾收保费 0=No, 1=Yes
*/
private Integer isPayToYd;
/**
* 0000-00-00 00:00:00
*/
private Date createdAt;
/**
* FK ag_acl_user.id
*/
private Long createdBy;
/**
* 0000-00-00 00:00:00
*/
private Date updatedAt;
/**
* latest updator
*/
private Long updatedBy;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.dal.entity.product;
public class ProductE {
private String productId;
private String productName;
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
this.productId = productId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
}
package com.yd.dal.entity.product;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* ag_product_plan
* @author
*/
@Data
public class ProductPlan implements Serializable {
/**
* serial id
*/
private Long id;
/**
* FK ag_acl_insurer.id
*/
private Long insurerId;
/**
* FK ag_product.id
*/
private Long productId;
/**
* plan#= plan code
*/
private String planCode;
/**
* contract_id for Starr; Risk-Duty code for Fosun
*/
private String contractId;
/**
* plan Chinese name
*/
private String name;
/**
* plan Level name 档次显示
*/
private String nameSub;
/**
* plan Eng name
*/
private String nameEn;
/**
* 0, 1=low, 2=mid 3=high, 4=super
*/
private Integer level;
private BigDecimal commisionRate;
private BigDecimal referralRate;
private BigDecimal salePrice;
/**
* 0000-00-00
*/
private Date effectiveStartDate;
/**
* 0000-00-00
*/
private Date effectiveEndDate;
/**
* 0=No, 1=Yes
*/
private Integer isActive;
/**
* 0=No, 1=Yes
*/
private Integer isGlobal;
/**
* FK ag_acl_continent.id
*/
private Long continentId;
/**
* FK ag_md_country.id
*/
private Long countryId;
/**
* FK ag_md_region.id
*/
private Long regionId;
/**
* 0=No, 1=Yes
*/
private Integer isPopular;
/**
* incremental +1
*/
private Integer salesCount;
/**
* version control
*/
private Integer version;
/**
* 支持社保类型(1-仅支持有社保; 0-仅支持无社保; 3-同时支持有、无社保)
*/
private Integer isSocialInsured;
/**
* 适用性别(1-男;2-女)
*/
private Integer appGender;
/**
* 创建时间
*/
private Date createdAt;
/**
* 创建人
*/
private Long createdBy;
/**
* 修改时间
*/
private Date updatedAt;
/**
* 修改人
*/
private Long updatedBy;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.dal.mapper.order;
import com.yd.dal.entity.order.CustomerPolicyInfo;
import com.yd.dal.entity.order.PoOrder;
import org.apache.ibatis.annotations.Param;
......@@ -19,4 +20,8 @@ public interface PoOrderMapper {
int updateByPrimaryKey(PoOrder record);
List<PoOrder> findByStatusAndShareCodeInGroupByCustomerId(@Param("status") int status, @Param("customerShareCodes") List<String> customerShareCodes);
List<CustomerPolicyInfo> findPolicyInfoByCustomerId(@Param("customerId")Long customerId, @Param("time")Integer time);
List<CustomerPolicyInfo> findPolicyInfoByMobileNoE(@Param("mobileNo")String mobileNo, @Param("time")Integer time);
}
\ No newline at end of file
package com.yd.dal.mapper.product;
import com.yd.dal.entity.product.Product;
import com.yd.dal.entity.product.ProductE;
import java.util.List;
public interface ProductMapper {
int deleteByPrimaryKey(Long id);
int insert(Product record);
int insertSelective(Product record);
Product selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(Product record);
int updateByPrimaryKey(Product record);
List<Product> findAll();
List<ProductE> findAllE();
}
\ No newline at end of file
package com.yd.dal.mapper.product;
import com.yd.dal.entity.product.ProductPlan;
import java.util.List;
public interface ProductPlanMapper {
int deleteByPrimaryKey(Long id);
int insert(ProductPlan record);
int insertSelective(ProductPlan record);
ProductPlan selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(ProductPlan record);
int updateByPrimaryKey(ProductPlan record);
List<ProductPlan> findAll();
}
\ No newline at end of file
......@@ -116,4 +116,11 @@ public interface AclPractitionerDALService {
* @return 查询结果
*/
PractitionerBasicInfo findByMobileNoE(String mobileNo);
/**
* 根据id查询经纪人信息
* @param practitionerId 经纪人id
* @return 查询结果
*/
AclPractitioner findById(Long practitionerId);
}
......@@ -119,4 +119,9 @@ public class AclPractitionerDALServiceImpl implements AclPractitionerDALService
public PractitionerBasicInfo findByMobileNoE(String mobileNo) {
return aclPractitionerMapper.findByMobileNoE(mobileNo);
}
@Override
public AclPractitioner findById(Long practitionerId) {
return aclPractitionerMapper.selectByPrimaryKey(practitionerId);
}
}
package com.yd.dal.service.order.Impl;
import com.yd.dal.entity.order.CustomerPolicyInfo;
import com.yd.dal.entity.order.PoOrder;
import com.yd.dal.mapper.order.PoOrderMapper;
import com.yd.dal.service.order.PoOrderDALService;
import com.yd.util.intercept.annotation.TargetDataSource;
import com.yd.util.intercept.commons.DataSourceKey;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -22,4 +25,15 @@ public class PoOrderDALServiceImpl implements PoOrderDALService {
public PoOrder findByOrderId(Long orderId) {
return poOrderMapper.selectByPrimaryKey(orderId);
}
@Override
public List<CustomerPolicyInfo> findPolicyInfoByCustomerId(Long customerId, Integer time) {
return poOrderMapper.findPolicyInfoByCustomerId(customerId,time);
}
@Override
@TargetDataSource(dataSourceKey = DataSourceKey.DB_EGOLDEN)
public List<CustomerPolicyInfo> findPolicyInfoByMobileNoE(String mobileNo, Integer time) {
return poOrderMapper.findPolicyInfoByMobileNoE(mobileNo,time);
}
}
package com.yd.dal.service.order;
import com.yd.dal.entity.order.CustomerPolicyInfo;
import com.yd.dal.entity.order.PoOrder;
import java.util.List;
......@@ -8,4 +9,8 @@ public interface PoOrderDALService {
List<PoOrder> findByStatusAndShareCodeInGroupByCustomerId(int status, List<String> customerShareCodes);
PoOrder findByOrderId(Long orderId);
List<CustomerPolicyInfo> findPolicyInfoByCustomerId(Long customerId, Integer time);
List<CustomerPolicyInfo> findPolicyInfoByMobileNoE(String mobileNo, Integer time);
}
package com.yd.dal.service.product;
import com.yd.dal.entity.product.Product;
import com.yd.dal.entity.product.ProductE;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("productDALService")
public interface ProductDALService {
List<Product> findAll();
List<ProductE> findAllE();
}
package com.yd.dal.service.product;
import com.yd.dal.entity.product.ProductPlan;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("productPlanDALService")
public interface ProductPlanDALService {
List<ProductPlan> findAll();
}
package com.yd.dal.service.product.impl;
import com.yd.dal.entity.product.Product;
import com.yd.dal.entity.product.ProductE;
import com.yd.dal.mapper.product.ProductMapper;
import com.yd.dal.service.product.ProductDALService;
import com.yd.util.intercept.annotation.TargetDataSource;
import com.yd.util.intercept.commons.DataSourceKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("productDALService")
public class ProductDALServiceImpl implements ProductDALService {
@Autowired
private ProductMapper productMapper;
@Override
public List<Product> findAll() {
return productMapper.findAll();
}
@Override
@TargetDataSource(dataSourceKey = DataSourceKey.DB_EGOLDEN)
public List<ProductE> findAllE() {
return productMapper.findAllE();
}
}
package com.yd.dal.service.product.impl;
import com.yd.dal.entity.product.ProductPlan;
import com.yd.dal.mapper.product.ProductPlanMapper;
import com.yd.dal.service.product.ProductPlanDALService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("productPlanDALService")
public class ProductPlanDALServiceImpl implements ProductPlanDALService {
@Autowired
private ProductPlanMapper productPlanMapper;
@Override
public List<ProductPlan> findAll() {
return productPlanMapper.findAll();
}
}
......@@ -540,34 +540,66 @@
<result column="fyc" property="fyc"/>
</resultMap>
<select id="getPractitionerRankInfoForOffline" resultMap="practitioner_rank_map" resultType="java.lang.Integer">
SELECT
p.SAL_MST_ID as practitionerId ,
p.SAL_MST_NAME as name ,-- 姓名
md.DRP_TITLE_LEVEL as titleCode,-- 职称code
md.DRP_TITLE_NAME as titleName,-- 职称名称
spc.SPC_DIV_NAME as spcDivName,-- 体系id
ifnull(count(m.MON025_002),0) as count,-- 保单id
ifnull(sum(m.MON025_401),0) as fyp,-- 保费
ifnull(sum(policy.INS001_FYCTOTAL),0) as fyc -- 应发佣金
FROM MON025 m INNER JOIN sal001 p on m.MON025_007 = p.SAL_MST_ID -- 业务员id
left join DRP003 md on p.FK_DRP_TITLE_CODE = md.DRP_TITLE_CODE
inner JOIN ins001 policy on m.MON025_002 = policy.INS_MST_ID -- 保单id
inner join spc004 spc on m.MON025_006 = spc.SPC_DIV_ID -- 体系
WHERE m.MON025_109 IN (1,2,3) AND m.MON025_303 = 1 AND m.mon025_108 = 'S01'
<choose>
<when test="time == 1">
and DATE_FORMAT(policy.INS_MST_ACCEPT_DATE, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
</when>
<when test="time == 3">
and QUARTER(policy.INS_MST_ACCEPT_DATE) = QUARTER(NOW()) AND year(policy.INS_MST_ACCEPT_DATE)=year(now())
</when>
<otherwise>
and YEAR(policy.INS_MST_ACCEPT_DATE) = YEAR(now())
</otherwise>
</choose>
group by p.SAL_MST_ID;
</select>
<!-- <select id="getPractitionerRankInfoForOffline" resultMap="practitioner_rank_map" resultType="java.lang.Integer">-->
<!-- SELECT-->
<!-- p.SAL_MST_ID as practitionerId ,-->
<!-- p.SAL_MST_NAME as name ,&#45;&#45; 姓名-->
<!-- md.DRP_TITLE_LEVEL as titleCode,&#45;&#45; 职称code-->
<!-- md.DRP_TITLE_NAME as titleName,&#45;&#45; 职称名称-->
<!-- spc.SPC_DIV_NAME as spcDivName,&#45;&#45; 体系id-->
<!-- ifnull(count(m.MON025_002),0) as count,&#45;&#45; 保单id-->
<!-- ifnull(sum(m.MON025_401),0) as fyp,&#45;&#45; 保费-->
<!-- ifnull(sum(policy.INS001_FYCTOTAL),0) as fyc &#45;&#45; 应发佣金-->
<!-- FROM MON025 m INNER JOIN sal001 p on m.MON025_007 = p.SAL_MST_ID &#45;&#45; 业务员id-->
<!-- left join DRP003 md on p.FK_DRP_TITLE_CODE = md.DRP_TITLE_CODE-->
<!-- inner JOIN ins001 policy on m.MON025_002 = policy.INS_MST_ID &#45;&#45; 保单id-->
<!-- inner join spc004 spc on m.MON025_006 = spc.SPC_DIV_ID &#45;&#45; 体系-->
<!-- WHERE m.MON025_109 IN (1,2,3) AND m.MON025_303 = 1 AND m.mon025_108 = 'S01'-->
<!-- <choose>-->
<!-- <when test="time == 1">-->
<!-- and DATE_FORMAT(policy.INS_MST_ACCEPT_DATE, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )-->
<!-- </when>-->
<!-- <when test="time == 3">-->
<!-- and QUARTER(policy.INS_MST_ACCEPT_DATE) = QUARTER(NOW()) AND year(policy.INS_MST_ACCEPT_DATE)=year(now())-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- and YEAR(policy.INS_MST_ACCEPT_DATE) = YEAR(now())-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- group by p.SAL_MST_ID;-->
<!-- </select>-->
<select id="getPractitionerRankInfoForOffline" resultMap="practitioner_rank_map" resultType="java.lang.Integer">
SELECT
p.SAL_MST_ID as practitionerId ,
p.SAL_MST_NAME as name ,-- 姓名
p.SAL_MST_ID_TYPE as titleCode,-- 职称code
p.SAL_MST_OFFICIAL_TITLE as titleName,-- 职称名称
spc.SPC_DIV_NAME as spcDivName,-- 体系id
ifnull(count(distinct policy.INS_MST_ID),0) as count,-- 保单id
ifnull(sum(policy.INS_MST_TOTAL_PREIUM),0) as fyp,-- 保费
ifnull(sum(policy.INS001_FYCTOTAL),0) as fyc -- 应发佣金
FROM
ins001 policy INNER JOIN mon025 m on policy.INS_MST_ID = m.MON025_002 and m.MON025_109 IN (1,2,3) AND m.MON025_303 = 1 AND m.mon025_108 = 'S01'
INNER JOIN (
SELECT mon025_002,MAX(MON025_405) as MON025_405 FROM mon025 group by mon025_002 ORDER BY mon025_002
) b on m.mon025_002 = b.mon025_002 AND m.MON025_405 = b.MON025_405
INNER JOIN sal001 p on m.MON025_007 = p.SAL_MST_ID -- 业务员id
inner join spc004 spc on m.MON025_006 = spc.SPC_DIV_ID -- 体系
where
<choose>
<when test="time == 1">
DATE_FORMAT(policy.INS_MST_ACCEPT_DATE, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
</when>
<when test="time == 3">
QUARTER(policy.INS_MST_ACCEPT_DATE) = QUARTER(NOW()) AND year(policy.INS_MST_ACCEPT_DATE)=year(now())
</when>
<otherwise>
YEAR(policy.INS_MST_ACCEPT_DATE) = YEAR(now())
</otherwise>
</choose>
group by p.SAL_MST_ID;
</select>
<select id="getPractitionerRankInfoForOnline" resultMap="practitioner_rank_map">
SELECT
......
......@@ -975,8 +975,62 @@
#{item}
</foreach>
</if>
</select>
<select id="findPolicyInfoByCustomerId" resultType="com.yd.dal.entity.order.CustomerPolicyInfo">
SELECT
o.id as orderId,
o.order_no as orderNo ,
o.policy_no as policyNo ,
p.name as holderName,
o.destination as destination,
date_format(o.order_date, '%Y-%m-%d %H:%i:%s') as orderDate,
date_format(o.effective_start_date, '%Y-%m-%d %H:%i:%s') as startDate,
date_format(o.effective_end_date, '%Y-%m-%d %H:%i:%s') as endDate,
f.referral_amount as referralAmount,
f.order_price as orderPrice,
o.plan_id as planId,
o.product_id as productId
FROM ag_acl_customer_fortune f INNER JOIN ag_po_order o ON f.order_id = o.id and o.status = 3 and o.order_price > 0
inner JOIN ag_acl_policyholder p ON o.id = p.order_id and p.type = 2
WHERE f.customer_id = #{customerId,jdbcType=BIGINT}
<choose>
<when test="time == 1">
and DATE_FORMAT(f.order_date, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
</when>
<when test="time == 3">
and QUARTER(f.order_date) = QUARTER(NOW()) AND year(f.order_date)=year(now())
</when>
<otherwise>
and YEAR(f.order_date) = YEAR(now())
</otherwise>
</choose>
</select>
<select id="findPolicyInfoByMobileNoE" resultType="com.yd.dal.entity.order.CustomerPolicyInfo">
SELECT
policy.INS_MST_ID as orderNo ,
policy.INS_MST_POLICY_NUM as policyyNo ,
c.CUS_MST_NAME as holderName,
date_format(policy.INS_MST_ACCEPT_DATE, '%Y-%m-%d %H:%i:%s') as orderDate,
date_format(policy.INS_MST_EFFECT_DATE, '%Y-%m-%d %H:%i:%s') as startDate,
date_format(policy.INS_MST_INVALID_DATE, '%Y-%m-%d %H:%i:%s') as endDate,
sum(m.MON025_405) as referralAmount,
sum(m.MON025_401) as orderPrice,
m.MON025_004 as productName
FROM sal001 p INNER JOIN MON025 m on m.MON025_007 = p.SAL_MST_ID and m.MON025_109 IN (1,2,3) AND m.MON025_303 = 1 AND m.mon025_108 = 'S01'-- 业务员id
inner JOIN ins001 policy on m.MON025_002 = policy.INS_MST_ID -- 保单id
inner join cus001 c on policy.FK_CUS_PRO_ID = c.CUS_MST_ID
WHERE p.SAL_MST_MOBILE like concat(concat('%',#{mobileNo,jdbcType=VARCHAR}),'%')
<choose>
<when test="time == 1">
and DATE_FORMAT(policy.INS_MST_ACCEPT_DATE, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
</when>
<when test="time == 3">
and QUARTER(policy.INS_MST_ACCEPT_DATE) = QUARTER(NOW()) AND year(policy.INS_MST_ACCEPT_DATE)=year(now())
</when>
<otherwise>
and YEAR(policy.INS_MST_ACCEPT_DATE) = YEAR(now())
</otherwise>
</choose>
group by policy.ins_mst_id
</select>
</mapper>
\ No newline at end of file
<?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="com.yd.dal.mapper.product.ProductMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.product.Product">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="insurer_id" jdbcType="BIGINT" property="insurerId" />
<result column="insurer_name" jdbcType="VARCHAR" property="insurerName" />
<result column="insurer_branch_id" jdbcType="BIGINT" property="insurerBranchId" />
<result column="product_category_id" jdbcType="BIGINT" property="productCategoryId" />
<result column="no" jdbcType="VARCHAR" property="no" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="name_en" jdbcType="VARCHAR" property="nameEn" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="effective_start_date" jdbcType="DATE" property="effectiveStartDate" />
<result column="effective_end_date" jdbcType="DATE" property="effectiveEndDate" />
<result column="sale_price" jdbcType="DECIMAL" property="salePrice" />
<result column="is_active" jdbcType="INTEGER" property="isActive" />
<result column="policy_eff_count" jdbcType="INTEGER" property="policyEffCount" />
<result column="policy_eff_count_unit" jdbcType="VARCHAR" property="policyEffCountUnit" />
<result column="min_cover_term" jdbcType="INTEGER" property="minCoverTerm" />
<result column="min_cover_term_unit" jdbcType="VARCHAR" property="minCoverTermUnit" />
<result column="hesitate_peroid" jdbcType="INTEGER" property="hesitatePeroid" />
<result column="ui_display_unit" jdbcType="VARCHAR" property="uiDisplayUnit" />
<result column="article_url" jdbcType="VARCHAR" property="articleUrl" />
<result column="is_pay_to_yd" jdbcType="INTEGER" property="isPayToYd" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="BIGINT" property="updatedBy" />
</resultMap>
<sql id="Base_Column_List">
id, insurer_id, insurer_name, insurer_branch_id, product_category_id, `no`, `name`,
name_en, description, effective_start_date, effective_end_date, sale_price, is_active,
policy_eff_count, policy_eff_count_unit, min_cover_term, min_cover_term_unit, hesitate_peroid,
ui_display_unit, article_url, is_pay_to_yd, created_at, created_by, updated_at, updated_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_product
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ag_product
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.product.Product" useGeneratedKeys="true">
insert into ag_product (insurer_id, insurer_name, insurer_branch_id,
product_category_id, `no`, `name`,
name_en, description, effective_start_date,
effective_end_date, sale_price, is_active,
policy_eff_count, policy_eff_count_unit, min_cover_term,
min_cover_term_unit, hesitate_peroid, ui_display_unit,
article_url, is_pay_to_yd, created_at,
created_by, updated_at, updated_by
)
values (#{insurerId,jdbcType=BIGINT}, #{insurerName,jdbcType=VARCHAR}, #{insurerBranchId,jdbcType=BIGINT},
#{productCategoryId,jdbcType=BIGINT}, #{no,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{nameEn,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{effectiveStartDate,jdbcType=DATE},
#{effectiveEndDate,jdbcType=DATE}, #{salePrice,jdbcType=DECIMAL}, #{isActive,jdbcType=INTEGER},
#{policyEffCount,jdbcType=INTEGER}, #{policyEffCountUnit,jdbcType=VARCHAR}, #{minCoverTerm,jdbcType=INTEGER},
#{minCoverTermUnit,jdbcType=VARCHAR}, #{hesitatePeroid,jdbcType=INTEGER}, #{uiDisplayUnit,jdbcType=VARCHAR},
#{articleUrl,jdbcType=VARCHAR}, #{isPayToYd,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP},
#{createdBy,jdbcType=BIGINT}, #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.product.Product" useGeneratedKeys="true">
insert into ag_product
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="insurerId != null">
insurer_id,
</if>
<if test="insurerName != null">
insurer_name,
</if>
<if test="insurerBranchId != null">
insurer_branch_id,
</if>
<if test="productCategoryId != null">
product_category_id,
</if>
<if test="no != null">
`no`,
</if>
<if test="name != null">
`name`,
</if>
<if test="nameEn != null">
name_en,
</if>
<if test="description != null">
description,
</if>
<if test="effectiveStartDate != null">
effective_start_date,
</if>
<if test="effectiveEndDate != null">
effective_end_date,
</if>
<if test="salePrice != null">
sale_price,
</if>
<if test="isActive != null">
is_active,
</if>
<if test="policyEffCount != null">
policy_eff_count,
</if>
<if test="policyEffCountUnit != null">
policy_eff_count_unit,
</if>
<if test="minCoverTerm != null">
min_cover_term,
</if>
<if test="minCoverTermUnit != null">
min_cover_term_unit,
</if>
<if test="hesitatePeroid != null">
hesitate_peroid,
</if>
<if test="uiDisplayUnit != null">
ui_display_unit,
</if>
<if test="articleUrl != null">
article_url,
</if>
<if test="isPayToYd != null">
is_pay_to_yd,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="insurerId != null">
#{insurerId,jdbcType=BIGINT},
</if>
<if test="insurerName != null">
#{insurerName,jdbcType=VARCHAR},
</if>
<if test="insurerBranchId != null">
#{insurerBranchId,jdbcType=BIGINT},
</if>
<if test="productCategoryId != null">
#{productCategoryId,jdbcType=BIGINT},
</if>
<if test="no != null">
#{no,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="nameEn != null">
#{nameEn,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="effectiveStartDate != null">
#{effectiveStartDate,jdbcType=DATE},
</if>
<if test="effectiveEndDate != null">
#{effectiveEndDate,jdbcType=DATE},
</if>
<if test="salePrice != null">
#{salePrice,jdbcType=DECIMAL},
</if>
<if test="isActive != null">
#{isActive,jdbcType=INTEGER},
</if>
<if test="policyEffCount != null">
#{policyEffCount,jdbcType=INTEGER},
</if>
<if test="policyEffCountUnit != null">
#{policyEffCountUnit,jdbcType=VARCHAR},
</if>
<if test="minCoverTerm != null">
#{minCoverTerm,jdbcType=INTEGER},
</if>
<if test="minCoverTermUnit != null">
#{minCoverTermUnit,jdbcType=VARCHAR},
</if>
<if test="hesitatePeroid != null">
#{hesitatePeroid,jdbcType=INTEGER},
</if>
<if test="uiDisplayUnit != null">
#{uiDisplayUnit,jdbcType=VARCHAR},
</if>
<if test="articleUrl != null">
#{articleUrl,jdbcType=VARCHAR},
</if>
<if test="isPayToYd != null">
#{isPayToYd,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.product.Product">
update ag_product
<set>
<if test="insurerId != null">
insurer_id = #{insurerId,jdbcType=BIGINT},
</if>
<if test="insurerName != null">
insurer_name = #{insurerName,jdbcType=VARCHAR},
</if>
<if test="insurerBranchId != null">
insurer_branch_id = #{insurerBranchId,jdbcType=BIGINT},
</if>
<if test="productCategoryId != null">
product_category_id = #{productCategoryId,jdbcType=BIGINT},
</if>
<if test="no != null">
`no` = #{no,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="nameEn != null">
name_en = #{nameEn,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="effectiveStartDate != null">
effective_start_date = #{effectiveStartDate,jdbcType=DATE},
</if>
<if test="effectiveEndDate != null">
effective_end_date = #{effectiveEndDate,jdbcType=DATE},
</if>
<if test="salePrice != null">
sale_price = #{salePrice,jdbcType=DECIMAL},
</if>
<if test="isActive != null">
is_active = #{isActive,jdbcType=INTEGER},
</if>
<if test="policyEffCount != null">
policy_eff_count = #{policyEffCount,jdbcType=INTEGER},
</if>
<if test="policyEffCountUnit != null">
policy_eff_count_unit = #{policyEffCountUnit,jdbcType=VARCHAR},
</if>
<if test="minCoverTerm != null">
min_cover_term = #{minCoverTerm,jdbcType=INTEGER},
</if>
<if test="minCoverTermUnit != null">
min_cover_term_unit = #{minCoverTermUnit,jdbcType=VARCHAR},
</if>
<if test="hesitatePeroid != null">
hesitate_peroid = #{hesitatePeroid,jdbcType=INTEGER},
</if>
<if test="uiDisplayUnit != null">
ui_display_unit = #{uiDisplayUnit,jdbcType=VARCHAR},
</if>
<if test="articleUrl != null">
article_url = #{articleUrl,jdbcType=VARCHAR},
</if>
<if test="isPayToYd != null">
is_pay_to_yd = #{isPayToYd,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.product.Product">
update ag_product
set insurer_id = #{insurerId,jdbcType=BIGINT},
insurer_name = #{insurerName,jdbcType=VARCHAR},
insurer_branch_id = #{insurerBranchId,jdbcType=BIGINT},
product_category_id = #{productCategoryId,jdbcType=BIGINT},
`no` = #{no,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
name_en = #{nameEn,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
effective_start_date = #{effectiveStartDate,jdbcType=DATE},
effective_end_date = #{effectiveEndDate,jdbcType=DATE},
sale_price = #{salePrice,jdbcType=DECIMAL},
is_active = #{isActive,jdbcType=INTEGER},
policy_eff_count = #{policyEffCount,jdbcType=INTEGER},
policy_eff_count_unit = #{policyEffCountUnit,jdbcType=VARCHAR},
min_cover_term = #{minCoverTerm,jdbcType=INTEGER},
min_cover_term_unit = #{minCoverTermUnit,jdbcType=VARCHAR},
hesitate_peroid = #{hesitatePeroid,jdbcType=INTEGER},
ui_display_unit = #{uiDisplayUnit,jdbcType=VARCHAR},
article_url = #{articleUrl,jdbcType=VARCHAR},
is_pay_to_yd = #{isPayToYd,jdbcType=INTEGER},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="findAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_product
where is_active is not null
</select>
<select id="findAllE" resultType="com.yd.dal.entity.product.ProductE">
select
t.prd_mst_id as productId,
t.PRD_MST_PRO_NAME as productName
from prd001 t
</select>
</mapper>
\ No newline at end of file
<?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="com.yd.dal.mapper.product.ProductPlanMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.product.ProductPlan">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="insurer_id" jdbcType="BIGINT" property="insurerId" />
<result column="product_id" jdbcType="BIGINT" property="productId" />
<result column="plan_code" jdbcType="VARCHAR" property="planCode" />
<result column="contract_id" jdbcType="VARCHAR" property="contractId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="name_sub" jdbcType="VARCHAR" property="nameSub" />
<result column="name_en" jdbcType="VARCHAR" property="nameEn" />
<result column="level" jdbcType="INTEGER" property="level" />
<result column="commision_rate" jdbcType="DECIMAL" property="commisionRate" />
<result column="referral_rate" jdbcType="DECIMAL" property="referralRate" />
<result column="sale_price" jdbcType="DECIMAL" property="salePrice" />
<result column="effective_start_date" jdbcType="DATE" property="effectiveStartDate" />
<result column="effective_end_date" jdbcType="DATE" property="effectiveEndDate" />
<result column="is_active" jdbcType="INTEGER" property="isActive" />
<result column="is_global" jdbcType="INTEGER" property="isGlobal" />
<result column="continent_id" jdbcType="BIGINT" property="continentId" />
<result column="country_id" jdbcType="BIGINT" property="countryId" />
<result column="region_id" jdbcType="BIGINT" property="regionId" />
<result column="is_popular" jdbcType="INTEGER" property="isPopular" />
<result column="sales_count" jdbcType="INTEGER" property="salesCount" />
<result column="version" jdbcType="INTEGER" property="version" />
<result column="is_social_insured" jdbcType="INTEGER" property="isSocialInsured" />
<result column="app_gender" jdbcType="INTEGER" property="appGender" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="BIGINT" property="updatedBy" />
</resultMap>
<sql id="Base_Column_List">
id, insurer_id, product_id, plan_code, contract_id, `name`, name_sub, name_en, `level`,
commision_rate, referral_rate, sale_price, effective_start_date, effective_end_date,
is_active, is_global, continent_id, country_id, region_id, is_popular, sales_count,
version, is_social_insured, app_gender, created_at, created_by, updated_at, updated_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_product_plan
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ag_product_plan
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.product.ProductPlan" useGeneratedKeys="true">
insert into ag_product_plan (insurer_id, product_id, plan_code,
contract_id, `name`, name_sub,
name_en, `level`, commision_rate,
referral_rate, sale_price, effective_start_date,
effective_end_date, is_active, is_global,
continent_id, country_id, region_id,
is_popular, sales_count, version,
is_social_insured, app_gender, created_at,
created_by, updated_at, updated_by
)
values (#{insurerId,jdbcType=BIGINT}, #{productId,jdbcType=BIGINT}, #{planCode,jdbcType=VARCHAR},
#{contractId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{nameSub,jdbcType=VARCHAR},
#{nameEn,jdbcType=VARCHAR}, #{level,jdbcType=INTEGER}, #{commisionRate,jdbcType=DECIMAL},
#{referralRate,jdbcType=DECIMAL}, #{salePrice,jdbcType=DECIMAL}, #{effectiveStartDate,jdbcType=DATE},
#{effectiveEndDate,jdbcType=DATE}, #{isActive,jdbcType=INTEGER}, #{isGlobal,jdbcType=INTEGER},
#{continentId,jdbcType=BIGINT}, #{countryId,jdbcType=BIGINT}, #{regionId,jdbcType=BIGINT},
#{isPopular,jdbcType=INTEGER}, #{salesCount,jdbcType=INTEGER}, #{version,jdbcType=INTEGER},
#{isSocialInsured,jdbcType=INTEGER}, #{appGender,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP},
#{createdBy,jdbcType=BIGINT}, #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.product.ProductPlan" useGeneratedKeys="true">
insert into ag_product_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="insurerId != null">
insurer_id,
</if>
<if test="productId != null">
product_id,
</if>
<if test="planCode != null">
plan_code,
</if>
<if test="contractId != null">
contract_id,
</if>
<if test="name != null">
`name`,
</if>
<if test="nameSub != null">
name_sub,
</if>
<if test="nameEn != null">
name_en,
</if>
<if test="level != null">
`level`,
</if>
<if test="commisionRate != null">
commision_rate,
</if>
<if test="referralRate != null">
referral_rate,
</if>
<if test="salePrice != null">
sale_price,
</if>
<if test="effectiveStartDate != null">
effective_start_date,
</if>
<if test="effectiveEndDate != null">
effective_end_date,
</if>
<if test="isActive != null">
is_active,
</if>
<if test="isGlobal != null">
is_global,
</if>
<if test="continentId != null">
continent_id,
</if>
<if test="countryId != null">
country_id,
</if>
<if test="regionId != null">
region_id,
</if>
<if test="isPopular != null">
is_popular,
</if>
<if test="salesCount != null">
sales_count,
</if>
<if test="version != null">
version,
</if>
<if test="isSocialInsured != null">
is_social_insured,
</if>
<if test="appGender != null">
app_gender,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="insurerId != null">
#{insurerId,jdbcType=BIGINT},
</if>
<if test="productId != null">
#{productId,jdbcType=BIGINT},
</if>
<if test="planCode != null">
#{planCode,jdbcType=VARCHAR},
</if>
<if test="contractId != null">
#{contractId,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="nameSub != null">
#{nameSub,jdbcType=VARCHAR},
</if>
<if test="nameEn != null">
#{nameEn,jdbcType=VARCHAR},
</if>
<if test="level != null">
#{level,jdbcType=INTEGER},
</if>
<if test="commisionRate != null">
#{commisionRate,jdbcType=DECIMAL},
</if>
<if test="referralRate != null">
#{referralRate,jdbcType=DECIMAL},
</if>
<if test="salePrice != null">
#{salePrice,jdbcType=DECIMAL},
</if>
<if test="effectiveStartDate != null">
#{effectiveStartDate,jdbcType=DATE},
</if>
<if test="effectiveEndDate != null">
#{effectiveEndDate,jdbcType=DATE},
</if>
<if test="isActive != null">
#{isActive,jdbcType=INTEGER},
</if>
<if test="isGlobal != null">
#{isGlobal,jdbcType=INTEGER},
</if>
<if test="continentId != null">
#{continentId,jdbcType=BIGINT},
</if>
<if test="countryId != null">
#{countryId,jdbcType=BIGINT},
</if>
<if test="regionId != null">
#{regionId,jdbcType=BIGINT},
</if>
<if test="isPopular != null">
#{isPopular,jdbcType=INTEGER},
</if>
<if test="salesCount != null">
#{salesCount,jdbcType=INTEGER},
</if>
<if test="version != null">
#{version,jdbcType=INTEGER},
</if>
<if test="isSocialInsured != null">
#{isSocialInsured,jdbcType=INTEGER},
</if>
<if test="appGender != null">
#{appGender,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.product.ProductPlan">
update ag_product_plan
<set>
<if test="insurerId != null">
insurer_id = #{insurerId,jdbcType=BIGINT},
</if>
<if test="productId != null">
product_id = #{productId,jdbcType=BIGINT},
</if>
<if test="planCode != null">
plan_code = #{planCode,jdbcType=VARCHAR},
</if>
<if test="contractId != null">
contract_id = #{contractId,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="nameSub != null">
name_sub = #{nameSub,jdbcType=VARCHAR},
</if>
<if test="nameEn != null">
name_en = #{nameEn,jdbcType=VARCHAR},
</if>
<if test="level != null">
`level` = #{level,jdbcType=INTEGER},
</if>
<if test="commisionRate != null">
commision_rate = #{commisionRate,jdbcType=DECIMAL},
</if>
<if test="referralRate != null">
referral_rate = #{referralRate,jdbcType=DECIMAL},
</if>
<if test="salePrice != null">
sale_price = #{salePrice,jdbcType=DECIMAL},
</if>
<if test="effectiveStartDate != null">
effective_start_date = #{effectiveStartDate,jdbcType=DATE},
</if>
<if test="effectiveEndDate != null">
effective_end_date = #{effectiveEndDate,jdbcType=DATE},
</if>
<if test="isActive != null">
is_active = #{isActive,jdbcType=INTEGER},
</if>
<if test="isGlobal != null">
is_global = #{isGlobal,jdbcType=INTEGER},
</if>
<if test="continentId != null">
continent_id = #{continentId,jdbcType=BIGINT},
</if>
<if test="countryId != null">
country_id = #{countryId,jdbcType=BIGINT},
</if>
<if test="regionId != null">
region_id = #{regionId,jdbcType=BIGINT},
</if>
<if test="isPopular != null">
is_popular = #{isPopular,jdbcType=INTEGER},
</if>
<if test="salesCount != null">
sales_count = #{salesCount,jdbcType=INTEGER},
</if>
<if test="version != null">
version = #{version,jdbcType=INTEGER},
</if>
<if test="isSocialInsured != null">
is_social_insured = #{isSocialInsured,jdbcType=INTEGER},
</if>
<if test="appGender != null">
app_gender = #{appGender,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.product.ProductPlan">
update ag_product_plan
set insurer_id = #{insurerId,jdbcType=BIGINT},
product_id = #{productId,jdbcType=BIGINT},
plan_code = #{planCode,jdbcType=VARCHAR},
contract_id = #{contractId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
name_sub = #{nameSub,jdbcType=VARCHAR},
name_en = #{nameEn,jdbcType=VARCHAR},
`level` = #{level,jdbcType=INTEGER},
commision_rate = #{commisionRate,jdbcType=DECIMAL},
referral_rate = #{referralRate,jdbcType=DECIMAL},
sale_price = #{salePrice,jdbcType=DECIMAL},
effective_start_date = #{effectiveStartDate,jdbcType=DATE},
effective_end_date = #{effectiveEndDate,jdbcType=DATE},
is_active = #{isActive,jdbcType=INTEGER},
is_global = #{isGlobal,jdbcType=INTEGER},
continent_id = #{continentId,jdbcType=BIGINT},
country_id = #{countryId,jdbcType=BIGINT},
region_id = #{regionId,jdbcType=BIGINT},
is_popular = #{isPopular,jdbcType=INTEGER},
sales_count = #{salesCount,jdbcType=INTEGER},
version = #{version,jdbcType=INTEGER},
is_social_insured = #{isSocialInsured,jdbcType=INTEGER},
app_gender = #{appGender,jdbcType=INTEGER},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="findAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_product_plan
where is_active is not null
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment