Commit 23fcd536 authored by 赵啸非's avatar 赵啸非

添加区域树

parent efa10d54
package com.mortals.xhx.common.code; package com.mortals.xhx.common.code;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
/** /**
* 区域级别 * 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)枚举类
* *
* @author yiqimin * @author zxfei
* @create 2018/09/26 */
*/ public enum AreaLevelEnum {
public enum AreaLevelEnum implements IBaseEnum { (1, "省"),
地市州(2, "地市州"),
PROVINCE(1, "省", SysConstains.STYLE_DEFAULT), 区县(3, "区县"),
CITY(2, "市", SysConstains.STYLE_DEFAULT), 街道(4, "街道"),
AREA(3, "区/县", SysConstains.STYLE_DEFAULT), 社区(5, "社区");
TOWN(4, "镇", SysConstains.STYLE_DEFAULT); private Integer value;
private int value;
private String desc; private String desc;
private String style;
AreaLevelEnum(int value, String desc, String style) { AreaLevelEnum(Integer value, String desc) {
this.value = value; this.value = value;
this.desc = desc; this.desc = desc;
this.style = style;
} }
@Override public Integer getValue() {
public int getValue() {
return this.value; return this.value;
} }
public String getDesc() { public String getDesc() {
return desc; return this.desc;
} }
public String getStyle() public static AreaLevelEnum getByValue(Integer value) {
{ for (AreaLevelEnum areaLevelEnum : AreaLevelEnum.values()) {
return style; if (areaLevelEnum.getValue() == value) {
} return areaLevelEnum;
public static AreaLevelEnum getByValue(int value) {
for (AreaLevelEnum e : AreaLevelEnum.values()) {
if (e.getValue() == value) {
return e;
} }
} }
return null; return null;
} }
public static Map<String,String> getEnumMap(int... eItem) { /**
Map<String,String> resultMap= new LinkedHashMap<String,String>(); * 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (AreaLevelEnum item : AreaLevelEnum.values()) { for (AreaLevelEnum item : AreaLevelEnum.values()) {
try{ try {
boolean hasE = false; boolean hasE = false;
for (int e : eItem){ for (Integer e : eItem) {
if(item.getValue()==e){ if (item.getValue() == e) {
hasE = true; hasE = true;
break; break;
} }
} }
if(!hasE){ if (!hasE) {
resultMap.put(item.getValue()+"", item.getDesc()); resultMap.put(item.getValue() + "", item.getDesc());
} }
}catch(Exception ex){ } catch (Exception ex) {
} }
} }
return resultMap; return resultMap;
} }
}
} \ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 是否获取部门(true.是,false.否)枚举类
*
* @author zxfei
*/
public enum HaveGetDeptEnum {
("true", "是"),
("false", "否");
private String value;
private String desc;
HaveGetDeptEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static HaveGetDeptEnum getByValue(String value) {
for (HaveGetDeptEnum haveGetDeptEnum : HaveGetDeptEnum.values()) {
if (haveGetDeptEnum.getValue() == value) {
return haveGetDeptEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (HaveGetDeptEnum item : HaveGetDeptEnum.values()) {
try {
boolean hasE = false;
for (String e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 是否获取事项列表(true.是,false.否)枚举类
*
* @author zxfei
*/
public enum HaveGetMatterListEnum {
("true", "是"),
("false", "否");
private String value;
private String desc;
HaveGetMatterListEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static HaveGetMatterListEnum getByValue(String value) {
for (HaveGetMatterListEnum haveGetMatterListEnum : HaveGetMatterListEnum.values()) {
if (haveGetMatterListEnum.getValue() == value) {
return haveGetMatterListEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (HaveGetMatterListEnum item : HaveGetMatterListEnum.values()) {
try {
boolean hasE = false;
for (String e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 是否有下级区域(True.是,False.否)枚举类
*
* @author zxfei
*/
public enum HaveSonAreaEnum {
("True", "是"),
("False", "否");
private String value;
private String desc;
HaveSonAreaEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static HaveSonAreaEnum getByValue(String value) {
for (HaveSonAreaEnum haveSonAreaEnum : HaveSonAreaEnum.values()) {
if (haveSonAreaEnum.getValue() == value) {
return haveSonAreaEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (HaveSonAreaEnum item : HaveSonAreaEnum.values()) {
try {
boolean hasE = false;
for (String e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 是否有下级部门(True.是,False.否)枚举类
*
* @author zxfei
*/
public enum HaveSonDeptEnum {
("True", "是"),
("False", "否");
private String value;
private String desc;
HaveSonDeptEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static HaveSonDeptEnum getByValue(String value) {
for (HaveSonDeptEnum haveSonDeptEnum : HaveSonDeptEnum.values()) {
if (haveSonDeptEnum.getValue() == value) {
return haveSonDeptEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (HaveSonDeptEnum item : HaveSonDeptEnum.values()) {
try {
boolean hasE = false;
for (String e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 区域状态 (0.停用,1.正常)枚举类
*
* @author zxfei
*/
public enum StatusEnum {
停用(0, "停用"),
正常(1, "正常");
private Integer value;
private String desc;
StatusEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static StatusEnum getByValue(Integer value) {
for (StatusEnum statusEnum : StatusEnum.values()) {
if (statusEnum.getValue() == value) {
return statusEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (StatusEnum item : StatusEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
...@@ -2,16 +2,23 @@ package com.mortals.xhx.module.base.dao; ...@@ -2,16 +2,23 @@ package com.mortals.xhx.module.base.dao;
import com.mortals.framework.dao.ICRUDDao; import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.base.model.BaseAreaEntity; import com.mortals.xhx.module.base.model.BaseAreaEntity;
import java.util.List;
/** /**
* 区域Dao * 区域Dao
* 区域 DAO接口 * 区域 DAO接口
* *
* @author zxfei * @author zxfei
* @date 2022-11-22 * @date 2024-11-01
*/ */
public interface BaseAreaDao extends ICRUDDao<BaseAreaEntity,Long>{ public interface BaseAreaDao extends ICRUDDao<BaseAreaEntity,Long>{
/**
* 查询子节点
*
* @param
* @return
*/
List<BaseAreaEntity> selectChildrenBaseAreaById(String baseAreaId);
} }
package com.mortals.xhx.module.base.dao.ibatis; package com.mortals.xhx.module.base.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis; import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.base.dao.BaseAreaDao; import com.mortals.xhx.module.base.dao.BaseAreaDao;
import com.mortals.xhx.module.base.model.BaseAreaEntity; import com.mortals.xhx.module.base.model.BaseAreaEntity;
import org.springframework.stereotype.Repository; import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/** /**
* 区域DaoImpl DAO接口 * 区域DaoImpl DAO接口
* *
* @author zxfei * @author zxfei
* @date 2022-11-22 * @date 2024-11-01
*/ */
@Repository("baseAreaDao") @Repository("baseAreaDao")
public class BaseAreaDaoImpl extends BaseCRUDDaoMybatis<BaseAreaEntity,Long> implements BaseAreaDao { public class BaseAreaDaoImpl extends BaseCRUDDaoMybatis<BaseAreaEntity,Long> implements BaseAreaDao {
@Override
public List<BaseAreaEntity> selectChildrenBaseAreaById(String baseAreaId) {
return getSqlSession().selectList(getSqlId("selectChildrenBaseAreaById"), baseAreaId);
}
} }
package com.mortals.xhx.module.base.model; package com.mortals.xhx.module.base.model;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.base.model.vo.BaseAreaVo; import com.mortals.xhx.module.base.model.vo.BaseAreaVo;
import lombok.Data;
/** /**
* 区域实体对象 * 区域实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-11-22 * @date 2024-11-01
*/ */
@Data
public class BaseAreaEntity extends BaseAreaVo { public class BaseAreaEntity extends BaseAreaVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -63,196 +71,6 @@ public class BaseAreaEntity extends BaseAreaVo { ...@@ -63,196 +71,6 @@ public class BaseAreaEntity extends BaseAreaVo {
* 区域状态 (0.停用,1.正常) * 区域状态 (0.停用,1.正常)
*/ */
private Integer status; private Integer status;
public BaseAreaEntity(){}
/**
* 获取 祖级列表,逗号分隔
* @return String
*/
public String getAncestors(){
return ancestors;
}
/**
* 设置 祖级列表,逗号分隔
* @param ancestors
*/
public void setAncestors(String ancestors){
this.ancestors = ancestors;
}
/**
* 获取 区域名称
* @return String
*/
public String getName(){
return name;
}
/**
* 设置 区域名称
* @param name
*/
public void setName(String name){
this.name = name;
}
/**
* 获取 一体化的ID号
* @return String
*/
public String getIid(){
return iid;
}
/**
* 设置 一体化的ID号
* @param iid
*/
public void setIid(String iid){
this.iid = iid;
}
/**
* 获取 一体化的父id
* @return String
*/
public String getPid(){
return pid;
}
/**
* 设置 一体化的父id
* @param pid
*/
public void setPid(String pid){
this.pid = pid;
}
/**
* 获取 是否有下级区域(True.是,False.否)
* @return String
*/
public String getHaveSonArea(){
return haveSonArea;
}
/**
* 设置 是否有下级区域(True.是,False.否)
* @param haveSonArea
*/
public void setHaveSonArea(String haveSonArea){
this.haveSonArea = haveSonArea;
}
/**
* 获取 是否有下级部门(True.是,False.否)
* @return String
*/
public String getHaveSonDept(){
return haveSonDept;
}
/**
* 设置 是否有下级部门(True.是,False.否)
* @param haveSonDept
*/
public void setHaveSonDept(String haveSonDept){
this.haveSonDept = haveSonDept;
}
/**
* 获取 是否获取部门(true.是,false.否)
* @return String
*/
public String getHaveGetDept(){
return haveGetDept;
}
/**
* 设置 是否获取部门(true.是,false.否)
* @param haveGetDept
*/
public void setHaveGetDept(String haveGetDept){
this.haveGetDept = haveGetDept;
}
/**
* 获取 是否获取事项列表(true.是,false.否)
* @return String
*/
public String getHaveGetMatterList(){
return haveGetMatterList;
}
/**
* 设置 是否获取事项列表(true.是,false.否)
* @param haveGetMatterList
*/
public void setHaveGetMatterList(String haveGetMatterList){
this.haveGetMatterList = haveGetMatterList;
}
/**
* 获取 区域编码
* @return String
*/
public String getAreaCode(){
return areaCode;
}
/**
* 设置 区域编码
* @param areaCode
*/
public void setAreaCode(String areaCode){
this.areaCode = areaCode;
}
/**
* 获取 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @return Integer
*/
public Integer getAreaLevel(){
return areaLevel;
}
/**
* 设置 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @param areaLevel
*/
public void setAreaLevel(Integer areaLevel){
this.areaLevel = areaLevel;
}
/**
* 获取 名称简称
* @return String
*/
public String getShortName(){
return shortName;
}
/**
* 设置 名称简称
* @param shortName
*/
public void setShortName(String shortName){
this.shortName = shortName;
}
/**
* 获取 访问地址
* @return String
*/
public String getDomain(){
return domain;
}
/**
* 设置 访问地址
* @param domain
*/
public void setDomain(String domain){
this.domain = domain;
}
/**
* 获取 区域状态 (0.停用,1.正常)
* @return Integer
*/
public Integer getStatus(){
return status;
}
/**
* 设置 区域状态 (0.停用,1.正常)
* @param status
*/
public void setStatus(Integer status){
this.status = status;
}
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
...@@ -269,50 +87,19 @@ public class BaseAreaEntity extends BaseAreaVo { ...@@ -269,50 +87,19 @@ public class BaseAreaEntity extends BaseAreaVo {
return false; return false;
} }
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",ancestors:").append(getAncestors());
sb.append(",name:").append(getName());
sb.append(",iid:").append(getIid());
sb.append(",pid:").append(getPid());
sb.append(",haveSonArea:").append(getHaveSonArea());
sb.append(",haveSonDept:").append(getHaveSonDept());
sb.append(",haveGetDept:").append(getHaveGetDept());
sb.append(",haveGetMatterList:").append(getHaveGetMatterList());
sb.append(",areaCode:").append(getAreaCode());
sb.append(",areaLevel:").append(getAreaLevel());
sb.append(",shortName:").append(getShortName());
sb.append(",domain:").append(getDomain());
sb.append(",status:").append(getStatus());
return sb.toString();
}
public void initAttrValue(){ public void initAttrValue(){
this.ancestors = ""; this.ancestors = "";
this.name = "";
this.name = null; this.iid = "";
this.pid = "";
this.iid = null; this.haveSonArea = "";
this.haveSonDept = "";
this.pid = null; this.haveGetDept = "";
this.haveGetMatterList = "";
this.haveSonArea = null; this.areaCode = "";
this.haveSonDept = null;
this.haveGetDept = null;
this.haveGetMatterList = null;
this.areaCode = null;
this.areaLevel = 1; this.areaLevel = 1;
this.shortName = "";
this.shortName = null; this.domain = "";
this.domain = null;
this.status = 1; this.status = 1;
} }
} }
\ No newline at end of file
package com.mortals.xhx.module.base.model; package com.mortals.xhx.module.base.model;
import java.util.List; import java.util.List;
import com.mortals.xhx.module.base.model.BaseAreaEntity;
/** /**
* 区域查询对象 * 区域查询对象
* *
* @author zxfei * @author zxfei
* @date 2022-11-22 * @date 2024-11-01
*/ */
public class BaseAreaQuery extends BaseAreaEntity { public class BaseAreaQuery extends BaseAreaEntity {
/** 开始 序号,主键,自增长 */ /** 开始 序号,主键,自增长 */
...@@ -21,33 +21,54 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -21,33 +21,54 @@ public class BaseAreaQuery extends BaseAreaEntity {
/** 序号,主键,自增长列表 */ /** 序号,主键,自增长列表 */
private List <Long> idList; private List <Long> idList;
/** 序号,主键,自增长排除列表 */
private List <Long> idNotList;
/** 祖级列表,逗号分隔 */ /** 祖级列表,逗号分隔 */
private List<String> ancestorsList; private List<String> ancestorsList;
/** 祖级列表,逗号分隔排除列表 */
private List <String> ancestorsNotList;
/** 区域名称 */ /** 区域名称 */
private List<String> nameList; private List<String> nameList;
/** 区域名称排除列表 */
private List <String> nameNotList;
/** 一体化的ID号 */ /** 一体化的ID号 */
private List<String> iidList; private List<String> iidList;
/** 一体化的ID号排除列表 */
private List <String> iidNotList;
/** 一体化的父id */ /** 一体化的父id */
private List<String> pidList; private List<String> pidList;
/** 一体化的父id排除列表 */
private List <String> pidNotList;
/** 是否有下级区域(True.是,False.否) */ /** 是否有下级区域(True.是,False.否) */
private List<String> haveSonAreaList; private List<String> haveSonAreaList;
/** 是否有下级区域(True.是,False.否)排除列表 */
private List <String> haveSonAreaNotList;
/** 是否有下级部门(True.是,False.否) */ /** 是否有下级部门(True.是,False.否) */
private List<String> haveSonDeptList; private List<String> haveSonDeptList;
/** 是否有下级部门(True.是,False.否)排除列表 */
private List <String> haveSonDeptNotList;
/** 是否获取部门(true.是,false.否) */ /** 是否获取部门(true.是,false.否) */
private List<String> haveGetDeptList; private List<String> haveGetDeptList;
/** 是否获取部门(true.是,false.否)排除列表 */
private List <String> haveGetDeptNotList;
/** 是否获取事项列表(true.是,false.否) */ /** 是否获取事项列表(true.是,false.否) */
private List<String> haveGetMatterListList; private List<String> haveGetMatterListList;
/** 是否获取事项列表(true.是,false.否)排除列表 */
private List <String> haveGetMatterListNotList;
/** 区域编码 */ /** 区域编码 */
private List<String> areaCodeList; private List<String> areaCodeList;
/** 区域编码排除列表 */
private List <String> areaCodeNotList;
/** 开始 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区) */ /** 开始 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区) */
private Integer areaLevelStart; private Integer areaLevelStart;
...@@ -60,12 +81,19 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -60,12 +81,19 @@ public class BaseAreaQuery extends BaseAreaEntity {
/** 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)列表 */ /** 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)列表 */
private List <Integer> areaLevelList; private List <Integer> areaLevelList;
/** 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)排除列表 */
private List <Integer> areaLevelNotList;
/** 名称简称 */ /** 名称简称 */
private List<String> shortNameList; private List<String> shortNameList;
/** 名称简称排除列表 */
private List <String> shortNameNotList;
/** 访问地址 */ /** 访问地址 */
private List<String> domainList; private List<String> domainList;
/** 访问地址排除列表 */
private List <String> domainNotList;
/** 开始 区域状态 (0.停用,1.正常) */ /** 开始 区域状态 (0.停用,1.正常) */
private Integer statusStart; private Integer statusStart;
...@@ -78,6 +106,9 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -78,6 +106,9 @@ public class BaseAreaQuery extends BaseAreaEntity {
/** 区域状态 (0.停用,1.正常)列表 */ /** 区域状态 (0.停用,1.正常)列表 */
private List <Integer> statusList; private List <Integer> statusList;
/** 区域状态 (0.停用,1.正常)排除列表 */
private List <Integer> statusNotList;
/** 开始 创建时间 */ /** 开始 创建时间 */
private String createTimeStart; private String createTimeStart;
...@@ -96,6 +127,9 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -96,6 +127,9 @@ public class BaseAreaQuery extends BaseAreaEntity {
/** 创建用户列表 */ /** 创建用户列表 */
private List <Long> createUserIdList; private List <Long> createUserIdList;
/** 创建用户排除列表 */
private List <Long> createUserIdNotList;
/** 开始 修改时间 */ /** 开始 修改时间 */
private String updateTimeStart; private String updateTimeStart;
...@@ -174,6 +208,23 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -174,6 +208,23 @@ public class BaseAreaQuery extends BaseAreaEntity {
this.idList = idList; this.idList = idList;
} }
/**
* 获取 序号,主键,自增长
* @return idNotList
*/
public List<Long> getIdNotList(){
return this.idNotList;
}
/**
* 设置 序号,主键,自增长
* @param idNotList
*/
public void setIdNotList(List<Long> idNotList){
this.idNotList = idNotList;
}
/** /**
* 获取 祖级列表,逗号分隔 * 获取 祖级列表,逗号分隔
* @return ancestorsList * @return ancestorsList
...@@ -189,6 +240,23 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -189,6 +240,23 @@ public class BaseAreaQuery extends BaseAreaEntity {
public void setAncestorsList(List<String> ancestorsList){ public void setAncestorsList(List<String> ancestorsList){
this.ancestorsList = ancestorsList; this.ancestorsList = ancestorsList;
} }
/**
* 获取 祖级列表,逗号分隔
* @return ancestorsNotList
*/
public List<String> getAncestorsNotList(){
return this.ancestorsNotList;
}
/**
* 设置 祖级列表,逗号分隔
* @param ancestorsNotList
*/
public void setAncestorsNotList(List<String> ancestorsNotList){
this.ancestorsNotList = ancestorsNotList;
}
/** /**
* 获取 区域名称 * 获取 区域名称
* @return nameList * @return nameList
...@@ -204,6 +272,23 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -204,6 +272,23 @@ public class BaseAreaQuery extends BaseAreaEntity {
public void setNameList(List<String> nameList){ public void setNameList(List<String> nameList){
this.nameList = nameList; this.nameList = nameList;
} }
/**
* 获取 区域名称
* @return nameNotList
*/
public List<String> getNameNotList(){
return this.nameNotList;
}
/**
* 设置 区域名称
* @param nameNotList
*/
public void setNameNotList(List<String> nameNotList){
this.nameNotList = nameNotList;
}
/** /**
* 获取 一体化的ID号 * 获取 一体化的ID号
* @return iidList * @return iidList
...@@ -219,6 +304,23 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -219,6 +304,23 @@ public class BaseAreaQuery extends BaseAreaEntity {
public void setIidList(List<String> iidList){ public void setIidList(List<String> iidList){
this.iidList = iidList; this.iidList = iidList;
} }
/**
* 获取 一体化的ID号
* @return iidNotList
*/
public List<String> getIidNotList(){
return this.iidNotList;
}
/**
* 设置 一体化的ID号
* @param iidNotList
*/
public void setIidNotList(List<String> iidNotList){
this.iidNotList = iidNotList;
}
/** /**
* 获取 一体化的父id * 获取 一体化的父id
* @return pidList * @return pidList
...@@ -234,6 +336,23 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -234,6 +336,23 @@ public class BaseAreaQuery extends BaseAreaEntity {
public void setPidList(List<String> pidList){ public void setPidList(List<String> pidList){
this.pidList = pidList; this.pidList = pidList;
} }
/**
* 获取 一体化的父id
* @return pidNotList
*/
public List<String> getPidNotList(){
return this.pidNotList;
}
/**
* 设置 一体化的父id
* @param pidNotList
*/
public void setPidNotList(List<String> pidNotList){
this.pidNotList = pidNotList;
}
/** /**
* 获取 是否有下级区域(True.是,False.否) * 获取 是否有下级区域(True.是,False.否)
* @return haveSonAreaList * @return haveSonAreaList
...@@ -249,6 +368,23 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -249,6 +368,23 @@ public class BaseAreaQuery extends BaseAreaEntity {
public void setHaveSonAreaList(List<String> haveSonAreaList){ public void setHaveSonAreaList(List<String> haveSonAreaList){
this.haveSonAreaList = haveSonAreaList; this.haveSonAreaList = haveSonAreaList;
} }
/**
* 获取 是否有下级区域(True.是,False.否)
* @return haveSonAreaNotList
*/
public List<String> getHaveSonAreaNotList(){
return this.haveSonAreaNotList;
}
/**
* 设置 是否有下级区域(True.是,False.否)
* @param haveSonAreaNotList
*/
public void setHaveSonAreaNotList(List<String> haveSonAreaNotList){
this.haveSonAreaNotList = haveSonAreaNotList;
}
/** /**
* 获取 是否有下级部门(True.是,False.否) * 获取 是否有下级部门(True.是,False.否)
* @return haveSonDeptList * @return haveSonDeptList
...@@ -264,6 +400,23 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -264,6 +400,23 @@ public class BaseAreaQuery extends BaseAreaEntity {
public void setHaveSonDeptList(List<String> haveSonDeptList){ public void setHaveSonDeptList(List<String> haveSonDeptList){
this.haveSonDeptList = haveSonDeptList; this.haveSonDeptList = haveSonDeptList;
} }
/**
* 获取 是否有下级部门(True.是,False.否)
* @return haveSonDeptNotList
*/
public List<String> getHaveSonDeptNotList(){
return this.haveSonDeptNotList;
}
/**
* 设置 是否有下级部门(True.是,False.否)
* @param haveSonDeptNotList
*/
public void setHaveSonDeptNotList(List<String> haveSonDeptNotList){
this.haveSonDeptNotList = haveSonDeptNotList;
}
/** /**
* 获取 是否获取部门(true.是,false.否) * 获取 是否获取部门(true.是,false.否)
* @return haveGetDeptList * @return haveGetDeptList
...@@ -279,6 +432,23 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -279,6 +432,23 @@ public class BaseAreaQuery extends BaseAreaEntity {
public void setHaveGetDeptList(List<String> haveGetDeptList){ public void setHaveGetDeptList(List<String> haveGetDeptList){
this.haveGetDeptList = haveGetDeptList; this.haveGetDeptList = haveGetDeptList;
} }
/**
* 获取 是否获取部门(true.是,false.否)
* @return haveGetDeptNotList
*/
public List<String> getHaveGetDeptNotList(){
return this.haveGetDeptNotList;
}
/**
* 设置 是否获取部门(true.是,false.否)
* @param haveGetDeptNotList
*/
public void setHaveGetDeptNotList(List<String> haveGetDeptNotList){
this.haveGetDeptNotList = haveGetDeptNotList;
}
/** /**
* 获取 是否获取事项列表(true.是,false.否) * 获取 是否获取事项列表(true.是,false.否)
* @return haveGetMatterListList * @return haveGetMatterListList
...@@ -294,6 +464,23 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -294,6 +464,23 @@ public class BaseAreaQuery extends BaseAreaEntity {
public void setHaveGetMatterListList(List<String> haveGetMatterListList){ public void setHaveGetMatterListList(List<String> haveGetMatterListList){
this.haveGetMatterListList = haveGetMatterListList; this.haveGetMatterListList = haveGetMatterListList;
} }
/**
* 获取 是否获取事项列表(true.是,false.否)
* @return haveGetMatterListNotList
*/
public List<String> getHaveGetMatterListNotList(){
return this.haveGetMatterListNotList;
}
/**
* 设置 是否获取事项列表(true.是,false.否)
* @param haveGetMatterListNotList
*/
public void setHaveGetMatterListNotList(List<String> haveGetMatterListNotList){
this.haveGetMatterListNotList = haveGetMatterListNotList;
}
/** /**
* 获取 区域编码 * 获取 区域编码
* @return areaCodeList * @return areaCodeList
...@@ -309,6 +496,23 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -309,6 +496,23 @@ public class BaseAreaQuery extends BaseAreaEntity {
public void setAreaCodeList(List<String> areaCodeList){ public void setAreaCodeList(List<String> areaCodeList){
this.areaCodeList = areaCodeList; this.areaCodeList = areaCodeList;
} }
/**
* 获取 区域编码
* @return areaCodeNotList
*/
public List<String> getAreaCodeNotList(){
return this.areaCodeNotList;
}
/**
* 设置 区域编码
* @param areaCodeNotList
*/
public void setAreaCodeNotList(List<String> areaCodeNotList){
this.areaCodeNotList = areaCodeNotList;
}
/** /**
* 获取 开始 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区) * 获取 开始 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @return areaLevelStart * @return areaLevelStart
...@@ -373,6 +577,23 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -373,6 +577,23 @@ public class BaseAreaQuery extends BaseAreaEntity {
this.areaLevelList = areaLevelList; this.areaLevelList = areaLevelList;
} }
/**
* 获取 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @return areaLevelNotList
*/
public List<Integer> getAreaLevelNotList(){
return this.areaLevelNotList;
}
/**
* 设置 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @param areaLevelNotList
*/
public void setAreaLevelNotList(List<Integer> areaLevelNotList){
this.areaLevelNotList = areaLevelNotList;
}
/** /**
* 获取 名称简称 * 获取 名称简称
* @return shortNameList * @return shortNameList
...@@ -388,6 +609,23 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -388,6 +609,23 @@ public class BaseAreaQuery extends BaseAreaEntity {
public void setShortNameList(List<String> shortNameList){ public void setShortNameList(List<String> shortNameList){
this.shortNameList = shortNameList; this.shortNameList = shortNameList;
} }
/**
* 获取 名称简称
* @return shortNameNotList
*/
public List<String> getShortNameNotList(){
return this.shortNameNotList;
}
/**
* 设置 名称简称
* @param shortNameNotList
*/
public void setShortNameNotList(List<String> shortNameNotList){
this.shortNameNotList = shortNameNotList;
}
/** /**
* 获取 访问地址 * 获取 访问地址
* @return domainList * @return domainList
...@@ -403,6 +641,23 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -403,6 +641,23 @@ public class BaseAreaQuery extends BaseAreaEntity {
public void setDomainList(List<String> domainList){ public void setDomainList(List<String> domainList){
this.domainList = domainList; this.domainList = domainList;
} }
/**
* 获取 访问地址
* @return domainNotList
*/
public List<String> getDomainNotList(){
return this.domainNotList;
}
/**
* 设置 访问地址
* @param domainNotList
*/
public void setDomainNotList(List<String> domainNotList){
this.domainNotList = domainNotList;
}
/** /**
* 获取 开始 区域状态 (0.停用,1.正常) * 获取 开始 区域状态 (0.停用,1.正常)
* @return statusStart * @return statusStart
...@@ -467,6 +722,23 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -467,6 +722,23 @@ public class BaseAreaQuery extends BaseAreaEntity {
this.statusList = statusList; this.statusList = statusList;
} }
/**
* 获取 区域状态 (0.停用,1.正常)
* @return statusNotList
*/
public List<Integer> getStatusNotList(){
return this.statusNotList;
}
/**
* 设置 区域状态 (0.停用,1.正常)
* @param statusNotList
*/
public void setStatusNotList(List<Integer> statusNotList){
this.statusNotList = statusNotList;
}
/** /**
* 获取 开始 创建时间 * 获取 开始 创建时间
* @return createTimeStart * @return createTimeStart
...@@ -563,6 +835,23 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -563,6 +835,23 @@ public class BaseAreaQuery extends BaseAreaEntity {
this.createUserIdList = createUserIdList; this.createUserIdList = createUserIdList;
} }
/**
* 获取 创建用户
* @return createUserIdNotList
*/
public List<Long> getCreateUserIdNotList(){
return this.createUserIdNotList;
}
/**
* 设置 创建用户
* @param createUserIdNotList
*/
public void setCreateUserIdNotList(List<Long> createUserIdNotList){
this.createUserIdNotList = createUserIdNotList;
}
/** /**
* 获取 开始 修改时间 * 获取 开始 修改时间
* @return updateTimeStart * @return updateTimeStart
...@@ -640,6 +929,15 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -640,6 +929,15 @@ public class BaseAreaQuery extends BaseAreaEntity {
return this; return this;
} }
/**
* 设置 序号,主键,自增长
* @param idNotList
*/
public BaseAreaQuery idNotList(List<Long> idNotList){
this.idNotList = idNotList;
return this;
}
/** /**
* 设置 祖级列表,逗号分隔 * 设置 祖级列表,逗号分隔
...@@ -856,6 +1154,15 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -856,6 +1154,15 @@ public class BaseAreaQuery extends BaseAreaEntity {
return this; return this;
} }
/**
* 设置 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @param areaLevelNotList
*/
public BaseAreaQuery areaLevelNotList(List<Integer> areaLevelNotList){
this.areaLevelNotList = areaLevelNotList;
return this;
}
/** /**
* 设置 名称简称 * 设置 名称简称
...@@ -939,6 +1246,15 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -939,6 +1246,15 @@ public class BaseAreaQuery extends BaseAreaEntity {
return this; return this;
} }
/**
* 设置 区域状态 (0.停用,1.正常)
* @param statusNotList
*/
public BaseAreaQuery statusNotList(List<Integer> statusNotList){
this.statusNotList = statusNotList;
return this;
}
/** /**
* 设置 创建用户 * 设置 创建用户
...@@ -985,6 +1301,15 @@ public class BaseAreaQuery extends BaseAreaEntity { ...@@ -985,6 +1301,15 @@ public class BaseAreaQuery extends BaseAreaEntity {
return this; return this;
} }
/**
* 设置 创建用户
* @param createUserIdNotList
*/
public BaseAreaQuery createUserIdNotList(List<Long> createUserIdNotList){
this.createUserIdNotList = createUserIdNotList;
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)
......
package com.mortals.xhx.module.base.model;
import java.lang.reflect.Type;
import java.util.List;
import java.util.ArrayList;
import com.mortals.xhx.module.base.model.vo.BaseAreaVo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.DefaultJSONParser;
import com.alibaba.fastjson.parser.JSONToken;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;
import org.springframework.util.ObjectUtils;
/**
* 区域前端映射树结构实体类
*
* @author zxfei
* @date 2024-11-01
*/
@Data
public class BaseAreaTreeSelect implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 节点ID
*/
private Long id;
/**
* 节点名称
*/
private String label;
/**
* 区域编码
*/
private String areaCode;
/**
* 是否叶子节点
*/
private Boolean isLeaf;
/**
* 节点类型
*/
private String type;
/**
* 图标
*/
private String icon;
/**
* 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
*/
private Integer areaLevel;
/**
* 子节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<BaseAreaTreeSelect> children;
public BaseAreaTreeSelect() {};
public BaseAreaTreeSelect(BaseAreaEntity entity) {
this.id = entity.getId();
this.label = entity.getName();
if ("False".equalsIgnoreCase(entity.getHaveSonArea())) {
this.isLeaf = true;
this.children = new ArrayList();
} else {
this.isLeaf = false;
}
this.areaCode=entity.getAreaCode();
this.areaLevel=entity.getAreaLevel();
this.type = "area";
this.icon = "el-icon-folder";
if(!ObjectUtils.isEmpty(entity.getChildren())){
this.children = entity.getChildren().stream().map(BaseAreaTreeSelect::new).collect(Collectors.toList());
}
}
// 反序列化器
public class Deserializer implements ObjectDeserializer {
@Override
public BaseAreaTreeSelect deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
BaseAreaTreeSelect node = new BaseAreaTreeSelect();
JSONObject jsonObject = parser.parseObject();
node.setId(jsonObject.getLong("id"));
node.setLabel(jsonObject.getString("label"));
JSONArray jsonArray = jsonObject.getJSONArray("children");
List<BaseAreaTreeSelect> children = new ArrayList<>();
if(!ObjectUtils.isEmpty(jsonArray)){
for (int i = 0; i < jsonArray.size(); i++) {
BaseAreaTreeSelect child = JSON.parseObject(jsonArray.getJSONObject(i).toJSONString(), BaseAreaTreeSelect.class);
children.add(child);
}
}
node.setChildren(children);
return node;
}
@Override
public int getFastMatchToken() {
return JSONToken.LBRACE;
}
}
}
\ No newline at end of file
package com.mortals.xhx.module.base.model.vo; package com.mortals.xhx.module.base.model.vo;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.base.model.BaseAreaEntity; import com.mortals.xhx.module.base.model.BaseAreaEntity;
import lombok.Data;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/** /**
* 区域视图对象 * 区域视图对象
* *
* @author zxfei * @author zxfei
* @date 2022-11-22 * @date 2024-11-01
*/ */
@Data @Data
public class BaseAreaVo extends BaseEntityLong { public class BaseAreaVo extends BaseEntityLong {
private List<BaseAreaEntity> children = new ArrayList<>();
/** 序号,主键,自增长列表 */
private List <Long> idList;
/** 子区域 */
private List<BaseAreaEntity> children = new ArrayList<>();
} }
\ No newline at end of file
package com.mortals.xhx.module.base.service; package com.mortals.xhx.module.base.service;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.base.model.BaseAreaEntity; import com.mortals.xhx.module.base.model.BaseAreaEntity;
import com.mortals.xhx.module.base.model.BaseAreaTreeSelect;
import java.util.List;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
/** /**
* BaseAreaService * BaseAreaService
* <p> *
* 区域 service接口 * 区域 service接口
* *
* @author zxfei * @author zxfei
* @date 2022-11-22 * @date 2024-11-01
*/ */
public interface BaseAreaService extends ICRUDService<BaseAreaEntity, Long> { public interface BaseAreaService extends ICRUDService<BaseAreaEntity,Long>{
/**
* 是否存在区域节点
*
* @param baseAreaId 区域ID
* @return 结果
*/
boolean hasChildByBaseAreaId(String baseAreaId);
/**
* 构建前端所需要下拉树结构
*
* @param baseAreaList 区域列表
* @return 下拉树结构列表
*/
List<BaseAreaTreeSelect> buildBaseAreaTreeSelect(List<BaseAreaEntity> baseAreaList);
/**
* 根据父id查询子节点
* @param parentId
* @param context
* @return
*/
List<BaseAreaTreeSelect> getListByParentId(String parentId,Context context);
} }
\ No newline at end of file
package com.mortals.xhx.module.base.service.impl; package com.mortals.xhx.module.base.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.base.dao.BaseAreaDao; import com.mortals.xhx.module.base.dao.BaseAreaDao;
import com.mortals.xhx.module.base.model.BaseAreaEntity; import com.mortals.xhx.module.base.model.BaseAreaEntity;
import com.mortals.xhx.module.base.model.BaseAreaQuery;
import com.mortals.xhx.module.base.service.BaseAreaService; import com.mortals.xhx.module.base.service.BaseAreaService;
import org.springframework.stereotype.Service; import com.mortals.xhx.module.base.model.BaseAreaTreeSelect;
import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* BaseAreaService * BaseAreaService
* 区域 service实现 * 区域 service实现
* *
* @author zxfei * @author zxfei
* @date 2022-11-22 * @date 2024-11-01
*/ */
@Service("baseAreaService") @Service("baseAreaService")
public class BaseAreaServiceImpl extends AbstractCRUDServiceImpl<BaseAreaDao, BaseAreaEntity, Long> implements BaseAreaService { public class BaseAreaServiceImpl extends AbstractCRUDServiceImpl<BaseAreaDao, BaseAreaEntity, Long> implements BaseAreaService {
/**
* 修改子元素关系
*
* @param baseAreaId 被修改的区域ID
* @param newAncestors 新的父ID集合
* @param oldAncestors 旧的父ID集合
*/
public void updateBaseAreaChildren(Long baseAreaId, String newAncestors, String oldAncestors, Context context) {
List<BaseAreaEntity> children = getDao().selectChildrenBaseAreaById(baseAreaId.toString());
for (BaseAreaEntity child : children) {
child.setAncestors(child.getAncestors().replace(oldAncestors, newAncestors));
}
if (children.size() > 0) {
this.updateAfter(children, context);
}
}
@Override
protected void removeBefore(Long[] ids, Context context) throws AppException {
//有子节点 禁止删除
if (!ObjectUtils.isEmpty(ids)) {
BaseAreaEntity baseAreaEntity = this.get(ids[0]);
if(hasChildByBaseAreaId(baseAreaEntity.getIid())){
throw new AppException("存在下级区域,不允许删除");
}
}
super.removeBefore(ids, context);
}
@Override
public boolean hasChildByBaseAreaId(String baseAreaId) {
List<BaseAreaEntity> list = this.find(new BaseAreaQuery().pid(baseAreaId));
return list.size() > 0 ? true : false;
}
@Override
public List<BaseAreaTreeSelect> buildBaseAreaTreeSelect(List<BaseAreaEntity> list) {
List<BaseAreaEntity> returnList = new ArrayList<>();
List<Long> tempList = list.stream().map(BaseAreaEntity::getId).collect(Collectors.toList());
for (Iterator<BaseAreaEntity> iterator = list.iterator(); iterator.hasNext(); ) {
BaseAreaEntity baseAreaEntity = iterator.next();
if (!tempList.contains(baseAreaEntity.getPid())) {
recursionFn(list, baseAreaEntity);
returnList.add(baseAreaEntity);
}
}
if (returnList.isEmpty()) {
returnList = list;
}
return returnList.stream().map(BaseAreaTreeSelect::new).collect(Collectors.toList());
}
/**
* 递归列表
*/
private void recursionFn(List<BaseAreaEntity> list, BaseAreaEntity t) {
// 得到子节点列表
List<BaseAreaEntity> childList = getChildList(list, t);
t.setChildren(childList);
for (BaseAreaEntity tChild : childList) {
if (hasChild(list, tChild)) {
recursionFn(list, tChild);
}
}
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<BaseAreaEntity> list, BaseAreaEntity t) {
return getChildList(list, t).size() > 0 ? true : false;
}
/**
* 得到子节点列表
*/
private List<BaseAreaEntity> getChildList(List<BaseAreaEntity> list, BaseAreaEntity t) {
return list.stream().map(item->{
if (!ObjectUtils.isEmpty(item.getPid()) && item.getPid().equals(t.getIid())) {
return item;
}
return null;
}).filter(f->f!=null).collect(Collectors.toList());
}
@Override
public List<BaseAreaTreeSelect> getListByParentId(String parentId, Context context) {
if (ObjectUtils.isEmpty(parentId)) {
parentId = "0";
}
//只做一层
List<BaseAreaTreeSelect> collect = this.find(new BaseAreaQuery().pid(parentId), context).stream().map(item -> new BaseAreaTreeSelect(item)
).collect(Collectors.toList());
return collect;
}
} }
\ No newline at end of file
package com.mortals.xhx.module.base.web; package com.mortals.xhx.module.base.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.base.model.BaseAreaEntity;
import com.mortals.xhx.module.base.service.BaseAreaService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; 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.base.model.BaseAreaEntity;
import com.mortals.xhx.module.base.service.BaseAreaService;
import com.mortals.xhx.module.base.model.BaseAreaQuery;
import com.mortals.xhx.module.base.model.BaseAreaTreeSelect;
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.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.*;
import com.mortals.xhx.common.code.*;
/** /**
* 区域 *
* * 区域
* @author zxfei *
* @date 2022-11-22 * @author zxfei
*/ * @date 2024-11-01
*/
@RestController @RestController
@RequestMapping("base/area") @RequestMapping("base/area")
public class BaseAreaController extends BaseCRUDJsonBodyMappingController<BaseAreaService, BaseAreaEntity, Long> { public class BaseAreaController extends BaseCRUDJsonBodyMappingController<BaseAreaService,BaseAreaEntity,Long> {
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
@Autowired
private ICacheService cacheService;
public BaseAreaController() { public BaseAreaController(){
super.setModuleDesc("区域"); super.setModuleDesc( "区域");
} }
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "haveSonArea", paramService.getParamBySecondOrganize("BaseArea", "haveSonArea")); this.addDict(model, "haveSonArea", HaveSonAreaEnum.getEnumMap());
this.addDict(model, "haveSonDept", paramService.getParamBySecondOrganize("BaseArea", "haveSonDept")); this.addDict(model, "haveSonDept", HaveSonDeptEnum.getEnumMap());
this.addDict(model, "haveGetDept", paramService.getParamBySecondOrganize("BaseArea", "haveGetDept")); this.addDict(model, "haveGetDept", HaveGetDeptEnum.getEnumMap());
this.addDict(model, "haveGetMatterList", paramService.getParamBySecondOrganize("BaseArea", "haveGetMatterList")); this.addDict(model, "haveGetMatterList", HaveGetMatterListEnum.getEnumMap());
this.addDict(model, "areaLevel", paramService.getParamBySecondOrganize("BaseArea", "areaLevel")); this.addDict(model, "areaLevel", AreaLevelEnum.getEnumMap());
this.addDict(model, "status", paramService.getParamBySecondOrganize("BaseArea", "status")); this.addDict(model, "status", StatusEnum.getEnumMap());
super.init(model, context); super.init(model, context);
} }
/**
* 获取站点下拉树列表
*/
@PostMapping("treeselect")
@UnAuth
public String treeselect() {
Map<String, Object> model = new HashMap<>();
JSONObject ret = new JSONObject();
String busiDesc = "查询" + this.getModuleDesc();
int code=VALUE_RESULT_SUCCESS;
try {
List<BaseAreaEntity> list = this.service.find(new BaseAreaQuery());
List<BaseAreaTreeSelect> treeSelects = this.service.buildBaseAreaTreeSelect(list);
model.put("result", treeSelects);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
}
ret.put(KEY_RESULT_DATA, model);
ret.put(KEY_RESULT_CODE, code);
return ret.toJSONString();
}
/**
* 根据parentId查询子信息
*/
@GetMapping(value = "getListByParentId")
@UnAuth
public String getListByParentId(String parentId) {
JSONObject ret = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = "查询" + this.getModuleDesc()+"子节点";
try {
List<BaseAreaTreeSelect> treeList = this.service.getListByParentId(parentId, getContext());
model.put(RESULT_KEY,treeList);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_DATA, model);
recordSysLog(request, busiDesc+"【成功】");
} catch (Exception e) {
log.error("根据parentId查询子信息错误", e);
this.doException(request, busiDesc, model, e);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, e.getMessage());
}
return ret.toJSONString();
}
} }
\ No newline at end of file
...@@ -22,10 +22,8 @@ ...@@ -22,10 +22,8 @@
<result property="createTime" column="createTime" /> <result property="createTime" column="createTime" />
<result property="createUserId" column="createUserId" /> <result property="createUserId" column="createUserId" />
<result property="updateTime" column="updateTime" /> <result property="updateTime" column="updateTime" />
</resultMap> </resultMap>
<!-- 表所有列 --> <!-- 表所有列 -->
<sql id="_columns"> <sql id="_columns">
<trim suffixOverrides="," suffix=""> <trim suffixOverrides="," suffix="">
...@@ -364,6 +362,10 @@ ...@@ -364,6 +362,10 @@
</select> </select>
<!-- 获取子节点 -->
<select id="selectChildrenBaseAreaById" parameterType="String" resultMap="BaseAreaEntity-Map">
select * from mortals_sys_base_area as a where find_in_set(#{baseAreaId}, ancestors)
</select>
<!-- 获取 --> <!-- 获取 -->
<select id="getListCount" parameterType="paramDto" resultType="int"> <select id="getListCount" parameterType="paramDto" resultType="int">
...@@ -413,6 +415,10 @@ ...@@ -413,6 +415,10 @@
<!-- 条件映射-代参数 --> <!-- 条件映射-代参数 -->
<sql id="_condition_param_"> <sql id="_condition_param_">
<bind name="conditionParamRef" value="${_conditionParam_}"/> <bind name="conditionParamRef" value="${_conditionParam_}"/>
<if test="permissionSql != null and permissionSql != ''">
${permissionSql}
</if>
<if test="conditionParamRef.containsKey('id')"> <if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null"> <if test="conditionParamRef.id != null">
${_conditionType_} a.id=#{${_conditionParam_}.id} ${_conditionType_} a.id=#{${_conditionParam_}.id}
...@@ -426,12 +432,18 @@ ...@@ -426,12 +432,18 @@
${_conditionType_} a.id is null ${_conditionType_} a.id is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('idList')"> <if test="conditionParamRef.containsKey('idList') and conditionParamRef.idList.size() > 0">
${_conditionType_} a.id in ${_conditionType_} a.id in
<foreach collection="conditionParamRef.idList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.idList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('idNotList') and conditionParamRef.idNotList.size() > 0">
${_conditionType_} a.id not in
<foreach collection="conditionParamRef.idNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('idStart') and conditionParamRef.idStart != null"> <if test="conditionParamRef.containsKey('idStart') and conditionParamRef.idStart != null">
${_conditionType_} a.id <![CDATA[ >= ]]> #{${_conditionParam_}.idStart} ${_conditionType_} a.id <![CDATA[ >= ]]> #{${_conditionParam_}.idStart}
</if> </if>
...@@ -448,12 +460,18 @@ ...@@ -448,12 +460,18 @@
${_conditionType_} a.ancestors is null ${_conditionType_} a.ancestors is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('ancestorsList')"> <if test="conditionParamRef.containsKey('ancestorsList') and conditionParamRef.ancestorsList.size() > 0">
${_conditionType_} a.ancestors in ${_conditionType_} a.ancestors in
<foreach collection="conditionParamRef.ancestorsList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.ancestorsList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('ancestorsNotList') and conditionParamRef.ancestorsNotList.size() > 0">
${_conditionType_} a.ancestors not in
<foreach collection="conditionParamRef.ancestorsNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('name')"> <if test="conditionParamRef.containsKey('name')">
<if test="conditionParamRef.name != null and conditionParamRef.name != ''"> <if test="conditionParamRef.name != null and conditionParamRef.name != ''">
...@@ -463,12 +481,18 @@ ...@@ -463,12 +481,18 @@
${_conditionType_} a.name is null ${_conditionType_} a.name is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('nameList')"> <if test="conditionParamRef.containsKey('nameList') and conditionParamRef.nameList.size() > 0">
${_conditionType_} a.name in ${_conditionType_} a.name in
<foreach collection="conditionParamRef.nameList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.nameList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('nameNotList') and conditionParamRef.nameNotList.size() > 0">
${_conditionType_} a.name not in
<foreach collection="conditionParamRef.nameNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('iid')"> <if test="conditionParamRef.containsKey('iid')">
<if test="conditionParamRef.iid != null and conditionParamRef.iid != ''"> <if test="conditionParamRef.iid != null and conditionParamRef.iid != ''">
...@@ -478,12 +502,18 @@ ...@@ -478,12 +502,18 @@
${_conditionType_} a.iid is null ${_conditionType_} a.iid is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('iidList')"> <if test="conditionParamRef.containsKey('iidList') and conditionParamRef.iidList.size() > 0">
${_conditionType_} a.iid in ${_conditionType_} a.iid in
<foreach collection="conditionParamRef.iidList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.iidList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('iidNotList') and conditionParamRef.iidNotList.size() > 0">
${_conditionType_} a.iid not in
<foreach collection="conditionParamRef.iidNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('pid')"> <if test="conditionParamRef.containsKey('pid')">
<if test="conditionParamRef.pid != null and conditionParamRef.pid != ''"> <if test="conditionParamRef.pid != null and conditionParamRef.pid != ''">
...@@ -493,12 +523,18 @@ ...@@ -493,12 +523,18 @@
${_conditionType_} a.pid is null ${_conditionType_} a.pid is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('pidList')"> <if test="conditionParamRef.containsKey('pidList') and conditionParamRef.pidList.size() > 0">
${_conditionType_} a.pid in ${_conditionType_} a.pid in
<foreach collection="conditionParamRef.pidList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.pidList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('pidNotList') and conditionParamRef.pidNotList.size() > 0">
${_conditionType_} a.pid not in
<foreach collection="conditionParamRef.pidNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('haveSonArea')"> <if test="conditionParamRef.containsKey('haveSonArea')">
<if test="conditionParamRef.haveSonArea != null and conditionParamRef.haveSonArea != ''"> <if test="conditionParamRef.haveSonArea != null and conditionParamRef.haveSonArea != ''">
...@@ -508,12 +544,18 @@ ...@@ -508,12 +544,18 @@
${_conditionType_} a.haveSonArea is null ${_conditionType_} a.haveSonArea is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('haveSonAreaList')"> <if test="conditionParamRef.containsKey('haveSonAreaList') and conditionParamRef.haveSonAreaList.size() > 0">
${_conditionType_} a.haveSonArea in ${_conditionType_} a.haveSonArea in
<foreach collection="conditionParamRef.haveSonAreaList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.haveSonAreaList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('haveSonAreaNotList') and conditionParamRef.haveSonAreaNotList.size() > 0">
${_conditionType_} a.haveSonArea not in
<foreach collection="conditionParamRef.haveSonAreaNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('haveSonDept')"> <if test="conditionParamRef.containsKey('haveSonDept')">
<if test="conditionParamRef.haveSonDept != null and conditionParamRef.haveSonDept != ''"> <if test="conditionParamRef.haveSonDept != null and conditionParamRef.haveSonDept != ''">
...@@ -523,12 +565,18 @@ ...@@ -523,12 +565,18 @@
${_conditionType_} a.haveSonDept is null ${_conditionType_} a.haveSonDept is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('haveSonDeptList')"> <if test="conditionParamRef.containsKey('haveSonDeptList') and conditionParamRef.haveSonDeptList.size() > 0">
${_conditionType_} a.haveSonDept in ${_conditionType_} a.haveSonDept in
<foreach collection="conditionParamRef.haveSonDeptList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.haveSonDeptList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('haveSonDeptNotList') and conditionParamRef.haveSonDeptNotList.size() > 0">
${_conditionType_} a.haveSonDept not in
<foreach collection="conditionParamRef.haveSonDeptNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('haveGetDept')"> <if test="conditionParamRef.containsKey('haveGetDept')">
<if test="conditionParamRef.haveGetDept != null and conditionParamRef.haveGetDept != ''"> <if test="conditionParamRef.haveGetDept != null and conditionParamRef.haveGetDept != ''">
...@@ -538,12 +586,18 @@ ...@@ -538,12 +586,18 @@
${_conditionType_} a.haveGetDept is null ${_conditionType_} a.haveGetDept is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('haveGetDeptList')"> <if test="conditionParamRef.containsKey('haveGetDeptList') and conditionParamRef.haveGetDeptList.size() > 0">
${_conditionType_} a.haveGetDept in ${_conditionType_} a.haveGetDept in
<foreach collection="conditionParamRef.haveGetDeptList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.haveGetDeptList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('haveGetDeptNotList') and conditionParamRef.haveGetDeptNotList.size() > 0">
${_conditionType_} a.haveGetDept not in
<foreach collection="conditionParamRef.haveGetDeptNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('haveGetMatterList')"> <if test="conditionParamRef.containsKey('haveGetMatterList')">
<if test="conditionParamRef.haveGetMatterList != null and conditionParamRef.haveGetMatterList != ''"> <if test="conditionParamRef.haveGetMatterList != null and conditionParamRef.haveGetMatterList != ''">
...@@ -553,12 +607,18 @@ ...@@ -553,12 +607,18 @@
${_conditionType_} a.haveGetMatterList is null ${_conditionType_} a.haveGetMatterList is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('haveGetMatterListList')"> <if test="conditionParamRef.containsKey('haveGetMatterListList') and conditionParamRef.haveGetMatterListList.size() > 0">
${_conditionType_} a.haveGetMatterList in ${_conditionType_} a.haveGetMatterList in
<foreach collection="conditionParamRef.haveGetMatterListList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.haveGetMatterListList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('haveGetMatterListNotList') and conditionParamRef.haveGetMatterListNotList.size() > 0">
${_conditionType_} a.haveGetMatterList not in
<foreach collection="conditionParamRef.haveGetMatterListNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('areaCode')"> <if test="conditionParamRef.containsKey('areaCode')">
<if test="conditionParamRef.areaCode != null and conditionParamRef.areaCode != ''"> <if test="conditionParamRef.areaCode != null and conditionParamRef.areaCode != ''">
...@@ -568,12 +628,18 @@ ...@@ -568,12 +628,18 @@
${_conditionType_} a.areaCode is null ${_conditionType_} a.areaCode is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('areaCodeList')"> <if test="conditionParamRef.containsKey('areaCodeList') and conditionParamRef.areaCodeList.size() > 0">
${_conditionType_} a.areaCode in ${_conditionType_} a.areaCode in
<foreach collection="conditionParamRef.areaCodeList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.areaCodeList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('areaCodeNotList') and conditionParamRef.areaCodeNotList.size() > 0">
${_conditionType_} a.areaCode not in
<foreach collection="conditionParamRef.areaCodeNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('areaLevel')"> <if test="conditionParamRef.containsKey('areaLevel')">
<if test="conditionParamRef.areaLevel != null "> <if test="conditionParamRef.areaLevel != null ">
${_conditionType_} a.areaLevel = #{${_conditionParam_}.areaLevel} ${_conditionType_} a.areaLevel = #{${_conditionParam_}.areaLevel}
...@@ -582,12 +648,18 @@ ...@@ -582,12 +648,18 @@
${_conditionType_} a.areaLevel is null ${_conditionType_} a.areaLevel is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('areaLevelList')"> <if test="conditionParamRef.containsKey('areaLevelList') and conditionParamRef.areaLevelList.size() > 0">
${_conditionType_} a.areaLevel in ${_conditionType_} a.areaLevel in
<foreach collection="conditionParamRef.areaLevelList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.areaLevelList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('areaLevelNotList') and conditionParamRef.areaLevelNotList.size() > 0">
${_conditionType_} a.areaLevel not in
<foreach collection="conditionParamRef.areaLevelNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('areaLevelStart') and conditionParamRef.areaLevelStart != null"> <if test="conditionParamRef.containsKey('areaLevelStart') and conditionParamRef.areaLevelStart != null">
${_conditionType_} a.areaLevel <![CDATA[ >= ]]> #{${_conditionParam_}.areaLevelStart} ${_conditionType_} a.areaLevel <![CDATA[ >= ]]> #{${_conditionParam_}.areaLevelStart}
</if> </if>
...@@ -604,12 +676,18 @@ ...@@ -604,12 +676,18 @@
${_conditionType_} a.shortName is null ${_conditionType_} a.shortName is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('shortNameList')"> <if test="conditionParamRef.containsKey('shortNameList') and conditionParamRef.shortNameList.size() > 0">
${_conditionType_} a.shortName in ${_conditionType_} a.shortName in
<foreach collection="conditionParamRef.shortNameList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.shortNameList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('shortNameNotList') and conditionParamRef.shortNameNotList.size() > 0">
${_conditionType_} a.shortName not in
<foreach collection="conditionParamRef.shortNameNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('domain')"> <if test="conditionParamRef.containsKey('domain')">
<if test="conditionParamRef.domain != null and conditionParamRef.domain != ''"> <if test="conditionParamRef.domain != null and conditionParamRef.domain != ''">
...@@ -619,12 +697,18 @@ ...@@ -619,12 +697,18 @@
${_conditionType_} a.domain is null ${_conditionType_} a.domain is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('domainList')"> <if test="conditionParamRef.containsKey('domainList') and conditionParamRef.domainList.size() > 0">
${_conditionType_} a.domain in ${_conditionType_} a.domain in
<foreach collection="conditionParamRef.domainList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.domainList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('domainNotList') and conditionParamRef.domainNotList.size() > 0">
${_conditionType_} a.domain not in
<foreach collection="conditionParamRef.domainNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('status')"> <if test="conditionParamRef.containsKey('status')">
<if test="conditionParamRef.status != null "> <if test="conditionParamRef.status != null ">
${_conditionType_} a.status = #{${_conditionParam_}.status} ${_conditionType_} a.status = #{${_conditionParam_}.status}
...@@ -633,12 +717,18 @@ ...@@ -633,12 +717,18 @@
${_conditionType_} a.status is null ${_conditionType_} a.status is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('statusList')"> <if test="conditionParamRef.containsKey('statusList') and conditionParamRef.statusList.size() > 0">
${_conditionType_} a.status in ${_conditionType_} a.status in
<foreach collection="conditionParamRef.statusList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.statusList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('statusNotList') and conditionParamRef.statusNotList.size() > 0">
${_conditionType_} a.status not in
<foreach collection="conditionParamRef.statusNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('statusStart') and conditionParamRef.statusStart != null"> <if test="conditionParamRef.containsKey('statusStart') and conditionParamRef.statusStart != null">
${_conditionType_} a.status <![CDATA[ >= ]]> #{${_conditionParam_}.statusStart} ${_conditionType_} a.status <![CDATA[ >= ]]> #{${_conditionParam_}.statusStart}
</if> </if>
...@@ -669,12 +759,18 @@ ...@@ -669,12 +759,18 @@
${_conditionType_} a.createUserId is null ${_conditionType_} a.createUserId is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('createUserIdList')"> <if test="conditionParamRef.containsKey('createUserIdList') and conditionParamRef.createUserIdList.size() > 0">
${_conditionType_} a.createUserId in ${_conditionType_} a.createUserId in
<foreach collection="conditionParamRef.createUserIdList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.createUserIdList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('createUserIdNotList') and conditionParamRef.createUserIdNotList.size() > 0">
${_conditionType_} a.createUserId not in
<foreach collection="conditionParamRef.createUserIdNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('createUserIdStart') and conditionParamRef.createUserIdStart != null"> <if test="conditionParamRef.containsKey('createUserIdStart') and conditionParamRef.createUserIdStart != null">
${_conditionType_} a.createUserId <![CDATA[ >= ]]> #{${_conditionParam_}.createUserIdStart} ${_conditionType_} a.createUserId <![CDATA[ >= ]]> #{${_conditionParam_}.createUserIdStart}
</if> </if>
...@@ -701,14 +797,70 @@ ...@@ -701,14 +797,70 @@
<sql id="_orderCols_"> <sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()"> <if test="orderColList != null and !orderColList.isEmpty()">
order by order by
<if test="conditionParamRef.containsKey('idList') and conditionParamRef.idList.size() > 0">
field(a.id,
<foreach collection="conditionParamRef.idList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('areaLevelList') and conditionParamRef.areaLevelList.size() > 0">
field(a.areaLevel,
<foreach collection="conditionParamRef.areaLevelList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('statusList') and conditionParamRef.statusList.size() > 0">
field(a.status,
<foreach collection="conditionParamRef.statusList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('createUserIdList') and conditionParamRef.createUserIdList.size() > 0">
field(a.createUserId,
<foreach collection="conditionParamRef.createUserIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<trim suffixOverrides="," suffix=""> <trim suffixOverrides="," suffix="">
<foreach collection="orderColList" open="" close="" index="index" item="item" separator=","> <foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
${item.colName} ${item.sortKind} a.${item.colName} ${item.sortKind}
</foreach> </foreach>
</trim> </trim>
</if> </if>
<if test="(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()"> <if test="(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()">
order by order by
<if test="conditionParamRef.containsKey('idList') and conditionParamRef.idList.size() > 0">
field(a.id,
<foreach collection="conditionParamRef.idList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('areaLevelList') and conditionParamRef.areaLevelList.size() > 0">
field(a.areaLevel,
<foreach collection="conditionParamRef.areaLevelList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('statusList') and conditionParamRef.statusList.size() > 0">
field(a.status,
<foreach collection="conditionParamRef.statusList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('createUserIdList') and conditionParamRef.createUserIdList.size() > 0">
field(a.createUserId,
<foreach collection="conditionParamRef.createUserIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<trim suffixOverrides="," suffix=""> <trim suffixOverrides="," suffix="">
<if test="orderCol.containsKey('id')"> <if test="orderCol.containsKey('id')">
a.id a.id
...@@ -797,6 +949,8 @@ ...@@ -797,6 +949,8 @@
</if> </if>
</trim> </trim>
</if> </if>
</sql> </sql>
<sql id="_group_by_"> <sql id="_group_by_">
<if test="groupList != null and !groupList.isEmpty()"> <if test="groupList != null and !groupList.isEmpty()">
......
###登录
POST {{baseUrl}}/login/login
Content-Type: application/json
{
"loginName":"admin",
"password":"admin",
"securityCode":"8888"
}
> {%
client.global.set("SmsSet_id", JSON.parse(response.body).data.id);
client.global.set("authToken", JSON.parse(response.body).data.token);
%}
###区域列表
POST {{baseUrl}}/base/area/list
Content-Type: application/json
{
"page":1,
"size":10
}
###区域更新与保存
POST {{baseUrl}}/base/area/save
Authorization: {{authToken}}
Content-Type: application/json
{
"ancestors":"LdZ2li",
"name":"i3SKJc",
"iid":"suSUQY",
"pid":"uRSFOx",
"haveSonArea":"BfkquZ",
"haveSonDept":"pCokey",
"haveGetDept":"2yYsnf",
"haveGetMatterList":"r9jokc",
"areaCode":"gWJcgU",
"areaLevel":1,
"shortName":"fWbdcd",
"domain":"u7GMku",
"status":1,
}
> {%
client.global.set("BaseArea_id", JSON.parse(response.body).data.id);
%}
###区域查看
GET {{baseUrl}}/base/area/info?id=1
###区域编辑
GET {{baseUrl}}/base/area/edit?id=1
Accept: application/json
###区域删除
GET {{baseUrl}}/base/area/delete?id=1
Authorization: {{authToken}}
Accept: application/json
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