| @@ -4,6 +4,12 @@ import java.util.ArrayList; | |||||
| import java.util.Arrays; | import java.util.Arrays; | ||||
| import java.util.List; | import java.util.List; | ||||
| import com.iformall.domain.po.WxTagsGroup; | |||||
| import com.iformall.domain.po.WxTagsType; | |||||
| import com.iformall.domain.vo.WxTagsGroupVo; | |||||
| import com.iformall.domain.vo.WxTagsTypeVo; | |||||
| import com.iformall.service.WxTagsGroupService; | |||||
| import com.iformall.service.WxTagsTypeService; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -15,7 +21,6 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxTags; | import com.iformall.domain.po.WxTags; | ||||
| import com.iformall.domain.vo.WxTagsVo; | |||||
| import com.iformall.service.WxCUserTagsService; | import com.iformall.service.WxCUserTagsService; | ||||
| import com.iformall.service.WxTagsService; | import com.iformall.service.WxTagsService; | ||||
| @@ -30,64 +35,78 @@ public class WxTagsController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxTagsService wxTagsService; | private WxTagsService wxTagsService; | ||||
| @Autowired | |||||
| private WxTagsGroupService wxTagsGroupService; | |||||
| @Autowired | |||||
| private WxTagsTypeService wxTagsTypeService; | |||||
| @Autowired | @Autowired | ||||
| private WxCUserTagsService wxCUserTagsService; | private WxCUserTagsService wxCUserTagsService; | ||||
| @GetMapping("getAllList") | @GetMapping("getAllList") | ||||
| @ApiOperation("标签弹窗接口") | @ApiOperation("标签弹窗接口") | ||||
| public ResultData getAllList() { | public ResultData getAllList() { | ||||
| List<WxTagsVo> type1List = new ArrayList<>(); | |||||
| List<WxTags> tags = wxTagsService.findType1Value(); | |||||
| for(WxTags t:tags) { | |||||
| WxTagsVo vo =new WxTagsVo(); | |||||
| vo.setValue(t.getType1()); | |||||
| List<WxTagsVo> type2List =new ArrayList<>(); | |||||
| List<WxTags> type2s = wxTagsService.findType2Value(t.getType1()); | |||||
| for(WxTags wt:type2s) { | |||||
| WxTagsVo v = new WxTagsVo(); | |||||
| v.setValue(wt.getType2()); | |||||
| List<WxTagsVo> list = new ArrayList<>(); | |||||
| WxTags tag = new WxTags(); | |||||
| tag.setType2(wt.getType2()); | |||||
| PageInfo<WxTags> page = wxTagsService.listAsPage(tag, 1, 1000); | |||||
| for(WxTags wxT : page.getList()) { | |||||
| WxTagsVo wxVo = new WxTagsVo(); | |||||
| wxVo.setId(wxT.getId()); | |||||
| wxVo.setValue(wxT.getName()); | |||||
| list.add(wxVo); | |||||
| } | |||||
| v.setSubTags(list); | |||||
| type2List.add(v); | |||||
| vo.setSubTags(type2List); | |||||
| List<WxTagsGroupVo> groupVos = new ArrayList<>(); | |||||
| List<WxTagsGroup> groups = wxTagsGroupService.findList(null); | |||||
| for(WxTagsGroup tg:groups) { | |||||
| WxTagsGroupVo tgvo =new WxTagsGroupVo(); | |||||
| tgvo.setId(tg.getId()); | |||||
| tgvo.setName(tg.getName()); | |||||
| WxTagsType type = new WxTagsType(); | |||||
| type.setGroupId(tg.getId()); | |||||
| List<WxTagsTypeVo> typeVos =new ArrayList<>(); | |||||
| List<WxTagsType> types = wxTagsTypeService.findList(type); | |||||
| for(WxTagsType tt:types) { | |||||
| WxTagsTypeVo ttvo = new WxTagsTypeVo(); | |||||
| ttvo.setId(tt.getId()); | |||||
| ttvo.setName(tt.getName()); | |||||
| ttvo.setGroupId(tg.getId()); | |||||
| ttvo.setGroupName(tg.getName()); | |||||
| WxTags t = new WxTags(); | |||||
| t.setTypeId(tt.getId()); | |||||
| ttvo.setTags(wxTagsService.findList(t)); | |||||
| typeVos.add(ttvo); | |||||
| } | } | ||||
| type1List.add(vo); | |||||
| tgvo.setTypes(typeVos); | |||||
| groupVos.add(tgvo); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS,"查询成功",type1List); | |||||
| return new ResultData(groupVos); | |||||
| } | } | ||||
| @GetMapping("getPeopleTagList") | @GetMapping("getPeopleTagList") | ||||
| @ApiOperation("用户人群tag接口") | @ApiOperation("用户人群tag接口") | ||||
| public ResultData getPeopleTagList() { | public ResultData getPeopleTagList() { | ||||
| List<WxTagsVo> type2List =new ArrayList<>(); | |||||
| List<WxTags> type2s = wxTagsService.findType2Value(null); | |||||
| for(WxTags wt:type2s) { | |||||
| WxTagsVo v = new WxTagsVo(); | |||||
| v.setValue(wt.getType2()); | |||||
| List<WxTagsVo> list = new ArrayList<>(); | |||||
| WxTags tag = new WxTags(); | |||||
| tag.setType2(wt.getType2()); | |||||
| PageInfo<WxTags> page = wxTagsService.listAsPage(tag, 1, 1000); | |||||
| for(WxTags wxT : page.getList()) { | |||||
| WxTagsVo wxVo = new WxTagsVo(); | |||||
| wxVo.setValue(wxT.getName()); | |||||
| wxVo.setId(wxT.getId()); | |||||
| list.add(wxVo); | |||||
| List<WxTagsGroupVo> groupVos = new ArrayList<>(); | |||||
| List<WxTagsGroup> groups = wxTagsGroupService.findList(null); | |||||
| for(WxTagsGroup tg:groups) { | |||||
| WxTagsGroupVo tgvo =new WxTagsGroupVo(); | |||||
| tgvo.setId(tg.getId()); | |||||
| tgvo.setName(tg.getName()); | |||||
| WxTagsType type = new WxTagsType(); | |||||
| type.setGroupId(tg.getId()); | |||||
| List<WxTagsTypeVo> typeVos =new ArrayList<>(); | |||||
| List<WxTagsType> types = wxTagsTypeService.findList(type); | |||||
| for(WxTagsType tt:types) { | |||||
| WxTagsTypeVo ttvo = new WxTagsTypeVo(); | |||||
| ttvo.setId(tt.getId()); | |||||
| ttvo.setName(tt.getName()); | |||||
| ttvo.setGroupId(tg.getId()); | |||||
| ttvo.setGroupName(tg.getName()); | |||||
| WxTags t = new WxTags(); | |||||
| t.setTypeId(tt.getId()); | |||||
| ttvo.setTags(wxTagsService.findList(t)); | |||||
| typeVos.add(ttvo); | |||||
| } | } | ||||
| v.setSubTags(list); | |||||
| type2List.add(v); | |||||
| tgvo.setTypes(typeVos); | |||||
| groupVos.add(tgvo); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS,"查询成功",type2List); | |||||
| return new ResultData(groupVos); | |||||
| } | } | ||||
| @@ -22,80 +22,85 @@ public class WxTags implements Serializable { | |||||
| public Long getId() { | public Long getId() { | ||||
| return id; | return id; | ||||
| } | } | ||||
| public void setId(Long id) { | public void setId(Long id) { | ||||
| this.id = id; | this.id = id; | ||||
| } | } | ||||
| public String getSortColumns() { | public String getSortColumns() { | ||||
| return sortColumns; | return sortColumns; | ||||
| } | } | ||||
| public List<Long> getIds() { | public List<Long> getIds() { | ||||
| return ids; | return ids; | ||||
| } | } | ||||
| public void setIds(List<Long> ids) { | public void setIds(List<Long> ids) { | ||||
| this.ids = ids; | this.ids = ids; | ||||
| } | } | ||||
| /**名称**/ | /**名称**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="名称",name="name") | @io.swagger.annotations.ApiModelProperty(value="名称",name="name") | ||||
| private String name; | private String name; | ||||
| /**1基础2生活属性3消费偏好4行为偏好**/ | /**1基础2生活属性3消费偏好4行为偏好**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="1基础2生活属性3消费偏好4行为偏好",name="type1") | |||||
| private String type1; | |||||
| @io.swagger.annotations.ApiModelProperty(value="1基础2生活属性3消费偏好4行为偏好",name="groupId") | |||||
| private Long groupId; | |||||
| /**二级属性 性别等**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="二级属性 性别等",name="typeId") | |||||
| private Long typeId; | |||||
| /**1基础2生活属性3消费偏好4行为偏好**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="1基础2生活属性3消费偏好4行为偏好",name="groupName") | |||||
| private String groupName; | |||||
| /**二级属性 性别等**/ | /**二级属性 性别等**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="二级属性 性别等",name="type2") | |||||
| private String type2; | |||||
| /**创建时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| private Date createDate; | |||||
| /**更新时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||||
| private Date updateDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="二级属性 性别等",name="typeName") | |||||
| private String typeName; | |||||
| public String getName() { | public String getName() { | ||||
| return name; | return name; | ||||
| } | } | ||||
| public void setName(String _name) { | public void setName(String _name) { | ||||
| name = _name; | name = _name; | ||||
| } | } | ||||
| public String getType1() { | |||||
| return type1; | |||||
| public Long getGroupId() { | |||||
| return groupId; | |||||
| } | } | ||||
| public void setType1(String _type1) { | |||||
| type1 = _type1; | |||||
| public void setGroupId(Long groupId) { | |||||
| this.groupId = groupId; | |||||
| } | } | ||||
| public String getType2() { | |||||
| return type2; | |||||
| public Long getTypeId() { | |||||
| return typeId; | |||||
| } | } | ||||
| public void setType2(String _type2) { | |||||
| type2 = _type2; | |||||
| public void setTypeId(Long typeId) { | |||||
| this.typeId = typeId; | |||||
| } | } | ||||
| public Date getCreateDate() { | |||||
| return createDate; | |||||
| public String getGroupName() { | |||||
| return groupName; | |||||
| } | } | ||||
| public void setCreateDate(Date _createDate) { | |||||
| createDate = _createDate; | |||||
| public void setGroupName(String groupName) { | |||||
| this.groupName = groupName; | |||||
| } | } | ||||
| public Date getUpdateDate() { | |||||
| return updateDate; | |||||
| public String getTypeName() { | |||||
| return typeName; | |||||
| } | } | ||||
| public void setUpdateDate(Date _updateDate) { | |||||
| updateDate = _updateDate; | |||||
| public void setTypeName(String typeName) { | |||||
| this.typeName = typeName; | |||||
| } | } | ||||
| public static enum Field | |||||
| public enum Field | |||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | ||||
| ,Type1_ASC("`type1` ASC"),Type1_DESC("`type1` DESC") | |||||
| ,Type2_ASC("`type2` ASC"),Type2_DESC("`type2` DESC") | |||||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | |||||
| ,GroupId_ASC("`group_id` ASC"),GroupId_DESC("`group_id` DESC") | |||||
| ,GroupName_ASC("`group_name` ASC"),GroupName_DESC("`group_name` DESC") | |||||
| ,TypeId_ASC("`type_id` ASC"),TypeId_DESC("`type_id` DESC") | |||||
| ,TypeName_ASC("`type_name` ASC"),TypeName_DESC("`type_name` DESC") | |||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -0,0 +1,113 @@ | |||||
| package com.iformall.domain.po; | |||||
| import javax.persistence.Id; | |||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | |||||
| import java.util.ArrayList; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Table(name = "wx_tags_group") | |||||
| public class WxTagsGroup implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getSortColumns() { | |||||
| return sortColumns; | |||||
| } | |||||
| public List<Long> getIds() { | |||||
| return ids; | |||||
| } | |||||
| public void setIds(List<Long> ids) { | |||||
| this.ids = ids; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| /**名称**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="名称",name="name") | |||||
| private String name; | |||||
| public enum Field | |||||
| { | |||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | |||||
| ; | |||||
| private String value; | |||||
| Field(String value){ | |||||
| this.value = value; | |||||
| } | |||||
| public String getValue() { | |||||
| return value; | |||||
| } | |||||
| public void setCol(String value) { | |||||
| this.value = value; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return this.getValue(); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(WxTagsGroup.Field... fields) | |||||
| { | |||||
| if (fields == null || fields.length == 0) { | |||||
| return; | |||||
| } | |||||
| for (int k = 0; k < fields.length; k++) { | |||||
| if (fields[k] == null) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||||
| for (int k = 1; k < fields.length; k++) { | |||||
| sb.append(","); | |||||
| sb.append(fields[k].toString()); | |||||
| } | |||||
| this.sortColumns = sb.toString(); | |||||
| } | |||||
| public void setSortColumns(String sortColumns) | |||||
| { | |||||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||||
| return; | |||||
| } | |||||
| if (sortColumns.contains(",")) { | |||||
| String[] cols = sortColumns.split(","); | |||||
| List<Field> fList = new ArrayList(); | |||||
| for (int k = 0; k < cols.length; k++) { | |||||
| fList.add(Field.valueOf(cols[k])); | |||||
| } | |||||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||||
| } else { | |||||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,138 @@ | |||||
| package com.iformall.domain.po; | |||||
| import javax.persistence.Id; | |||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| @Table(name = "wx_tags_type") | |||||
| public class WxTagsType implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getSortColumns() { | |||||
| return sortColumns; | |||||
| } | |||||
| public List<Long> getIds() { | |||||
| return ids; | |||||
| } | |||||
| public void setIds(List<Long> ids) { | |||||
| this.ids = ids; | |||||
| } | |||||
| /**名称**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="名称",name="name") | |||||
| private String name; | |||||
| /**1基础2生活属性3消费偏好4行为偏好**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="1基础2生活属性3消费偏好4行为偏好",name="groupId") | |||||
| private Long groupId; | |||||
| /**1基础2生活属性3消费偏好4行为偏好**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="1基础2生活属性3消费偏好4行为偏好",name="groupName") | |||||
| private String groupName; | |||||
| public Long getGroupId() { | |||||
| return groupId; | |||||
| } | |||||
| public void setGroupId(Long groupId) { | |||||
| this.groupId = groupId; | |||||
| } | |||||
| public String getGroupName() { | |||||
| return groupName; | |||||
| } | |||||
| public void setGroupName(String groupName) { | |||||
| this.groupName = groupName; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| public enum Field | |||||
| { | |||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | |||||
| ,GroupId_ASC("`group_id` ASC"),GroupId_DESC("`group_id` DESC") | |||||
| ,GroupName_ASC("`group_name` ASC"),GroupName_DESC("`group_name` DESC") | |||||
| ; | |||||
| private String value; | |||||
| Field(String value){ | |||||
| this.value = value; | |||||
| } | |||||
| public String getValue() { | |||||
| return value; | |||||
| } | |||||
| public void setCol(String value) { | |||||
| this.value = value; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return this.getValue(); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(WxTagsType.Field... fields) | |||||
| { | |||||
| if (fields == null || fields.length == 0) { | |||||
| return; | |||||
| } | |||||
| for (int k = 0; k < fields.length; k++) { | |||||
| if (fields[k] == null) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||||
| for (int k = 1; k < fields.length; k++) { | |||||
| sb.append(","); | |||||
| sb.append(fields[k].toString()); | |||||
| } | |||||
| this.sortColumns = sb.toString(); | |||||
| } | |||||
| public void setSortColumns(String sortColumns) | |||||
| { | |||||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||||
| return; | |||||
| } | |||||
| if (sortColumns.contains(",")) { | |||||
| String[] cols = sortColumns.split(","); | |||||
| List<Field> fList = new ArrayList(); | |||||
| for (int k = 0; k < cols.length; k++) { | |||||
| fList.add(Field.valueOf(cols[k])); | |||||
| } | |||||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||||
| } else { | |||||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,22 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import com.iformall.domain.po.WxTagsGroup; | |||||
| import java.io.Serializable; | |||||
| import java.util.List; | |||||
| public class WxTagsGroupVo extends WxTagsGroup implements Serializable{ | |||||
| private static final long serialVersionUID = 1786459967532225067L; | |||||
| private List<WxTagsTypeVo> types; | |||||
| public List<WxTagsTypeVo> getTypes() { | |||||
| return types; | |||||
| } | |||||
| public void setTypes(List<WxTagsTypeVo> types) { | |||||
| this.types = types; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,21 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import com.iformall.domain.po.WxTags; | |||||
| import com.iformall.domain.po.WxTagsType; | |||||
| import java.io.Serializable; | |||||
| import java.util.List; | |||||
| public class WxTagsTypeVo extends WxTagsType implements Serializable{ | |||||
| private List<WxTags> tags; | |||||
| public List<WxTags> getTags() { | |||||
| return tags; | |||||
| } | |||||
| public void setTags(List<WxTags> tags) { | |||||
| this.tags = tags; | |||||
| } | |||||
| } | |||||
| @@ -1,43 +0,0 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import java.io.Serializable; | |||||
| import java.util.List; | |||||
| public class WxTagsVo implements Serializable{ | |||||
| /** | |||||
| * | |||||
| */ | |||||
| private static final long serialVersionUID = 1786459967532225067L; | |||||
| private Long id; | |||||
| private String value; | |||||
| private List<WxTagsVo> subTags; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getValue() { | |||||
| return value; | |||||
| } | |||||
| public void setValue(String value) { | |||||
| this.value = value; | |||||
| } | |||||
| public List<WxTagsVo> getSubTags() { | |||||
| return subTags; | |||||
| } | |||||
| public void setSubTags(List<WxTagsVo> subTags) { | |||||
| this.subTags = subTags; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,12 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxTagsGroup; | |||||
| import java.util.List; | |||||
| public interface WxTagsGroupMapper extends CommonMapper<WxTagsGroup, String> { | |||||
| List<WxTagsGroup> findList(WxTagsGroup wxTagsGroup); | |||||
| } | |||||
| @@ -8,10 +8,5 @@ import com.iformall.domain.po.WxTags; | |||||
| public interface WxTagsMapper extends CommonMapper<WxTags, String> { | public interface WxTagsMapper extends CommonMapper<WxTags, String> { | ||||
| List<WxTags> findList(WxTags wxTags); | List<WxTags> findList(WxTags wxTags); | ||||
| List<WxTags> findType1Value(); | |||||
| List<WxTags> findType2Value(String type1); | |||||
| WxTags getByName(String name); | WxTags getByName(String name); | ||||
| } | } | ||||
| @@ -0,0 +1,12 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxTagsType; | |||||
| import java.util.List; | |||||
| public interface WxTagsTypeMapper extends CommonMapper<WxTagsType, String> { | |||||
| List<WxTagsType> findList(WxTagsType wxTagsType); | |||||
| } | |||||
| @@ -0,0 +1,44 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxTagsGroup; | |||||
| import java.util.List; | |||||
| public interface WxTagsGroupService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param offset | |||||
| * @param limit | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxTagsGroup> listAsPage(WxTagsGroup record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxTagsGroup getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxTagsGroup record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| List<WxTagsGroup> findList(WxTagsGroup wxTagsGroup); | |||||
| } | |||||
| @@ -37,22 +37,7 @@ public interface WxTagsService { | |||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| /** | |||||
| * 查询第一个属性 | |||||
| * @return | |||||
| */ | |||||
| List<WxTags> findType1Value(); | |||||
| /** | |||||
| * 根据第一个属性获取第二个属性 | |||||
| * @param type1 | |||||
| * @return | |||||
| */ | |||||
| List<WxTags> findType2Value(String type1); | |||||
| List<WxTags> findList(WxTags wxTags); | |||||
| } | } | ||||
| @@ -0,0 +1,43 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxTagsType; | |||||
| import java.util.List; | |||||
| public interface WxTagsTypeService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param offset | |||||
| * @param limit | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxTagsType> listAsPage(WxTagsType record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxTagsType getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxTagsType record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| List<WxTagsType> findList(WxTagsType wxTagsType); | |||||
| } | |||||
| @@ -0,0 +1,55 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.WxTagsGroup; | |||||
| import com.iformall.mapper.WxTagsGroupMapper; | |||||
| import com.iformall.service.WxTagsGroupService; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.List; | |||||
| @Service | |||||
| public class WxTagsGroupServiceImpl implements WxTagsGroupService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| WxTagsGroupMapper wxTagsGroupMapper; | |||||
| @Override | |||||
| public PageInfo<WxTagsGroup> listAsPage(WxTagsGroup record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxTagsGroupMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxTagsGroup getById(Long id) { | |||||
| return wxTagsGroupMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxTagsGroup record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxTagsGroupMapper.insertSelective(record); | |||||
| } else { | |||||
| wxTagsGroupMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxTagsGroupMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public List<WxTagsGroup> findList(WxTagsGroup wxTagsGroup) { | |||||
| return wxTagsGroupMapper.findList(wxTagsGroup); | |||||
| } | |||||
| } | |||||
| @@ -47,22 +47,8 @@ public class WxTagsServiceImpl implements WxTagsService { | |||||
| wxTagsMapper.deleteByPrimaryKey(id); | wxTagsMapper.deleteByPrimaryKey(id); | ||||
| } | } | ||||
| @Override | |||||
| public List<WxTags> findType1Value() { | |||||
| return wxTagsMapper.findType1Value(); | |||||
| } | |||||
| @Override | |||||
| public List<WxTags> findType2Value(String type1) { | |||||
| return wxTagsMapper.findType2Value(type1); | |||||
| } | |||||
| @Override | |||||
| public List<WxTags> findList(WxTags wxTags) { | |||||
| return wxTagsMapper.findList(wxTags); | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,55 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.WxTagsType; | |||||
| import com.iformall.mapper.WxTagsTypeMapper; | |||||
| import com.iformall.service.WxTagsTypeService; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.List; | |||||
| @Service | |||||
| public class WxTagsTypeServiceImpl implements WxTagsTypeService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| WxTagsTypeMapper wxTagsTypeMapper; | |||||
| @Override | |||||
| public PageInfo<WxTagsType> listAsPage(WxTagsType record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxTagsTypeMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxTagsType getById(Long id) { | |||||
| return wxTagsTypeMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxTagsType record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxTagsTypeMapper.insertSelective(record); | |||||
| } else { | |||||
| wxTagsTypeMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxTagsTypeMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public List<WxTagsType> findList(WxTagsType wxTagsType) { | |||||
| return wxTagsTypeMapper.findList(wxTagsType); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,41 @@ | |||||
| <?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.iformall.mapper.WxTagsGroupMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxTagsGroup"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`name` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != name "> | |||||
| and `name` = #{name} | |||||
| </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="findList" parameterType="com.iformall.domain.po.WxTagsGroup" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_tags_group | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -4,14 +4,14 @@ | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxTags"> | <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxTags"> | ||||
| <id column="id" jdbcType="BIGINT" property="id"/> | <id column="id" jdbcType="BIGINT" property="id"/> | ||||
| <result column="name" jdbcType="VARCHAR" property="name"/> | <result column="name" jdbcType="VARCHAR" property="name"/> | ||||
| <result column="type1" jdbcType="VARCHAR" property="type1"/> | |||||
| <result column="type2" jdbcType="VARCHAR" property="type2"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="group_id" jdbcType="BIGINT" property="groupId"/> | |||||
| <result column="group_name" jdbcType="VARCHAR" property="groupName"/> | |||||
| <result column="type_id" jdbcType="BIGINT" property="typeId"/> | |||||
| <result column="type_name" jdbcType="VARCHAR" property="typeName"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`name`,`type1`,`type2`,`create_date`,`update_date` | |||||
| `id`,`name`,`group_id`,`group_name`,`type_id`,`type_name` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -25,21 +25,22 @@ | |||||
| and `name` = #{name} | and `name` = #{name} | ||||
| </if> | </if> | ||||
| <if test=" null != type1 "> | |||||
| and `type1` = #{type1} | |||||
| <if test=" null != groupId "> | |||||
| and `group_id` = #{groupId} | |||||
| </if> | </if> | ||||
| <if test=" null != type2 "> | |||||
| and `type2` = #{type2} | |||||
| <if test=" null != groupName "> | |||||
| and `group_name` = #{groupName} | |||||
| </if> | </if> | ||||
| <if test=" null != createDate "> | |||||
| and `create_date` = #{createDate} | |||||
| <if test=" null != typeId "> | |||||
| and `type_id` = #{typeId} | |||||
| </if> | </if> | ||||
| <if test=" null != updateDate "> | |||||
| and `update_date` = #{updateDate} | |||||
| <if test=" null != typeName "> | |||||
| and `type_name` = #{typeName} | |||||
| </if> | </if> | ||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| @@ -56,17 +57,6 @@ | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="findType1Value" resultMap="BaseResultMap"> | |||||
| select DISTINCT type1 from wx_tags | |||||
| </select> | |||||
| <select id="findType2Value" parameterType="String" resultMap="BaseResultMap"> | |||||
| select DISTINCT type2 from wx_tags where 1=1 | |||||
| <if test="_parameter!= null and _parameter!= ''"> | |||||
| and type1=#{type1} | |||||
| </if> | |||||
| </select> | |||||
| <select id="getByName" parameterType="String" resultMap="BaseResultMap"> | <select id="getByName" parameterType="String" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns"/> | select <include refid="allColumns"/> | ||||
| from wx_tags where 1=1 | from wx_tags where 1=1 | ||||
| @@ -74,5 +64,4 @@ | |||||
| and `name` = #{name} | and `name` = #{name} | ||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||
| @@ -0,0 +1,51 @@ | |||||
| <?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.iformall.mapper.WxTagsTypeMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxTagsType"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||||
| <result column="group_id" jdbcType="BIGINT" property="groupId"/> | |||||
| <result column="group_name" jdbcType="VARCHAR" property="groupName"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`name`,`group_id`,`group_name` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != name "> | |||||
| and `name` = #{name} | |||||
| </if> | |||||
| <if test=" null != groupId "> | |||||
| and `group_id` = #{groupId} | |||||
| </if> | |||||
| <if test=" null != groupName "> | |||||
| and `group_name` = #{groupName} | |||||
| </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="findList" parameterType="com.iformall.domain.po.WxTagsType" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_tags_type | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | |||||