Commit 888f2386 authored by 廖旭伟's avatar 廖旭伟

客户管理增加图片视频作品数量展示

parent 5e961dd5
package com.mortals.xhx.module.customer.dao;
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.CustomerEntity;
import java.util.List;
import com.mortals.xhx.module.customer.model.CustomerEntityExt;
/**
* 客户管理Dao
* 客户管理 DAO接口
......@@ -12,5 +14,5 @@ import java.util.List;
*/
public interface CustomerDao extends ICRUDDao<CustomerEntity,Long>{
Result<CustomerEntityExt> getListExt(CustomerEntity params, PageInfo pageInfo);
}
package com.mortals.xhx.module.customer.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.customer.model.CustomerWorkCollectEntity;
import java.util.List;
/**
* 客户收藏信息Dao
* 客户收藏信息 DAO接口
*
* @author zxfei
* @date 2022-06-13
*/
public interface CustomerWorkCollectDao extends ICRUDDao<CustomerWorkCollectEntity,Long>{
}
......@@ -8,7 +8,7 @@ import java.util.List;
* 客户作品信息 DAO接口
*
* @author zxfei
* @date 2022-06-08
* @date 2022-06-13
*/
public interface CustomerWorkDesignDao extends ICRUDDao<CustomerWorkDesignEntity,Long>{
......
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.CustomerEntityExt;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.customer.dao.CustomerDao;
import com.mortals.xhx.module.customer.model.CustomerEntity;
import java.util.ArrayList;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
......@@ -17,5 +24,39 @@ import java.util.List;
public class CustomerDaoImpl extends BaseCRUDDaoMybatis<CustomerEntity,Long> implements CustomerDao {
@Override
public Result<CustomerEntityExt> getListExt(CustomerEntity params, PageInfo pageInfo) {
ParamDto paramDto = this.getQueryParam(params);
Result result = new Result();
List list = null;
if (pageInfo.isCountPage()) {
int count = this.getCount(paramDto, "getListExtCount");
if (count == 0) {
list = new ArrayList();
} else if (pageInfo.getPrePageResult() == -1) {
list = this.getSqlSession().selectList(this.getSqlId("getListExt"), paramDto);
} else {
RowBounds rowBounds = new RowBounds(pageInfo.getBeginIndex(), pageInfo.getPrePageResult());
list = this.getSqlSession().selectList(this.getSqlId("getListExt"), this.cpyQueryParamDto(paramDto), rowBounds);
}
pageInfo.setTotalResult(count);
result.setPageInfo(pageInfo);
result.setList((List)list);
} else {
if (pageInfo.getPrePageResult() == -1) {
list = this.getSqlSession().selectList(this.getSqlId("getListExt"), paramDto);
} else {
RowBounds rowBounds = new RowBounds(pageInfo.getBeginIndex(), pageInfo.getPrePageResult());
list = this.getSqlSession().selectList(this.getSqlId("getListExt"), this.cpyQueryParamDto(paramDto), rowBounds);
}
pageInfo.setTotalResult(-1);
result.setPageInfo(pageInfo);
result.setList(list);
}
return result;
}
}
package com.mortals.xhx.module.customer.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.customer.dao.CustomerWorkCollectDao;
import com.mortals.xhx.module.customer.model.CustomerWorkCollectEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 客户收藏信息DaoImpl DAO接口
*
* @author zxfei
* @date 2022-06-13
*/
@Repository("customerWorkCollectDao")
public class CustomerWorkCollectDaoImpl extends BaseCRUDDaoMybatis<CustomerWorkCollectEntity,Long> implements CustomerWorkCollectDao {
}
......@@ -11,7 +11,7 @@ import java.util.List;
* 客户作品信息DaoImpl DAO接口
*
* @author zxfei
* @date 2022-06-08
* @date 2022-06-13
*/
@Repository("customerWorkDesignDao")
public class CustomerWorkDesignDaoImpl extends BaseCRUDDaoMybatis<CustomerWorkDesignEntity,Long> implements CustomerWorkDesignDao {
......
package com.mortals.xhx.module.customer.model;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.customer.model.vo.CustomerVo;
/**
* 客户管理实体对象
*
* @author zxfei
* @date 2022-06-08
*/
* 客户管理实体对象
*
* @author zxfei
* @date 2022-06-13
*/
public class CustomerEntity extends CustomerVo {
private static final long serialVersionUID = 1L;
......@@ -68,6 +71,15 @@ public class CustomerEntity extends CustomerVo {
* 使用状态,1:正常,0:禁用,默认:0
*/
private Integer status;
/**
* 最后一次登录时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date lastLoginTime;
/**
* 最后一次登录地址
*/
private String lastLoginAddress;
......@@ -254,6 +266,34 @@ public class CustomerEntity extends CustomerVo {
public void setStatus(Integer status){
this.status = status;
}
/**
* 获取 最后一次登录时间
* @return Date
*/
public Date getLastLoginTime(){
return lastLoginTime;
}
/**
* 设置 最后一次登录时间
* @param lastLoginTime
*/
public void setLastLoginTime(Date lastLoginTime){
this.lastLoginTime = lastLoginTime;
}
/**
* 获取 最后一次登录地址
* @return String
*/
public String getLastLoginAddress(){
return lastLoginAddress;
}
/**
* 设置 最后一次登录地址
* @param lastLoginAddress
*/
public void setLastLoginAddress(String lastLoginAddress){
this.lastLoginAddress = lastLoginAddress;
}
......@@ -289,6 +329,8 @@ public class CustomerEntity extends CustomerVo {
sb.append(",job:").append(getJob());
sb.append(",customerSrc:").append(getCustomerSrc());
sb.append(",status:").append(getStatus());
sb.append(",lastLoginTime:").append(getLastLoginTime());
sb.append(",lastLoginAddress:").append(getLastLoginAddress());
return sb.toString();
}
......@@ -298,7 +340,7 @@ public class CustomerEntity extends CustomerVo {
this.password = "";
this.memberLevel = null;
this.memberLevel = 0;
this.custName = "";
......@@ -318,6 +360,10 @@ public class CustomerEntity extends CustomerVo {
this.customerSrc = null;
this.status = null;
this.status = 0;
this.lastLoginTime = null;
this.lastLoginAddress = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.customer.model;
import lombok.Data;
@Data
public class CustomerEntityExt extends CustomerEntity {
/**
* 客户设计图片数量
*/
private Integer customerDesignPictures;
/**
* 客户设计视频数量
*/
private Integer customerDesignVideos;
private String createTimeStr;
}
package com.mortals.xhx.module.customer.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.customer.model.vo.CustomerWorkCollectVo;
/**
* 客户收藏信息实体对象
*
* @author zxfei
* @date 2022-06-13
*/
public class CustomerWorkCollectEntity extends CustomerWorkCollectVo {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private Long customerId;
/**
* 模版ID
*/
private Long masterplateId;
public CustomerWorkCollectEntity(){}
/**
* 获取 客户ID
* @return Long
*/
public Long getCustomerId(){
return customerId;
}
/**
* 设置 客户ID
* @param customerId
*/
public void setCustomerId(Long customerId){
this.customerId = customerId;
}
/**
* 获取 模版ID
* @return Long
*/
public Long getMasterplateId(){
return masterplateId;
}
/**
* 设置 模版ID
* @param masterplateId
*/
public void setMasterplateId(Long masterplateId){
this.masterplateId = masterplateId;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof CustomerWorkCollectEntity) {
CustomerWorkCollectEntity tmp = (CustomerWorkCollectEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",customerId:").append(getCustomerId());
sb.append(",masterplateId:").append(getMasterplateId());
return sb.toString();
}
public void initAttrValue(){
this.customerId = null;
this.masterplateId = null;
}
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ import com.mortals.xhx.module.customer.model.vo.CustomerWorkDesignVo;
* 客户作品信息实体对象
*
* @author zxfei
* @date 2022-06-08
* @date 2022-06-13
*/
public class CustomerWorkDesignEntity extends CustomerWorkDesignVo {
......@@ -21,9 +21,33 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo {
*/
private Long customerId;
/**
* 模版ID
* 作品名称
*/
private Long masterplateId;
private String workDesignName;
/**
* 作品状态:0:草稿,1:发布
*/
private Integer workDesignStatus;
/**
* 作品描述
*/
private String workDesignDesc;
/**
* 模版引用的图片
*/
private Long pictureId;
/**
* 模版引用的素材
*/
private Long pictureSrcId;
/**
* 模版引用的背景
*/
private Long pictureBackgroundId;
/**
* 作品引用的字体
*/
private Long fontId;
......@@ -43,18 +67,102 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo {
this.customerId = customerId;
}
/**
* 获取 模版ID
* 获取 作品名称
* @return String
*/
public String getWorkDesignName(){
return workDesignName;
}
/**
* 设置 作品名称
* @param workDesignName
*/
public void setWorkDesignName(String workDesignName){
this.workDesignName = workDesignName;
}
/**
* 获取 作品状态:0:草稿,1:发布
* @return Integer
*/
public Integer getWorkDesignStatus(){
return workDesignStatus;
}
/**
* 设置 作品状态:0:草稿,1:发布
* @param workDesignStatus
*/
public void setWorkDesignStatus(Integer workDesignStatus){
this.workDesignStatus = workDesignStatus;
}
/**
* 获取 作品描述
* @return String
*/
public String getWorkDesignDesc(){
return workDesignDesc;
}
/**
* 设置 作品描述
* @param workDesignDesc
*/
public void setWorkDesignDesc(String workDesignDesc){
this.workDesignDesc = workDesignDesc;
}
/**
* 获取 模版引用的图片
* @return Long
*/
public Long getPictureId(){
return pictureId;
}
/**
* 设置 模版引用的图片
* @param pictureId
*/
public void setPictureId(Long pictureId){
this.pictureId = pictureId;
}
/**
* 获取 模版引用的素材
* @return Long
*/
public Long getPictureSrcId(){
return pictureSrcId;
}
/**
* 设置 模版引用的素材
* @param pictureSrcId
*/
public void setPictureSrcId(Long pictureSrcId){
this.pictureSrcId = pictureSrcId;
}
/**
* 获取 模版引用的背景
* @return Long
*/
public Long getPictureBackgroundId(){
return pictureBackgroundId;
}
/**
* 设置 模版引用的背景
* @param pictureBackgroundId
*/
public void setPictureBackgroundId(Long pictureBackgroundId){
this.pictureBackgroundId = pictureBackgroundId;
}
/**
* 获取 作品引用的字体
* @return Long
*/
public Long getMasterplateId(){
return masterplateId;
public Long getFontId(){
return fontId;
}
/**
* 设置 模版ID
* @param masterplateId
* 设置 作品引用的字体
* @param fontId
*/
public void setMasterplateId(Long masterplateId){
this.masterplateId = masterplateId;
public void setFontId(Long fontId){
this.fontId = fontId;
}
......@@ -79,7 +187,13 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo {
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",customerId:").append(getCustomerId());
sb.append(",masterplateId:").append(getMasterplateId());
sb.append(",workDesignName:").append(getWorkDesignName());
sb.append(",workDesignStatus:").append(getWorkDesignStatus());
sb.append(",workDesignDesc:").append(getWorkDesignDesc());
sb.append(",pictureId:").append(getPictureId());
sb.append(",pictureSrcId:").append(getPictureSrcId());
sb.append(",pictureBackgroundId:").append(getPictureBackgroundId());
sb.append(",fontId:").append(getFontId());
return sb.toString();
}
......@@ -87,6 +201,18 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo {
this.customerId = null;
this.masterplateId = null;
this.workDesignName = "";
this.workDesignStatus = null;
this.workDesignDesc = "";
this.pictureId = null;
this.pictureSrcId = null;
this.pictureBackgroundId = null;
this.fontId = null;
}
}
\ No newline at end of file
package com.mortals.xhx.module.customer.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.customer.model.CustomerWorkCollectEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 客户收藏信息视图对象
*
* @author zxfei
* @date 2022-06-13
*/
@Data
public class CustomerWorkCollectVo extends BaseEntityLong {
}
\ No newline at end of file
......@@ -9,7 +9,7 @@ import java.util.List;
* 客户作品信息视图对象
*
* @author zxfei
* @date 2022-06-08
* @date 2022-06-13
*/
@Data
public class CustomerWorkDesignVo extends BaseEntityLong {
......
package com.mortals.xhx.module.customer.service;
import com.mortals.framework.exception.AppException;
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.xhx.module.customer.model.CustomerEntity;
import com.mortals.xhx.module.customer.model.CustomerEntityExt;
/**
* CustomerService
*
......@@ -11,4 +18,6 @@ import com.mortals.xhx.module.customer.model.CustomerEntity;
*/
public interface CustomerService extends ICRUDService<CustomerEntity,Long>{
Result<CustomerEntityExt> findExt(CustomerEntity params, PageInfo pageInfo, Context context) throws AppException;
}
\ No newline at end of file
package com.mortals.xhx.module.customer.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.customer.model.CustomerWorkCollectEntity;
/**
* CustomerWorkCollectService
*
* 客户收藏信息 service接口
*
* @author zxfei
* @date 2022-06-13
*/
public interface CustomerWorkCollectService extends ICRUDService<CustomerWorkCollectEntity,Long>{
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ import com.mortals.xhx.module.customer.model.CustomerWorkDesignEntity;
* 客户作品信息 service接口
*
* @author zxfei
* @date 2022-06-08
* @date 2022-06-13
*/
public interface CustomerWorkDesignService extends ICRUDService<CustomerWorkDesignEntity,Long>{
......
......@@ -2,8 +2,12 @@ package com.mortals.xhx.module.customer.service.impl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.module.customer.model.CustomerEntityExt;
import com.mortals.xhx.module.customer.model.CustomerQuery;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
......@@ -45,4 +49,17 @@ public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, Cu
}
return query;
}
@Override
public Result<CustomerEntityExt> findExt(CustomerEntity params, PageInfo pageInfo, Context context) throws AppException {
CustomerEntity query = this.findBefore(params, pageInfo, context);
Result<CustomerEntityExt> result = getDao().getListExt(query,pageInfo);
List<CustomerEntityExt> list = result.getList();
if(CollectionUtils.isNotEmpty(list)){
list.stream().forEach(item->{
item.setCreateTimeStr(DateUtils.getDateTime(item.getCreateTime(),DateUtils.P_yyyy_MM_dd_HH_mm_ss));
});
}
return result;
}
}
\ No newline at end of file
package com.mortals.xhx.module.customer.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.customer.dao.CustomerWorkCollectDao;
import com.mortals.xhx.module.customer.model.CustomerWorkCollectEntity;
import com.mortals.xhx.module.customer.service.CustomerWorkCollectService;
/**
* CustomerWorkCollectService
* 客户收藏信息 service实现
*
* @author zxfei
* @date 2022-06-13
*/
@Service("customerWorkCollectService")
public class CustomerWorkCollectServiceImpl extends AbstractCRUDServiceImpl<CustomerWorkCollectDao, CustomerWorkCollectEntity, Long> implements CustomerWorkCollectService {
}
\ No newline at end of file
......@@ -9,7 +9,7 @@ import com.mortals.xhx.module.customer.service.CustomerWorkDesignService;
* 客户作品信息 service实现
*
* @author zxfei
* @date 2022-06-08
* @date 2022-06-13
*/
@Service("customerWorkDesignService")
public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<CustomerWorkDesignDao, CustomerWorkDesignEntity, Long> implements CustomerWorkDesignService {
......
package com.mortals.xhx.module.customer.web;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.code.UserType;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.CustomerSatusEnum;
import com.mortals.xhx.common.code.CustomerSrcEnum;
import com.mortals.xhx.common.code.MemberLevelEnum;
import com.mortals.xhx.common.code.SexEnum;
import com.mortals.xhx.module.customer.model.CustomerTrialEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -51,6 +54,36 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom
super.init(model, context);
}
@Override
public String list(@RequestBody(required = false) CustomerEntity query) {
Map<String, Object> model = new HashMap();
JSONObject ret = new JSONObject();
Context context = this.getContext();
String busiDesc = "查询" + this.getModuleDesc();
int code;
try {
PageInfo pageInfo = this.buildPageInfo(query);
this.doListBefore(query, model, context);
Result result = this.getService().findExt(query, pageInfo, context);
model.put("data", result.getList());
model.put("pageInfo", result.getPageInfo());
this.parsePageInfo(model, result.getPageInfo());
code = this.doListAfter(query, model, context);
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
this.init(model, context);
ret.put("code", code);
ret.put("msg", model.remove("message_info"));
ret.put("dict", model.remove("dict"));
ret.put("data", model);
return ret.toJSONString();
}
@GetMapping({"status/enable"})
public String enableStatus(Long[] id) {
Context context = this.getContext();
......
package com.mortals.xhx.module.customer.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.customer.model.CustomerWorkCollectEntity;
import com.mortals.xhx.module.customer.model.CustomerWorkCollectQuery;
import com.mortals.xhx.module.customer.service.CustomerWorkCollectService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 客户收藏信息
*
* @author zxfei
* @date 2022-06-13
*/
@RestController
@RequestMapping("customer/work/collect")
public class CustomerWorkCollectController extends BaseCRUDJsonBodyMappingController<CustomerWorkCollectService,CustomerWorkCollectEntity,Long> {
@Autowired
private ParamService paramService;
public CustomerWorkCollectController(){
super.setModuleDesc( "客户收藏信息");
}
@Override
protected void init(Map<String, Object> model, Context context) {
super.init(model, context);
}
}
\ No newline at end of file
......@@ -28,7 +28,7 @@ import static com.mortals.framework.ap.SysConstains.*;
* 客户作品信息
*
* @author zxfei
* @date 2022-06-08
* @date 2022-06-13
*/
@RestController
@RequestMapping("customer/work/design")
......@@ -43,6 +43,7 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "workDesignStatus", paramService.getParamBySecondOrganize("CustomerWorkDesign","workDesignStatus"));
super.init(model, context);
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.customer.dao.ibatis.CustomerDaoImpl">
<!-- 字段和属性映射 -->
......@@ -22,6 +22,8 @@
<result property="createUserId" column="createUserId" />
<result property="createTime" column="createTime" />
<result property="updateTime" column="updateTime" />
<result property="lastLoginTime" column="lastLoginTime" />
<result property="lastLoginAddress" column="lastLoginAddress" />
</resultMap>
......@@ -80,23 +82,29 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
a.updateTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('lastLoginTime') or colPickMode == 1 and data.containsKey('lastLoginTime')))">
a.lastLoginTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('lastLoginAddress') or colPickMode == 1 and data.containsKey('lastLoginAddress')))">
a.lastLoginAddress,
</if>
</trim>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="CustomerEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_customer
(loginName,password,memberLevel,custName,organization,contactTelphone,enterpriseConsultant,siteId,sex,mailbox,job,customerSrc,status,createUserId,createTime,updateTime)
(loginName,password,memberLevel,custName,organization,contactTelphone,enterpriseConsultant,siteId,sex,mailbox,job,customerSrc,status,createUserId,createTime,updateTime,lastLoginTime,lastLoginAddress)
VALUES
(#{loginName},#{password},#{memberLevel},#{custName},#{organization},#{contactTelphone},#{enterpriseConsultant},#{siteId},#{sex},#{mailbox},#{job},#{customerSrc},#{status},#{createUserId},#{createTime},#{updateTime})
(#{loginName},#{password},#{memberLevel},#{custName},#{organization},#{contactTelphone},#{enterpriseConsultant},#{siteId},#{sex},#{mailbox},#{job},#{customerSrc},#{status},#{createUserId},#{createTime},#{updateTime},#{lastLoginTime},#{lastLoginAddress})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_customer
(loginName,password,memberLevel,custName,organization,contactTelphone,enterpriseConsultant,siteId,sex,mailbox,job,customerSrc,status,createUserId,createTime,updateTime)
(loginName,password,memberLevel,custName,organization,contactTelphone,enterpriseConsultant,siteId,sex,mailbox,job,customerSrc,status,createUserId,createTime,updateTime,lastLoginTime,lastLoginAddress)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.loginName},#{item.password},#{item.memberLevel},#{item.custName},#{item.organization},#{item.contactTelphone},#{item.enterpriseConsultant},#{item.siteId},#{item.sex},#{item.mailbox},#{item.job},#{item.customerSrc},#{item.status},#{item.createUserId},#{item.createTime},#{item.updateTime})
(#{item.loginName},#{item.password},#{item.memberLevel},#{item.custName},#{item.organization},#{item.contactTelphone},#{item.enterpriseConsultant},#{item.siteId},#{item.sex},#{item.mailbox},#{item.job},#{item.customerSrc},#{item.status},#{item.createUserId},#{item.createTime},#{item.updateTime},#{item.lastLoginTime},#{item.lastLoginAddress})
</foreach>
</insert>
......@@ -172,6 +180,12 @@
<if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
a.updateTime=#{data.updateTime},
</if>
<if test="(colPickMode==0 and data.containsKey('lastLoginTime')) or (colPickMode==1 and !data.containsKey('lastLoginTime'))">
a.lastLoginTime=#{data.lastLoginTime},
</if>
<if test="(colPickMode==0 and data.containsKey('lastLoginAddress')) or (colPickMode==1 and !data.containsKey('lastLoginAddress'))">
a.lastLoginAddress=#{data.lastLoginAddress},
</if>
</trim>
<trim suffixOverrides="where" suffix="">
where
......@@ -326,6 +340,20 @@
</if>
</foreach>
</trim>
<trim prefix="lastLoginTime=(case" suffix="ELSE lastLoginTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('lastLoginTime')) or (colPickMode==1 and !item.containsKey('lastLoginTime'))">
when a.id=#{item.id} then #{item.lastLoginTime}
</if>
</foreach>
</trim>
<trim prefix="lastLoginAddress=(case" suffix="ELSE lastLoginAddress end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('lastLoginAddress')) or (colPickMode==1 and !item.containsKey('lastLoginAddress'))">
when a.id=#{item.id} then #{item.lastLoginAddress}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
......@@ -724,6 +752,36 @@
<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('lastLoginTime')">
<if test="conditionParamRef.lastLoginTime != null ">
${_conditionType_} a.lastLoginTime = #{${_conditionParam_}.lastLoginTime}
</if>
<if test="conditionParamRef.lastLoginTime == null">
${_conditionType_} a.lastLoginTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('lastLoginTimeStart') and conditionParamRef.lastLoginTimeStart != null and conditionParamRef.lastLoginTimeStart!=''">
${_conditionType_} a.lastLoginTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.lastLoginTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('lastLoginTimeEnd') and conditionParamRef.lastLoginTimeEnd != null and conditionParamRef.lastLoginTimeEnd!=''">
${_conditionType_} a.lastLoginTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.lastLoginTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('lastLoginAddress')">
<if test="conditionParamRef.lastLoginAddress != null and conditionParamRef.lastLoginAddress != ''">
${_conditionType_} a.lastLoginAddress like #{${_conditionParam_}.lastLoginAddress}
</if>
<if test="conditionParamRef.lastLoginAddress == null">
${_conditionType_} a.lastLoginAddress is null
</if>
</if>
<if test="conditionParamRef.containsKey('lastLoginAddressList')">
${_conditionType_} a.lastLoginAddress in
<foreach collection="conditionParamRef.lastLoginAddressList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
</sql>
<sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()">
......@@ -822,6 +880,16 @@
<if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('lastLoginTime')">
a.lastLoginTime
<if test='orderCol.lastLoginTime != null and "DESC".equalsIgnoreCase(orderCol.lastLoginTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('lastLoginAddress')">
a.lastLoginAddress
<if test='orderCol.lastLoginAddress != null and "DESC".equalsIgnoreCase(orderCol.lastLoginAddress)'>DESC</if>
,
</if>
</trim>
</if>
</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.CustomerDaoImpl">
<!-- 字段和属性映射 -->
<resultMap type="CustomerEntityExt" id="CustomerEntityExt-Map">
<id property="id" column="id" />
<result property="loginName" column="loginName" />
<result property="password" column="password" />
<result property="memberLevel" column="memberLevel" />
<result property="custName" column="custName" />
<result property="organization" column="organization" />
<result property="contactTelphone" column="contactTelphone" />
<result property="enterpriseConsultant" column="enterpriseConsultant" />
<result property="siteId" column="siteId" />
<result property="sex" column="sex" />
<result property="mailbox" column="mailbox" />
<result property="job" column="job" />
<result property="customerSrc" column="customerSrc" />
<result property="status" column="status" />
<result property="createUserId" column="createUserId" />
<result property="createTime" column="createTime" />
<result property="updateTime" column="updateTime" />
<result property="lastLoginTime" column="lastLoginTime" />
<result property="lastLoginAddress" column="lastLoginAddress" />
<result property="customerDesignPictures" column="customerDesignPictures" />
<result property="customerDesignVideos" column="customerDesignVideos" />
</resultMap>
<!-- 获取列表 -->
<select id="getListExt" parameterType="paramDto" resultMap="CustomerEntityExt-Map">
select *
from (
SELECT
c.*, ifnull(s.customerDesignPictures,0) as customerDesignPictures,
ifnull(s.customerDesignVideos,0) as customerDesignVideos
FROM
mortals_xhx_customer c
LEFT JOIN mortals_xhx_customer_work_design_stat s ON c.id = s.customerId
) as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
<include refid="_orderCols_"/>
</select>
<!-- 获取 -->
<select id="getListExtCount" parameterType="paramDto" resultType="int">
select count(1)
from (
SELECT
c.*, ifnull(s.customerDesignPictures,0) as customerDesignPictures,
ifnull(s.customerDesignVideos,0) as customerDesignVideos
FROM
mortals_xhx_customer c
LEFT JOIN mortals_xhx_customer_work_design_stat s ON c.id = s.customerId
) as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</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