新增查看页面
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.BizAreaSource;
|
||||
|
||||
/**
|
||||
* 区域信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2026-01-22
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface BizAreaSourceDao extends CrudDao<BizAreaSource> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
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 java.io.Serial;
|
||||
|
||||
/**
|
||||
* 区域信息Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-01-22
|
||||
*/
|
||||
@Table(name = "biz_area_source", alias = "a", label = "区域信息信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false),
|
||||
@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 = "区域级别", queryType = QueryType.LTE),
|
||||
@Column(name = "tree_name", attrName = "treeName", label = "区域地址", queryType = QueryType.LIKE),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isUpdateForce = true),
|
||||
@Column(name = "area_status", attrName = "areaStatus", label = "区域状态"),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizAreaSource extends DataEntity<BizAreaSource> 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 areaStatus; // 区域状态
|
||||
|
||||
public BizAreaSource() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizAreaSource(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -33,6 +33,7 @@ import java.io.Serial;
|
||||
@Column(name = "requirement_id", attrName = "requirementId", label = "需求标识", isPK = true),
|
||||
@Column(name = "requirement_name", attrName = "requirementName", label = "需求名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "requirement_code", attrName = "requirementCode", label = "需求编号"),
|
||||
@Column(name = "area_level", attrName = "areaLevel", label = "区域级别"),
|
||||
@Column(name = "area_code", attrName = "areaCode", label = "项目区域"),
|
||||
@Column(name = "requirement_description", attrName = "requirementDescription", label = "需求描述"),
|
||||
@Column(name = "start_time", attrName = "startTime", label = "开始时间", isQuery = false, isUpdateForce = true),
|
||||
@@ -60,10 +61,11 @@ import java.io.Serial;
|
||||
@Column(name = "project_code", attrName = "projectCode", label = "项目编码"),
|
||||
@Column(name = "project_name", attrName = "projectName", label = "项目名称"),
|
||||
}),
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = BizProvince.class, attrName = "this", alias = "d",
|
||||
on = "a.area_code = d.province_code",
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = BizAreaSource.class, attrName = "this", alias = "d",
|
||||
on = "a.area_code = d.area_code",
|
||||
columns = {
|
||||
@Column(name = "province_name", attrName = "provinceName", label = "省份名称"),
|
||||
@Column(name = "area_name", attrName = "areaName", label = "区域名称"),
|
||||
@Column(name = "tree_name", attrName = "treeName", label = "区域地址"),
|
||||
}),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@@ -76,6 +78,7 @@ public class BizProjectRequirements extends DataEntity<BizProjectRequirements> i
|
||||
private String requirementId; // 需求标识
|
||||
private String requirementName; // 需求名称
|
||||
private String requirementCode; // 需求编号
|
||||
private Integer areaLevel;
|
||||
private String areaCode; // 项目区域
|
||||
private String requirementDescription; // 需求描述
|
||||
private Date startTime; // 开始时间
|
||||
@@ -96,7 +99,8 @@ public class BizProjectRequirements extends DataEntity<BizProjectRequirements> i
|
||||
private String projectCode;
|
||||
private String projectName;
|
||||
|
||||
private String provinceName;
|
||||
private String areaName;
|
||||
private String treeName;
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录日期", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@@ -104,7 +108,7 @@ public class BizProjectRequirements extends DataEntity<BizProjectRequirements> i
|
||||
@ExcelField(title = "需求名称", attrName = "requirementName", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "需求编号", attrName = "requirementCode", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "区域编码", attrName = "areaCode", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "区域名称", attrName = "provinceName", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "区域名称", attrName = "treeName", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "需求描述", attrName = "requirementDescription", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "开始时间", attrName = "startTime", align = Align.CENTER, sort = 70, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "结束时间", attrName = "endTime", align = Align.CENTER, sort = 80, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
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.BizAreaSource;
|
||||
import com.jeesite.modules.biz.dao.BizAreaSourceDao;
|
||||
|
||||
/**
|
||||
* 区域信息Service
|
||||
* @author gaoxq
|
||||
* @version 2026-01-22
|
||||
*/
|
||||
@Service
|
||||
public class BizAreaSourceService extends CrudService<BizAreaSourceDao, BizAreaSource> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizAreaSource 主键
|
||||
*/
|
||||
@Override
|
||||
public BizAreaSource get(BizAreaSource bizAreaSource) {
|
||||
return super.get(bizAreaSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param bizAreaSource 查询条件
|
||||
* @param bizAreaSource page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<BizAreaSource> findPage(BizAreaSource bizAreaSource) {
|
||||
return super.findPage(bizAreaSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizAreaSource 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizAreaSource> findList(BizAreaSource bizAreaSource) {
|
||||
return super.findList(bizAreaSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizAreaSource 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(BizAreaSource bizAreaSource) {
|
||||
super.save(bizAreaSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bizAreaSource 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(BizAreaSource bizAreaSource) {
|
||||
super.updateStatus(bizAreaSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizAreaSource 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(BizAreaSource bizAreaSource) {
|
||||
super.delete(bizAreaSource);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
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.BizAreaSource;
|
||||
import com.jeesite.modules.biz.service.BizAreaSourceService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 区域信息Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-01-22
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/areaSource")
|
||||
public class BizAreaSourceController extends BaseController {
|
||||
|
||||
private final BizAreaSourceService bizAreaSourceService;
|
||||
|
||||
public BizAreaSourceController(BizAreaSourceService bizAreaSourceService) {
|
||||
this.bizAreaSourceService = bizAreaSourceService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizAreaSource get(String areaId, boolean isNewRecord) {
|
||||
return bizAreaSourceService.get(areaId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:areaSource:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizAreaSource bizAreaSource, Model model) {
|
||||
model.addAttribute("bizAreaSource", bizAreaSource);
|
||||
return "modules/biz/bizAreaSourceList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:areaSource:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizAreaSource> listData(BizAreaSource bizAreaSource, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizAreaSource.setPage(new Page<>(request, response));
|
||||
Page<BizAreaSource> page = bizAreaSourceService.findPage(bizAreaSource);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:areaSource:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizAreaSource bizAreaSource, Model model) {
|
||||
model.addAttribute("bizAreaSource", bizAreaSource);
|
||||
return "modules/biz/bizAreaSourceForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:areaSource:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizAreaSource bizAreaSource) {
|
||||
bizAreaSourceService.save(bizAreaSource);
|
||||
return renderResult(Global.TRUE, text("保存区域信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:areaSource:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizAreaSource bizAreaSource) {
|
||||
bizAreaSourceService.delete(bizAreaSource);
|
||||
return renderResult(Global.TRUE, text("删除区域信息成功!"));
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "treeData")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> treeAreasData(BizAreaSource bizAreaSource) {
|
||||
List<Map<String, Object>> treeData = new ArrayList<>();
|
||||
bizAreaSource.setAreaStatus("1");
|
||||
List<BizAreaSource> areaSourceList = bizAreaSourceService.findList(bizAreaSource);
|
||||
Map<String, Map<String, Object>> nodeMap = new HashMap<>();
|
||||
for (BizAreaSource 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 (BizAreaSource 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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user