| @@ -0,0 +1,18 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||||
| public class WxCUserBasicInfoVo extends WxCUserBasicInfo { | |||||
| /**用户tags*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="用户tags",name="tags") | |||||
| private String tags; | |||||
| public String getTags() { | |||||
| return tags; | |||||
| } | |||||
| public void setTags(String tags) { | |||||
| this.tags = tags; | |||||
| } | |||||
| } | |||||
| @@ -4,6 +4,7 @@ import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | import com.iformall.domain.dto.WxCUserBasicInfoDto; | ||||
| import com.iformall.domain.po.WxCUserBasicInfo; | import com.iformall.domain.po.WxCUserBasicInfo; | ||||
| import com.iformall.domain.vo.CUserBaseVo; | import com.iformall.domain.vo.CUserBaseVo; | ||||
| import com.iformall.domain.vo.WxCUserBasicInfoVo; | |||||
| import java.util.List; | import java.util.List; | ||||
| @@ -22,4 +23,6 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||||
| long findCountByScore(WxCUserBasicInfoDto dto); | long findCountByScore(WxCUserBasicInfoDto dto); | ||||
| long findCount(WxCUserBasicInfoDto dto); | long findCount(WxCUserBasicInfoDto dto); | ||||
| List<WxCUserBasicInfoVo> findVoList(WxCUserBasicInfo wxCUserBasicInfo); | |||||
| } | } | ||||
| @@ -18,6 +18,7 @@ import com.iformall.domain.po.WxTags; | |||||
| import com.iformall.domain.vo.CUserBaseInfoT; | import com.iformall.domain.vo.CUserBaseInfoT; | ||||
| import com.iformall.domain.vo.CUserBaseVo; | import com.iformall.domain.vo.CUserBaseVo; | ||||
| import com.iformall.domain.vo.CUserTagVo; | import com.iformall.domain.vo.CUserTagVo; | ||||
| import com.iformall.domain.vo.WxCUserBasicInfoVo; | |||||
| import com.iformall.enums.EnumAssignTagsTrigger; | import com.iformall.enums.EnumAssignTagsTrigger; | ||||
| import com.iformall.enums.EnumScoreType; | import com.iformall.enums.EnumScoreType; | ||||
| import com.iformall.mapper.WxCUserBasicInfoMapper; | import com.iformall.mapper.WxCUserBasicInfoMapper; | ||||
| @@ -155,7 +156,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) { | public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) { | ||||
| WxCUserBasicInfo basicInfoQ = new WxCUserBasicInfo(); | WxCUserBasicInfo basicInfoQ = new WxCUserBasicInfo(); | ||||
| basicInfoQ.setTenantId(tenantId); | basicInfoQ.setTenantId(tenantId); | ||||
| List<WxCUserBasicInfo> memberlist = wxCUserBasicInfoMapper.findList(basicInfoQ); | |||||
| List<WxCUserBasicInfoVo> memberlist = wxCUserBasicInfoMapper.findVoList(basicInfoQ); | |||||
| XSSFWorkbook workbook; | XSSFWorkbook workbook; | ||||
| String filepath = Constant.fileDirectory; | String filepath = Constant.fileDirectory; | ||||
| @@ -168,6 +169,9 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||||
| WxTags wxTagsQ = new WxTags(); | |||||
| List<WxTags> tagList = wxTagsMapper.findList(wxTagsQ); | |||||
| try { | try { | ||||
| File file = new File(filepath); | File file = new File(filepath); | ||||
| workbook = new XSSFWorkbook(); | workbook = new XSSFWorkbook(); | ||||
| @@ -211,7 +215,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| tagCellTwo = rowtwo.createCell(9); | tagCellTwo = rowtwo.createCell(9); | ||||
| scoreCellTwo = rowtwo.createCell(10); | scoreCellTwo = rowtwo.createCell(10); | ||||
| WxCUserBasicInfo entity = memberlist.get(i); | |||||
| WxCUserBasicInfoVo entity = memberlist.get(i); | |||||
| String sexStr = "保密"; | String sexStr = "保密"; | ||||
| if (entity.getSex() == 1) | if (entity.getSex() == 1) | ||||
| @@ -229,21 +233,22 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| updateDateCellTwo.setCellValue(sdf.format(entity.getUpdateDate())); | updateDateCellTwo.setCellValue(sdf.format(entity.getUpdateDate())); | ||||
| createDateCellTwo.setCellValue(sdf.format(entity.getCreateDate())); | createDateCellTwo.setCellValue(sdf.format(entity.getCreateDate())); | ||||
| if (entity != null) { | if (entity != null) { | ||||
| if (entity.getTagId() != null) { | |||||
| WxCUserTags uTag = wxCUserTagsMapper.selectByPrimaryKey(entity.getTagId()); | |||||
| if (uTag != null && StringUtils.isNotBlank(uTag.getTags())) { | |||||
| List<Long> ids = JSONObject.parseArray(uTag.getTags(), Long.class); | |||||
| if (entity.getTagId() != null && entity.getTags() != null) { | |||||
| if (StringUtils.isNotBlank(entity.getTags())) { | |||||
| List<Long> ids = JSONObject.parseArray(entity.getTags(), Long.class); | |||||
| if (!ids.isEmpty()) { | if (!ids.isEmpty()) { | ||||
| WxTags wxTagsQ = new WxTags(); | |||||
| wxTagsQ.setIds(ids); | |||||
| List<WxTags> tagList = wxTagsMapper.findList(wxTagsQ); | |||||
| String tagNames = ""; | String tagNames = ""; | ||||
| String tagIds = ""; | String tagIds = ""; | ||||
| List<Long> tagIdList = new ArrayList<>(); | List<Long> tagIdList = new ArrayList<>(); | ||||
| for (WxTags wt : tagList) { | |||||
| tagNames += wt.getName() + "/"; | |||||
| tagIds += wt.getId() + ","; | |||||
| tagIdList.add(wt.getId()); | |||||
| for(Long id: ids) { | |||||
| for(WxTags tag: tagList) { | |||||
| if(id.equals(tag.getId())) { | |||||
| tagNames += tag.getName() + "/"; | |||||
| tagIds += tag.getId() + ","; | |||||
| tagIdList.add(tag.getId()); | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| if (StringUtils.isNotBlank(tagNames)) { | if (StringUtils.isNotBlank(tagNames)) { | ||||
| entity.setTagNames(tagNames.substring(0, tagNames.length() - 1)); | entity.setTagNames(tagNames.substring(0, tagNames.length() - 1)); | ||||
| @@ -194,4 +194,104 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <resultMap id="VoBaseResultMap" type="com.iformall.domain.vo.WxCUserBasicInfoVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="phone" jdbcType="VARCHAR" property="phone"/> | |||||
| <result column="birthdate" jdbcType="TIMESTAMP" property="birthdate"/> | |||||
| <result column="education" jdbcType="VARCHAR" property="education"/> | |||||
| <result column="sex" jdbcType="INTEGER" property="sex"/> | |||||
| <result column="email" jdbcType="VARCHAR" property="email"/> | |||||
| <result column="address" jdbcType="VARCHAR" property="address"/> | |||||
| <result column="poins" jdbcType="INTEGER" property="poins"/> | |||||
| <result column="tag_id" jdbcType="BIGINT" property="tagId"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||||
| <result column="level" jdbcType="VARCHAR" property="level"/> | |||||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | |||||
| <result column="tags" jdbcType="VARCHAR" property="tags"/> | |||||
| </resultMap> | |||||
| <sql id="allVoColumns"> | |||||
| cu.`id`,cu.`phone`,cu.`birthdate`,cu.`education`,cu.`sex`,cu.`email`,cu.`address`,cu.`poins`,cu.`tag_id`, | |||||
| cu.`create_date`,cu.`update_date`,cu.`tenant_id`,cu.`name`,cu.`level`,cu.`nick_name`, | |||||
| cut.`tags` | |||||
| </sql> | |||||
| <sql id="dynamicVoWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and cu.`id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and cu.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != phone "> | |||||
| and cu.`phone` like concat('%', #{phone},'%') | |||||
| </if> | |||||
| <if test=" null != birthdate "> | |||||
| and cu.`birthdate` = #{birthdate} | |||||
| </if> | |||||
| <if test=" null != education "> | |||||
| and cu.`education` like concat('%', #{education},'%') | |||||
| </if> | |||||
| <if test=" null != sex "> | |||||
| and cu.`sex` = #{sex} | |||||
| </if> | |||||
| <if test=" null != email "> | |||||
| and cu.`email` like concat('%', #{email},'%') | |||||
| </if> | |||||
| <if test=" null != address "> | |||||
| and cu.`address` like concat('%', #{address},'%') | |||||
| </if> | |||||
| <if test=" null != poins "> | |||||
| and cu.`poins` = #{poins} | |||||
| </if> | |||||
| <if test=" null != tagId "> | |||||
| and cu.`tag_id` = #{tagId} | |||||
| </if> | |||||
| <if test=" null != createDate "> | |||||
| and cu.`create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and cu.`update_date` = #{updateDate} | |||||
| </if> | |||||
| <if test=" null != name "> | |||||
| and `name` like concat('%', #{name},'%') | |||||
| </if> | |||||
| <if test=" null != startTime and null!=endTime"> | |||||
| and cu.`create_date` between #{startTime} and #{endTime} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findVoList" parameterType="com.iformall.domain.vo.WxCUserBasicInfoVo" resultMap="VoBaseResultMap"> | |||||
| select | |||||
| <include refid="allVoColumns"/> | |||||
| from wx_c_user_basic_info cu | |||||
| left join wx_c_user_tags cut on cut.`id` = cu.`tag_id` | |||||
| <include refid="dynamicVoWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||