Commit da186756 authored by 鲁鑫's avatar 鲁鑫

资源值的增删改查

parent 3099a277
......@@ -2,7 +2,7 @@ $(document).ready(function () {
initResourceFieldGrid();
});
//初始化研制人员
//初始化资源
function initResourceFieldGrid(){
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
addHandler: function(){
......@@ -15,7 +15,7 @@ function initResourceFieldGrid(){
param: {},
gridManager: _grid,
onSuccess: function () {
reloadGrid();
reloadFieldGrid();
}
});
}
......@@ -92,7 +92,7 @@ function getGridColumns(){
return columns;
}
function reloadGrid() {
function reloadFieldGrid() {
var param = {tableName:$("#tableName").val()};
$('#resourceFieldGrid').ligerGetGridManager().options.url =web_app.name + '/resource/findParentResourceTypeAndFields.ajax';
_grid = UICtrl.getGridManager('#resourceFieldGrid');
......
......@@ -3,34 +3,21 @@ $(document).ready(function () {
});
function initResourceFields() {
Public.ajax(web_app.name + "/resourceField/getResourceField.ajax", {
resourceTypeId: $("#resourceTypeId").val()
Public.ajax(web_app.name + "/resourceField/getResourceFieldValue.ajax", {
resourceTypeId: $("#resourceTypeId").val(),id: $("#id").val()
}, function (data) {
debugger;
var $d = $('#rowDiv');
var $d = $('#submitForm .hg-form-row');
for (var i = 0; i < data.length; i++) {
var field = data[i];
//var s = $(`<input name="${field.resourceFieldName}" label="${field.resourceFiledTitle}" labelCol="2" fieldCol="4"/>`);
//var input = $("<x:inputC name='").append(field.resourceFieldName).append("' label='").append(field.resourceFiledTitle).append("'").append("/>");
/*var ss = $(`<div class="col-xs-4 col-sm-2">
var ss = $(`<div class="col-xs-4 col-sm-2">
<label class="hg-form-label" id="${field.resourceFiledTitle}_label" title="${field.resourceFiledTitle}">
${field.resourceFiledTitle} :
</label>
</div>
<div class="col-xs-8 col-sm-4 col-warp col-white-bg">
<input type="text" name="${field.resourceFieldName}" id="${field.resourceFieldName}" label="${field.resourceFiledTitle}">
</div>`)*/
var ss = $(`<div class="col-xs-4 col-sm-2">
<label class="hg-form-label" id="resourceFiledTitle_label" title="哈哈哈哈哈哈">
哈哈哈哈 :
</label>
</div>
`)
var s2= $(`<div class="col-xs-8 col-sm-4 col-warp col-white-bg">
<input type="text" name="name" id="name" label="hhhhhhh">
</div>`);
$d.append(ss,s2);
<input type="text" name="${field.resourceFieldName}" id="${field.resourceFieldName}" value="${field.resourceFieldValue}" label="${field.resourceFiledTitle}">
</div>`)
$d.append(ss);
//input1.attr('value', data[i]);
}
}
......
......@@ -5,11 +5,10 @@
<x:script src='/biz/topsun/resource/fieldValueDetail.js'/>
</head>
<form class="hg-form" method="post" action="" id="submitForm">
<x:hidden name="tableName" />
<x:hidden name="id" />
<x:hidden name="resourceTypeId"/>
<div class="hg-form-cols">
<div class="hg-form-row" id="rowDiv>
<x:inputC name="resourceTableTitle" required="true" label="资源名称" labelCol="2" fieldCol="4"/>
<div class="hg-form-row">
</div>
</div>
</form>
\ No newline at end of file
......@@ -43,7 +43,7 @@ function initializeGrid() {
gridManager = UICtrl.grid('#maingrid', {
//columns: columnData,
dataAction : 'server',
url: web_app.name+'/resourceField/getResourceFieldValue.ajax',
url: web_app.name+'/resourceField/getResourceFieldValueList.ajax',
parms: {resourceTypeId: $("#resourceTypeId").val()},
checkbox: true,
width : '100%',
......@@ -114,11 +114,14 @@ function addHandler() {
//新增保存
function insert() {
var _self=this,systemId=$('#treeSystemId').val();
var _self=this;
$('#submitForm').ajaxSubmit({
url : web_app.name + '/ssrfPurchaseBudget/insertSsrfBudgetRecord.ajax',
param:{systemId:systemId},
url : web_app.name + '/resourceField/saveResourceFiledValue.ajax',
param:{},
success : function(data) {
if (data == "1"){
Public.successTip("保存成功!");
}
_self.close();
reloadGrid();
}
......@@ -134,11 +137,10 @@ function updateHandler(id) {
}
}
UICtrl.showAjaxDialog({
title: $.i18nProp('common.field.modif.title','预算'),
title: $.i18nProp('资源值'),
width: 600,
url: web_app.name + '/ssrfPurchaseBudget/showLoadSsrfBudgetRecord.load',
init:initDetailDialog,
param: {id: id},
url: web_app.name + '/resourceField/forwardUpdateResourceFieldValue.load',
param: {id: id,resourceTypeId: $('#resourceTypeId').val()},
ok: update,
close:dialogClose
});
......@@ -148,10 +150,14 @@ function updateHandler(id) {
function update() {
var _self=this;
$('#submitForm').ajaxSubmit({
url : web_app.name + '/ssrfPurchaseBudget/updateSsrfBudgetRecord.ajax',
success : function() {
url : web_app.name + '/resourceField/updateResourceFiledValue.ajax',
success : function(data) {
if (data == "1"){
Public.successTip("修改成功!");
}
refreshFlag = true;
_self.close();
reloadGrid();
}
});
}
......@@ -159,30 +165,16 @@ function update() {
//删除按钮
function deleteHandler() {
DataUtil.del({
action: 'ssrfPurchaseBudget/deleteSsrfBudgetRecord.ajax',
action: 'resourceField/deleteResourceFiledValue.ajax',
param:{
id:DataUtil.getUpdateRowId(gridManager),
resourceTypeId: $('#resourceTypeId').val()
},
gridManager: gridManager, idFieldName: 'id',
onSuccess: function () {
reloadGrid();
}
});
}
//启用
function enableHandler(){
DataUtil.updateById({ action: 'ssrfPurchaseBudget/updateHaseBudgetStatus.ajax',
gridManager: gridManager,idFieldName:'id', param:{status:1},
message:'common.confirm.enable',
onSuccess:function(){
reloadGrid();
}
});
}
//禁用
function disableHandler(){
DataUtil.updateById({ action: 'ssrfPurchaseBudget/updateHaseBudgetStatus.ajax',
gridManager: gridManager,idFieldName:'id',param:{status:0},
message: 'common.confirm.disable',
onSuccess:function(){
onSuccess: function (data) {
if (data == "1"){
Public.successTip("删除成功!");
}
reloadGrid();
}
});
......
......@@ -97,7 +97,7 @@ public class ResourceController extends CommonController {
//@Operation(summary = "根据id查询资源")
public String findById(){
SDO sdo = this.getSDO();
Long id = sdo.getLong("id");
String id = sdo.getString("id");
ResourceTypeVo resourceTypeVo = resourceTypeService.findById(id);
return toResult(resourceTypeVo);
}
......
package com.huigou.topsun.resource.controller;
import com.huigou.topsun.resource.service.ResourceFiledService;
import com.huigou.topsun.resource.vo.ResourceFiledVo;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO;
import com.huigou.util.StringUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -34,40 +37,65 @@ public class ResourceFieldController extends CommonController {
return forward("fieldValueDetail");
}
public String forwardUpdateResourceFieldValue(){
return forward("fieldValueDetail");
}
//@Operation(summary = "根据资源类型id,查询资源字段")
public String getResourceField(){
SDO sdo = this.getSDO();
Long resourceTypeId = sdo.getLong("resourceTypeId");
String resourceTypeId = sdo.getString("resourceTypeId");
return toResult(resourceFiledService.findByResourceTypeId(resourceTypeId));
}
public String getResourceFieldValue(){
SDO sdo = this.getSDO();
String id = sdo.getString("id");
String resourceTypeId = sdo.getString("resourceTypeId");
List<ResourceFiledVo> resourceFiledVos = resourceFiledService.findFieldValueByResourceTypeIdAndId(resourceTypeId, id);
return toResult(resourceFiledVos);
}
//@Operation(summary = "保存资源字段值")
public String saveResourceFiledValue(@RequestBody HashMap<String,Object> map){
public String saveResourceFiledValue(){
SDO sdo = this.getSDO();
Map<String, Object> map = sdo.getProperties();
return toResult(resourceFiledService.saveResourceFiledValue(map));
}
//@Operation(summary = "修改资源字段值")
public String updateResourceFiledValue(@RequestBody HashMap<String,Object> map){
public String updateResourceFiledValue(){
SDO sdo = this.getSDO();
Map<String, Object> map = sdo.getProperties();
return toResult(resourceFiledService.saveResourceFiledValue(map));
}
//@Operation(summary = "根据资源类型id,获取资源值")
public String getResourceFieldValue(){
public String getResourceFieldValueList(){
SDO sdo = this.getSDO();
Long resourceTypeId = sdo.getLong("resourceTypeId");
List<Map<String, Object>> resourceFieldValue = resourceFiledService.getResourceFieldValue(resourceTypeId);
String resourceTypeId = sdo.getString("resourceTypeId");
List<Map<String, Object>> resourceFieldValue = null;
if (StringUtil.isBlank(resourceTypeId)){
resourceFieldValue = new ArrayList<>();
}else {
resourceFieldValue = resourceFiledService.getResourceFieldValueList(resourceTypeId);
}
HashMap<Object, Object> map = new HashMap<>();
map.put("Rows",resourceFieldValue);
return toResult(map);
//return success();
}
//@Operation(summary = "根据资源类型id和数据id删除资源值")
public String deleteResourceFiledValue(@RequestParam("resourceTypeId") Long resourceTypeId, @RequestParam("id") Long id){
public String deleteResourceFiledValue(){
SDO sdo = this.getSDO();
String id = sdo.getString("id");
String resourceTypeId = sdo.getString("resourceTypeId");
return toResult(resourceFiledService.deleteResourceFieldValue(resourceTypeId,id));
}
public String getResourceFieldType(@RequestParam("id") Long id){
public String getResourceFieldType(){
SDO sdo = this.getSDO();
String id = sdo.getString("id");
return toResult(resourceFiledService.findById(id));
}
}
......@@ -19,14 +19,14 @@ public class ResourceFiled implements Serializable {
*/
//@Schema(description = "资源字段ID")
@TableId(value = "resource_field_id")
private Long resourceFieldId;
private String resourceFieldId;
/**
* 所属资源类型
*/
//@Schema(description = "所属资源类型ID")
@TableField(value = "resource_type_id")
private Long resourceTypeId;
private String resourceTypeId;
/**
* 字段名
......
......@@ -21,7 +21,7 @@ public class ResourceType implements Serializable {
*/
//@Schema(description = "资源库类型ID")
@TableId(value = "resource_type_id")
private Long resourceTypeId;
private String resourceTypeId;
/**
* 资源库类型表名
......
......@@ -18,9 +18,9 @@ import java.util.Map;
*/
public interface ResourceFiledMapper extends BaseMapper<ResourceFiled> {
void deleteByResourceTypeId(@Param("resourceTypeId") Long resourceTypeId);
void deleteByResourceTypeId(@Param("resourceTypeId") String resourceTypeId);
List<ResourceFiled> findByResourceTypeId(@Param("resourceTypeId") Long resourceTypeId);
List<ResourceFiled> findByResourceTypeId(@Param("resourceTypeId") String resourceTypeId);
void createTable(@Param("tableName")String tableName,@Param("tableTile")String tableTile, @Param("resourceFields")List<ResourceFiledVo> resourceFields);
......@@ -30,13 +30,15 @@ public interface ResourceFiledMapper extends BaseMapper<ResourceFiled> {
int insertData(@Param("tableName")String tableName,@Param("resourceFieldValues")List<ResourceFieldValue> resourceFieldValues);
int updateData(@Param("id") Long id, @Param("tableName")String tableName,@Param("resourceFieldValues")List<ResourceFieldValue> resourceFieldValues);
int updateData(@Param("id") String id, @Param("tableName")String tableName,@Param("resourceFieldValues")List<ResourceFieldValue> resourceFieldValues);
List<Map<String,Object>> selectDataList(@Param("tableName")String tableName);
int deleteDataById(@Param("tableName")String tableName,@Param("id") Long id);
int deleteDataById(@Param("tableName")String tableName,@Param("id") String id);
void dropTableByResourceTableName(@Param("tableName") String tableName);
Map<String, Object> findFieldValueByResourceTypeIdAndId(@Param("tableName") String tableName,@Param("id") String id);
}
......
......@@ -28,21 +28,23 @@ public interface ResourceFiledService extends IService<ResourceFiled> {
ResourceFiledVo updateResourceFiled(ResourceFiledVo resourceFiled);
void deleteById(Long id);
void deleteById(String id);
void deleteByResourceTypeId(Long resourceFieldId);
void deleteByResourceTypeId(String resourceFieldId);
ResourceFiledVo findById(Long id);
ResourceFiledVo findById(String id);
List<ResourceFiledVo> findList();
List<ResourceFiledVo> findByResourceTypeId(Long resourceTypeId);
List<ResourceFiledVo> findByResourceTypeId(String resourceTypeId);
int saveResourceFiledValue(HashMap<String,Object> obj);
int saveResourceFiledValue(Map<String, Object> map);
List<Map<String, Object>> getResourceFieldValue(Long resourceTypeId);
List<Map<String, Object>> getResourceFieldValueList(String resourceTypeId);
int deleteResourceFieldValue(Long resourceTypeId, Long id);
int deleteResourceFieldValue(String resourceTypeId, String id);
List<ResourceFiledVo> findFieldValueByResourceTypeIdAndId(String resourceTypeId, String id);
void dropTableByResourceName(String tableName);
}
......@@ -22,9 +22,9 @@ public interface ResourceTypeService extends IService<ResourceType> {
ResourceTypeVo updateResourceTypeMain(ResourceTypeVo resourceType);
void deleteById(Long id);
void deleteById(String id);
ResourceTypeVo findById(Long id);
ResourceTypeVo findById(String id);
List<ResourceTypeVo> findList();
......
......@@ -11,8 +11,8 @@ import com.huigou.topsun.resource.domain.ResourceType;
import com.huigou.topsun.resource.mapper.ResourceFiledMapper;
import com.huigou.topsun.resource.mapper.ResourceTypeMapper;
import com.huigou.topsun.resource.service.ResourceFiledService;
//import com.huigou.topsun.resource.util.IdGenerator;
import com.huigou.topsun.resource.vo.ResourceFiledVo;
import com.huigou.topsun.util.CommonUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -31,9 +31,6 @@ public class ResourceFiledServiceImpl extends ServiceImpl<ResourceFiledMapper, R
private ResourceFiledMapper resourceFiledMapper;
@Resource
private ResourceTypeMapper resourceTypeMapper;
//@Resource
//private IdGenerator idGenerator;
@Override
public ResourceFiledVo saveResourceFiled(ResourceFiledVo resourceFiledVo) {
ResourceFiled resourceFiled = ResourceFiledVo.getResourceFiled(resourceFiledVo);
......@@ -87,19 +84,19 @@ public class ResourceFiledServiceImpl extends ServiceImpl<ResourceFiledMapper, R
}
@Override
public void deleteById(Long id) {
public void deleteById(String id) {
this.removeById(id);
}
@Override
public void deleteByResourceTypeId(Long resourceTypeId) {
public void deleteByResourceTypeId(String resourceTypeId) {
LambdaQueryWrapper<ResourceFiled> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ResourceFiled::getResourceTypeId,resourceTypeId);
this.remove(queryWrapper);
}
@Override
public ResourceFiledVo findById(Long id) {
public ResourceFiledVo findById(String id) {
ResourceFiled resourceFiled = this.getById(id);
return ResourceFiledVo.getResourceFiledVo(resourceFiled);
}
......@@ -111,7 +108,7 @@ public class ResourceFiledServiceImpl extends ServiceImpl<ResourceFiledMapper, R
}
@Override
public List<ResourceFiledVo> findByResourceTypeId(Long resourceTypeId) {
public List<ResourceFiledVo> findByResourceTypeId(String resourceTypeId) {
LambdaQueryWrapper<ResourceFiled> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ResourceFiled::getResourceTypeId,resourceTypeId);
List<ResourceFiled> list = this.list(queryWrapper);
......@@ -128,20 +125,20 @@ public class ResourceFiledServiceImpl extends ServiceImpl<ResourceFiledMapper, R
}
@Override
public int saveResourceFiledValue(HashMap<String,Object> map) {
Long resourceTypeId = (Long) map.get("resourceTypeId");
public int saveResourceFiledValue(Map<String,Object> map) {
String resourceTypeId = (String) map.get("resourceTypeId");
ResourceType resourceType = resourceTypeMapper.selectById(resourceTypeId);
//获取表名
String tableName = resourceType.getResourceTableName();
//获取字段
List<ResourceFiledVo> resourceFiledList = this.findByResourceTypeId(resourceTypeId);
//自动生成长整型id值
//自动生成uuid值
List<ResourceFieldValue> resourceFieldValues = this.dealFieldAndValue(resourceFiledList, map);
Long id = (Long) map.get("id");
if (id == null){
Object idObj = map.get("id");
if (idObj == null || idObj == ""){
return resourceFiledMapper.insertData(tableName,resourceFieldValues);
}else {
return resourceFiledMapper.updateData((Long) map.get("id"),tableName,resourceFieldValues);
return resourceFiledMapper.updateData(idObj.toString(),tableName,resourceFieldValues);
}
}
......@@ -151,7 +148,7 @@ public class ResourceFiledServiceImpl extends ServiceImpl<ResourceFiledMapper, R
* @param map
* @return
*/
public List<ResourceFieldValue> dealFieldAndValue(List<ResourceFiledVo> resourceFiledList, HashMap<String, Object> map){
public List<ResourceFieldValue> dealFieldAndValue(List<ResourceFiledVo> resourceFiledList, Map<String, Object> map){
Set<String> keySet = map.keySet();
List<ResourceFieldValue> resourceFieldValues = new ArrayList<>();
resourceFiledList
......@@ -163,7 +160,7 @@ public class ResourceFiledServiceImpl extends ServiceImpl<ResourceFiledMapper, R
resourceFieldValue.setField(key);
//如果值是字符串,文本,日期格式的需要加英文状态下的引号: ''
if ("string".equals(resourceFiled.getResourceFieldType()) ||
"datetime".equals(resourceFiled.getResourceFieldType()) ||
"date".equals(resourceFiled.getResourceFieldType()) ||
"text".equals(resourceFiled.getResourceFieldType()) ){
resourceFieldValue.setValue("'" + map.get(key) + "'");
}else {
......@@ -173,20 +170,19 @@ public class ResourceFiledServiceImpl extends ServiceImpl<ResourceFiledMapper, R
}
}
});
Long id = (Long) map.get("id");
if (id == null){
Object idObj = map.get("id");
if (idObj == null || idObj == ""){
ResourceFieldValue resourceFieldValue = new ResourceFieldValue();
resourceFieldValue.setField("id");
//Long nextedId = idGenerator.nextId(resourceFieldValue);
resourceFieldValue.setValue(null);
String uuid = CommonUtil.createUuid();
resourceFieldValue.setValue("'"+uuid+"'");
resourceFieldValues.add(resourceFieldValue);
}
return resourceFieldValues;
}
@Override
public List<Map<String, Object>> getResourceFieldValue(Long resourceTypeId){
public List<Map<String, Object>> getResourceFieldValueList(String resourceTypeId){
List<Map<String, Object>> maps = new ArrayList<>();
if (resourceTypeId == null){
return maps;
......@@ -200,13 +196,30 @@ public class ResourceFiledServiceImpl extends ServiceImpl<ResourceFiledMapper, R
}
@Override
public int deleteResourceFieldValue(Long resourceTypeId, Long id){
public int deleteResourceFieldValue(String resourceTypeId, String id){
ResourceType resourceType = resourceTypeMapper.selectById(resourceTypeId);
//获取表名
String tableName = resourceType.getResourceTableName();
return resourceFiledMapper.deleteDataById(tableName,id);
}
@Override
public List<ResourceFiledVo> findFieldValueByResourceTypeIdAndId(String resourceTypeId, String id) {
ResourceType resourceType = resourceTypeMapper.selectById(resourceTypeId);
//获取表名
String tableName = resourceType.getResourceTableName();
Map<String, Object> map = resourceFiledMapper.findFieldValueByResourceTypeIdAndId(tableName, id);
List<ResourceFiledVo> filedVoList = this.findByResourceTypeId(resourceTypeId);
if (map == null){
return filedVoList;
}
for (ResourceFiledVo resourceFiledVo : filedVoList) {
Object value = map.get(resourceFiledVo.getResourceFieldName());
resourceFiledVo.setResourceFieldValue(value);
}
return filedVoList;
}
@Override
public void dropTableByResourceName(String tableName) {
resourceFiledMapper.dropTableByResourceTableName(tableName);
......
......@@ -7,7 +7,7 @@ import com.huigou.topsun.resource.domain.ResourceType;
import com.huigou.topsun.resource.mapper.ResourceTypeMapper;
import com.huigou.topsun.resource.service.ResourceFiledService;
import com.huigou.topsun.resource.service.ResourceTypeService;
import com.huigou.topsun.resource.util.PinyinHelperUtil;
import com.huigou.topsun.util.PinyinHelperUtil;
import com.huigou.topsun.resource.vo.ResourceFiledVo;
import com.huigou.topsun.resource.vo.ResourceTypeTreeVo;
import com.huigou.topsun.resource.vo.ResourceTypeVo;
......@@ -47,7 +47,7 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
List<String> fieldList = new ArrayList<>();
for (int i = 0; i < resourceFileds.size(); i++) {
ResourceFiledVo resourceFiled = resourceFileds.get(i);
resourceFiled.setResourceTypeId(resourceType.getResourceTypeId().toString());
resourceFiled.setResourceTypeId(resourceType.getResourceTypeId());
resourceFiled.setResourceFieldId(null);
//字段名称首字母小写
String pinYinHeadChar = PinyinHelperUtil.getPinYinHeadChar(resourceFiled.getResourceFiledTitle());
......@@ -91,7 +91,7 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
//字段名称首字母小写
String pinYinHeadChar = PinyinHelperUtil.getPinYinHeadChar(resourceFiledVo.getResourceFieldName());
resourceFiledVo.setResourceFieldName(pinYinHeadChar);
resourceFiledVo.setResourceTypeId(resourceTypeVo.getResourceTypeId().toString());
resourceFiledVo.setResourceTypeId(resourceTypeVo.getResourceTypeId());
resourceFiledService.saveResourceFiled(resourceFiledVo);
}
//更新表
......@@ -136,7 +136,7 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
@Override
public void deleteById(Long id) {
public void deleteById(String id) {
ResourceType resourceType = this.getById(id);
resourceFiledService.deleteByResourceTypeId(id);
resourceTypeMapper.deleteById(id);
......@@ -144,7 +144,7 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
}
@Override
public ResourceTypeVo findById(Long id) {
public ResourceTypeVo findById(String id) {
return ResourceTypeVo.getResourceTypeVo(this.getById(id));
}
......
//package com.huigou.topsun.resource.util;
//
//import cn.hutool.core.lang.Snowflake;
//import cn.hutool.core.util.IdUtil;
//import com.baomidou.mybatisplus.core.incrementer.IKeyGenerator;
//import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
//import org.hibernate.HibernateException;
//import org.hibernate.engine.spi.SessionImplementor;
//import org.hibernate.id.IdentifierGenerator;
//import org.springframework.stereotype.Component;
//
//import java.io.Serializable;
//
//@Component
//public class IdGenerator implements IdentifierGenerator {
// @Override
// public Long nextId(Object entity) {
// //使用 hutools 雪花算法生成分布式ID
// //参数1为终端ID
// //参数2为数据中心ID
// Snowflake snowflake = IdUtil.getSnowflake(1, 1);
// return snowflake.nextId();
// }
//
// @Override
// public Serializable generate(SessionImplementor sessionImplementor, Object o) throws HibernateException {
// return null;
// }
//}
......@@ -33,6 +33,11 @@ public class ResourceFiledVo implements Serializable {
//@Schema(description = "字段名")
private String resourceFieldName;
/**
* 字段值
*/
private Object resourceFieldValue = "";
/**
* 字段显示名
*/
......
......@@ -18,7 +18,7 @@ public class ResourceTypeVo implements Serializable {
* 资源库类型ID
*/
//@Schema(description = "资源库类型ID")
private Long resourceTypeId;
private String resourceTypeId;
/**
* 资源库类型表名
......
package com.huigou.topsun.util;
import java.util.UUID;
public class CommonUtil {
/**
* @Description TODO(自动生成uuid)
*/
public static String createUuid() {
UUID u = UUID.randomUUID();
String uuid = u.toString().replace("-", "").toUpperCase();
return uuid;
}
}
package com.huigou.topsun.resource.util;
package com.huigou.topsun.util;
import net.sourceforge.pinyin4j.PinyinHelper;
public class PinyinHelperUtil {
/**
......
......@@ -56,7 +56,7 @@
<update id="createTable">
create table ${tableName}
( id bigint(0) COMMENT '主键ID',
( id varchar(128) COMMENT '主键ID',
<foreach collection="resourceFields" item="resourceField" separator=",">
<include refid="matchFieldType"/>
</foreach>
......@@ -108,6 +108,9 @@
<select id="selectDataList" resultType="java.util.Map" parameterType="java.lang.String">
select * from ${tableName}
</select>
<select id="findFieldValueByResourceTypeIdAndId" resultType="java.util.Map">
select * from ${tableName} where id = #{id}
</select>
<delete id="deleteDataById">
delete from ${tableName} where id = #{id}
......
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