Commit cc7465fc authored by 廖旭伟's avatar 廖旭伟

客户试用申请功能调整,客户作品删除后没有修改作品统计结果的bug修复

parent 4ec518ce
...@@ -1152,13 +1152,14 @@ dict|object|字典对象 ...@@ -1152,13 +1152,14 @@ dict|object|字典对象
参数名称|类型|必填|描述 参数名称|类型|必填|描述
:---|:---|:---|:------- :---|:---|:---|:-------
memberLevel|Integer|是|会员等级,,0:未开启,1:试用客户,2:VIP,3:设计师,默认0 memberLevel|Integer|是|会员等级,0:未开启,1:试用客户,2:VIP,3:设计师,默认0
custName|String|是|客户真实名称 custName|String|是|客户真实名称,customerId不为空时可以不传该值
organization|String|是|单位名称 organization|String|是|单位名称,customerId不为空时可以不传该值
contactTelphone|String|是|联系电话 contactTelphone|String|是|联系电话,customerId不为空时可以不传该值
sex|Integer|是|性别 sex|Integer|是|性别,customerId不为空时可以不传该值
mailbox|String|是|邮箱 mailbox|String|是|邮箱,customerId不为空时可以不传该值
job|String|是|职位 job|String|是|职位,customerId不为空时可以不传该值
customerId|Long|否|客户id
**请求样例:** **请求样例:**
``` ```
...@@ -1242,8 +1243,8 @@ msg|String|消息|- ...@@ -1242,8 +1243,8 @@ msg|String|消息|-
参数名称|类型|必填|描述 参数名称|类型|必填|描述
:---|:---|:---|:------- :---|:---|:---|:-------
id|Long|是|客户试用申请主键 id|Long|是|客户试用申请主键
loginName|String|否|登陆账号 loginName|String|否|登陆账号,试用申请记录customerId不为空时不传该值
password|String|否|登陆密码 password|String|否|登陆密码,试用申请记录customerId不为空时不传该值
isAccept|Integer|是|受理状态,0:未受理,1:同意,2:不同意。默认:0 isAccept|Integer|是|受理状态,0:未受理,1:同意,2:不同意。默认:0
**请求样例:** **请求样例:**
......
package com.mortals.xhx.module.customer.dao; package com.mortals.xhx.module.customer.dao;
import com.mortals.framework.dao.ICRUDDao; import com.mortals.framework.dao.ICRUDDao;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.customer.model.CustomerTrialEntity; import com.mortals.xhx.module.customer.model.CustomerTrialEntity;
import com.mortals.xhx.module.customer.model.CustomerTrialEntityExt;
import java.util.List;
/** /**
* 客户试用申请Dao * 客户试用申请Dao
* 客户试用申请 DAO接口 * 客户试用申请 DAO接口
......
package com.mortals.xhx.module.customer.dao.ibatis; package com.mortals.xhx.module.customer.dao.ibatis;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.ParamDto;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.customer.model.CustomerTrialEntityExt;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.customer.dao.CustomerTrialDao; import com.mortals.xhx.module.customer.dao.CustomerTrialDao;
import com.mortals.xhx.module.customer.model.CustomerTrialEntity; import com.mortals.xhx.module.customer.model.CustomerTrialEntity;
import java.util.ArrayList;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis; import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/** /**
* 客户试用申请DaoImpl DAO接口 * 客户试用申请DaoImpl DAO接口
* *
......
...@@ -10,7 +10,7 @@ import com.mortals.xhx.module.customer.model.vo.CustomerTrialVo; ...@@ -10,7 +10,7 @@ import com.mortals.xhx.module.customer.model.vo.CustomerTrialVo;
* 客户试用申请实体对象 * 客户试用申请实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-07-26 * @date 2022-07-27
*/ */
public class CustomerTrialEntity extends CustomerTrialVo { public class CustomerTrialEntity extends CustomerTrialVo {
...@@ -48,6 +48,10 @@ public class CustomerTrialEntity extends CustomerTrialVo { ...@@ -48,6 +48,10 @@ public class CustomerTrialEntity extends CustomerTrialVo {
* 职位 * 职位
*/ */
private String job; private String job;
/**
* 客户ID
*/
private Long customerId;
...@@ -164,6 +168,20 @@ public class CustomerTrialEntity extends CustomerTrialVo { ...@@ -164,6 +168,20 @@ public class CustomerTrialEntity extends CustomerTrialVo {
public void setJob(String job){ public void setJob(String job){
this.job = job; this.job = job;
} }
/**
* 获取 客户ID
* @return Long
*/
public Long getCustomerId(){
return customerId;
}
/**
* 设置 客户ID
* @param customerId
*/
public void setCustomerId(Long customerId){
this.customerId = customerId;
}
...@@ -194,6 +212,7 @@ public class CustomerTrialEntity extends CustomerTrialVo { ...@@ -194,6 +212,7 @@ public class CustomerTrialEntity extends CustomerTrialVo {
sb.append(",sex:").append(getSex()); sb.append(",sex:").append(getSex());
sb.append(",mailbox:").append(getMailbox()); sb.append(",mailbox:").append(getMailbox());
sb.append(",job:").append(getJob()); sb.append(",job:").append(getJob());
sb.append(",customerId:").append(getCustomerId());
return sb.toString(); return sb.toString();
} }
...@@ -214,5 +233,7 @@ public class CustomerTrialEntity extends CustomerTrialVo { ...@@ -214,5 +233,7 @@ public class CustomerTrialEntity extends CustomerTrialVo {
this.mailbox = ""; this.mailbox = "";
this.job = ""; this.job = "";
this.customerId = null;
} }
} }
\ No newline at end of file
package com.mortals.xhx.module.customer.model;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.util.Date;
@Data
public class CustomerTrialEntityExt extends CustomerTrialEntity {
/**
* 客户真实名称
*/
private String custName;
/**
* 单位名称
*/
private String organization;
/**
* 联系电话
*/
private String contactTelphone;
/**
* 邮箱
*/
private String mailbox;
/**
* 职位
*/
private String job;
/**
* 申请时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date applyDate;
}
...@@ -6,7 +6,7 @@ import com.mortals.xhx.module.customer.model.CustomerTrialEntity; ...@@ -6,7 +6,7 @@ import com.mortals.xhx.module.customer.model.CustomerTrialEntity;
* 客户试用申请查询对象 * 客户试用申请查询对象
* *
* @author zxfei * @author zxfei
* @date 2022-07-26 * @date 2022-07-27
*/ */
public class CustomerTrialQuery extends CustomerTrialEntity { public class CustomerTrialQuery extends CustomerTrialEntity {
/** 开始 主键ID,主键,自增长 */ /** 开始 主键ID,主键,自增长 */
...@@ -96,6 +96,18 @@ public class CustomerTrialQuery extends CustomerTrialEntity { ...@@ -96,6 +96,18 @@ public class CustomerTrialQuery extends CustomerTrialEntity {
/** 职位 */ /** 职位 */
private List<String> jobList; private List<String> jobList;
/** 开始 客户ID */
private Long customerIdStart;
/** 结束 客户ID */
private Long customerIdEnd;
/** 增加 客户ID */
private Long customerIdIncrement;
/** 客户ID列表 */
private List <Long> customerIdList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */ /** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<CustomerTrialQuery> orConditionList; private List<CustomerTrialQuery> orConditionList;
...@@ -563,6 +575,70 @@ public class CustomerTrialQuery extends CustomerTrialEntity { ...@@ -563,6 +575,70 @@ public class CustomerTrialQuery extends CustomerTrialEntity {
public void setJobList(List<String> jobList){ public void setJobList(List<String> jobList){
this.jobList = jobList; this.jobList = jobList;
} }
/**
* 获取 开始 客户ID
* @return customerIdStart
*/
public Long getCustomerIdStart(){
return this.customerIdStart;
}
/**
* 设置 开始 客户ID
* @param customerIdStart
*/
public void setCustomerIdStart(Long customerIdStart){
this.customerIdStart = customerIdStart;
}
/**
* 获取 结束 客户ID
* @return $customerIdEnd
*/
public Long getCustomerIdEnd(){
return this.customerIdEnd;
}
/**
* 设置 结束 客户ID
* @param customerIdEnd
*/
public void setCustomerIdEnd(Long customerIdEnd){
this.customerIdEnd = customerIdEnd;
}
/**
* 获取 增加 客户ID
* @return customerIdIncrement
*/
public Long getCustomerIdIncrement(){
return this.customerIdIncrement;
}
/**
* 设置 增加 客户ID
* @param customerIdIncrement
*/
public void setCustomerIdIncrement(Long customerIdIncrement){
this.customerIdIncrement = customerIdIncrement;
}
/**
* 获取 客户ID
* @return customerIdList
*/
public List<Long> getCustomerIdList(){
return this.customerIdList;
}
/**
* 设置 客户ID
* @param customerIdList
*/
public void setCustomerIdList(List<Long> customerIdList){
this.customerIdList = customerIdList;
}
/** /**
* 设置 主键ID,主键,自增长 * 设置 主键ID,主键,自增长
* @param id * @param id
...@@ -885,6 +961,51 @@ public class CustomerTrialQuery extends CustomerTrialEntity { ...@@ -885,6 +961,51 @@ public class CustomerTrialQuery extends CustomerTrialEntity {
return this; return this;
} }
/**
* 设置 客户ID
* @param customerId
*/
public CustomerTrialQuery customerId(Long customerId){
setCustomerId(customerId);
return this;
}
/**
* 设置 开始 客户ID
* @param customerIdStart
*/
public CustomerTrialQuery customerIdStart(Long customerIdStart){
this.customerIdStart = customerIdStart;
return this;
}
/**
* 设置 结束 客户ID
* @param customerIdEnd
*/
public CustomerTrialQuery customerIdEnd(Long customerIdEnd){
this.customerIdEnd = customerIdEnd;
return this;
}
/**
* 设置 增加 客户ID
* @param customerIdIncrement
*/
public CustomerTrialQuery customerIdIncrement(Long customerIdIncrement){
this.customerIdIncrement = customerIdIncrement;
return this;
}
/**
* 设置 客户ID
* @param customerIdList
*/
public CustomerTrialQuery customerIdList(List<Long> customerIdList){
this.customerIdList = customerIdList;
return this;
}
/** /**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) * 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList * @return orConditionList
......
package com.mortals.xhx.module.customer.service; package com.mortals.xhx.module.customer.service;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.customer.model.CustomerTrialEntity; import com.mortals.xhx.module.customer.model.CustomerTrialEntity;
import com.mortals.xhx.module.customer.model.CustomerTrialEntityExt;
/** /**
* CustomerTrialService * CustomerTrialService
......
...@@ -56,6 +56,18 @@ public class CustomerTrialServiceImpl extends AbstractCRUDServiceImpl<CustomerTr ...@@ -56,6 +56,18 @@ public class CustomerTrialServiceImpl extends AbstractCRUDServiceImpl<CustomerTr
@Override @Override
protected void saveBefore(CustomerTrialEntity entity, Context context) throws AppException { protected void saveBefore(CustomerTrialEntity entity, Context context) throws AppException {
entity.setIsAccept(TrialAcceptEnum.NOT_ACCEPTED.getValue()); entity.setIsAccept(TrialAcceptEnum.NOT_ACCEPTED.getValue());
if(entity.getCustomerId()!=null){
CustomerEntity customerEntity = customerDao.get(entity.getCustomerId());
if(customerEntity==null){
throw new AppException("客户信息不存在");
}
entity.setJob(customerEntity.getJob());
entity.setCustName(customerEntity.getCustName());
entity.setOrganization(customerEntity.getOrganization());
entity.setContactTelphone(customerEntity.getContactTelphone());
entity.setSex(customerEntity.getSex());
entity.setMailbox(customerEntity.getMailbox());
}
super.saveBefore(entity, context); super.saveBefore(entity, context);
} }
...@@ -72,6 +84,15 @@ public class CustomerTrialServiceImpl extends AbstractCRUDServiceImpl<CustomerTr ...@@ -72,6 +84,15 @@ public class CustomerTrialServiceImpl extends AbstractCRUDServiceImpl<CustomerTr
throw new AppException("受理意见不能为空"); throw new AppException("受理意见不能为空");
} }
if(entity.getIsAccept()== TrialAcceptEnum.AGREE.getValue()){ if(entity.getIsAccept()== TrialAcceptEnum.AGREE.getValue()){
if(customerTrialEntity.getCustomerId()!=null){
CustomerEntity update = new CustomerEntity();
update.setId(customerTrialEntity.getCustomerId());
update.setMemberLevel(customerTrialEntity.getMemberLevel());
update.setUpdateTime(new Date());
update.setUpdateUserId(this.getContextUserId(context));
customerDao.update(update);
}else {
if(StringUtils.isEmpty(entity.getLoginName())){ if(StringUtils.isEmpty(entity.getLoginName())){
throw new AppException("登录账号不能为空"); throw new AppException("登录账号不能为空");
} }
...@@ -82,13 +103,13 @@ public class CustomerTrialServiceImpl extends AbstractCRUDServiceImpl<CustomerTr ...@@ -82,13 +103,13 @@ public class CustomerTrialServiceImpl extends AbstractCRUDServiceImpl<CustomerTr
throw new AppException("企业顾问不能为空"); throw new AppException("企业顾问不能为空");
} }
CustomerEntity customerEntity = new CustomerEntity(); CustomerEntity customerEntity = new CustomerEntity();
customerEntity.setJob(entity.getJob()); customerEntity.setJob(customerTrialEntity.getJob());
customerEntity.setCustName(entity.getCustName()); customerEntity.setCustName(customerTrialEntity.getCustName());
customerEntity.setMemberLevel(entity.getMemberLevel()); customerEntity.setMemberLevel(customerTrialEntity.getMemberLevel());
customerEntity.setOrganization(entity.getOrganization()); customerEntity.setOrganization(customerTrialEntity.getOrganization());
customerEntity.setContactTelphone(entity.getContactTelphone()); customerEntity.setContactTelphone(customerTrialEntity.getContactTelphone());
customerEntity.setSex(entity.getSex()); customerEntity.setSex(customerTrialEntity.getSex());
customerEntity.setMailbox(entity.getMailbox()); customerEntity.setMailbox(customerTrialEntity.getMailbox());
customerEntity.setCustomerSrc(1l); customerEntity.setCustomerSrc(1l);
customerEntity.setStatus(CustomerSatusEnum.NORMAL.getValue()); customerEntity.setStatus(CustomerSatusEnum.NORMAL.getValue());
customerEntity.setEnterpriseConsultant(entity.getEnterpriseConsultant()); customerEntity.setEnterpriseConsultant(entity.getEnterpriseConsultant());
...@@ -102,6 +123,8 @@ public class CustomerTrialServiceImpl extends AbstractCRUDServiceImpl<CustomerTr ...@@ -102,6 +123,8 @@ public class CustomerTrialServiceImpl extends AbstractCRUDServiceImpl<CustomerTr
} }
customerDao.insert(customerEntity); customerDao.insert(customerEntity);
} }
}
CustomerTrialEntity update = new CustomerTrialEntity(); CustomerTrialEntity update = new CustomerTrialEntity();
update.setId(customerTrialEntity.getId()); update.setId(customerTrialEntity.getId());
update.setIsAccept(entity.getIsAccept()); update.setIsAccept(entity.getIsAccept());
......
...@@ -148,4 +148,26 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo ...@@ -148,4 +148,26 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
updateEntity.setUpdateTime(new Date()); updateEntity.setUpdateTime(new Date());
return dao.update(updateEntity); return dao.update(updateEntity);
} }
@Override
public int remove(Long[] ids, Context context) throws AppException {
this.removeBefore(ids, context);
List<CustomerWorkDesignEntity> list = this.get(ids,context);
int iRet = this.dao.delete(ids);
if(CollectionUtils.isNotEmpty(list)){
list.forEach(e->{
CustomerWorkDesignStatEntity cQuery = new CustomerWorkDesignStatEntity();
cQuery.setCustomerId(e.getCustomerId());
List<CustomerWorkDesignStatEntity> cwdList = customerWorkDesignStatService.find(cQuery);
CustomerWorkDesignStatEntity cwdEntity = cwdList.get(0);
CustomerWorkDesignStatQuery updateEntity = new CustomerWorkDesignStatQuery();
updateEntity.setId(cwdEntity.getId());
updateEntity.setCustomerDesignPicturesIncrement(-1);
updateEntity.setUpdateTime(new Date());
customerWorkDesignStatService.update(updateEntity);
});
}
this.removeAfter(ids, context, iRet);
return iRet;
}
} }
\ No newline at end of file
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<result property="sex" column="sex" /> <result property="sex" column="sex" />
<result property="mailbox" column="mailbox" /> <result property="mailbox" column="mailbox" />
<result property="job" column="job" /> <result property="job" column="job" />
<result property="customerId" column="customerId" />
</resultMap> </resultMap>
...@@ -60,23 +61,26 @@ ...@@ -60,23 +61,26 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('job') or colPickMode == 1 and data.containsKey('job')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('job') or colPickMode == 1 and data.containsKey('job')))">
a.job, a.job,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('customerId') or colPickMode == 1 and data.containsKey('customerId')))">
a.customerId,
</if>
</trim> </trim>
</sql> </sql>
<!-- 新增 区分主键自增加还是业务插入 --> <!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="CustomerTrialEntity" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="CustomerTrialEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_customer_trial insert into mortals_xhx_customer_trial
(memberLevel,isAccept,createUserId,createTime,updateTime,custName,organization,contactTelphone,sex,mailbox,job) (memberLevel,isAccept,createUserId,createTime,updateTime,custName,organization,contactTelphone,sex,mailbox,job,customerId)
VALUES VALUES
(#{memberLevel},#{isAccept},#{createUserId},#{createTime},#{updateTime},#{custName},#{organization},#{contactTelphone},#{sex},#{mailbox},#{job}) (#{memberLevel},#{isAccept},#{createUserId},#{createTime},#{updateTime},#{custName},#{organization},#{contactTelphone},#{sex},#{mailbox},#{job},#{customerId})
</insert> </insert>
<!-- 批量新增 --> <!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto"> <insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_customer_trial insert into mortals_xhx_customer_trial
(memberLevel,isAccept,createUserId,createTime,updateTime,custName,organization,contactTelphone,sex,mailbox,job) (memberLevel,isAccept,createUserId,createTime,updateTime,custName,organization,contactTelphone,sex,mailbox,job,customerId)
VALUES VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," > <foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.memberLevel},#{item.isAccept},#{item.createUserId},#{item.createTime},#{item.updateTime},#{item.custName},#{item.organization},#{item.contactTelphone},#{item.sex},#{item.mailbox},#{item.job}) (#{item.memberLevel},#{item.isAccept},#{item.createUserId},#{item.createTime},#{item.updateTime},#{item.custName},#{item.organization},#{item.contactTelphone},#{item.sex},#{item.mailbox},#{item.job},#{item.customerId})
</foreach> </foreach>
</insert> </insert>
...@@ -131,6 +135,12 @@ ...@@ -131,6 +135,12 @@
<if test="(colPickMode==0 and data.containsKey('job')) or (colPickMode==1 and !data.containsKey('job'))"> <if test="(colPickMode==0 and data.containsKey('job')) or (colPickMode==1 and !data.containsKey('job'))">
a.job=#{data.job}, a.job=#{data.job},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('customerId')) or (colPickMode==1 and !data.containsKey('customerId'))">
a.customerId=#{data.customerId},
</if>
<if test="(colPickMode==0 and data.containsKey('customerIdIncrement')) or (colPickMode==1 and !data.containsKey('customerIdIncrement'))">
a.customerId=ifnull(a.customerId,0) + #{data.customerIdIncrement},
</if>
</trim> </trim>
<trim suffixOverrides="where" suffix=""> <trim suffixOverrides="where" suffix="">
where where
...@@ -240,6 +250,18 @@ ...@@ -240,6 +250,18 @@
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="customerId=(case" suffix="ELSE customerId end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('customerId')) or (colPickMode==1 and !item.containsKey('customerId'))">
when a.id=#{item.id} then #{item.customerId}
</when>
<when test="(colPickMode==0 and item.containsKey('customerIdIncrement')) or (colPickMode==1 and !item.containsKey('customerIdIncrement'))">
when a.id=#{item.id} then ifnull(a.customerId,0) + #{item.customerIdIncrement}
</when>
</choose>
</foreach>
</trim>
</trim> </trim>
where id in where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")"> <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
...@@ -551,6 +573,27 @@ ...@@ -551,6 +573,27 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('customerId')">
<if test="conditionParamRef.customerId != null ">
${_conditionType_} a.customerId = #{${_conditionParam_}.customerId}
</if>
<if test="conditionParamRef.customerId == null">
${_conditionType_} a.customerId is null
</if>
</if>
<if test="conditionParamRef.containsKey('customerIdList')">
${_conditionType_} a.customerId in
<foreach collection="conditionParamRef.customerIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('customerIdStart') and conditionParamRef.customerIdStart != null">
${_conditionType_} a.customerId <![CDATA[ >= ]]> #{${_conditionParam_}.customerIdStart}
</if>
<if test="conditionParamRef.containsKey('customerIdEnd') and conditionParamRef.customerIdEnd != null">
${_conditionType_} a.customerId <![CDATA[ <= ]]> #{${_conditionParam_}.customerIdEnd}
</if>
</sql> </sql>
<sql id="_orderCols_"> <sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()"> <if test="orderColList != null and !orderColList.isEmpty()">
...@@ -624,6 +667,11 @@ ...@@ -624,6 +667,11 @@
<if test='orderCol.job != null and "DESC".equalsIgnoreCase(orderCol.job)'>DESC</if> <if test='orderCol.job != null and "DESC".equalsIgnoreCase(orderCol.job)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('customerId')">
a.customerId
<if test='orderCol.customerId != null and "DESC".equalsIgnoreCase(orderCol.customerId)'>DESC</if>
,
</if>
</trim> </trim>
</if> </if>
</sql> </sql>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.customer.dao.ibatis.CustomerTrialDaoImpl">
<!-- 字段和属性映射 -->
<resultMap type="CustomerTrialEntityExt" id="CustomerTrialEntityExt-Map">
<id property="id" column="id" />
<result property="customerId" column="customerId" />
<result property="memberLevel" column="memberLevel" />
<result property="isAccept" column="isAccept" />
<result property="createUserId" column="createUserId" />
<result property="createTime" column="createTime" />
<result property="updateTime" column="updateTime" />
<result property="custName" column="custName" />
<result property="organization" column="organization" />
<result property="contactTelphone" column="contactTelphone" />
<result property="mailbox" column="mailbox" />
<result property="job" column="job" />
<result property="applyDate" column="applyDate" />
</resultMap>
<!-- 获取列表 -->
<select id="getListExt" parameterType="paramDto" resultMap="CustomerTrialEntityExt-Map">
select *
from (
SELECT
t.*, c.custName,
c.contactTelphone,
c.organization,
c.job,
c.mailbox,
t.createTime as applyDate
FROM
mortals_xhx_customer_trial t
LEFT JOIN mortals_xhx_customer c ON t.customerId = c.id
) as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_conditionExt_"/>
</trim>
</trim>
<include refid="_orderCols_"/>
</select>
<!-- 获取 -->
<select id="getListExtCount" parameterType="paramDto" resultType="int">
select count(1)
from (
SELECT
t.*, c.custName,
c.contactTelphone,
c.organization,
c.job,
c.mailbox,
t.createTime as applyDate
FROM
mortals_xhx_customer_trial t
LEFT JOIN mortals_xhx_customer c ON t.customerId = c.id
) as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_conditionExt_"/>
</trim>
</trim>
</select>
<!-- 条件映射 -->
<sql id="_conditionExt_">
<if test="condition != null and !condition.isEmpty()">
<!-- 条件映射-普通条件 -->
<include refid="_conditionExt_param_">
<property name="_conditionParam_" value="condition"/>
<property name="_conditionType_" value="and"/>
</include>
<!-- 条件映射-集合之间使用AND,集合中元素使用OR-(list[0].1 or list[0].2) and (list[1].3 or list[1].4) -->
<if test="condition.containsKey('andConditionList') and !condition.andConditionList.isEmpty()">
and
<foreach collection="condition.andConditionList" open="(" close=")" index="index" item="andCondition" separator=" and ">
<trim prefixOverrides="or" prefix="(" suffix=")">
<include refid="_conditionExt_param_">
<property name="_conditionParam_" value="andCondition"/>
<property name="_conditionType_" value="or"/>
</include>
</trim>
</foreach>
</if>
<!-- 条件映射-集合之间使用OR,集合中元素使用AND-(list[0].1 and list[0].2) or (list[1].3 and list[1].4) -->
<if test="condition.containsKey('orConditionList') and !condition.orConditionList.isEmpty()">
and
<foreach collection="condition.orConditionList" open="(" close=")" index="index" item="orCondition" separator=" or ">
<trim prefixOverrides="and" prefix="(" suffix=")">
<include refid="_conditionExt_param_">
<property name="_conditionParam_" value="orCondition"/>
<property name="_conditionType_" value="and"/>
</include>
</trim>
</foreach>
</if>
</if>
</sql>
<!-- 条件映射-代参数 -->
<sql id="_conditionExt_param_">
<bind name="conditionParamRef" value="${_conditionParam_}"/>
<if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null">
${_conditionType_} a.id=#{${_conditionParam_}.id}
</if>
</if>
<if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null ">
${_conditionType_} a.id = #{${_conditionParam_}.id}
</if>
<if test="conditionParamRef.id == null">
${_conditionType_} a.id is null
</if>
</if>
<if test="conditionParamRef.containsKey('idList')">
${_conditionType_} a.id in
<foreach collection="conditionParamRef.idList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('idStart') and conditionParamRef.idStart != null">
${_conditionType_} a.id <![CDATA[ >= ]]> #{${_conditionParam_}.idStart}
</if>
<if test="conditionParamRef.containsKey('idEnd') and conditionParamRef.idEnd != null">
${_conditionType_} a.id <![CDATA[ <= ]]> #{${_conditionParam_}.idEnd}
</if>
<if test="conditionParamRef.containsKey('customerId')">
<if test="conditionParamRef.customerId != null ">
${_conditionType_} a.customerId = #{${_conditionParam_}.customerId}
</if>
<if test="conditionParamRef.customerId == null">
${_conditionType_} a.customerId is null
</if>
</if>
<if test="conditionParamRef.containsKey('customerIdList')">
${_conditionType_} a.customerId in
<foreach collection="conditionParamRef.customerIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('customerIdStart') and conditionParamRef.customerIdStart != null">
${_conditionType_} a.customerId <![CDATA[ >= ]]> #{${_conditionParam_}.customerIdStart}
</if>
<if test="conditionParamRef.containsKey('customerIdEnd') and conditionParamRef.customerIdEnd != null">
${_conditionType_} a.customerId <![CDATA[ <= ]]> #{${_conditionParam_}.customerIdEnd}
</if>
<if test="conditionParamRef.containsKey('memberLevel')">
<if test="conditionParamRef.memberLevel != null ">
${_conditionType_} a.memberLevel = #{${_conditionParam_}.memberLevel}
</if>
<if test="conditionParamRef.memberLevel == null">
${_conditionType_} a.memberLevel is null
</if>
</if>
<if test="conditionParamRef.containsKey('memberLevelList')">
${_conditionType_} a.memberLevel in
<foreach collection="conditionParamRef.memberLevelList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('memberLevelStart') and conditionParamRef.memberLevelStart != null">
${_conditionType_} a.memberLevel <![CDATA[ >= ]]> #{${_conditionParam_}.memberLevelStart}
</if>
<if test="conditionParamRef.containsKey('memberLevelEnd') and conditionParamRef.memberLevelEnd != null">
${_conditionType_} a.memberLevel <![CDATA[ <= ]]> #{${_conditionParam_}.memberLevelEnd}
</if>
<if test="conditionParamRef.containsKey('isAccept')">
<if test="conditionParamRef.isAccept != null ">
${_conditionType_} a.isAccept = #{${_conditionParam_}.isAccept}
</if>
<if test="conditionParamRef.isAccept == null">
${_conditionType_} a.isAccept is null
</if>
</if>
<if test="conditionParamRef.containsKey('isAcceptList')">
${_conditionType_} a.isAccept in
<foreach collection="conditionParamRef.isAcceptList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('isAcceptStart') and conditionParamRef.isAcceptStart != null">
${_conditionType_} a.isAccept <![CDATA[ >= ]]> #{${_conditionParam_}.isAcceptStart}
</if>
<if test="conditionParamRef.containsKey('isAcceptEnd') and conditionParamRef.isAcceptEnd != null">
${_conditionType_} a.isAccept <![CDATA[ <= ]]> #{${_conditionParam_}.isAcceptEnd}
</if>
<if test="conditionParamRef.containsKey('createUserId')">
<if test="conditionParamRef.createUserId != null ">
${_conditionType_} a.createUserId = #{${_conditionParam_}.createUserId}
</if>
<if test="conditionParamRef.createUserId == null">
${_conditionType_} a.createUserId is null
</if>
</if>
<if test="conditionParamRef.containsKey('createUserIdList')">
${_conditionType_} a.createUserId in
<foreach collection="conditionParamRef.createUserIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('createUserIdStart') and conditionParamRef.createUserIdStart != null">
${_conditionType_} a.createUserId <![CDATA[ >= ]]> #{${_conditionParam_}.createUserIdStart}
</if>
<if test="conditionParamRef.containsKey('createUserIdEnd') and conditionParamRef.createUserIdEnd != null">
${_conditionType_} a.createUserId <![CDATA[ <= ]]> #{${_conditionParam_}.createUserIdEnd}
</if>
<if test="conditionParamRef.containsKey('createTime')">
<if test="conditionParamRef.createTime != null ">
${_conditionType_} a.createTime = #{${_conditionParam_}.createTime}
</if>
<if test="conditionParamRef.createTime == null">
${_conditionType_} a.createTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('createTimeStart') and conditionParamRef.createTimeStart != null and conditionParamRef.createTimeStart!=''">
${_conditionType_} a.createTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('createTimeEnd') and conditionParamRef.createTimeEnd != null and conditionParamRef.createTimeEnd!=''">
${_conditionType_} a.createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('updateTime')">
<if test="conditionParamRef.updateTime != null ">
${_conditionType_} a.updateTime = #{${_conditionParam_}.updateTime}
</if>
<if test="conditionParamRef.updateTime == null">
${_conditionType_} a.updateTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('updateTimeStart') and conditionParamRef.updateTimeStart != null and conditionParamRef.updateTimeStart!=''">
${_conditionType_} a.updateTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('custName')">
<if test="conditionParamRef.custName != null and conditionParamRef.custName != ''">
${_conditionType_} a.custName like #{${_conditionParam_}.custName}
</if>
<if test="conditionParamRef.custName == null">
${_conditionType_} a.custName is null
</if>
</if>
<if test="conditionParamRef.containsKey('custNameList')">
${_conditionType_} a.custName in
<foreach collection="conditionParamRef.custNameList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('contactTelphone')">
<if test="conditionParamRef.contactTelphone != null and conditionParamRef.contactTelphone != ''">
${_conditionType_} a.contactTelphone like #{${_conditionParam_}.contactTelphone}
</if>
<if test="conditionParamRef.contactTelphone == null">
${_conditionType_} a.contactTelphone is null
</if>
</if>
<if test="conditionParamRef.containsKey('contactTelphoneList')">
${_conditionType_} a.contactTelphone in
<foreach collection="conditionParamRef.contactTelphoneList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
</sql>
</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