| @@ -144,7 +144,7 @@ public class WxCUserDataController extends BaseController { | |||||
| wxCUserBasicInfoDto.setTenantId(getTenantId()); | wxCUserBasicInfoDto.setTenantId(getTenantId()); | ||||
| wxCUserBasicInfoDto.setStartTime(null); | wxCUserBasicInfoDto.setStartTime(null); | ||||
| wxCUserBasicInfoDto.setEndTime(null); | wxCUserBasicInfoDto.setEndTime(null); | ||||
| long importCount = wxCUserBasicInfoService.findCountByFilter(wxCUserBasicInfoDto); | |||||
| long importCount = wxCUserBasicInfoService.findCount(wxCUserBasicInfoDto); | |||||
| map.put("importCount", importCount); | map.put("importCount", importCount); | ||||
| map.put("allHistoryUserCount", growCount+importCount); | map.put("allHistoryUserCount", growCount+importCount); | ||||
| @@ -0,0 +1,16 @@ | |||||
| package com.iformall.common; | |||||
| import java.lang.annotation.ElementType; | |||||
| import java.lang.annotation.Retention; | |||||
| import java.lang.annotation.RetentionPolicy; | |||||
| import java.lang.annotation.Target; | |||||
| /** | |||||
| * @author luozukai | |||||
| * 排序注解 | |||||
| */ | |||||
| @Target(ElementType.FIELD) | |||||
| @Retention(RetentionPolicy.RUNTIME) | |||||
| public @interface SortColumn { | |||||
| String column(); | |||||
| } | |||||
| @@ -0,0 +1,78 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.iformall.common.SortColumn; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | |||||
| import java.lang.reflect.Field; | |||||
| /** | |||||
| * @author luozukai | |||||
| * @date 2019/4/24 14:32 | |||||
| */ | |||||
| public class BaseEntity implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Transient | |||||
| private String sortColumn; | |||||
| @Transient | |||||
| private String sortOrder; | |||||
| public String getSortColumn() { | |||||
| try { | |||||
| //扫描子类SortColumn注解的属性,替换sortColumn | |||||
| if(StringUtils.isNotBlank(sortColumn)) { | |||||
| Field[] fields = this.getClass().getDeclaredFields(); | |||||
| for (Field field : fields) { | |||||
| SortColumn sortColumnField = field.getAnnotation(SortColumn.class); | |||||
| if (sortColumnField != null && field.getName().equals(sortColumn)) { | |||||
| sortColumn = sortColumnField.column(); | |||||
| return sortColumn; | |||||
| } | |||||
| } | |||||
| //默认驼峰解析 | |||||
| this.setSortColumn(underscoreName(sortColumn)); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return sortColumn; | |||||
| } | |||||
| /** | |||||
| * 转换为下划线 | |||||
| * | |||||
| * @param camelCaseName | |||||
| * @return | |||||
| */ | |||||
| public static String underscoreName(String camelCaseName) { | |||||
| StringBuilder result = new StringBuilder(); | |||||
| if (camelCaseName != null && camelCaseName.length() > 0) { | |||||
| result.append(camelCaseName.substring(0, 1).toLowerCase()); | |||||
| for (int i = 1; i < camelCaseName.length(); i++) { | |||||
| char ch = camelCaseName.charAt(i); | |||||
| if (Character.isUpperCase(ch)) { | |||||
| result.append("_"); | |||||
| result.append(Character.toLowerCase(ch)); | |||||
| } else { | |||||
| result.append(ch); | |||||
| } | |||||
| } | |||||
| } | |||||
| return result.toString(); | |||||
| } | |||||
| public void setSortColumn(String sortColumn) { | |||||
| this.sortColumn = sortColumn; | |||||
| } | |||||
| public String getSortOrder() { | |||||
| return sortOrder; | |||||
| } | |||||
| public void setSortOrder(String sortOrder) { | |||||
| this.sortOrder = sortOrder; | |||||
| } | |||||
| } | |||||
| @@ -10,9 +10,7 @@ import java.util.List; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| @Table(name = "wx_merchant") | @Table(name = "wx_merchant") | ||||
| public class WxMerchant implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| public class WxMerchant extends BaseEntity { | |||||
| @Id | @Id | ||||
| protected Long id; | protected Long id; | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | import cn.afterturn.easypoi.excel.annotation.Excel; | ||||
| import com.iformall.common.SortColumn; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import javax.persistence.Table; | import javax.persistence.Table; | ||||
| @@ -11,9 +12,7 @@ import java.util.Date; | |||||
| import java.util.List; | import java.util.List; | ||||
| @Table(name = "wx_shop") | @Table(name = "wx_shop") | ||||
| public class WxShop implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| public class WxShop extends BaseEntity { | |||||
| @Id | @Id | ||||
| protected Long id; | protected Long id; | ||||
| @@ -58,6 +57,7 @@ public class WxShop implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "点位类型", name = "pointType") | @io.swagger.annotations.ApiModelProperty(value = "点位类型", name = "pointType") | ||||
| @Excel(name="类型",width = 20,orderNum = "1", | @Excel(name="类型",width = 20,orderNum = "1", | ||||
| replace = {"商铺_null", "固定点位_1", "临时促销点位_2", "宣传点位_3","ATM点位_4","仓库点位_5","其他点位_6"}) | replace = {"商铺_null", "固定点位_1", "临时促销点位_2", "宣传点位_3","ATM点位_4","仓库点位_5","其他点位_6"}) | ||||
| @SortColumn(column="point_type") | |||||
| private Integer pointType; | private Integer pointType; | ||||
| /*商铺编号**/ | /*商铺编号**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="商铺编号",name="shopNumber") | @io.swagger.annotations.ApiModelProperty(value="商铺编号",name="shopNumber") | ||||
| @@ -227,6 +227,9 @@ | |||||
| <if test="null != tenantId"> | <if test="null != tenantId"> | ||||
| and tenant_id =#{tenantId} | and tenant_id =#{tenantId} | ||||
| </if> | </if> | ||||
| <if test="1 == queryImport"> | |||||
| and create_date like '%00:00:00' | |||||
| </if> | |||||
| </select> | </select> | ||||
| <resultMap id="VoBaseResultMap" type="com.iformall.domain.vo.WxCUserBasicInfoVo"> | <resultMap id="VoBaseResultMap" type="com.iformall.domain.vo.WxCUserBasicInfoVo"> | ||||
| @@ -367,9 +370,6 @@ | |||||
| <if test=" null != phones"> | <if test=" null != phones"> | ||||
| and cu.phone in (${phones}) | and cu.phone in (${phones}) | ||||
| </if> | </if> | ||||
| <if test="1 = queryImport"> | |||||
| and create_date like '%00:00:00' | |||||
| </if> | |||||
| <if test=" null != levelStartScore and (0 != levelStartScore and '' != levelStartScore)"> | <if test=" null != levelStartScore and (0 != levelStartScore and '' != levelStartScore)"> | ||||
| and cu.poins >= #{levelStartScore} | and cu.poins >= #{levelStartScore} | ||||
| @@ -83,8 +83,15 @@ | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| #{idItem} | #{idItem} | ||||
| </foreach> | </foreach> | ||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </if> | |||||
| <if test="null != sortColumn"> | |||||
| order by ${sortColumn} ${sortOrder} | |||||
| </if> | |||||
| <if test="null == sortColumn"> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </if> | |||||
| </sql> | </sql> | ||||
| <select id="findList" parameterType="com.iformall.domain.po.WxMerchantBUser" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxMerchantBUser" resultMap="BaseResultMap"> | ||||
| @@ -149,7 +149,6 @@ | |||||
| </select> | </select> | ||||
| <select id="findListMap" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap"> | <select id="findListMap" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap"> | ||||
| select s.id,s.shop_number shopNumber,s.build_area buildArea, | select s.id,s.shop_number shopNumber,s.build_area buildArea, | ||||
| s.img_url imgUrl,s.operation_area operationArea, | s.img_url imgUrl,s.operation_area operationArea, | ||||
| s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId, | s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId, | ||||
| @@ -258,7 +257,14 @@ | |||||
| #{idItem} | #{idItem} | ||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| <if test=" null != sortColumns">order by s.${sortColumns}</if> | |||||
| <if test="null != sortColumn"> | |||||
| order by s.${sortColumn} ${sortOrder} | |||||
| </if> | |||||
| <if test="null == sortColumn"> | |||||
| <if test=" null != sortColumns">order by s.${sortColumns}</if> | |||||
| </if> | |||||
| </select> | </select> | ||||