1:ocr_dict_init

feat/dict_gz_0430
guanzheng 1 year ago
parent 6e857bae4c
commit 0a7c3ab0a4

@ -79,6 +79,18 @@
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-3 control-label is-required">* 租户:</label>
<div class="col-sm-9">
<select data-placeholder="请选择租户" id="tenantId" name="tenantId" class="chosen-select" style="width:100%;" tabindex="4" required>
<option value=''>选择租户</option>
</select>
</div>
</div>
</div>
</div>
</form>
</div>
@ -119,6 +131,33 @@
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',
});
parent.axgetXiaoyao("${ctx}/backstage/admin/department/showDeptJsTree",null,false,function (data) {
$.each(data,function(name,anArray) {
console.log(anArray)
$("#tenantId").append("<option value='" + anArray.deptNo + "'>" + anArray.name + "</option>");
});
});
var config = {
'.chosen-select': {},
'.chosen-select-deselect': {
allow_single_deselect: true
},
'.chosen-select-no-single': {
disable_search_threshold: 10
},
'.chosen-select-no-results': {
no_results_text: 'Oops, nothing found!'
},
'.chosen-select-width': {
width: "95%"
}
}
//for (var selector in config) {
// $(selector).chosen(config[selector]);
//}
_tableListDistionary = $('#Distionary_list').bootstrapTable({
url: '${ctx}/ocr/dictionary/list',
pagination: true, //是否显示分页(*
@ -149,6 +188,8 @@
// { width:150,valign: "middle",field:'distionatygroupid',title:'数据字典分组主键',sortable:true},
{ width:150,valign: "middle",field:'value',title:'编码',sortable:true},
{ width:150,valign: "middle",field:'lable',title:'描述',sortable:true},
{ width:150,valign: "middle",field:'tenantName',title:'部门名称',sortable:true},
{
width:200,
field: 'id',
@ -164,6 +205,15 @@
]
});
/*
$('.i-checks').iCheck({
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',
});*/
$("#Distionaryform").attr("action","${ctx}/ocr/dictionary/save");
var distionaryForm1 = $('#Distionaryform');
var distionaryError1 = $('.alert-danger', distionaryForm1);
@ -198,6 +248,7 @@
},
success: function (label) {
label.closest('.form-group').removeClass('has-error');
},
submitHandler: function (){
parent.layer.load();
@ -241,10 +292,10 @@
});
}
function _distionaryAdd(){
$("#Distionaryform")[0].reset();
showDistionaryModel();
$("#Distionaryform")[0].reset();
}
function _distionaryUpdateData(jframeid,str){
parent.axgetXiaoyao('${ctx}/ocr/dictionary/getdata/' + str,null,false , function(data){
@ -252,10 +303,12 @@
$("#id").val(data.data.id);
$("#value").val(data.data.value);
$("#lable").val(data.data.lable);
$("#tenantId option[value='" + data.data.tenantId + "']").attr("selected",true);
showDistionaryModel();
}else{
parent.toastr.error("非法请求。");
}
});
}

@ -288,7 +288,7 @@ public class DepartmentServiceImpl extends BaseServiceImpl<DepartmentMybatisDao,
jsoncell.put("id", departmentVo.getId().toString());
jsoncell.put("pId",departmentVo.getpId().toString());
jsoncell.put("name",departmentVo.getName());
jsoncell.put("deptNo",departmentVo.getDeptNo());
jsoncells.add(jsoncell);
}

@ -15,6 +15,9 @@ public class DepartmentVo implements Serializable{
private String name;
private String deptNo;
@JsonSerialize(using = ToStringSerializer.class)
public Long getId() {
return id;
@ -40,4 +43,12 @@ public class DepartmentVo implements Serializable{
public void setName(String name) {
this.name = name;
}
public String getDeptNo() {
return deptNo;
}
public void setDeptNo(String deptNo) {
this.deptNo = deptNo;
}
}

@ -168,7 +168,8 @@
select
ID AS id,
DEPARTNAME AS name,
PARENTID AS pId
PARENTID AS pId,
DEPTNO AS deptNo
from S_DEPARTMENT_T WHERE 1=1
<if test="enabled != null"> and ENABLED ${enabled.dataOp} ${enabled.likestar}#{enabled.value}${enabled.likeend}</if>
<if test="parentid != null"> and PARENTID ${parentid.dataOp} ${parentid.likestar}#{parentid.value}${parentid.likeend}</if>
@ -185,7 +186,8 @@
select
ID AS id,
DEPARTNAME AS name,
PARENTID AS pId
PARENTID AS pId,
DEPTNO AS deptNo
from S_DEPARTMENT_T WHERE ID = #{id}
</select>
<select id="selectRootidById" resultMap="BaseResultMap_only" parameterType="java.lang.Long">

@ -1,5 +1,7 @@
package cn.jyjz.xiaoyao.ocr.controller;
import cn.jyjz.xiaoyao.admin.dataobject.Department;
import cn.jyjz.xiaoyao.admin.service.DepartmentService;
import cn.jyjz.xiaoyao.admin.service.ResourcesService;
import cn.jyjz.xiaoyao.admin.service.UserService;
import cn.jyjz.xiaoyao.common.base.constant.SystemConstants;
@ -31,7 +33,10 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* ocr_
@ -55,6 +60,10 @@ public class OcrDictionaryController extends BaseController {
@Autowired
private UserService userService;
@Autowired
private DepartmentService departmentService;
@Autowired
private ResourcesService resourcesService;
@ -122,6 +131,14 @@ public class OcrDictionaryController extends BaseController {
QueryWrapper<OcrDictionary> queryWrapper = SearchQueryFormat
.queryStringFormat(searchQuery,distionarygroup);
IPage<OcrDictionary> page = this.ocrDictionaryService.selectSearchListPage(paramterPage,queryWrapper);;
List<OcrDictionary> records = page.getRecords();
List<Long> tenantIds = records.stream().map(OcrDictionary::getTenantId).collect(Collectors.toList());
List<Department> departments = departmentService.list(new LambdaQueryWrapper<Department>().in(Department::getDeptno, tenantIds));
Map<String, String> deptNameMap = departments.stream().collect(Collectors.toMap(Department::getDeptno, Department::getDepartname));
records.forEach(s->{
s.setTenantName(deptNameMap.get(String.valueOf(s.getTenantId())));
});
return ResultVoUtil.success(page);
}
@ -163,6 +180,8 @@ public class OcrDictionaryController extends BaseController {
@ResponseBody
public ResultVo getdateDistionarygroup(HttpServletResponse response,HttpServletRequest request,@PathVariable("id") Long id) throws IOException{
OcrDictionary dto = this.ocrDictionaryService.selectDtoById(id);
Department one = departmentService.getOne(new LambdaQueryWrapper<Department>().eq(Department::getDeptno, dto.getTenantId()).last("limit 1"));
dto.setTenantName(Objects.nonNull(one)?one.getDepartname():"");
if(null != dto){
return ResultVoUtil.success(dto);
}else{

@ -59,8 +59,13 @@ public class OcrDictionary implements BaseDto,java.io.Serializable{
@ApiModelProperty(value ="租户id")
@TableField(value="tenant_id")
@JsonSerialize(using = ToStringSerializer.class)
private Long tenantId;
@ApiModelProperty(value ="租户名称")
@TableField(exist = false)
private String tenantName;
@ApiModelProperty(value ="字典组")
@TableField(value="group_id")
private Long groupId;

Loading…
Cancel
Save