初始化项目
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.MyAreaSource;
|
||||
|
||||
/**
|
||||
* 区域信息 DAO 接口
|
||||
* @author gaoxq
|
||||
* @version 2026-03-21
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface MyAreaSourceDao extends CrudDao<MyAreaSource> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.MyCities;
|
||||
|
||||
/**
|
||||
* 城市信息 DAO 接口
|
||||
* @author gaoxq
|
||||
* @version 2026-03-21
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface MyCitiesDao extends CrudDao<MyCities> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.MyProvince;
|
||||
|
||||
/**
|
||||
* 省份信息 DAO 接口
|
||||
* @author gaoxq
|
||||
* @version 2026-03-21
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface MyProvinceDao extends CrudDao<MyProvince> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 区域信息 Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-03-21
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "my_area_source", alias = "a", label = "区域信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "area_id", attrName = "areaId", label = "唯一编号", isPK = true),
|
||||
@Column(name = "area_code", attrName = "areaCode", label = "区域编号"),
|
||||
@Column(name = "area_name", attrName = "areaName", label = "区域名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "p_area_code", attrName = "pareaCode", label = "上级编码"),
|
||||
@Column(name = "area_level", attrName = "areaLevel", label = "区域级别"),
|
||||
@Column(name = "tree_name", attrName = "treeName", label = "树形名称", isQuery = false),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "ustatus", attrName = "ustatus", label = "状态"),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class MyAreaSource extends DataEntity<MyAreaSource> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String areaId; // 唯一编号
|
||||
private String areaCode; // 区域编号
|
||||
private String areaName; // 区域名称
|
||||
private String pareaCode; // 上级编码
|
||||
private Integer areaLevel; // 区域级别
|
||||
private String treeName; // 树形名称
|
||||
private Date updateTime; // 更新时间
|
||||
private String ustatus; // 状态
|
||||
|
||||
public MyAreaSource() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public MyAreaSource(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 城市信息 Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-03-21
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "my_cities", alias = "a", label = "城市信息", columns = {
|
||||
@Column(name = "city_id", attrName = "cityId", label = "唯一主键", isPK = true),
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "province_code", attrName = "provinceCode", label = "省份编码"),
|
||||
@Column(name = "city_code", attrName = "cityCode", label = "市区编码", isQuery = false),
|
||||
@Column(name = "city_name", attrName = "cityName", label = "市区名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "area_code", attrName = "areaCode", label = "市区区号"),
|
||||
@Column(name = "area_type", attrName = "areaType", label = "市区级别"),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "ustatus", attrName = "ustatus", label = "状态"),
|
||||
}, joinTable = {
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = MyProvince.class, alias = "b",
|
||||
on = "a.province_code = b.province_code", attrName = "this",
|
||||
columns = {
|
||||
@Column(name = "province_name", attrName = "provinceName", label = "省份名称"),
|
||||
}),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class MyCities extends DataEntity<MyCities> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String cityId; // 唯一主键
|
||||
private Date createTime; // 记录时间
|
||||
private String provinceCode; // 省份编码
|
||||
private String cityCode; // 市区编码
|
||||
private String cityName; // 市区名称
|
||||
private String areaCode; // 市区区号
|
||||
private String areaType; // 市区级别
|
||||
private Date updateTime; // 更新时间
|
||||
private String ustatus; // 状态
|
||||
|
||||
private String provinceName;
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "唯一主键", attrName = "cityId", align = Align.CENTER, sort = 10),
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 20, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "省份名称", attrName = "provinceName", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "省份编码", attrName = "provinceCode", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "市区编码", attrName = "cityCode", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "市区名称", attrName = "cityName", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "市区区号", attrName = "areaCode", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "市区级别", attrName = "areaType", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 80, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "状态", attrName = "ustatus", dictType = "biz_status", align = Align.CENTER, sort = 90),
|
||||
})
|
||||
public MyCities() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public MyCities(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 省份信息 Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-03-21
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "my_province", alias = "a", label = "省份信息", columns = {
|
||||
@Column(name = "province_id", attrName = "provinceId", label = "唯一主键", isPK = true),
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "province_name", attrName = "provinceName", label = "省份名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "province_code", attrName = "provinceCode", label = "省份编码"),
|
||||
@Column(name = "sorting", attrName = "sorting", label = "省份序号", isQuery = false),
|
||||
@Column(name = "ustatus", attrName = "ustatus", label = "状态"),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class MyProvince extends DataEntity<MyProvince> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String provinceId; // 唯一主键
|
||||
private Date createTime; // 记录时间
|
||||
private String provinceName; // 省份名称
|
||||
private String provinceCode; // 省份编码
|
||||
private Integer sorting; // 省份序号
|
||||
private String ustatus; // 状态
|
||||
private Date updateTime; // 更新时间
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "唯一主键", attrName = "provinceId", align = Align.CENTER, sort = 10),
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 20, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "省份名称", attrName = "provinceName", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "省份编码", attrName = "provinceCode", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "省份序号", attrName = "sorting", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "状态", attrName = "ustatus", dictType = "biz_status", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 70, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
})
|
||||
public MyProvince() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public MyProvince(String id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ import java.io.Serial;
|
||||
@Column(name="remark", attrName="remark", label="说明描述", isQuery=false),
|
||||
@Column(name="ustatus", attrName="ustatus", label="状态"),
|
||||
@Column(name="update_time", attrName="updateTime", label="更新时间", isInsert=false, isQuery=false, isUpdateForce=true),
|
||||
}, orderBy="a.screen_id DESC"
|
||||
}, orderBy="a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class MyScreenInfo extends DataEntity<MyScreenInfo> implements Serializable {
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.MyAreaSource;
|
||||
import com.jeesite.modules.biz.dao.MyAreaSourceDao;
|
||||
|
||||
/**
|
||||
* 区域信息 Service
|
||||
* @author gaoxq
|
||||
* @version 2026-03-21
|
||||
*/
|
||||
@Service
|
||||
public class MyAreaSourceService extends CrudService<MyAreaSourceDao, MyAreaSource> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param myAreaSource 主键
|
||||
*/
|
||||
@Override
|
||||
public MyAreaSource get(MyAreaSource myAreaSource) {
|
||||
return super.get(myAreaSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param myAreaSource 查询条件
|
||||
* @param myAreaSource page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<MyAreaSource> findPage(MyAreaSource myAreaSource) {
|
||||
return super.findPage(myAreaSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param myAreaSource 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<MyAreaSource> findList(MyAreaSource myAreaSource) {
|
||||
return super.findList(myAreaSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param myAreaSource 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(MyAreaSource myAreaSource) {
|
||||
super.save(myAreaSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param myAreaSource 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(MyAreaSource myAreaSource) {
|
||||
super.updateStatus(myAreaSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param myAreaSource 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(MyAreaSource myAreaSource) {
|
||||
myAreaSource.sqlMap().markIdDelete(); // 逻辑删除时标记ID值
|
||||
super.delete(myAreaSource);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.MyCities;
|
||||
import com.jeesite.modules.biz.dao.MyCitiesDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 城市信息 Service
|
||||
* @author gaoxq
|
||||
* @version 2026-03-21
|
||||
*/
|
||||
@Service
|
||||
public class MyCitiesService extends CrudService<MyCitiesDao, MyCities> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param myCities 主键
|
||||
*/
|
||||
@Override
|
||||
public MyCities get(MyCities myCities) {
|
||||
return super.get(myCities);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param myCities 查询条件
|
||||
* @param myCities page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<MyCities> findPage(MyCities myCities) {
|
||||
return super.findPage(myCities);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param myCities 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<MyCities> findList(MyCities myCities) {
|
||||
return super.findList(myCities);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param myCities 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(MyCities myCities) {
|
||||
super.save(myCities);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<MyCities> list = ei.getDataList(MyCities.class);
|
||||
for (MyCities myCities : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(myCities);
|
||||
this.save(myCities);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + myCities.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + myCities.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param myCities 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(MyCities myCities) {
|
||||
super.updateStatus(myCities);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param myCities 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(MyCities myCities) {
|
||||
super.delete(myCities);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.MyProvince;
|
||||
import com.jeesite.modules.biz.dao.MyProvinceDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 省份信息 Service
|
||||
* @author gaoxq
|
||||
* @version 2026-03-21
|
||||
*/
|
||||
@Service
|
||||
public class MyProvinceService extends CrudService<MyProvinceDao, MyProvince> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param myProvince 主键
|
||||
*/
|
||||
@Override
|
||||
public MyProvince get(MyProvince myProvince) {
|
||||
return super.get(myProvince);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param myProvince 查询条件
|
||||
* @param myProvince page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<MyProvince> findPage(MyProvince myProvince) {
|
||||
return super.findPage(myProvince);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param myProvince 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<MyProvince> findList(MyProvince myProvince) {
|
||||
return super.findList(myProvince);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param myProvince 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(MyProvince myProvince) {
|
||||
super.save(myProvince);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<MyProvince> list = ei.getDataList(MyProvince.class);
|
||||
for (MyProvince myProvince : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(myProvince);
|
||||
this.save(myProvince);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + myProvince.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + myProvince.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param myProvince 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(MyProvince myProvince) {
|
||||
super.updateStatus(myProvince);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param myProvince 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(MyProvince myProvince) {
|
||||
super.delete(myProvince);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.MyAreaSource;
|
||||
import com.jeesite.modules.biz.service.MyAreaSourceService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 区域信息 Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-03-21
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/myAreaSource")
|
||||
public class MyAreaSourceController extends BaseController {
|
||||
|
||||
private final MyAreaSourceService myAreaSourceService;
|
||||
|
||||
public MyAreaSourceController(MyAreaSourceService myAreaSourceService) {
|
||||
this.myAreaSourceService = myAreaSourceService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public MyAreaSource get(String areaId, boolean isNewRecord) {
|
||||
return myAreaSourceService.get(areaId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:myAreaSource:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(MyAreaSource myAreaSource, Model model) {
|
||||
model.addAttribute("myAreaSource", myAreaSource);
|
||||
return "modules/biz/myAreaSourceList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myAreaSource:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<MyAreaSource> listData(MyAreaSource myAreaSource, HttpServletRequest request, HttpServletResponse response) {
|
||||
myAreaSource.setPage(new Page<>(request, response));
|
||||
Page<MyAreaSource> page = myAreaSourceService.findPage(myAreaSource);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:myAreaSource:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(MyAreaSource myAreaSource, Model model) {
|
||||
model.addAttribute("myAreaSource", myAreaSource);
|
||||
return "modules/biz/myAreaSourceForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myAreaSource:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated MyAreaSource myAreaSource) {
|
||||
myAreaSourceService.save(myAreaSource);
|
||||
return renderResult(Global.TRUE, text("保存区域成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myAreaSource:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(MyAreaSource myAreaSource) {
|
||||
myAreaSourceService.delete(myAreaSource);
|
||||
return renderResult(Global.TRUE, text("删除区域成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 树形结构
|
||||
*/
|
||||
@RequestMapping(value = "treeData")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> treeAreasData(MyAreaSource myAreaSource) {
|
||||
List<Map<String, Object>> treeData = new ArrayList<>();
|
||||
List<MyAreaSource> areaSourceList = myAreaSourceService.findList(myAreaSource);
|
||||
Map<String, Map<String, Object>> nodeMap = new HashMap<>();
|
||||
for (MyAreaSource area : areaSourceList) {
|
||||
Map<String, Object> node = new HashMap<>();
|
||||
node.put("id", area.getAreaCode());
|
||||
node.put("name", area.getAreaName());
|
||||
node.put("disabled", false);
|
||||
node.put("children", new ArrayList<Map<String, Object>>());
|
||||
nodeMap.put(area.getAreaCode(), node);
|
||||
}
|
||||
for (MyAreaSource area : areaSourceList) {
|
||||
Map<String, Object> currentNode = nodeMap.get(area.getAreaCode());
|
||||
String parentCode = area.getPareaCode(); // 当前节点的父编码
|
||||
if (nodeMap.containsKey(parentCode)) {
|
||||
Map<String, Object> parentNode = nodeMap.get(parentCode);
|
||||
List<Map<String, Object>> children = (List<Map<String, Object>>) parentNode.get("children");
|
||||
children.add(currentNode);
|
||||
} else {
|
||||
if (parentCode.equals("0")) {
|
||||
treeData.add(currentNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
return treeData;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.MyCities;
|
||||
import com.jeesite.modules.biz.service.MyCitiesService;
|
||||
|
||||
/**
|
||||
* 城市信息 Controller
|
||||
* @author gaoxq
|
||||
* @version 2026-03-21
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/myCities")
|
||||
public class MyCitiesController extends BaseController {
|
||||
|
||||
private final MyCitiesService myCitiesService;
|
||||
|
||||
public MyCitiesController(MyCitiesService myCitiesService) {
|
||||
this.myCitiesService = myCitiesService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public MyCities get(String cityId, boolean isNewRecord) {
|
||||
return myCitiesService.get(cityId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(MyCities myCities, Model model) {
|
||||
model.addAttribute("myCities", myCities);
|
||||
return "modules/biz/myCitiesList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<MyCities> listData(MyCities myCities, HttpServletRequest request, HttpServletResponse response) {
|
||||
myCities.setPage(new Page<>(request, response));
|
||||
Page<MyCities> page = myCitiesService.findPage(myCities);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(MyCities myCities, Model model) {
|
||||
model.addAttribute("myCities", myCities);
|
||||
return "modules/biz/myCitiesForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated MyCities myCities) {
|
||||
myCitiesService.save(myCities);
|
||||
return renderResult(Global.TRUE, text("保存城市成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(MyCities myCities, HttpServletResponse response) {
|
||||
List<MyCities> list = myCitiesService.findList(myCities);
|
||||
String fileName = "城市" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("城市", MyCities.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
MyCities myCities = new MyCities();
|
||||
List<MyCities> list = ListUtils.newArrayList(myCities);
|
||||
String fileName = "城市模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("城市", MyCities.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:myCities:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = myCitiesService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(MyCities myCities) {
|
||||
myCitiesService.delete(myCities);
|
||||
return renderResult(Global.TRUE, text("删除城市成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.MyProvince;
|
||||
import com.jeesite.modules.biz.service.MyProvinceService;
|
||||
|
||||
/**
|
||||
* 省份信息 Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-03-21
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/myProvince")
|
||||
public class MyProvinceController extends BaseController {
|
||||
|
||||
private final MyProvinceService myProvinceService;
|
||||
|
||||
public MyProvinceController(MyProvinceService myProvinceService) {
|
||||
this.myProvinceService = myProvinceService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public MyProvince get(String provinceId, boolean isNewRecord) {
|
||||
return myProvinceService.get(provinceId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:myProvince:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(MyProvince myProvince, Model model) {
|
||||
model.addAttribute("myProvince", myProvince);
|
||||
return "modules/biz/myProvinceList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myProvince:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<MyProvince> listData(MyProvince myProvince, HttpServletRequest request, HttpServletResponse response) {
|
||||
myProvince.setPage(new Page<>(request, response));
|
||||
Page<MyProvince> page = myProvinceService.findPage(myProvince);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:myProvince:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(MyProvince myProvince, Model model) {
|
||||
model.addAttribute("myProvince", myProvince);
|
||||
return "modules/biz/myProvinceForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myProvince:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated MyProvince myProvince) {
|
||||
myProvinceService.save(myProvince);
|
||||
return renderResult(Global.TRUE, text("保存省份成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myProvince:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(MyProvince myProvince, HttpServletResponse response) {
|
||||
List<MyProvince> list = myProvinceService.findList(myProvince);
|
||||
String fileName = "省份" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("省份", MyProvince.class)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:myProvince:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
MyProvince myProvince = new MyProvince();
|
||||
List<MyProvince> list = ListUtils.newArrayList(myProvince);
|
||||
String fileName = "省份模板.xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("省份", MyProvince.class, Type.IMPORT)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:myProvince:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = myProvinceService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:" + message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myProvince:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(MyProvince myProvince) {
|
||||
myProvinceService.delete(myProvince);
|
||||
return renderResult(Global.TRUE, text("删除省份成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表数据
|
||||
*/
|
||||
@RequestMapping(value = "listAll")
|
||||
@ResponseBody
|
||||
public List<MyProvince> listAll(MyProvince myProvince) {
|
||||
return myProvinceService.findList(myProvince);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?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.jeesite.modules.biz.dao.MyAreaSourceDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="MyAreaSource">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?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.jeesite.modules.biz.dao.MyCitiesDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="MyCities">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?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.jeesite.modules.biz.dao.MyProvinceDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="MyProvince">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
|
||||
</mapper>
|
||||
40
web-vue/packages/biz/api/biz/myAreaSource.ts
Normal file
40
web-vue/packages/biz/api/biz/myAreaSource.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
*/
|
||||
import { defHttp } from '@jeesite/core/utils/http/axios';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { BasicModel, Page, TreeDataModel } from '@jeesite/core/api/model/baseModel';
|
||||
|
||||
const { adminPath } = useGlobSetting();
|
||||
|
||||
export interface MyAreaSource extends BasicModel<MyAreaSource> {
|
||||
createTime: string; // 记录时间
|
||||
areaId: string; // 区域标识
|
||||
areaCode?: string; // 区域编号
|
||||
areaName?: string; // 区域名称
|
||||
pareaCode?: string; // 上级编号
|
||||
areaLevel: number; // 区域级别
|
||||
treeName?: string; // 区域地址
|
||||
updateTime?: string; // 更新时间
|
||||
areaStatus?: string; // 区域状态
|
||||
}
|
||||
|
||||
export const MyAreaSourceList = (params?: MyAreaSource | any) =>
|
||||
defHttp.get<MyAreaSource>({ url: adminPath + '/biz/myAreaSource/list', params });
|
||||
|
||||
export const MyAreaSourceListData = (params?: MyAreaSource | any) =>
|
||||
defHttp.post<Page<MyAreaSource>>({ url: adminPath + '/biz/myAreaSource/listData', params });
|
||||
|
||||
export const MyAreaSourceForm = (params?: MyAreaSource | any) =>
|
||||
defHttp.get<MyAreaSource>({ url: adminPath + '/biz/myAreaSource/form', params });
|
||||
|
||||
export const MyAreaSourceSave = (params?: any, data?: MyAreaSource | any) =>
|
||||
defHttp.postJson<MyAreaSource>({ url: adminPath + '/biz/myAreaSource/save', params, data });
|
||||
|
||||
export const MyAreaSourceDelete = (params?: MyAreaSource | any) =>
|
||||
defHttp.get<MyAreaSource>({ url: adminPath + '/biz/myAreaSource/delete', params });
|
||||
|
||||
export const MyAreaSourceTreeData = (params?: any) =>
|
||||
defHttp.get<TreeDataModel[]>({ url: adminPath + '/biz/myAreaSource/treeData', params });
|
||||
52
web-vue/packages/biz/api/biz/myCities.ts
Normal file
52
web-vue/packages/biz/api/biz/myCities.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now https://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
*/
|
||||
import { defHttp } from '@jeesite/core/utils/http/axios';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
|
||||
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
|
||||
import { UploadFileParams } from '@jeesite/types/axios';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const { ctxPath, adminPath } = useGlobSetting();
|
||||
|
||||
export interface MyCities extends BasicModel<MyCities> {
|
||||
cityId?: string; // 唯一主键
|
||||
createTime?: string; // 记录时间
|
||||
provinceCode: string; // 省份编码
|
||||
cityCode: string; // 市区编码
|
||||
cityName: string; // 市区名称
|
||||
areaCode: string; // 市区区号
|
||||
areaType: string; // 市区级别
|
||||
updateTime?: string; // 更新时间
|
||||
ustatus: string; // 状态
|
||||
}
|
||||
|
||||
export const myCitiesList = (params?: MyCities | any) =>
|
||||
defHttp.get<MyCities>({ url: adminPath + '/biz/myCities/list', params });
|
||||
|
||||
export const myCitiesListData = (params?: MyCities | any) =>
|
||||
defHttp.post<Page<MyCities>>({ url: adminPath + '/biz/myCities/listData', params });
|
||||
|
||||
export const myCitiesForm = (params?: MyCities | any) =>
|
||||
defHttp.get<MyCities>({ url: adminPath + '/biz/myCities/form', params });
|
||||
|
||||
export const myCitiesSave = (params?: any, data?: MyCities | any) =>
|
||||
defHttp.postJson<MyCities>({ url: adminPath + '/biz/myCities/save', params, data });
|
||||
|
||||
export const myCitiesImportData = (
|
||||
params: UploadFileParams,
|
||||
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
|
||||
) =>
|
||||
defHttp.uploadFile<UploadApiResult>(
|
||||
{
|
||||
url: ctxPath + adminPath + '/biz/myCities/importData',
|
||||
onUploadProgress,
|
||||
},
|
||||
params,
|
||||
);
|
||||
|
||||
export const myCitiesDelete = (params?: MyCities | any) =>
|
||||
defHttp.get<MyCities>({ url: adminPath + '/biz/myCities/delete', params });
|
||||
53
web-vue/packages/biz/api/biz/myProvince.ts
Normal file
53
web-vue/packages/biz/api/biz/myProvince.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now https://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
*/
|
||||
import { defHttp } from '@jeesite/core/utils/http/axios';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
|
||||
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
|
||||
import { UploadFileParams } from '@jeesite/types/axios';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const { ctxPath, adminPath } = useGlobSetting();
|
||||
|
||||
export interface MyProvince extends BasicModel<MyProvince> {
|
||||
provinceId?: string; // 唯一主键
|
||||
createTime?: string; // 记录时间
|
||||
provinceName: string; // 省份名称
|
||||
provinceCode: string; // 省份编码
|
||||
sorting: number; // 省份序号
|
||||
ustatus: string; // 状态
|
||||
updateTime?: string; // 更新时间
|
||||
}
|
||||
|
||||
export const myProvinceList = (params?: MyProvince | any) =>
|
||||
defHttp.get<MyProvince>({ url: adminPath + '/biz/myProvince/list', params });
|
||||
|
||||
export const myProvinceListAll = (params?: MyProvince | any) =>
|
||||
defHttp.get<MyProvince[]>({ url: adminPath + '/biz/myProvince/listAll', params });
|
||||
|
||||
export const myProvinceListData = (params?: MyProvince | any) =>
|
||||
defHttp.post<Page<MyProvince>>({ url: adminPath + '/biz/myProvince/listData', params });
|
||||
|
||||
export const myProvinceForm = (params?: MyProvince | any) =>
|
||||
defHttp.get<MyProvince>({ url: adminPath + '/biz/myProvince/form', params });
|
||||
|
||||
export const myProvinceSave = (params?: any, data?: MyProvince | any) =>
|
||||
defHttp.postJson<MyProvince>({ url: adminPath + '/biz/myProvince/save', params, data });
|
||||
|
||||
export const myProvinceImportData = (
|
||||
params: UploadFileParams,
|
||||
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
|
||||
) =>
|
||||
defHttp.uploadFile<UploadApiResult>(
|
||||
{
|
||||
url: ctxPath + adminPath + '/biz/myProvince/importData',
|
||||
onUploadProgress,
|
||||
},
|
||||
params,
|
||||
);
|
||||
|
||||
export const myProvinceDelete = (params?: MyProvince | any) =>
|
||||
defHttp.get<MyProvince>({ url: adminPath + '/biz/myProvince/delete', params });
|
||||
151
web-vue/packages/biz/views/biz/myCities/form.vue
Normal file
151
web-vue/packages/biz/views/biz/myCities/form.vue
Normal file
@@ -0,0 +1,151 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now https://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
:showFooter="true"
|
||||
:okAuth="'biz:myCities:edit'"
|
||||
@register="registerDrawer"
|
||||
@ok="handleSubmit"
|
||||
width="70%"
|
||||
>
|
||||
<template #title>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsBizMyCitiesForm">
|
||||
import { ref, unref, computed } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
|
||||
import { BasicDrawer, useDrawerInner } from '@jeesite/core/components/Drawer';
|
||||
import { MyCities, myCitiesSave, myCitiesForm } from '@jeesite/biz/api/biz/myCities';
|
||||
import { formatToDateTime } from '@jeesite/core/utils/dateUtil';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('biz.myCities');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<MyCities>({} as MyCities);
|
||||
|
||||
const getTitle = computed(() => ({
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: record.value.isNewRecord ? t('新增城市') : t('编辑城市'),
|
||||
}));
|
||||
|
||||
const inputFormSchemas: FormSchema<MyCities>[] = [
|
||||
{
|
||||
label: t('基本信息'),
|
||||
field: 'basicInfo',
|
||||
component: 'FormGroup',
|
||||
colProps: { md: 24, lg: 24 },
|
||||
},
|
||||
{
|
||||
label: t('省份编码'),
|
||||
field: 'provinceCode',
|
||||
fieldLabel: 'provinceName',
|
||||
component: 'ListSelect',
|
||||
componentProps: {
|
||||
selectType: 'bizProvinceSelect',
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('市区编码'),
|
||||
field: 'cityCode',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 24,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('市区名称'),
|
||||
field: 'cityName',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 125,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('市区区号'),
|
||||
field: 'areaCode',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 12,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('市区级别'),
|
||||
field: 'areaType',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 4,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('状态'),
|
||||
field: 'ustatus',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'biz_status',
|
||||
allowClear: true,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<MyCities>({
|
||||
labelWidth: 120,
|
||||
schemas: inputFormSchemas,
|
||||
baseColProps: { md: 24, lg: 12 },
|
||||
});
|
||||
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
setDrawerProps({ loading: true });
|
||||
await resetFields();
|
||||
const res = await myCitiesForm(data);
|
||||
record.value = (res.myCities || {}) as MyCities;
|
||||
record.value.__t = new Date().getTime();
|
||||
await setFieldsValue(record.value);
|
||||
setDrawerProps({ loading: false });
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const data = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
const params: any = {
|
||||
isNewRecord: record.value.isNewRecord,
|
||||
cityId: record.value.cityId || data.cityId,
|
||||
};
|
||||
|
||||
data[record.value.isNewRecord ? 'createTime' : 'updateTime'] = formatToDateTime(new Date());
|
||||
|
||||
// console.log('submit', params, data, record);
|
||||
const res = await myCitiesSave(params, data);
|
||||
showMessage(res.message);
|
||||
setTimeout(closeDrawer);
|
||||
emit('success', data);
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
261
web-vue/packages/biz/views/biz/myCities/list.vue
Normal file
261
web-vue/packages/biz/views/biz/myCities/list.vue
Normal file
@@ -0,0 +1,261 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now https://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<template #toolbar>
|
||||
<a-button type="default" :loading="loading" @click="handleExport()">
|
||||
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
|
||||
</a-button>
|
||||
<a-button type="primary" @click="handleForm({})" v-auth="'biz:myCities:edit'">
|
||||
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
|
||||
</a-button>
|
||||
</template>
|
||||
<template #bizScopeKey="{ record, text, value }">
|
||||
<a @click="handleForm({ cityId: record.cityId })" :title="value">
|
||||
{{ text }}
|
||||
</a>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<InputForm @register="registerDrawer" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsBizMyCitiesList">
|
||||
import { onMounted, ref, unref } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
||||
import { MyCities, myCitiesList } from '@jeesite/biz/api/biz/myCities';
|
||||
import { myCitiesDelete, myCitiesListData } from '@jeesite/biz/api/biz/myCities';
|
||||
import { useDrawer } from '@jeesite/core/components/Drawer';
|
||||
import { useModal } from '@jeesite/core/components/Modal';
|
||||
import { FormProps } from '@jeesite/core/components/Form';
|
||||
import InputForm from './form.vue';
|
||||
|
||||
const { t } = useI18n('biz.myCities');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<MyCities>({} as MyCities);
|
||||
|
||||
const getTitle = {
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: meta.title || t('城市管理'),
|
||||
};
|
||||
const loading = ref(false);
|
||||
|
||||
const searchForm: FormProps<MyCities> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('记录时间起'),
|
||||
field: 'createTime_gte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('记录时间止'),
|
||||
field: 'createTime_lte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('省份编码'),
|
||||
field: 'provinceCode',
|
||||
fieldLabel: 'provinceName',
|
||||
component: 'ListSelect',
|
||||
componentProps: {
|
||||
selectType: 'bizProvinceSelect',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('市区名称'),
|
||||
field: 'cityName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('市区区号'),
|
||||
field: 'areaCode',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('市区级别'),
|
||||
field: 'areaType',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('状态'),
|
||||
field: 'ustatus',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'biz_status',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<MyCities>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 150,
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
title: t('省份编码'),
|
||||
dataIndex: 'provinceCode',
|
||||
key: 'a.province_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('省份名称'),
|
||||
dataIndex: 'provinceName',
|
||||
key: 'a.province_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('市区编码'),
|
||||
dataIndex: 'cityCode',
|
||||
key: 'a.city_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('市区名称'),
|
||||
dataIndex: 'cityName',
|
||||
key: 'a.city_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
slot: 'bizScopeKey',
|
||||
},
|
||||
{
|
||||
title: t('市区区号'),
|
||||
dataIndex: 'areaCode',
|
||||
key: 'a.area_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('市区级别'),
|
||||
dataIndex: 'areaType',
|
||||
key: 'a.area_type',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 150,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
dataIndex: 'ustatus',
|
||||
key: 'a.ustatus',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
dictType: 'biz_status',
|
||||
},
|
||||
];
|
||||
|
||||
const actionColumn: BasicColumn<MyCities> = {
|
||||
width: 160,
|
||||
align: 'center',
|
||||
actions: (record: MyCities) => [
|
||||
{
|
||||
icon: 'i-clarity:note-edit-line',
|
||||
title: t('编辑城市'),
|
||||
onClick: handleForm.bind(this, { cityId: record.cityId }),
|
||||
auth: 'biz:myCities:edit',
|
||||
},
|
||||
{
|
||||
icon: 'i-ant-design:delete-outlined',
|
||||
color: 'error',
|
||||
title: t('删除城市'),
|
||||
popConfirm: {
|
||||
title: t('是否确认删除城市'),
|
||||
confirm: handleDelete.bind(this, record),
|
||||
},
|
||||
auth: 'biz:myCities:edit',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const [registerTable, { reload, getForm }] = useTable<MyCities>({
|
||||
api: myCitiesListData,
|
||||
beforeFetch: (params) => {
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
actionColumn: actionColumn,
|
||||
formConfig: searchForm,
|
||||
showTableSetting: true,
|
||||
useSearchForm: true,
|
||||
canResize: true,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await myCitiesList();
|
||||
record.value = (res.myCities || {}) as MyCities;
|
||||
await getForm().setFieldsValue(record.value);
|
||||
});
|
||||
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
|
||||
function handleForm(record: Recordable) {
|
||||
openDrawer(true, record);
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
loading.value = true;
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
await downloadByUrl({
|
||||
url: ctxAdminPath + '/biz/myCities/exportData',
|
||||
params: getForm().getFieldsValue(),
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
async function handleDelete(record: Recordable) {
|
||||
const params = { cityId: record.cityId };
|
||||
const res = await myCitiesDelete(params);
|
||||
showMessage(res.message);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
|
||||
async function handleSuccess(record: Recordable) {
|
||||
await reload({ record });
|
||||
}
|
||||
</script>
|
||||
151
web-vue/packages/biz/views/biz/myCities/select.ts
Normal file
151
web-vue/packages/biz/views/biz/myCities/select.ts
Normal file
@@ -0,0 +1,151 @@
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
|
||||
import { MyCities, myCitiesListData } from '@jeesite/biz/api/biz/myCities';
|
||||
|
||||
const { t } = useI18n('biz.myCities');
|
||||
|
||||
const modalProps = {
|
||||
title: t('城市选择'),
|
||||
};
|
||||
|
||||
const searchForm: FormProps<MyCities> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('记录时间起'),
|
||||
field: 'createTime_gte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('记录时间止'),
|
||||
field: 'createTime_lte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('省份编码'),
|
||||
field: 'provinceCode',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('市区名称'),
|
||||
field: 'cityName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('市区区号'),
|
||||
field: 'areaCode',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('市区级别'),
|
||||
field: 'areaType',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('状态'),
|
||||
field: 'ustatus',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'biz_status',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<MyCities>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 230,
|
||||
align: 'left',
|
||||
slot: 'firstColumn',
|
||||
},
|
||||
{
|
||||
title: t('省份编码'),
|
||||
dataIndex: 'provinceCode',
|
||||
key: 'a.province_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('市区编码'),
|
||||
dataIndex: 'cityCode',
|
||||
key: 'a.city_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('市区名称'),
|
||||
dataIndex: 'cityName',
|
||||
key: 'a.city_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('市区区号'),
|
||||
dataIndex: 'areaCode',
|
||||
key: 'a.area_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('市区级别'),
|
||||
dataIndex: 'areaType',
|
||||
key: 'a.area_type',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
dataIndex: 'ustatus',
|
||||
key: 'a.ustatus',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
dictType: 'biz_status',
|
||||
},
|
||||
];
|
||||
|
||||
const tableProps: BasicTableProps = {
|
||||
api: myCitiesListData,
|
||||
beforeFetch: (params) => {
|
||||
params['isAll'] = true;
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
formConfig: searchForm,
|
||||
rowKey: 'cityId',
|
||||
};
|
||||
|
||||
export default {
|
||||
modalProps,
|
||||
tableProps,
|
||||
itemCode: 'cityId',
|
||||
itemName: 'cityId',
|
||||
isShowCode: false,
|
||||
};
|
||||
132
web-vue/packages/biz/views/biz/myProvince/form.vue
Normal file
132
web-vue/packages/biz/views/biz/myProvince/form.vue
Normal file
@@ -0,0 +1,132 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now https://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
:showFooter="true"
|
||||
:okAuth="'biz:myProvince:edit'"
|
||||
@register="registerDrawer"
|
||||
@ok="handleSubmit"
|
||||
width="70%"
|
||||
>
|
||||
<template #title>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsBizMyProvinceForm">
|
||||
import { ref, unref, computed } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
|
||||
import { BasicDrawer, useDrawerInner } from '@jeesite/core/components/Drawer';
|
||||
import { MyProvince, myProvinceSave, myProvinceForm } from '@jeesite/biz/api/biz/myProvince';
|
||||
import { formatToDateTime } from '@jeesite/core/utils/dateUtil';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('biz.myProvince');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<MyProvince>({} as MyProvince);
|
||||
|
||||
const getTitle = computed(() => ({
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: record.value.isNewRecord ? t('新增省份') : t('编辑省份'),
|
||||
}));
|
||||
|
||||
const inputFormSchemas: FormSchema<MyProvince>[] = [
|
||||
{
|
||||
label: t('基本信息'),
|
||||
field: 'basicInfo',
|
||||
component: 'FormGroup',
|
||||
colProps: { md: 24, lg: 24 },
|
||||
},
|
||||
{
|
||||
label: t('省份名称'),
|
||||
field: 'provinceName',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 52,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('省份编码'),
|
||||
field: 'provinceCode',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 12,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('省份序号'),
|
||||
field: 'sorting',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
maxlength: 9,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('状态'),
|
||||
field: 'ustatus',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'biz_status',
|
||||
allowClear: true,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<MyProvince>({
|
||||
labelWidth: 120,
|
||||
schemas: inputFormSchemas,
|
||||
baseColProps: { md: 24, lg: 12 },
|
||||
});
|
||||
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
setDrawerProps({ loading: true });
|
||||
await resetFields();
|
||||
const res = await myProvinceForm(data);
|
||||
record.value = (res.myProvince || {}) as MyProvince;
|
||||
record.value.__t = new Date().getTime();
|
||||
await setFieldsValue(record.value);
|
||||
setDrawerProps({ loading: false });
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const data = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
const params: any = {
|
||||
isNewRecord: record.value.isNewRecord,
|
||||
provinceId: record.value.provinceId || data.provinceId,
|
||||
};
|
||||
|
||||
data[record.value.isNewRecord ? 'createTime' : 'updateTime'] = formatToDateTime(new Date());
|
||||
|
||||
// console.log('submit', params, data, record);
|
||||
const res = await myProvinceSave(params, data);
|
||||
showMessage(res.message);
|
||||
setTimeout(closeDrawer);
|
||||
emit('success', data);
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
205
web-vue/packages/biz/views/biz/myProvince/list.vue
Normal file
205
web-vue/packages/biz/views/biz/myProvince/list.vue
Normal file
@@ -0,0 +1,205 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now https://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<template #toolbar>
|
||||
<a-button type="default" :loading="loading" @click="handleExport()">
|
||||
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
|
||||
</a-button>
|
||||
<a-button type="primary" @click="handleForm({})" v-auth="'biz:myProvince:edit'">
|
||||
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
|
||||
</a-button>
|
||||
</template>
|
||||
<template #bizScopeKey="{ record, text, value }">
|
||||
<a @click="handleForm({ provinceId: record.provinceId })" :title="value">
|
||||
{{ text }}
|
||||
</a>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<InputForm @register="registerDrawer" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsBizMyProvinceList">
|
||||
import { onMounted, ref, unref } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
||||
import { MyProvince, myProvinceList } from '@jeesite/biz/api/biz/myProvince';
|
||||
import { myProvinceDelete, myProvinceListData } from '@jeesite/biz/api/biz/myProvince';
|
||||
import { useDrawer } from '@jeesite/core/components/Drawer';
|
||||
import { useModal } from '@jeesite/core/components/Modal';
|
||||
import { FormProps } from '@jeesite/core/components/Form';
|
||||
import InputForm from './form.vue';
|
||||
|
||||
const { t } = useI18n('biz.myProvince');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<MyProvince>({} as MyProvince);
|
||||
|
||||
const getTitle = {
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: meta.title || t('省份管理'),
|
||||
};
|
||||
const loading = ref(false);
|
||||
|
||||
const searchForm: FormProps<MyProvince> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('省份名称'),
|
||||
field: 'provinceName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('省份编码'),
|
||||
field: 'provinceCode',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('状态'),
|
||||
field: 'ustatus',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'biz_status',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<MyProvince>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 150,
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
title: t('省份名称'),
|
||||
dataIndex: 'provinceName',
|
||||
key: 'a.province_name',
|
||||
sorter: true,
|
||||
width: 200,
|
||||
align: 'left',
|
||||
slot: 'bizScopeKey',
|
||||
},
|
||||
{
|
||||
title: t('省份编码'),
|
||||
dataIndex: 'provinceCode',
|
||||
key: 'a.province_code',
|
||||
sorter: true,
|
||||
width: 200,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('省份序号'),
|
||||
dataIndex: 'sorting',
|
||||
key: 'a.sorting',
|
||||
sorter: true,
|
||||
width: 180,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
dataIndex: 'ustatus',
|
||||
key: 'a.ustatus',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
dictType: 'biz_status',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 150,
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
|
||||
const actionColumn: BasicColumn<MyProvince> = {
|
||||
width: 160,
|
||||
align: 'center',
|
||||
actions: (record: MyProvince) => [
|
||||
{
|
||||
icon: 'i-clarity:note-edit-line',
|
||||
title: t('编辑'),
|
||||
onClick: handleForm.bind(this, { provinceId: record.provinceId }),
|
||||
auth: 'biz:myProvince:edit',
|
||||
},
|
||||
{
|
||||
icon: 'i-ant-design:delete-outlined',
|
||||
color: 'error',
|
||||
title: t('删除'),
|
||||
popConfirm: {
|
||||
title: t('是否确认删除省份?'),
|
||||
confirm: handleDelete.bind(this, record),
|
||||
},
|
||||
auth: 'biz:myProvince:edit',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const [registerTable, { reload, getForm }] = useTable<MyProvince>({
|
||||
api: myProvinceListData,
|
||||
beforeFetch: (params) => {
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
actionColumn: actionColumn,
|
||||
formConfig: searchForm,
|
||||
showTableSetting: true,
|
||||
useSearchForm: true,
|
||||
canResize: true,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await myProvinceList();
|
||||
record.value = (res.myProvince || {}) as MyProvince;
|
||||
await getForm().setFieldsValue(record.value);
|
||||
});
|
||||
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
|
||||
function handleForm(record: Recordable) {
|
||||
openDrawer(true, record);
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
loading.value = true;
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
await downloadByUrl({
|
||||
url: ctxAdminPath + '/biz/myProvince/exportData',
|
||||
params: getForm().getFieldsValue(),
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
async function handleDelete(record: Recordable) {
|
||||
const params = { provinceId: record.provinceId };
|
||||
const res = await myProvinceDelete(params);
|
||||
showMessage(res.message);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
|
||||
async function handleSuccess(record: Recordable) {
|
||||
await reload({ record });
|
||||
}
|
||||
</script>
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
|
||||
import { myScreenInfoListData } from '@jeesite/biz/api/biz/myScreenInfo';
|
||||
import { MyScreenInfo, myScreenInfoListData } from '@jeesite/biz/api/biz/myScreenInfo';
|
||||
|
||||
const { t } = useI18n('biz.myScreenInfo');
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
|
||||
const tableColumns: BasicColumn<MyWebsiteStorage>[] = [
|
||||
{
|
||||
title: t('记录日期'),
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
|
||||
import { MyProvince, myProvinceListData } from '@jeesite/biz/api/biz/myProvince';
|
||||
|
||||
const { t } = useI18n('biz.myProvince');
|
||||
|
||||
const modalProps = {
|
||||
title: t('省份选择'),
|
||||
};
|
||||
|
||||
const searchForm: FormProps<MyProvince> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('省份名称'),
|
||||
field: 'provinceName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('省份编码'),
|
||||
field: 'provinceCode',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('状态'),
|
||||
field: 'ustatus',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'biz_status',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<MyProvince>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 150,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('省份名称'),
|
||||
dataIndex: 'provinceName',
|
||||
key: 'a.province_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('省份编码'),
|
||||
dataIndex: 'provinceCode',
|
||||
key: 'a.province_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('省份序号'),
|
||||
dataIndex: 'sorting',
|
||||
key: 'a.sorting',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
dataIndex: 'ustatus',
|
||||
key: 'a.ustatus',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
dictType: 'biz_status',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 150,
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
|
||||
const tableProps: BasicTableProps = {
|
||||
api: myProvinceListData,
|
||||
beforeFetch: (params) => {
|
||||
params['isAll'] = true;
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
formConfig: searchForm,
|
||||
rowKey: 'provinceCode',
|
||||
};
|
||||
|
||||
export default {
|
||||
modalProps,
|
||||
tableProps,
|
||||
itemCode: 'provinceCode',
|
||||
itemName: 'provinceName',
|
||||
isShowCode: true,
|
||||
};
|
||||
Reference in New Issue
Block a user