Commit 61d40d2b authored by 鲁鑫's avatar 鲁鑫

同步人员到SAP

parent 12a91a8a
......@@ -116,7 +116,7 @@ $(function () {
{ id: "addProjectOrgFun", text: "添加业务岗位", img: "fa-plus" },
{ id: "assignPerson", text: "分配人员", click: assignPerson, img: "fa-user-plus" },
{ id: "updateOrg", text: "修改", click: showUpdateOrg, img: "fa-edit" },
{ id: "deleteOrg", text: "删除", click: logicDeleteOrg, img: "fa-trash-o" },
//{ id: "deleteOrg", text: "删除", click: logicDeleteOrg, img: "fa-trash-o" },
{ id: "enableOrg", text: "启用", click: enableOrg, img: "fa-thumbs-o-up" },
{ id: "disableOrg", text: "禁用", click: disableOrg, img: "fa-thumbs-down" },
{ id: 'saveID', text:'保存排序号', click: updateOrgSequence, img: "fa-floppy-o"},
......@@ -155,7 +155,9 @@ $(function () {
render: function (item) {
return item.isVirtual == 1 ? "是": "否";
}
}
},
{ display: "消息类型", name: "typeTextView", width: 100, minWidth: 60, type: "string", align: "left" },
{ display: "消息文本", name: "message", width: 200, minWidth: 60, type: "string", align: "left" },
],
dataAction: "server",
url: web_app.name + "/org/slicedQueryOrgs.ajax",
......@@ -561,43 +563,45 @@ function sapMesShow(){
UICtrl.setElRequiredFlag("#country",true);
UICtrl.setElRequiredFlag("#bankCountry",true);
UICtrl.setElRequiredFlag("#bankCode",true);
UICtrl.setElRequiredFlag("#consultItem",true);
//UICtrl.setElRequiredFlag("#consultItem",true);
UICtrl.setElRequiredFlag("#companyCode",true);
UICtrl.setElRequiredFlag("#bankAccountNumber",true);
UICtrl.setElRequiredFlag("#langu",true);
UICtrl.setElRequiredFlag("#region",true);
UICtrl.setElRequiredFlag("#regionName",true);
}
function sapMesHide(){
UICtrl.setElRequiredFlag("#country",false);
UICtrl.setElRequiredFlag("#bankCountry",false);
UICtrl.setElRequiredFlag("#bankCode",false);
UICtrl.setElRequiredFlag("#consultItem",false);
//UICtrl.setElRequiredFlag("#consultItem",false);
UICtrl.setElRequiredFlag("#companyCode",false);
UICtrl.setElRequiredFlag("#bankAccountNumber",false);
UICtrl.setElRequiredFlag("#langu",false);
UICtrl.setElRequiredFlag("#region",false);
UICtrl.setElRequiredFlag("#regionName",false);
$("#country").val("");
$("#bankCountry").val("");
$("#bankCode").val("");
$("#consultItem").val("");
//$("#consultItem").val("");
$("#companyCode").val("");
$("#bankAccountNumber").val("");
$("#langu").val("");
$("#region").val("");
$("#regionName").val("");
}
function doSavePerson() {
var _self = this;
var id = getId();
var type = $("#type").val();
var param = {};
var url = web_app.name + (id ? '/org/updatePerson.ajax' : '/org/insertPerson.ajax');
$('#submitForm').ajaxSubmit({ url: url, param: param, success: function () {
Public.ajax(web_app.name + "/syncOrg/insertOrUpdatePersonToSap.ajax",{code:$("#code").val(),flag:type=='S'?"U":"I"},function () {
refreshFlag = true;
_self.close();
}
})}
});
}
......@@ -740,6 +744,7 @@ function enableOrg() {
param: params,
message: msg,
onSuccess: function () {
//Public.ajax("/syncOrg/enableOrDisablePerson.ajax",{id:row.id,flag:""})
Public.tip("启用“" + name + "”成功。");
reloadGrid();
}
......@@ -772,8 +777,10 @@ function disableOrg() {
param: params,
message: msg,
onSuccess: function () {
Public.tip("禁用“" + name + "”成功。");
reloadGrid();
Public.ajax(web_app.name + "/syncOrg/enableOrDisablePerson.ajax",{id:row.id,flag:"D"},function () {
Public.tip("禁用“" + name + "”成功。");
reloadGrid();
})
}
});
}
......
......@@ -7,6 +7,8 @@
<x:hidden name="version" />
<x:hidden name="status" />
<x:hidden name="picturePath" />
<x:hidden name="type" />
<x:hidden name="message" />
<div class="hg-form-row">
<div class="col-md-8">
<div class="hg-form-row">
......@@ -26,7 +28,7 @@
</div>
<div class="hg-form-row">
<x:inputC name="sequence" required="true" label="排序号" spinner="true" mask="nnn" dataOptions="min:1" labelCol="2" fieldCol="4" />
<x:selectC name="isSapPerson" required="true" label="是否SAP员工" dictionary="yesorno" labelCol="2" fieldCol="4" />
<x:selectC name="isSapPerson" required="true" label="SAP员工" dictionary="yesorno" labelCol="2" fieldCol="4" />
</div>
<div class="hg-form-row" id="sapMes2">
<x:selectC name="langu" label="语言" labelCol="2" fieldCol="4" dictionary="langu"/>
......@@ -49,13 +51,11 @@
<x:hidden name="region"/>
<x:selectC dictionary="country" name="bankCountry" label="银行所属国家" labelCol="2" fieldCol="4" />
</div>
<div class="col-md-4">
<x:inputC name="bankCode" label="银行代码" labelCol="4" fieldCol="8" wrapper="select"/>
</div>
</div>
<div class="hg-form-row">
<div class="col-md-8">
<x:inputC name="consultItem" label="参考明细" labelCol="2" fieldCol="4" />
<x:inputC name="bankCode" label="银行代码" labelCol="2" fieldCol="4" wrapper="select"/>
<%--<x:inputC name="consultItem" label="参考明细" labelCol="2" fieldCol="4" />--%>
<x:inputC name="companyCode" label="公司代码" labelCol="2" fieldCol="4" wrapper="select"/>
</div>
<div class="col-md-4">
......@@ -65,7 +65,7 @@
</div>
<div class="hg-form-row">
<div class="col-md-8">
<x:selectC name="sex" dictionary="sexFlag" label="性别" labelCol="2" fieldCol="4" />
<x:selectC name="sex" dictionary="sexFlag" label="性别" required="true" labelCol="2" fieldCol="4" />
<x:selectC name="marriage" dictionary="maritalStatus" label="婚姻状况" labelCol="2" fieldCol="4" />
</div>
<div class="col-md-4">
......
......@@ -170,37 +170,37 @@ public class SapQualityInfoRecordItemVo implements Serializable {
/**
* 批次号
*/
@JsonProperty("BATCH_NO")
@JsonProperty("CHARG")
private String batchNo;
/**
* 检验数量
*/
@JsonProperty("CHECK_NUMBER")
@JsonProperty("LFMNG")
private BigDecimal checkNumber;
/**
* 单位
*/
@JsonProperty("UNIT")
@JsonProperty("LFMNE")
private String unit;
/**
* 凭证年份
*/
@JsonProperty("CERTIFICATE_YEAR")
@JsonProperty("MJAHR")
private String certificateYear;
/**
* 凭证号
*/
@JsonProperty("CERTIFICATE_NO")
@JsonProperty("MBLNR")
private String certificateNo;
/**
* 凭证项次
*/
@JsonProperty("CERTIFICATE_ITEM")
@JsonProperty("ZEILE")
private String certificateItem;
}
......@@ -3,8 +3,9 @@ package com.huigou.topsun.syncOrg.application;
import com.huigou.topsun.syncOrg.vo.EpOrgVo;
import com.huigou.topsun.syncOrg.vo.OrgPersonVo;
import com.huigou.topsun.syncOrg.vo.PersonVo;
import com.huigou.topsun.syncOrg.vo.SapPersonVo;
import com.huigou.topsun.syncOrg.vo.SapPersonVo.SapPersonVo;
import com.huigou.uasp.bmp.opm.domain.model.org.Org;
import com.huigou.uasp.bmp.opm.domain.model.org.Person;
import java.io.IOException;
import java.util.List;
......@@ -43,11 +44,30 @@ public interface OrgSyncApplication {
/**
* 同步SAP人员
*/
public void syncOrgToSap() throws IOException;
public void syncPersonListToSap();
/**
* 同步SAP人员
*/
public void syncPersonToSap(String flag,List<String> codes);
/**
* 构建SAP人员
* @return
*/
List<SapPersonVo> slicedSapPersonVoList();
List<SapPersonVo> slicedSapPersonVo(List<String> codes);
void buildSapPerson(String flag,List<SapPersonVo> sapPersonVoList);
/**
* 根据fullid模糊查询下属人员编码
* @param fullId
* @return
*/
List<Person> queryPersonCodeByFullId(String fullId);
List<SapPersonVo> querySapPersonVoByFullId(String fullId);
}
package com.huigou.topsun.syncOrg.application.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.topsun.common.OrgKindId;
import com.huigou.topsun.sap.common.DefaultHttpClient;
import com.huigou.topsun.sap.common.application.SapMutualEpLogApplication;
import com.huigou.topsun.sap.common.domain.SapResult;
import com.huigou.topsun.syncOrg.application.OrgSyncApplication;
import com.huigou.topsun.syncOrg.vo.*;
import com.huigou.topsun.syncOrg.vo.SapPersonVo.BankVo;
import com.huigou.topsun.syncOrg.vo.SapPersonVo.CompanyCodeVo;
import com.huigou.topsun.syncOrg.vo.SapPersonVo.MdClientSapVo;
import com.huigou.topsun.syncOrg.vo.SapPersonVo.SapPersonVo;
import com.huigou.uasp.bmp.common.application.BaseApplication;
import com.huigou.uasp.bmp.opm.domain.model.org.Org;
import com.huigou.uasp.bmp.opm.domain.model.org.Person;
import com.huigou.uasp.bmp.opm.repository.org.OrgRepository;
import com.huigou.uasp.bmp.opm.repository.org.PersonRepository;
import com.huigou.util.DateUtil;
import com.huigou.util.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -34,6 +43,10 @@ public class OrgSyncApplicationImpl extends BaseApplication implements OrgSyncAp
private OrgRepository orgRepository;
@Autowired
private DefaultHttpClient httpClient;
@Autowired
SapMutualEpLogApplication sapMutualEpLogApplication;
@Autowired
private PersonRepository personRepository;
@Override
public EpOrgVo buildOrgVo () {
......@@ -121,11 +134,114 @@ public class OrgSyncApplicationImpl extends BaseApplication implements OrgSyncAp
}
@Override
public void syncOrgToSap() throws IOException {
List<SapPersonVo> sapPersonVoList = this.slicedSapPersonVoList();
String execute = httpClient.execute(sapPersonVoList, "");
LOG.info("====同步到SAP返回消息===={}",execute);
LOG.info(DateUtil.getDateFormat(new Date())+"====同步的组织结构数据===={}",sapPersonVoList);
public void syncPersonListToSap() {
List<SapPersonVo> sapPersonVos = this.slicedSapPersonVoList();
this.buildSapPerson("",sapPersonVos);
}
@Override
public void syncPersonToSap(String flag, List<String> codes) {
List<SapPersonVo> sapPersonVos = this.slicedSapPersonVo(codes);
this.buildSapPerson(flag,sapPersonVos);
}
@Override
public void buildSapPerson(String flag,List<SapPersonVo> sapPersonVoList) {
List<MdClientSapVo> mdClientSapVoList = new ArrayList<>();
List<String> ids = new ArrayList<>();
for (SapPersonVo sapPersonVo : sapPersonVoList) {
MdClientSapVo mdClientSapVo = new MdClientSapVo();
mdClientSapVo.setUpdkz(StringUtil.isNotBlank(flag)?flag:sapPersonVo.getFlag());//第一次新增I,修改U,删除D
mdClientSapVo.setRltyp("FLCU00");//BP角色,财务客户
mdClientSapVo.setBuGroup("C007");//业务伙伴分类,员工客户
mdClientSapVo.setKunnr(sapPersonVo.getCode());//员工编码
mdClientSapVo.setNameOrg1(sapPersonVo.getName());//名称
mdClientSapVo.setNameOrg3(sapPersonVo.getEnglishName());//英文名称
mdClientSapVo.setBuSort1(sapPersonVo.getName());//搜索词
mdClientSapVo.setSmtpAddr(sapPersonVo.getEmail());//邮件
if ("0".equals(sapPersonVo.getSex())){
mdClientSapVo.setTitle("0002");//男
}else if ("1".equals(sapPersonVo.getSex())){
mdClientSapVo.setTitle("0001");//女
}
mdClientSapVo.setTelNumber(sapPersonVo.getOfficePhone());//办公电话
mdClientSapVo.setMobNumber(sapPersonVo.getMobilePhone());//移动电话
mdClientSapVo.setPostCode1(sapPersonVo.getZip());//邮编
mdClientSapVo.setStras(sapPersonVo.getFamilyAddress());//家庭住址
mdClientSapVo.setLand1(sapPersonVo.getCountry());//国家
mdClientSapVo.setLangu(sapPersonVo.getLangu());//语言
mdClientSapVo.setRegion(sapPersonVo.getRegion());//地区
mdClientSapVo.setKnozs(sapPersonVo.getKostl());//成本中心
//银行信息
List<BankVo> bankVoList = new ArrayList<>();
BankVo bankVo = new BankVo();
bankVo.setBanks(sapPersonVo.getBankCountry());//银行所属国家
bankVo.setBankl(sapPersonVo.getBankCode());//银行代码
//银行账户
if (sapPersonVo.getBankAccountNumber().length() > 18){
String bankn = sapPersonVo.getBankAccountNumber();
bankVo.setBankn(bankn.substring(0,18));
//账户明细放18位后的值
bankVo.setBkref(bankn.substring(18,bankn.length()));
}else {
bankVo.setBankn(sapPersonVo.getBankAccountNumber());
}
bankVo.setKoinh(sapPersonVo.getName());//账户持有人姓名
bankVo.setAccname(sapPersonVo.getName());//银行账户的名称
bankVoList.add(bankVo);
//公司信息
List<CompanyCodeVo> companyCodeVoList = new ArrayList<>();
CompanyCodeVo companyCodeVo = new CompanyCodeVo();
companyCodeVo.setBukrs(sapPersonVo.getCompanyCode());//公司代码
companyCodeVo.setAkont("1221050000");//其他应收款-个人往来款
companyCodeVo.setZuawa("001");//排序
companyCodeVoList.add(companyCodeVo);
mdClientSapVo.setBank(bankVoList);
mdClientSapVo.setKnb1(companyCodeVoList);
mdClientSapVoList.add(mdClientSapVo);
ids.add(sapPersonVo.getId());
}
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("businessType", "人员部门主数据");
resultMap.put("businessId", DateUtil.getDateFormat(new Date(),"yyyy-MM-dd HH:mm:ss"));
resultMap.put("parameter", JSON.toJSONString(mdClientSapVoList));
resultMap.put("sequence", resultMap.get("row"));
try {
String result = httpClient.execute(mdClientSapVoList, "cud_custom/customer");
List<SapResult> sapResultList = JSONObject.parseArray(result, SapResult.class);
if (sapResultList.size()<1){
throw new RuntimeException("数据传输失败,没有收到返回结果:" + sapResultList);
}
List<Person> personList = personRepository.findAll(ids);
if (!CollectionUtils.isEmpty(sapPersonVoList) && !CollectionUtils.isEmpty(personList)){
for (Person person : personList) {
for (SapResult sapResult : sapResultList) {
if ("E".equals(sapResult.getTYPE())){
person.setType(sapResult.getTYPE());
person.setMessage(sapResult.getMESSAGE());
}else {
//根据返回的编码匹配是否传成功
if (sapResult.getMESSAGE().contains(person.getCode()) || sapResult.getMESSAGE_V1().contains(person.getCode())){
person.setType(sapResult.getTYPE());
person.setMessage(sapResult.getMESSAGE());
}
}
}
}
}
personRepository.save(personList);
resultMap.put("type", "S");
resultMap.put("message", "成功");
} catch (Exception e) {
resultMap.put("type", "E");
resultMap.put("message", e.getMessage());
throw new RuntimeException("数据传输失败请检查数据后重试!" + e.getMessage());
} finally {
//sapMutualEpLogApplication.saveSapMutualEpLog(resultMap);
}
}
@Override
......@@ -134,6 +250,27 @@ public class OrgSyncApplicationImpl extends BaseApplication implements OrgSyncAp
return this.sqlExecutorDao.queryToList(queryDescriptor.getSql(), SapPersonVo.class);
}
@Override
public List<SapPersonVo> slicedSapPersonVo(List<String> codes) {
String code = String.join(",", codes);
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "slicedSapPersonVo");
return this.sqlExecutorDao.queryToList(queryDescriptor.getSql(), SapPersonVo.class,code);
}
@Override
public List<Person> queryPersonCodeByFullId(String fullId) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "queryCodeByFullId");
return this.sqlExecutorDao.queryToList(queryDescriptor.getSql(),Person.class, fullId);
}
@Override
public List<SapPersonVo> querySapPersonVoByFullId(String fullId) {
StringBuilder stringBuffer = new StringBuilder();
StringBuilder append = stringBuffer.append("%").append(fullId).append("%");
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "querySapPersonVoByFullId");
return this.sqlExecutorDao.queryToList(queryDescriptor.getSql(),SapPersonVo.class, append.toString());
}
/**
* 字符串转hashcode
* @param value
......
......@@ -2,14 +2,22 @@ package com.huigou.topsun.syncOrg.controller;
import com.huigou.topsun.syncOrg.application.OrgSyncApplication;
import com.huigou.topsun.syncOrg.vo.EpOrgVo;
import com.huigou.topsun.syncOrg.vo.SapPersonVo.SapPersonVo;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.annotation.SkipAuth;
import com.huigou.uasp.bmp.opm.domain.model.org.Person;
import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Auther: xin.lu
* @Date: 2024/03/25/10:51
......@@ -27,4 +35,30 @@ public class SyncOrgController extends CommonController {
public EpOrgVo syncOrgInfo() {
return orgSyncApplication.buildOrgVo();
}
@SkipAuth
@RequestMapping( value = "/syncOrgToSap")
@ResponseBody
public void syncOrgToSap() throws IOException {
orgSyncApplication.syncPersonListToSap();
}
public String insertOrUpdatePersonToSap(){
SDO sdo = this.getSDO();
String code = sdo.getString("code");
String flag = sdo.getString("flag");
List<String> codes = new ArrayList<>();
codes.add(code);
orgSyncApplication.syncPersonToSap(flag,codes);
return success();
}
public String enableOrDisablePerson(){
SDO sdo = this.getSDO();
String id = sdo.getId();
String flag = sdo.getString("flag");
List<SapPersonVo> sapPersonVos = orgSyncApplication.querySapPersonVoByFullId(id);
orgSyncApplication.buildSapPerson(flag,sapPersonVos);
return success();
}
}
......@@ -20,6 +20,6 @@ public class OrgSync {
/** * 每10分钟执行一次 */
//@Scheduled(cron = "0 0/10 * * * ?")
public void syncOrgToSap() throws IOException {
orgSyncApplication.syncOrgToSap();
orgSyncApplication.syncPersonListToSap();
}
}
package com.huigou.topsun.syncOrg.vo.SapPersonVo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther: xin.lu
* @Date: 2024/04/12/9:25
* @Description:
*/
@Data
public class BankVo implements Serializable {
/**
* 银行所属国家/地区代码
*/
@JsonProperty("BANKS")
private String banks;
/**
* 银行编号
*/
@JsonProperty("BANKL")
private String bankl;
/**
* 银行帐号
*/
@JsonProperty("BANKN")
private String bankn;
/**
* 账户持有人姓名
*/
@JsonProperty("KOINH")
private String koinh;
/**
* 账户名称
*/
@JsonProperty("ACCNAME")
private String accname;
/**
* 参考明细
*/
@JsonProperty("BKREF")
private String bkref;
}
package com.huigou.topsun.syncOrg.vo.SapPersonVo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther: xin.lu
* @Date: 2024/04/12/9:25
* @Description:
*/
@Data
public class BrandContactVo implements Serializable {
/**
* 品牌
*/
@JsonProperty("ZF01")
private String zf01;
/**
* 部门
*/
@JsonProperty("ZSECTION")
private String zsection;
/**
* 职位
*/
@JsonProperty("ZF02")
private String zf02;
/**
* 联系人
*/
@JsonProperty("ZF03")
private String zf03;
/**
* 电话号码
*/
@JsonProperty("ZF04")
private String zf04;
/**
* e_Mail
*/
@JsonProperty("ZF05")
private String zf05;
/**
* 经营类型
*/
@JsonProperty("ZF06")
private String zf06;
/**
* 工厂代号
*/
@JsonProperty("ZF07")
private String zf07;
/**
* 跟单员
*/
@JsonProperty("ZKUNR")
private String zkunr;
}
package com.huigou.topsun.syncOrg.vo.SapPersonVo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther: xin.lu
* @Date: 2024/04/12/9:26
* @Description:
*/
@Data
public class CompanyCodeVo implements Serializable {
/**
* 公司代码
*/
@JsonProperty("BUKRS")
private String bukrs;
/**
* 总帐中的统驭科目
*/
@JsonProperty("AKONT")
private String akont;
/**
* 付款条件代码
*/
@JsonProperty("ZTERM")
private String zterm;
/**
* 催款程序
*/
@JsonProperty("MAHNA")
private String mahna;
/**
* 排序代码
*/
@JsonProperty("ZUAWA")
private String zuawa;
}
package com.huigou.topsun.syncOrg.vo.SapPersonVo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
@Data
public class MdClientSapVo {
/**
* 业务伙伴分组
*/
@JsonProperty("BU_GROUP")
private String buGroup;
/**
* 屏幕用途的BP角色
*/
@JsonProperty("RLTYP")
private String rltyp;
/**
* 客户编号
*/
@JsonProperty("KUNNR")
private String kunnr;
/**
* 客户名称
*/
@JsonProperty("NAME_ORG1")
private String nameOrg1;
/**
* 性别
*/
@JsonProperty("TITLE_MEDI")
private String title;
/**
* 客户英文名称
*/
@JsonProperty("NAME_ORG3")
private String nameOrg3;
/**
* 客户简称
*/
@JsonProperty("BU_SORT1")
private String buSort1;
/**
* 注册地址
*/
@JsonProperty("STRAS")
private String stras;
/**
* 客户送货地址
*/
@JsonProperty("STR_SUPPL3")
private String strSuppl3;
/**
* 税号类比
*/
@JsonProperty("TAXTYPE")
private String taxtype;
/**
* 税号
*/
@JsonProperty("TAXNUMXL")
private String taxnumxl;
/**
* 成本中心
*/
@JsonProperty("KNOZS")
private String knozs;
/**
* 城市
*/
@JsonProperty("CITY1")
private String city1;
/**
* 国家
*/
@JsonProperty("LAND1")
private String land1;
/**
* 地区
*/
@JsonProperty("REGION")
private String region;
/**
* 语言代码
*/
@JsonProperty("LANGU")
private String langu;
/**
* 城市邮政编码
*/
@JsonProperty("POST_CODE1")
private String postCode1;
/**
* 电话号码
*/
@JsonProperty("TEL_NUMBER")
private String telNumber;
/**
* 移动电话
*/
@JsonProperty("MOB_NUMBER")
private String mobNumber;
/**
* 电子邮件地址
*/
@JsonProperty("SMTP_ADDR")
private String smtpAddr;
/**
* 做账难度等级
*/
@JsonProperty("KUKLA")
private String kukla;
/**
* 要求用客户系统货单
*/
@JsonProperty("KATR1")
private String katr1;
/**
* 盖章方式
*/
@JsonProperty("KATR2")
private String katr2;
/**
* 请款联
*/
@JsonProperty("KATR3")
private String katr3;
/**
* 客户联
*/
@JsonProperty("KATR4")
private String katr4;
/**
* 订单要求
*/
@JsonProperty("KATR5")
private String katr5;
/**
* 验收单要求
*/
@JsonProperty("KATR6")
private String katr6;
/**
* 客户系统验收要求
*/
@JsonProperty("KATR7")
private String katr7;
/**
* 要求签回货单
*/
@JsonProperty("KATR8")
private String katr8;
/**
* 货单是否打印送货日期
*/
@JsonProperty("KATR9")
private String katr9;
/**
* 不开发票
*/
@JsonProperty("KATR10")
private String katr10;
/**
* 请款要求
*/
@JsonProperty("ZT01")
private String zt01;
/**
* 客户工作时间
*/
@JsonProperty("ZT02")
private String zt02;
/**
* 收货方签字要求
*/
@JsonProperty("ZT03")
private String zt03;
/**
* 货单打印要求
*/
@JsonProperty("ZT04")
private String zt04;
/**
* 产品检验报告类型
*/
@JsonProperty("ZF08")
private String zf08;
/**
* 货单签回方式
*/
@JsonProperty("ZF09")
private String zf09;
/**
* 出货方式
*/
@JsonProperty("ZF10")
private String zf10;
/**
* 线路
*/
@JsonProperty("ZF11")
private String zf11;
/**
* 送货单打印默认设置
*/
@JsonProperty("ZF12")
private String zf12;
/**
* 送货单统计异常期限
*/
@JsonProperty("ZF13")
private String zf13;
/**
* 生产发货方式
*/
@JsonProperty("ZF14")
private String zf14;
/**
* 月结方式
*/
@JsonProperty("ZF15")
private String zf15;
/**
* 请款期限
*/
@JsonProperty("ZF16")
private String zf16;
/**
* 做账截止日
*/
@JsonProperty("ZF17")
private String zf17;
/**
* 客户收账截止日
*/
@JsonProperty("ZF18")
private String zf18;
/**
* 订单统计异常期限
*/
@JsonProperty("ZF19")
private String zf19;
/**
* 所属集团
*/
@JsonProperty("ZF21")
private String zf21;
/**
* 更新标识
*/
@JsonProperty("UPDKZ")
private String updkz;
/**
* 客户品牌联系人列表
*/
@JsonProperty("KNA1_ZPP")
private List<BrandContactVo> kna1Zpp;
/**
* 公司代码视图
*/
@JsonProperty("KNB1")
private List<CompanyCodeVo> knb1;
/**
* 销售组织视图
*/
@JsonProperty("KNVV")
private List<SaleOrgVo> knvv;
/**
* 银行账号列表
*/
@JsonProperty("BANK")
private List<BankVo> bank;
}
package com.huigou.topsun.syncOrg.vo.SapPersonVo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther: xin.lu
* @Date: 2024/04/12/9:27
* @Description:
*/
@Data
public class SaleOrgVo implements Serializable {
/**
* 销售组织
*/
@JsonProperty("VKORG")
private String vkorg;
/**
* 分销渠道
*/
@JsonProperty("VKORG")
private String vtweg;
/**
* 产品组
*/
@JsonProperty("SPART")
private String spart;
/**
* 客户组
*/
@JsonProperty("KDGRP")
private String kdgrp;
/**
* 销售部门
*/
@JsonProperty("VKBUR")
private String vkbur;
/**
* 销售组
*/
@JsonProperty("VKGRP")
private String vkgrp;
/**
* 客户分类
*/
@JsonProperty("KLABC")
private String klabc;
/**
* 货币码
*/
@JsonProperty("WAERS")
private String waers;
/**
* 价格清单类型
*/
@JsonProperty("PLTYP")
private String pltyp;
/**
* 国际贸易条款
*/
@JsonProperty("INCO1")
private String inco1;
/**
* 国际贸易条款位置
*/
@JsonProperty("INCO2")
private String inco2;
/**
* 付款条件代码
*/
@JsonProperty("ZTERM")
private String zterm;
/**
* 客户科目分配组
*/
@JsonProperty("KTGRD")
private String ktgrd;
/**
* 客户税分类
*/
@JsonProperty("TAXKD")
private String taxkd;
/**
* 装运条件用于定价过程确定的客户分类
*/
@JsonProperty("KALKS")
private String kalks;
}
package com.huigou.topsun.syncOrg.vo;
package com.huigou.topsun.syncOrg.vo.SapPersonVo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
......@@ -13,6 +13,9 @@ import java.io.Serializable;
*/
@Data
public class SapPersonVo implements Serializable {
private String id;
private String flag;
/**
* 上级
......
package com.huigou.uasp.bmp.opm.controller;
import com.huigou.data.domain.model.CommonDomainConstants;
import com.huigou.data.domain.query.CodeAndNameQueryRequest;
import com.huigou.domain.ValidStatus;
import com.huigou.exception.ApplicationException;
import com.huigou.topsun.syncOrg.application.OrgSyncApplication;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.bmp.doc.attachment.application.AttachmentApplication;
import com.huigou.uasp.bmp.doc.attachment.domain.model.Attachment;
import com.huigou.uasp.bmp.opm.domain.model.org.*;
import com.huigou.uasp.bmp.opm.domain.query.OrgPropertyDefinitionQueryRequest;
import com.huigou.uasp.bmp.opm.domain.query.OrgQueryModel;
import com.huigou.uasp.bmp.opm.proxy.OrgApplicationProxy;
import com.huigou.uasp.bmp.opm.proxy.OrgTypeApplicationProxy;
import com.huigou.uasp.bmp.securitypolicy.application.SecurityPolicyApplication;
import com.huigou.uasp.client.CommonController;
import com.huigou.uasp.log.annotation.LogInfo;
import com.huigou.uasp.log.domain.model.LogType;
import com.huigou.uasp.log.domain.model.OperationType;
import com.huigou.util.*;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* @author gongmm
*/
@Controller
@ControllerMapping("org")
public class OrgController extends CommonController {
private static final String ORG_PROPERTY_DEFINITION_PAGE = "OrgPropertyDefinition";
private static final String ORG_PROPERTY_DEFINITION_DETAIL_PAGE = "OrgPropertyDefinitionDetail";
private static final String ORG_PAGE = "Org";
private static final String ORG_DETAIL_PAGE = "OrgDetail";
private static final String PERSON_DETAIL_PAGE = "PersonDetail";
private static final String PERSON_QUERY_PAGE = "PersonQuery";
private static final String SELECT_ORG_DIALOG = "SelectOrgCommonPage";
//private static final String ADJUST_ORG_DIALOG = "ShowAdjustOrganDialog";
private static final String RECYCLE_BIN_PAGE = "RecycleBin";
@Autowired
private OrgApplicationProxy application;
@Autowired
private OrgTypeApplicationProxy orgTypeApplication;
@Autowired
private AttachmentApplication attachmentApplication;
@Override
protected String getPagePath() {
return "/system/opm/organization/";
}
@RequiresPermissions("OrgPropertyDefinition:query")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.LIST, description = "跳转到组织属性定义页面")
public String forwardOrgPropertyDefinition() {
this.putAttribute("orgKindList", OrgNodeKind.getData());
return this.forward(ORG_PROPERTY_DEFINITION_PAGE);
}
@RequiresPermissions("Org:query")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.LIST, description = "跳转到组织管理页面")
public String forwardOrg() {
return this.forward(ORG_PAGE);
}
@RequiresPermissions("RecycleBin:query")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.LIST, description = "跳转到回收站页面")
public String forwardRecycleBin() {
return this.forward(RECYCLE_BIN_PAGE);
}
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.LIST, description = "跳转到人员查询页面")
public String forwardPersonQuery() {
return this.forward(PERSON_QUERY_PAGE);
}
// @LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.LIST, description = "跳转到组织机构AD页面")
// public String forwardOrgAD() {
// return this.forward("/system/opm/ad/Org.jsp");
// }
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.DETALL, description = "跳转到修改密码页面")
public String showUpdatePassword() {
return forward("/system/userPanel/UpdatePassword.jsp");
}
@RequiresPermissions("OrgPropertyDefinition:create")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.DETALL, description = "跳转到添加组织属性定义页面")
public String showInsertOrgPropertyDefinition() {
this.putAttribute("orgKindList", OrgNodeKind.getData());
return forward(ORG_PROPERTY_DEFINITION_DETAIL_PAGE);
}
@RequiresPermissions("OrgPropertyDefinition:update")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.DETALL, description = "跳转到修改组织属性定义页面")
public String showUpdateOrgPropertyDefinition() {
SDO params = this.getSDO();
String id = params.getString(ID_KEY_NAME);
this.putAttribute("orgKindList", OrgNodeKind.getData());
OrgPropertyDefinition orgPropertyDefinition = application.loadOrgPropertyDefinition(id);
return forward(ORG_PROPERTY_DEFINITION_DETAIL_PAGE, orgPropertyDefinition);
}
@RequiresPermissions(value = { "OrgPropertyDefinition:create", "OrgPropertyDefinition:update" }, logical = Logical.OR)
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.SAVE, description = "保存组织属性定义")
public String saveOrgPropertyDefinition() {
SDO params = this.getSDO();
OrgPropertyDefinition orgPropertyDefinition = params.toObject(OrgPropertyDefinition.class);
String id = this.application.saveOrgPropertyDefinition(orgPropertyDefinition);
return success(id);
}
@RequiresPermissions("OrgPropertyDefinition:delete")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.DELETE, description = "删除组织属性定义")
public String deleteOrgPropertyDefinitions() {
SDO params = this.getSDO();
List<String> ids = params.getStringList(IDS_KEY_NAME);
this.application.deleteOrgPropertyDefinitions(ids);
return success();
}
@RequiresPermissions("OrgPropertyDefinition:update")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.UPDATE, description = "修改组织属性定义排序号")
public String updateOrgPropertyDefinitionsSequence() {
SDO params = this.getSDO();
Map<String, Integer> data = params.getStringMap(DATA_KEY_NAME);
this.application.updateOrgPropertyDefinitionsSequence(data);
return success();
}
@RequiresPermissions("OrgPropertyDefinition:query")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.QUERY, description = "查询组织属性定义")
public String queryOrgPropertyDefinitions() {
SDO params = this.getSDO();
OrgPropertyDefinitionQueryRequest queryRequest = params.toQueryRequest(OrgPropertyDefinitionQueryRequest.class);
Map<String, Object> data = this.application.queryOrgPropertyDefinitions(queryRequest);
return this.toResult(data);
}
/**
* 得到父组织的路径
*
* @param parentId
* @return
*/
private String getParentPath(String parentId) {
String parentFullName = "/";
Org parentOrg = this.application.loadOrg(parentId);
if (parentOrg != null) {
parentFullName = parentOrg.getFullName();
}
return parentFullName;
}
@RequiresPermissions("Org:create")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.DETALL, description = "跳转到修改组织明细页面")
public String showOrgDetail() {
Map<String, Object> params = this.getSDO().getProperties();
String orgKindId = ClassHelper.convert(params.get("orgKindId"), String.class, "");
String parentId = ClassHelper.convert(params.get("parentId"), String.class, "");
String nextSequence = this.application.getOrgNextSequence(parentId);
params.put("parentFullName", getParentPath(parentId));
params.put("orgKindName", OrgNodeKind.fromValue(orgKindId).getDisplayName());
params.put("sequence", Integer.valueOf(nextSequence));
params.put("status", ValidStatus.ENABLED.getId());
return this.forward(ORG_DETAIL_PAGE, params);
}
@RequiresPermissions("Org:create")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.ADD, description = "通过组织模板添加组织")
public String insertOrgByTemplate() {
SDO params = this.getSDO();
Org org = params.toObject(Org.class);
String templateId = params.getString("templateId");
application.insertOrgByTemplateId(org, templateId);
return success();
}
@RequiresPermissions("Org:update")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.DETALL, description = "跳转到修改组织明细页面")
public String loadOrg() {
SDO params = this.getSDO();
String id = params.getString("id");
Org org = this.application.loadOrg(id);
this.putAttribute("parentFullName", getParentPath(org.getParentId()));
this.putAttribute("orgKindName", OrgNodeKind.fromValue(org.getOrgKindId()).getDisplayName());
return forward(ORG_DETAIL_PAGE, org);
}
@RequiresPermissions("Org:create")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.ADD, description = "新增组织")
public String insertOrg() {
SDO params = this.getSDO();
Org org = params.toObject(Org.class);
String orgTypeId = params.getString("typeId");
OrgType orgType = null;
if (!StringUtil.isBlank(orgTypeId)) {
orgType = orgTypeApplication.loadOrgType(orgTypeId);
}
String id = this.application.insertOrg(org, orgType);
// 保存机构的属性列表
return success(id);
}
@RequiresPermissions("Org:update")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.UPDATE, description = "修改组织")
public String updateOrg() {
SDO params = this.getSDO();
String id = params.getString("id");
Org org = this.application.loadOrg(id);
org.getOrgType();
org.fromMap(params.getProperties());
List<OrgProperty> orgProperties = params.getList("properties", OrgProperty.class);
org.setOrgProperties(orgProperties);
this.application.updateOrg(org);
return success();
}
// @LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.LIST, description = "跳转到调整组织页面")
// public String showAdjustOrgDialog() {
// return this.forward(ADJUST_ORG_DIALOG);
// }
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.LIST, description = "调整组织")
public String adjustOrg() {
/*
* SDO params = this.getSDO(); try { String sourceOrgId =
* params.getProperty("sourceOrgId", String.class); String destOrgId =
* params.getProperty("destOrgId", String.class);
* this.orgService.adjustOrg(sourceOrgId, destOrgId); return success();
* } catch (Exception e) { return error(e); }
*/
return error("not implements.");
}
@RequiresPermissions("Org:delete")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.DELETE, description = "逻辑删除组织")
public String logicDeleteOrg() {
SDO params = this.getSDO();
List<String> ids = params.getStringList("ids");
this.application.logicDeleteOrg(ids);
return success();
}
@RequiresPermissions("Org:delete")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.DELETE, description = "物理删除组织")
public String physicalDeleteOrg() {
SDO params = this.getSDO();
String id = params.getString("id");
this.application.physicalDeleteOrg(id, true);
return success();
}
@RequiresPermissions("Org:update")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.UPDATE, description = "恢复组织")
public String restoreOrg() {
SDO params = this.getSDO();
String id = params.getString("id");
this.application.restoreOrg(id, true);
return success();
}
@RequiresPermissions("Org:update")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.UPDATE, description = "启用组织")
public String enableOrg() throws IOException {
SDO params = this.getSDO();
String id = params.getString(CommonDomainConstants.ID_FIELD_NAME);
this.application.enableOrg(id, false);
return success();
}
@RequiresPermissions("Org:update")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.UPDATE, description = "启用附属人员成员")
public String enableSubordinatePsm() {
SDO params = this.getSDO();
String orgId = params.getString(CommonDomainConstants.ID_FIELD_NAME);
String personId = params.getString("personId");
if (StringUtil.isBlank(personId)) {
personId = orgId.substring(0, orgId.indexOf('@'));
}
this.application.enableSubordinatePsm(orgId, personId);
return success();
}
@RequiresPermissions("Org:update")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.UPDATE, description = "禁用组织")
public String disableOrg() throws IOException {
SDO params = this.getSDO();
String id = params.getString(CommonDomainConstants.ID_FIELD_NAME);
this.application.disableOrg(id);
return success();
}
@RequiresPermissions("Org:update")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.UPDATE, description = "修改人员主组织")
public String changePersonMainOrg() throws IOException {
SDO params = this.getSDO();
String personId = params.getProperty("personId", String.class);
String personMemberId = params.getProperty("personMemberId", String.class);
this.application.changePersonMainOrg(personId, personMemberId, false);
return success();
}
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.QUERY, description = "查询组织机构")
public String queryOrgs() {
SDO params = this.getSDO();
OrgQueryModel orgQueryModel = new OrgQueryModel(params);
Map<String, Object> data = this.application.queryOrgs(orgQueryModel);
return this.toResult(data);
}
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.QUERY, description = "查询组织机构")
public String slicedQueryOrgs() {
SDO params = this.getSDO();
OrgQueryModel orgQueryModel = new OrgQueryModel(params);
Map<String, Object> data = this.application.slicedQueryOrgs(orgQueryModel);
return this.toResult(data);
}
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.QUERY, description = "查询人员的人员成员")
public String queryPersonMembersByPersonId() {
SDO params = this.getSDO();
String personId = params.getOperator().getUserId();
List<Org> orgs = this.application.queryPersonMembersByPersonId(personId);
return this.toResult(orgs);// this.packGridDataAndResult(orgs);
}
@RequiresPermissions("Org:update")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.UPDATE, description = "修改组织排序号")
public String updateOrgSequence() {
Map<String, Object> m = this.getSDO().getObjectMap("data");
Map<String, String> params = new HashMap<String, String>(m.size());
for (String item : m.keySet()) {
params.put(ClassHelper.convert(item, String.class), ClassHelper.convert(m.get(item), String.class));
}
this.application.updateOrgSequence(params);
return success();
}
@RequiresPermissions("Org:create")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.DETALL, description = "跳转到添加人员明细页面")
public String showPersonDetail() {
SDO sdo = this.getSDO();
String mainOrgId = sdo.getString("mainOrgId");
this.putAttribute("parentFullName", getParentPath(mainOrgId));
this.putAttribute("status", ValidStatus.ENABLED.getId());
this.putAttribute("status", ValidStatus.ENABLED.getId());
return this.forward(PERSON_DETAIL_PAGE, sdo.getProperties());
}
@RequiresPermissions("Org:create")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.ADD, description = "添加人员")
public String insertPerson() throws IOException {
SDO params = this.getSDO();
Person person = params.toObject(Person.class);
this.application.insertPerson(person);
return success();
}
@RequiresPermissions("Org:create")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.ADD, description = "添加人员成员")
public String insertPersonMembers() {
SDO params = this.getSDO();
List<String> personIds = params.getStringList("personIds");
String orgId = params.getString("orgId");
this.application.insertPersonMembers(personIds, orgId, ValidStatus.ENABLED, false);
return success();
}
@RequiresPermissions("Org:update")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.UPDATE, description = "修改人员")
public String updatePerson() throws IOException {
SDO params = this.getSDO();
Person person = params.toObject(Person.class);
this.application.updatePerson(person);
return success();
}
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.UPDATE, description = "修改操作员")
public String updateOperator() {
/*
* SDO params = this.getSDO(); try {
* this.orgService.updateOperator(params); return success(); } catch
* (Exception e) { return error(e); }
*/
return error("not implements.");
}
// TODO
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.UPDATE, description = "对比AD")
public String compareAD() {
/*
* SDO params = this.getSDO(); try { String personId =
* params.getProperty("personId", String.class);
* this.orgService.compareAD(personId); return success(); } catch
* (Exception e) { return error(e); }
*/
return error("not implements.");
}
@RequiresPermissions("Org:update")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.DETALL, description = "跳转到修改人员明细页面")
public String loadPerson() {
SDO params = this.getSDO();
String id = params.getString("id");
Person person = this.application.loadPerson(id);
this.putAttribute("parentFullName", getParentPath(person.getMainOrgId()));
List<Attachment> attachments = attachmentApplication.queryAttachments(Constants.PERSON_PICTURE, id);
if (attachments.size() > 0) {
Attachment attachment = attachments.get(0);
this.putAttribute("picturePath", StringUtil.encode(attachment.getPath()));
}
return forward(PERSON_DETAIL_PAGE, person);
}
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.QUERY, description = "分页查询人员")
public String slicedQueryPerson() {
SDO params = this.getSDO();
String parentIdOrFullId = params.getString("parentIdOrFullId");
boolean showDisabled = "1".equals(params.getString("showDisabledOrg"));
boolean showAllChildren = "1".equals(params.getString("showAllChildrenOrg"));
CodeAndNameQueryRequest queryRequest = params.toQueryRequest(CodeAndNameQueryRequest.class);
Map<String, Object> data = this.application.slicedQueryPerson(parentIdOrFullId, showDisabled, showAllChildren, queryRequest);
return this.toResult(data);
}
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.DETALL, description = "跳转到人员明细页面")
public String loadPersonAD() {
return error("not implements.");
/*
* SDO params = this.getSDO(); try { String id =
* params.getProperty("id", String.class); Map<String, Object> data =
* this.orgService.loadPerson(id); String mainOrgId =
* ClassHelper.convert(data.get("mainOrgId"), String.class);
* data.put("parentFullName", getParentPath(mainOrgId)); String
* picturePath = orgService.loadArchivesPictureByPersonId(id);
* this.putAttribute("picturePath", StringUtil.encode(picturePath));
* this.putAttribute("isPersonSynToAD",
* this.orgService.isPersonSynToAD(id)); return
* forward("/system/opm/ad/PersonDetail.jsp", data); } catch (Exception
* e) { return errorPage(e.getMessage()); }
*/
}
//@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.LIST, description = "跳转到查询组织页面")
public String showSelectOrgDialog() {
return this.forward(SELECT_ORG_DIALOG, this.getSDO().getProperties());
}
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.LIST, description = "跳转到组织职能页面")
public String forwardOrgFuncExample() {
// 平台未使用本功能
return this.forward("OrgFunExample", this.getSDO().getProperties());
}
@RequiresPermissions("Org:query")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.QUERY, description = "查询组织属性")
public String queryOrgProperties() {
SDO params = this.getSDO();
String orgId = params.getString("orgId");
Map<String, Object> map = this.application.queryOrgProperties(orgId);
return toResult(map);
}
@RequiresPermissions("Org:initPassword")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.INIT, description = "初始化密码")
public String initPassword() {
SDO sdo = this.getSDO();
String personId = sdo.getString("personId");
this.application.initPassword(personId);
return success("初始化密码成功。");
}
public String initPasswordDetail(){
SDO sdo = this.getSDO();
String personId = sdo.getString("personId");
this.putAttribute("personId",personId);
return this.forward("OrgInitPasswordDetail");
}
public String generateRandomPassword(){
String randomPassword = RandomString.getInstance().getRandomString(6, "ilu");
return success(randomPassword);
}
private void clearSessionSecurityPolicyAttributes(){
Subject subject = SecurityUtils.getSubject();
Session session = subject.getSession();
session.setAttribute(SecurityPolicyApplication.FIRST_LOGIN_UPDATE_PASSWORD_ATTRIBUTE, false);
session.setAttribute(SecurityPolicyApplication.PASSWORD_EXPIRED_ATTRIBUTE, false);
session.setAttribute(SecurityPolicyApplication.UPDATE_PASSWORD_PROMPT_ATTRIBUTE, false);
}
@LogInfo(logType = LogType.BIZ, subType = "", operaionType = OperationType.UPDATE, description = "修改密码")
public String updatePassword() {
SDO sdo = this.getSDO();
String oldPassword = sdo.getString("psw");
String newPassword = sdo.getString("newPsw");
this.application.updatePassword(oldPassword, newPassword);
clearSessionSecurityPolicyAttributes();
return success("密码修改成功。");
}
@RequiresPermissions("Org:quote")
@LogInfo(logType = LogType.SYS, subType = "", operaionType = OperationType.ADD, description = "引用权限")
public String quoteAuthorizationAndBizManagement() {
SDO sdo = this.getSDO();
String sourceOrgId = sdo.getProperty("sourceOrgId", String.class);
String destOrgId = sdo.getProperty("destOrgId", String.class);
if (StringUtil.isBlank(sourceOrgId) || StringUtil.isBlank(destOrgId)) {
throw new ApplicationException("被引用或者引用组织为空。");
}
this.application.quoteAuthorizationAndBizManagement(sourceOrgId, destOrgId);
return success("您已成功引用权限。");
}
}
......@@ -213,6 +213,12 @@ public class Person extends BaseInfoWithTenantAbstractEntity {
@Column(name = "REGION")
private String region;
/**
* 地区描述
*/
@Column(name = "REGION_NAME")
private String regionName;
/**
* 银行所属国家
*/
......@@ -243,6 +249,42 @@ public class Person extends BaseInfoWithTenantAbstractEntity {
@Column(name = "COMPANY_CODE")
private String companyCode;
/**
* SAP返回消息状态
*/
@Column(name = "TYPE")
private String type;
/**
* SAP返回的消息内容
*/
@Column(name = "MESSAGE")
private String message;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getRegionName() {
return regionName;
}
public void setRegionName(String regionName) {
this.regionName = regionName;
}
public String getLangu() {
return langu;
}
......
......@@ -5,6 +5,7 @@
SELECT
o.FULL_NAME AS PARENT_FULL_NAME,
p.CODE,
p.ID,
p.NAME,
p.EMAIL,
p.ENGLISH_NAME,
......@@ -20,10 +21,88 @@
p.COMPANY_CODE,
p.REGION,
p.LANGU,
op.PROPERTY_VALUE AS KOSTL
FROM sa_opperson p
op.PROPERTY_VALUE AS KOSTL,
CASE WHEN ( p.type = 'S' AND (p.STATUS = - 1 || p.STATUS = 0)) THEN 'D'
WHEN ( p.type = 'S' AND p.STATUS = 1 ) THEN 'U'
WHEN ( P.type IS NULL || p.type = '' ) THEN 'I'
ELSE '' END AS flag
FROM sa_opperson p
LEFT JOIN sa_oporg o ON p.MAIN_ORG_ID = o.id
LEFT JOIN sa_oporgproperty op ON o.DEPT_ID = op.ORG_ID
LEFT JOIN sa_oporgproperty op ON o.DEPT_ID = op.ORG_ID and p.is_sap_person = '1'
</sql-query>
</query>
<query name="slicedSapPersonVo" label="构建SAP人员结构">
<sql-query>
SELECT
o.FULL_NAME AS PARENT_FULL_NAME,
p.CODE,
p.ID,
p.NAME,
p.EMAIL,
p.ENGLISH_NAME,
p.sex,
p.OFFICE_PHONE,
p.MOBILE_PHONE,
p.ZIP,
p.FAMILY_ADDRESS,
p.COUNTRY,
p.BANK_COUNTRY,
p.BANK_CODE,
p.BANK_ACCOUNT_NUMBER,
p.COMPANY_CODE,
p.REGION,
p.LANGU,
op.PROPERTY_VALUE AS KOSTL,
CASE WHEN ( p.type = 'S' AND (p.STATUS = - 1 || p.STATUS = 0) ) THEN 'D'
WHEN ( p.type = 'S' AND p.STATUS = 1 ) THEN 'U'
WHEN ( P.type IS NULL || p.type = '' ) THEN 'I'
ELSE '' END AS flag
FROM sa_opperson p
LEFT JOIN sa_oporg o ON p.MAIN_ORG_ID = o.id
LEFT JOIN sa_oporgproperty op ON o.DEPT_ID = op.ORG_ID
where p.code in ( ? ) and p.is_sap_person = '1'
</sql-query>
</query>
<query name="queryCodeByFullId" label="查询组织下人员">
<sql-query>
SELECT p.* FROM
sa_opperson p
LEFT JOIN sa_oporg o ON p.id = o.PERSON_ID
WHERE o.FULL_ID LIKE ?
</sql-query>
</query>
<query name="querySapPersonVoByFullId" label="查询组织下人员">
<sql-query>
SELECT
o.FULL_NAME AS PARENT_FULL_NAME,
p.CODE,
p.ID,
p.NAME,
p.EMAIL,
p.ENGLISH_NAME,
p.sex,
p.OFFICE_PHONE,
p.MOBILE_PHONE,
p.ZIP,
p.FAMILY_ADDRESS,
p.COUNTRY,
p.BANK_COUNTRY,
p.BANK_CODE,
p.BANK_ACCOUNT_NUMBER,
p.COMPANY_CODE,
p.REGION,
p.LANGU,
op.PROPERTY_VALUE AS KOSTL,
CASE WHEN ( p.type = 'S' AND (p.STATUS = - 1 || p.STATUS = 0) ) THEN 'D'
WHEN ( p.type = 'S' AND p.STATUS = 1 ) THEN 'U'
WHEN ( P.type IS NULL || p.type = '' ) THEN 'I'
ELSE '' END AS flag
FROM sa_opperson p
LEFT JOIN sa_oporg o ON p.MAIN_ORG_ID = o.id
LEFT JOIN sa_oporgproperty op ON o.DEPT_ID = op.ORG_ID
where p.code in ( SELECT p.code FROM sa_opperson p LEFT JOIN sa_oporg o ON p.id = o.PERSON_ID WHERE o.FULL_ID LIKE ? ) and p.is_sap_person = '1'
</sql-query>
</query>
</query-mappings>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<query-mappings>
<query name="orgType" label="组织类型">
<sql-query>
select t.* from SA_OPOrgType t where 1 = 1
</sql-query>
<condition column="folder_id" name="folderId" symbol="=" alias="t"/>
<condition column="code" name="code" symbol="like" alias="t"/>
<condition column="name" name="name" symbol="like" alias="t"/>
<condition column="org_kind_id" name="orgKindId" symbol="=" alias="t"/>
</query>
<query name="orgTemplate" label="组织模板">
<sql-query>
select a.id, b.org_Kind_Id, a.parent_Id, b.code, b.name, a.type_id,
a.sequence, a.version, (select count(1) from SA_OPOrgTemplate i where i.parent_id = a.id) has_Children, 0 is_expand
from SA_OPOrgTemplate a, SA_OPOrgType b
where a.type_id = b.id
</sql-query>
<condition column="parent_id" name="parentId" symbol="=" alias="a"/>
<condition column="code" name="code" symbol="like" alias="b"/>
<condition column="name" name="name" symbol="like" alias="b"/>
</query>
<query name="org" label="组织机构">
<sql name="updateChildrenStatus">
update SA_OPOrg o
set o.status = :newStatus, o.version = version_seq.nextval
where o.status in (:oldStatus)
and o.full_Id like :fullId
and (o.org_Kind_Id != 'psm' or
(select p.status from SA_OPPerson p where p.id = o.person_Id) >= :newStatus)
</sql>
<sql name="updateSubordinatePsmStatus">
update SA_OPOrg o
set o.status = :newStatus, o.version = version_seq.Nextval
where o.org_Kind_Id = 'psm'
and o.status in (:oldStatus)
and (select p.status from SA_OPOrg p where p.id = o.parent_Id) >= :newStatus
and exists (select 1
from SA_OPPerson person, SA_OPOrg org
where person.status = :newStatus
and org.org_Kind_Id = 'psm'
and org.status in (:oldStatus)
and org.full_Id like :fullId
and person.main_Org_Id = org.parent_Id
and person.id = org.person_Id
and o.person_Id = person.id
and o.parent_Id != person.main_Org_Id)
</sql>
<sql name="updateMainOrgPersonStatus">
update SA_OPPerson p
set p.status = :newStatus, p.version = version_seq.nextval
where (p.Status in (:oldStatus))
and exists (select 1
from SA_OPOrg o
where (o.org_Kind_Id = 'psm')
and (p.main_Org_Id = o.parent_Id)
and (p.id = o.person_Id)
and (o.status in (:oldStatus))
and (o.full_Id like :fullId))
</sql>
<sql name="updateOrgChildrenFullCodeAndName">
update SA_OPOrg
set full_Code = concat(:parentNewFullCode,
substr(full_Code,
length(:parentOldFullCode) + 1,
length(full_Code))),
full_Name = concat(:parentNewFullName,
substr(full_Name,
length(:parentOldFullName) + 1,
length(full_Name))), version = version_seq.Nextval
where full_Id like :likeFullId
</sql>
<sql name="updateRedundantData">
update SA_OPOrg t
set t.org_Id = :orgId, t.org_Code = :orgCode, t.org_Name = :orgName,
t.dept_Id = :deptId, t.dept_Code = :deptCode, t.dept_Name = :deptName,
t.position_Id = :positionId, t.position_Code = :positionCode,
t.position_Name = :positionName, version = version_seq.Nextval
where t.id = :id
</sql>
<sql name="updateOrgChildrenFullOrgKindId">
update SA_OPOrg
set full_org_kind_Id = concat(:parentNewFullOrgKindId,
substr(full_Org_Kind_Id,
length(:parentOldOrgKindId) + 1,
length(full_Org_Kind_Id))),
version = version_seq.Nextval
where full_Id like :likeFullId
</sql>
<sql name="updateOrgChildrenFullSequence">
update SA_OPOrg
set full_Sequence = concat(:parentNewSequence,
substr(full_Sequence,
length(:parentOldSequence) + 1,
length(full_Sequence))),
version = version_seq.nextval
where full_Id like :fullId
</sql>
<sql name="updateOrgSequence">
update SA_OPOrg
set full_sequence = :fullSequence, sequence = :sequence,
version = version_seq.Nextval
where id = :id
</sql>
<sql name="queryOrgProperties">
select p.*, d.data_source, d.description
from SA_OPOrgProperty p, SA_OPOrgPropertyDefinition d
where p.property_definition_id = d.id
and p.org_id = :orgId
</sql>
<sql name="getOrgNextSequence">
select max(sequence) as maxSequence
from Org
where parentId = :parentId
</sql>
<sql name="orgQuery">
select o.id, o.type_id, o.code, o.name, o.long_Name, o.parent_Id, o.full_Id,
o.full_Code, o.full_Name, o.org_Id, o.org_Code, o.org_Name, o.dept_Id,
o.dept_Code, o.dept_Name, o.position_Id, o.position_Code,
o.position_Name, o.org_Kind_Id, p.id as person_Id, o.description,
o.status, o.full_Sequence, p.sex, p.certificate_no, p.status as personStatus,
o.full_Org_Kind_Id, p.main_Org_Id, o.is_Virtual, o.sequence,
(select pos.name from SA_OPOrg pos where pos.id = p.main_org_id) main_org_name,
o.version,p.type,p.message
from SA_OPOrg o left join SA_OPPerson p on o.person_id = p.id
where 1=1
</sql>
<sql name="queryOrgExcludePos">
select o.id, o.type_id, o.code, o.name, o.long_Name, o.parent_Id, o.full_Id,
o.full_Code, o.full_Name, o.org_Id, o.org_Code, o.org_Name, o.dept_Id,
o.dept_Code, o.dept_Name, o.position_Id, o.position_Code,
o.position_Name, o.org_Kind_Id, p.id as person_Id, o.description,
o.status, o.full_Sequence, p.sex, p.certificate_no, p.status as personStatus,
o.full_Org_Kind_Id, p.main_Org_Id, o.is_Virtual, o.sequence,
o.version,p.type,p.message
from V_SA_OPOrg_Exclude_Pos o left join SA_OPPerson p on o.person_id = p.id
where 1=1
</sql>
<sql name="queryCount">
select count(o.id)
from SA_OPOrg o left join SA_OPPerson p on o.person_id = p.id
where o.parent_id = :parentId
</sql>
<sql name="deleteOrgChildren">
delete from SA_OPOrg where full_id like ?
</sql>
</query>
<query name="deleteOrg" label="删除组织机构">
<sql name="deleteOrgManagement">
delete from SA_OPBizManagement t
where t.manager_id in (select id from SA_OPOrg o where o.full_id like ?)
or t.subordination_id in
(select id from SA_OPOrg o where o.full_id like ?)
</sql>
<sql name="deleteOrgManagement">
delete from SA_OPBizManagement t
where exists
(select 1
from SA_OPPerson person, SA_OPOrg org
where org.Org_Kind_ID = 'psm'
and person.Main_Org_ID = org.Parent_ID
and person.ID = org.Person_ID
and org.full_id like ?
and (t.manager_id like concat(person.ID, '@%') or
t.subordination_id like concat(person.ID, '@%')))
</sql>
</query>
<query name="orgPropertyDefinition" label="组织机构">
<sql-query>
select t.* from SA_OPOrgPropertyDefinition t where 1 = 1
</sql-query>
<condition column="org_kind_id" name="orgKindId" symbol="=" alias="t"/>
</query>
<query name="person" label="用户查询">
<sql-query>
select p.*, o.full_sequence
from SA_OPOrg o, SA_OPPerson p
where o.person_id = p.id
and p.main_org_id = o.parent_id
</sql-query>
<condition column="code" name="code" symbol="like" alias="p"/>
<condition column="name" name="name" symbol="like" alias="p"/>
<sql name="checkDuplication">
select o
from Person o
where id != :id
and (upper(code) = :code or upper(coalesce(loginName, code)) = :loginName %s )
</sql>
</query>
<query name="role" label="角色">
<sql-query>
<![CDATA[
select t.* from SA_OPRole t where t.status > -1
]]>
</sql-query>
<condition column="parent_id" name="parentId" symbol="=" alias="t"/>
<condition name="keyword" symbol="like">
(t.code like :keyword or t.name like :keyword)
</condition>
<condition name="tenantId" symbol="=">
t.tenant_id in ('global', :tenantId)
</condition>
<condition column="node_Kind_Id" name="nodeKindId" symbol="=" alias="t"/>
<sql name="queryRolesByParentId">
select id, role_kind_id, code, name, description, status, sequence, version,
tenant_id, parent_id, full_id, full_name, node_kind_id,
(select count(0)
from SA_OPRole i
where i.parent_id = t.id) has_children
from SA_OPRole t
where parent_id = ?
and t.tenant_id in ('global', ?)
</sql>
</query>
<query name="permission" label="权限">
<sql-query>
select id, parent_id, code, name, full_id, full_name, resource_kind_id,
resource_id, operation_id, status, sequence, version, node_kind_id,
(select count(0) from sa_oppermission i where i.parent_id = t.id) has_children,
remark
from sa_oppermission t
where 1 = 1
</sql-query>
<condition column="parent_id" name="folderId" symbol="=" alias="t"/>
<condition column="code" name="code" symbol="like" alias="t"/>
<condition column="name" name="name" symbol="like" alias="t"/>
<sql name="queryByParentId">
select t.*,(select count(0) from sa_oppermission i where i.parent_id = t.id) has_children
from sa_oppermission t
where t.parent_id = ?
order by t.sequence asc
</sql>
<sql name="queryByFullId">
<![CDATA[
select t.*
from sa_oppermission t
where t.full_id like ?
and not exists
(select 0
from sa_oppermission p
where p.status <> 1
and t.full_id like concat(p.full_id, '%'))
order by t.sequence asc
]]>
</sql>
</query>
<query name="permissionQueryUIElement" label="查询界面元素权限">
<sql-query>
select * from SA_OPUIElementPermission p where 1=1
</sql-query>
<condition column="permission_id" name="parentId" symbol="=" alias="p"/>
</query>
<query name="authorization" label="授权">
<sql-query>
select o.id as org_id, o.org_Name, o.full_Id, o.full_Name,
r.id as role_id, r.code role_code, r.name role_name, r.role_kind_id,
r.description
from sa_oporg o, sa_opauthorize a, sa_oprole r
where o.id = a.org_id
and a.role_id = r.id
</sql-query>
<condition column="id" name="orgId" symbol="=" alias="o"/>
<condition column="code" name="roleCode" symbol="half_like" alias="r"/>
<condition column="name" name="roleName" symbol="half_like" alias="r"/>
</query>
<query name="queryPermissionsByRoleId" label="查询权限">
<sql-query>
select p.*, rp.created_by_name, rp.created_date
from sa_oprolepermission rp, sa_oppermission p
where rp.permission_id = p.id
</sql-query>
<condition column="role_id" name="roleId" symbol="=" alias="rp"/>
<condition name="keyword" symbol="like">
(p.code like :keyword or p.name like :keyword)
</condition>
<condition column="node_kind_id" name="nodeKindId" symbol="=" alias="p"/>
</query>
<query name="queryAuthorizedPermissionsByOrgFullId" label="查询已授权的权限">
<sql-query>
select *
from SA_OPPermission t
where t.id in (select rp.permission_id
from SA_OPOrg o, SA_OPAuthorize a, SA_OPRole r,
SA_OPRolePermission rp
where o.id = a.org_id
and a.role_id = r.id
and r.id = rp.role_id
and :orgFullId like concat(o.full_id,'%'))
</sql-query>
<condition column="orgFullId" name="orgFullId" symbol="=" alias="t" append="false"/>
<condition column="name" name="permissionName" symbol="like" alias="t"/>
<condition column="node_kind_id" name="nodeKindId" symbol="=" alias="t"/>
</query>
<query name="queryPersonAuthorizedPermissionsByOrgFullId" label="查询已授权的权限">
<sql-query>
select *
from SA_OPPermission t
where t.id in (select rp.permission_id
from SA_OPOrg o,
SA_OPOrg p,
sa_opperson s,
SA_OPAuthorize a,
SA_OPRole r,
SA_OPRolePermission rp
where p.full_id like concat(o.full_id, '%')
and p.person_id = s.id
and o.id = a.org_id
and a.role_id = r.id
and r.id = rp.role_id
and ((case
when s.person_kind is null or s.person_kind='' then
'def'
else
s.person_kind
end) = (case
when r.role_person_kind is null or r.role_person_kind='' then
'def'
else
r.role_person_kind
end))
and s.id = :personId)
</sql-query>
<condition column="name" name="permissionName" symbol="like" alias="t"/>
<condition column="node_kind_id" name="nodeKindId" symbol="=" alias="t"/>
</query>
<query name="queryRolesByOrgFullId" label="查询角色继承数据">
<sql-query>
select r.*, o.name as org_name, o.full_name as org_full_name
from SA_OPOrg o, SA_OPAuthorize a, SA_OPRole r
where o.id = a.org_id
and a.role_id = r.id
and o.status = 1
and r.status = 1
and :orgFullId like concat(o.full_id, '%')
</sql-query>
<condition column="orgFullId" name="orgFullId" symbol="=" alias="t" append="false"/>
<condition column="name" name="permissionName" symbol="like" alias="t">
(r.code like :permissionName or r.name like :permissionName or o.name like :permissionName)
</condition>
</query>
<query name="access" label="权限相关">
<sql name="queryAllocatedPermissions">
select b
from RolePermission a, Permission b
where a.permissionId = b.id
and b.fullId like :fullId
and a.roleId = :roleId
order by b.sequence
</sql>
<sql name="deletePermissionsByRoleAndOneLevePermissionId">
delete from RolePermission rp
where rp.roleId = :roleId
and rp.permissionId in
(select p.id from Permission p where p.fullId like :fullId)
</sql>
<sql name="queryPersonFunPermissions">
select distinct pp.code
from sa_oporg p,
sa_opperson s,
sa_oporg o,
sa_opauthorize a,
sa_oprole r,
sa_oprolepermission rp,
sa_oppermission pp
where p.person_id = s.id
and s.id = ?
and p.full_id like concat(o.full_id, '%')
and ((case
when s.person_kind is null or s.person_kind='' then
'def'
else
s.person_kind
end) = (case
when r.role_person_kind is null or r.role_person_kind='' then
'def'
else
r.role_person_kind
end))
and o.id = a.org_id
and a.role_id = r.id
and r.id = rp.role_id
and rp.permission_id = pp.id
and pp.resource_kind_id = 'fun'
and pp.node_kind_id in ('permission')
and p.status = 1
and o.status = 1
and r.status = 1
and pp.status = 1
</sql>
<sql name="queryPersonRoleIds">
select distinct r.id
from sa_oporg p, sa_opperson s, sa_oporg o, sa_opauthorize a, sa_oprole r
where p.person_id = s.id
and s.id = ?
and ((case
when s.person_kind is null or s.person_kind='' then
'def'
else
s.person_kind
end) = (case
when r.role_person_kind is null or r.role_person_kind='' then
'def'
else
r.role_person_kind
end))
and p.full_id like concat(o.full_id, '%')
and o.id = a.org_id
and a.role_id = r.id
and p.status = 1
and o.status = 1
and r.status = 1
</sql>
<sql name="queryPersonRoleKindId">
select distinct r.role_kind_id
from sa_oporg p, sa_opperson s, sa_oporg o, sa_opauthorize a, sa_oprole r
where p.person_id = s.id
and s.id = ?
and ((case
when s.person_kind is null or s.person_kind='' then
'def'
else
s.person_kind
end) = (case
when r.role_person_kind is null or r.role_person_kind='' then
'def'
else
r.role_person_kind
end))
and p.full_id like concat(o.full_id, '%')
and o.id = a.org_id
and a.role_id = r.id
and p.status = 1
and o.status = 1
and r.status = 1
and r.role_kind_id != 'common'
</sql>
<sql name="queryPersonFunctions">
select id,
parent_id,
code,
description,
name,
full_name,
node_kind_id,
key_code,
url,
icon,
remark,
depth,
status,
sequence,
version,
operation_map_id,
(select count(0) from sa_opfunction i where i.parent_id = f.id) as has_children,
0 as isexpand
from sa_opfunction f
where f.id in (select pp.resource_id
from sa_oporg p,
sa_opperson s,
sa_oporg o,
sa_opauthorize a,
sa_oprole r,
sa_oprolepermission rp,
sa_oppermission pp
where p.person_id = s.id
and s.id = :personId
and p.full_id like concat(o.full_id, '%')
and ((case
when s.person_kind is null or s.person_kind='' then
'def'
else
s.person_kind
end) = (case
when r.role_person_kind is null or r.role_person_kind='' then
'def'
else
r.role_person_kind
end))
and o.id = a.org_id
and a.role_id = r.id
and r.id = rp.role_id
and rp.permission_id = pp.id
and pp.resource_kind_id = 'fun'
and pp.node_kind_id in ('folder', 'fun', 'permission')
and p.status = 1
and o.status = 1
and r.status = 1
and pp.status = 1)
and f.status = 1
and f.parent_id = :parentId
order by sequence asc
</sql>
<sql name="queryPersonOneLevelAllFunctions">
select id,
parent_id,
code,
description,
name,
full_name,
node_kind_id,
key_code,
url,
icon,
remark,
depth,
status,
sequence,
version,
operation_map_id,
(select count(*) from sa_opfunction i where i.parent_id = f.id) as has_children,
0 as isexpand
from sa_opfunction f
where f.id in (select pp.resource_id
from sa_oporg p,
sa_opperson s,
sa_oporg o,
sa_opauthorize a,
sa_oprole r,
sa_oprolepermission rp,
sa_oppermission pp
where p.person_id = s.id
and s.id = :personId
and p.full_id like concat(o.full_id, '%')
and ((case
when s.person_kind is null or s.person_kind='' then
'def'
else
s.person_kind
end) = (case
when r.role_person_kind is null or r.role_person_kind='' then
'def'
else
r.role_person_kind
end))
and o.id = a.org_id
and a.role_id = r.id
and r.id = rp.role_id
and rp.permission_id = pp.id
and pp.resource_kind_id = 'fun'
and p.status = 1
and o.status = 1
and r.status = 1
and pp.status = 1)
and f.status = 1
and f.full_id like :fullId
and f.url is not null
order by full_id
</sql>
<sql name="queryPersonAllFunctions">
select id,
parent_id,
code,
description,
name,
full_name,
node_kind_id,
key_code,
url,
icon,
remark,
depth,
status,
sequence
from sa_opfunction f
where f.id in (select pp.resource_id
from sa_oporg p,
sa_opperson s,
sa_oporg o,
sa_opauthorize a,
sa_oprole r,
sa_oprolepermission rp,
sa_oppermission pp
where p.person_id = s.id
and s.id = :personId
and p.full_id like concat(o.full_id, '%')
and ((case
when s.person_kind is null or s.person_kind='' then
'def'
else
s.person_kind
end) = (case
when r.role_person_kind is null or r.role_person_kind='' then
'def'
else
r.role_person_kind
end))
and o.id = a.org_id
and a.role_id = r.id
and r.id = rp.role_id
and rp.permission_id = pp.id
and pp.resource_kind_id = 'fun'
and p.status = 1
and o.status = 1
and r.status = 1
and pp.status = 1)
and f.status = 1
and f.full_id like :fullId
order by full_id
</sql>
<sql name="checkPersonFunPermissions">
select count(0)
from sa_opfunction f
where f.id in (select pp.resource_id
from sa_oporg p,
sa_opperson s,
sa_oporg o,
sa_opauthorize a,
sa_oprole r,
sa_oprolepermission rp,
sa_oppermission pp
where p.person_id = s.id
and s.id = ?
and p.full_id like concat(o.full_id, '%')
and ((case
when s.person_kind is null or s.person_kind='' then
'def'
else
s.person_kind
end) = (case
when r.role_person_kind is null or r.role_person_kind='' then
'def'
else
r.role_person_kind
end))
and o.id = a.org_id
and a.role_id = r.id
and r.id = rp.role_id
and rp.permission_id = pp.id
and pp.resource_kind_id = 'fun'
and p.status = 1
and o.status = 1
and r.status = 1
and pp.status = 1)
and f.status = 1
and f.code = ?
</sql>
<sql name="loadPersonRole">
select distinct r.id
from sa_oporg p, sa_opperson s, sa_oporg o, sa_opauthorize a, sa_oprole r
where p.person_id = s.id
and s.id = ?
and p.full_id like concat(o.full_id, '%')
and ((case
when s.person_kind is null or s.person_kind='' then
'def'
else
s.person_kind
end) = (case
when r.role_person_kind is null or r.role_person_kind='' then
'def'
else
r.role_person_kind
end))
and o.id = a.org_id
and a.role_id = r.id
and p.status = 1
and o.status = 1
and r.status = 1
</sql>
<sql name="queryUIElementPermissionByFunction">
select uip.code, uip.name, uip.kind_id, uip.operation_id
from sa_opuielementpermission uip, sa_oppermission op
where uip.permission_id = op.id
and op.resource_id = ?
and exists (select 0
from sa_oporg p,
sa_opperson s,
sa_oporg o,
sa_opauthorize a,
sa_oprole r,
sa_oprolepermission rp
where p.person_id = s.id
and s.id = ?
and p.full_id like concat(o.full_id, '%')
and ((case
when s.person_kind is null or s.person_kind='' then
'def'
else
s.person_kind
end) = (case
when r.role_person_kind is null or r.role_person_kind='' then
'def'
else
r.role_person_kind
end))
and o.id = a.org_id
and a.role_id = r.id
and r.id = rp.role_id
and op.id = rp.permission_id
and p.status = 1
and o.status = 1
and r.status = 1)
order by uip.sequence
</sql>
<sql name="queryRoleKindContainsPersonIds">
select distinct p.person_id
from sa_oporg p, sa_opperson s, sa_oporg o, sa_opauthorize a, sa_oprole r
where p.person_id = s.id
and p.full_id like concat(o.full_id, '%')
and ((case
when s.person_kind is null or s.person_kind='' then
'def'
else
s.person_kind
end) = (case
when r.role_person_kind is null or r.role_person_kind='' then
'def'
else
r.role_person_kind
end))
and o.id = a.org_id
and a.role_id = r.id
and p.status = 1
and o.status = 1
and r.status = 1
and r.role_kind_id = ?
</sql>
<sql name="queryThreeMemberPermssion">
select distinct p.code, r.role_kind_id
from sa_oprole r, sa_oprolepermission rp, sa_oppermission p
where r.id = rp.role_id
and rp.permission_id = p.id
and r.role_kind_id in ('administrator', 'securityGuard', 'auditor')
and r.status = 1
and p.status = 1
and p.node_kind_id = 'permission'
order by p.code
</sql>
<sql name="queryFirstAuthorizationByRoleId">
select new com.huigou.uasp.bmp.opm.domain.query.AuthorizationDesc(o.id, o.fullName, r.id)
from Org o join o.roles r
where r.id = :roleId
</sql>
</query>
<query name="agent" label="代理信息">
<sql name="query">
select t.*, c.name as client_name, a.name agent_name
from sa_opagent t, sa_oporg c, sa_oporg a
where t.client_id = c.id
and t.agent_id = a.id
and (t.client_id like :personId or t.agent_id like :personId)
</sql>
<sql name="queryByAgentId">
select t.*, c.name as client_name, a.name agent_name
from sa_opagent t, sa_oporg c, sa_oporg a
where t.client_id = c.id
and t.agent_id = a.id
and t.agent_id like :personId
</sql>
<sql name="queryByClientId">
select t.*, c.name as client_name, a.name agent_name
from sa_opagent t, sa_oporg c, sa_oporg a
where t.client_id = c.id
and t.agent_id = a.id
and t.client_id like :personId
</sql>
<sql name="queryProc">
select t.*, d.full_name, d.proc_name
from sa_opagentproc t, wf_procdef d
where t.proc_id = d.id
and t.agent_id = :parentId
</sql>
<sql name="loadValid">
select o
from Agent o left join o.client
where o.client.id = :psmId
and o.status = 1
and current_date between o.startDate and o.endDate
</sql>
<condition column="start_date" name="startDate" symbol="&gt;=" type="java.util.Date" alias="t"/>
<condition column="end_date" name="endDate" symbol="&lt;=" type="java.util.Date" alias="t"/>
</query>
<query name="baseManagementType" label="基础管理权限类别">
<sql-query>
select a.*, b.name as biz_Management_Type_Name,b.code as biz_Management_Type_code
from SA_OPBaseManagementType a left join SA_OPBizManagementType b on a.biz_management_type_id = b.id
where 1=1
</sql-query>
<condition column="folder_id" name="folderId" symbol="=" alias="a"/>
<condition column="code" name="code" symbol="like" alias="a"/>
<condition column="name" name="name" symbol="like" alias="a"/>
</query>
<query name="bizManagementType" label="业务管理权限类别">
<sql-query>
select id, code, name, manage_org_kind_id, manage_org_kind_name, kind_id,
version, sequence, parent_id, full_id, node_kind_id, remark,
full_name, status
from SA_OPBizManagementType t
where 1 = 1
</sql-query>
<condition column="parent_id" name="parentId" symbol="=" alias="t"/>
<condition column="code" name="code" symbol="like" alias="t"/>
<condition column="name" name="name" symbol="like" alias="t"/>
<condition column="node_kind_id" name="nodeKindId" symbol="=" alias="t"/>
<condition column="full_id" name="fullId" symbol="half_like" alias="t"/>
<condition column="param" name="param" symbol="like" alias="t">
(t.code like :param or t.name like :param)
</condition>
<condition column="code" name="queryManageCodes" symbol="in" alias="t"/>
<sql name="queryBizManagementType">
select id, code, name, manage_org_kind_id, manage_org_kind_name, kind_id,
version, sequence, parent_id, full_id, node_kind_id, remark,
full_name, status,
(select count(0)
from SA_OPBizManagementType i
where i.parent_id = t.id) has_children
from SA_OPBizManagementType t
where parent_id = ?
order by t.sequence
</sql>
</query>
<query name="management" label="业务管理权限">
<sql name="queryByManagerAndManageTypeId">
select a.id, s.full_Name,s.status, a.created_By_Name, a.created_Date,s.name, null role_name,null role_id
from SA_OPBizManagement a, SA_OPBizManagementType t, Sa_Oporg m,
SA_OPorg s
where a.manager_id = m.id
and a.manage_type_id = t.id
and a.subordination_id = s.id
and m.id = :managerId
and t.id = :manageTypeId
union
select a.id, s.full_Name, s.status, a.created_By_Name, a.created_Date,s.name,m.name role_name,m.id role_id
from sa_oprolebizmanagement a, SA_OPBizManagementType t, sa_oprole m,
SA_OPorg s
where a.manager_id = m.id
and a.manage_type_id = t.id
and a.subordination_id = s.id
and m.id in (select ra.role_id from sa_opauthorize ra where ra.org_id=:managerId)
and t.id = :manageTypeId
</sql>
<sql name="queryBySubordinationAndManageTypeId">
select a.id, m.full_Name, m.status, a.created_By_Name, a.created_Date,m.name, null role_name,null role_id
from SA_OPBizManagement a, SA_OPBizManagementType t, Sa_Oporg m,
SA_OPorg s
where a.manager_id = m.id
and a.manage_type_id = t.id
and a.subordination_id = s.id
and s.id = :subordinationId
and t.id = :manageTypeId
union
select a.id, m.full_Name, m.status, a.created_By_Name, a.created_Date,m.name,m.name role_name,m.id role_id
from sa_oprolebizmanagement a, SA_OPBizManagementType t, sa_oprole m,
SA_OPorg s
where a.manager_id = m.id
and a.manage_type_id = t.id
and a.subordination_id = s.id
and s.id = :subordinationId
and t.id = :manageTypeId
</sql>
<!-- 选择查询组织管理者的已分配的业务权限类别 -->
<sql name="selectOrgAllocatedBizManagementTypeForManager">
select *
from SA_OPBizManagementType bizManagementType
where exists (select 1
from SA_OPBizManagement b, SA_OPOrg o,sa_oporg manager
where bizManagementType.id=b.manage_type_id
and b.subordination_id = o.id
and b.manager_id=manager.id
and :selectedFullId like concat(o.full_Id, '%'))
or exists (select 1
from sa_oprolebizmanagement b, SA_OPOrg o,sa_oporg manager,sa_oprole r,sa_opauthorize ra
where bizManagementType.id=b.manage_type_id
and b.subordination_id = o.id
and b.manager_id=r.id
and r.id=ra.role_id
and manager.id=ra.org_id
and :selectedFullId like concat(o.full_Id, '%') )
</sql>
<!-- 选择查询组织下属的已分配的业务权限类别 -->
<sql name="selectOrgAllocatedBizManagementTypeForSubordination">
select *
from SA_OPBizManagementType bizManagementType
where exists (select 1
from SA_OPBizManagement b, SA_OPOrg o,sa_oporg manager
where bizManagementType.id=b.manage_type_id
and b.manager_id = o.id
and b.manager_id=manager.id
and :selectedFullId like concat(o.full_Id,'%'))
or exists (select 1
from sa_oprolebizmanagement b, SA_OPOrg o,sa_oporg subordination,sa_oprole r,sa_opauthorize ra
where bizManagementType.id=b.manage_type_id
and b.manager_id = r.id
and b.subordination_id=subordination.id
and r.id=ra.role_id
and o.id=ra.org_id
and :selectedFullId like concat(o.full_Id, '%') )
</sql>
<!-- 选择管理者 -->
<sql name="selectBizManagementForManager">
select distinct m.full_name, m.status
from sa_opbizmanagement a, sa_oporg s, sa_oporg m
where a.subordination_id = s.id
and a.manager_id = m.id
and a.manage_type_id = :manageTypeId
and :selectedFullId like concat(s.full_id, '%')
union
select distinct m.full_Name, s.status
from sa_oprolebizmanagement a, sa_oprole r,
SA_OPorg s,sa_oporg m,sa_opauthorize ra
where a.manager_id = r.id
and ra.org_id=m.id
and ra.role_id=r.id
and a.subordination_id = s.id
and a.manage_type_id = :manageTypeId
and :selectedFullId like concat(s.full_id, '%')
</sql>
<!-- 选择下属 -->
<sql name="selectBizManagementForSubordination">
select distinct s.full_name, s.status
from sa_opbizmanagement a, sa_oporg s, sa_oporg m
where a.subordination_id = s.id
and a.manager_id = m.id
and a.manage_type_id = :manageTypeId
and :selectedFullId like concat(m.full_id, '%')
union
select distinct s.full_Name, s.status
from sa_oprolebizmanagement a, sa_oprole r,
SA_OPorg s,sa_oporg m,sa_opauthorize ra
where a.subordination_id=s.id
and a.manager_id = r.id
and ra.org_id=m.id
and ra.role_id=r.id
and a.manage_type_id = :manageTypeId
and :selectedFullId like concat(m.full_id, '%')
</sql>
</query>
<query name="managementQuery" label="管理权限查询">
<sql-query>
select t_2_.manager_name,
t_2_.manager_full_name,
t_2_.manager_status,
t_2_.sub_name,
t_2_.sub_full_name,
t_2_.sub_status,
t_2_.full_sequence,
t_2_.full_id,
t_2_.code,
t_2_.name,
t_2_.created_by_name,
t_2_.created_date
from (select t.id,
m.name as manager_name,
m.full_name as manager_full_name,
m.status as manager_status,
s.name as sub_name,
s.full_name as sub_full_name,
s.status as sub_status,
s.full_sequence,
s.full_id,
p.code,
p.name,
t.created_by_name,
t.created_date,
t.manage_type_id,
m.id manager_id,
s.id subordination_id,
p.full_id biz_type_full_id,
p.name biz_type_name,
p.code biz_type_code
from sa_opbizmanagement t,
sa_oporg m,
sa_oporg s,
sa_opbizmanagementtype p
where t.manager_id = m.id
and t.subordination_id = s.id
and t.manage_type_id = p.id
union
select t.id,
m.name as manager_name,
m.full_name as manager_full_name,
m.status as manager_status,
s.name as sub_name,
s.full_name as sub_full_name,
s.status as sub_status,
s.full_sequence,
s.full_id,
p.code,
p.name,
t.created_by_name,
t.created_date,
t.manage_type_id,
m.id manager_id,
s.id subordination_id,
p.full_id biz_type_full_id,
p.name biz_type_name,
p.code biz_type_code
from sa_oprolebizmanagement t,
sa_oporg m,
sa_oporg s,
sa_opbizmanagementtype p,
sa_oprole r,
sa_opauthorize ra
where t.manager_id = r.id
and t.subordination_id = s.id
and t.manage_type_id = p.id
and r.id=ra.role_id
and m.id=ra.org_id
) t_2_ where 1=1
</sql-query>
<condition column="manage_type_id" name="parentId" symbol="=" alias="t_2_"/>
<condition column="manager_id" name="manageOrgId" symbol="half_like" alias="t_2_"/>
<condition column="subordination_id" name="subordinationOrgId" symbol="=" alias="t_2_"/>
<condition column="biz_type_full_id" name="fullId" symbol="half_like" alias="t_2_"/>
<condition column="keyValue" name="keyValue" symbol="like" alias="t_2_">
(t_2_.manager_name like :keyValue or t_2_.sub_name like :keyValue)
</condition>
<condition column="param" name="param" symbol="like" alias="t_2_">
(t_2_.biz_type_code like :param or t_2_.biz_type_name like :param)
</condition>
</query>
<query name="tmAuthorize" label="三员授权">
<sql name="querySubordination">
select distinct subordination_id from SA_TMAuthorize where manager_id = :managerId
</sql>
<sql name="queryManager">
select o.id, o.full_id, o.status, o.name, o.person_id, o.full_name, o.code,
o.org_kind_id
from SA_TMAuthorize t, SA_OPOrg o
where o.id = t.manager_id
and t.system_id = :functionId
and t.role_kind_id = :roleId
and t.subordination_id = :subordinationId
</sql>
</query>
<query name="uiElement" label="界面元素">
<sql-query>
select t.* from SA_OPUIelement t where 1 = 1
</sql-query>
<condition column="folder_id" name="folderId" symbol="=" alias="t"/>
<condition column="code" name="code" symbol="like" alias="t"/>
<condition column="name" name="name" symbol="like" alias="t"/>
<condition column="kind_id" name="kindId" symbol="=" alias="t"/>
<condition column="status" name="status" symbol="=" alias="t"/>
</query>
<query name="userGroup" label="查询用户分组">
<sql-query>
select t.* from SA_UserGroup t where 1 = 1
</sql-query>
<condition column="folder_id" name="folderId" symbol="=" alias="t"/>
<condition column="code" name="code" symbol="like" alias="t"/>
<condition column="name" name="name" symbol="like" alias="t"/>
<sql name="queryAvailableUserGroupDetail">
select d.id,
d.group_id,
o.id as org_node_id,
o.name,
o.full_id,
o.full_name,
o.full_sequence,
o.org_kind_id,
o.org_id,
o.org_name,
o.dept_id,
o.dept_name,
o.center_id,
o.center_name,
o.position_id,
o.position_name,
o.person_id,
o.status,
d.sequence
from sa_usergroupdetail d, sa_oporg o
where d.org_id = o.id
and o.status =1
and d.group_id = :groupId
</sql>
<sql name="queryAvailableUserGroup">
select id, name, node_kind_id, group_kind, parent_id
from (select t.id,
t.name,
'tree' as node_kind_id,
'' as group_kind,
t.parent_id,
t.sequence
from sa_commontree t
where t.kind_id = 25
union all
select g.id,
g.name,
'node' as node_kind_id,
g.kind_id,
g.folder_id as parent_id,
g.sequence
from sa_usergroup g
where g.status = 1
and (g.kind_id = 'SYSTEM' or (g.kind_id = 'CUSTOM' and g.created_by_id like ?))) t
order by sequence asc
</sql>
<sql name="queryUserCustomGroup">
select * from sa_usergroup t where t.kind_id = 'CUSTOM' and t.created_by_id like ? order by t.sequence
</sql>
</query>
<query name="systemGroupDetail" label="查询用户分组">
<sql-query>
select d.id,
d.group_id,
o.id as org_node_id,
o.name,
o.full_id,
o.full_name,
o.full_sequence,
o.org_kind_id,
o.person_id,
o.status,
d.sequence
from sa_usergroupdetail d, sa_oporg o
where d.org_id = o.id
and d.group_id = :groupId
</sql-query>
<condition column="full_name" name="name" symbol="like" alias="o"/>
</query>
<query name="queryRolesByPermissionId" label="根据权限查询角色">
<sql-query>
select r.*
from SA_OPRole r, SA_OPRolePermission rp
where r.id = rp.role_id
and rp.permission_id = :permissionId
</sql-query>
<condition column="name" name="keyword" symbol="like" alias="r">
(r.code like :keyword or r.name like :keyword)
</condition>
</query>
<query name="queryAuthorizeByPermissionId" label="根据权限查询授权信息">
<sql-query>
select o.name,
o.full_name,
o.full_sequence,
r.code as role_code,
r.name as role_name,
r.full_name as role_full_name
from SA_OPOrg o, SA_OPAuthorize a, SA_OPRole r, SA_OPRolePermission rp
where o.id = a.org_id
and a.role_id = r.id
and r.id = rp.role_id
and o.status = 1
and r.status = 1
and rp.permission_id = :permissionId
</sql-query>
<condition column="name" name="keyword" symbol="like" alias="r">
(r.code like :keyword or r.name like :keyword or o.name like :keyword)
</condition>
</query>
<query name="queryPersonsByPermissionId" label="根据权限具有权限的用户">
<sql-query>
select p.name,
o.name as org_name,
o.full_name as org_full_name,
o.full_sequence,
r.code as role_code,
r.name as role_name,
r.full_name as role_full_name
from sa_oporg p,
sa_opperson s,
SA_OPOrg o,
SA_OPAuthorize a,
SA_OPRole r,
SA_OPRolePermission rp
where p.full_id like concat(o.full_id, '%')
and p.person_id = s.id
and ((case
when s.person_kind is null or s.person_kind='' then
'def'
else
s.person_kind
end) = (case
when r.role_person_kind is null or r.role_person_kind='' then
'def'
else
r.role_person_kind
end))
and o.id = a.org_id
and a.role_id = r.id
and r.id = rp.role_id
and o.status = 1
and r.status = 1
and p.status = 1
and rp.permission_id = :permissionId
</sql-query>
<condition column="name" name="keyword" symbol="like" alias="r">
(r.code like :keyword or r.name like :keyword or o.name like :keyword or p.name like :keyword)
</condition>
</query>
<query name="querySinglePersonsByPermissionId" label="根据权限具有权限的用户">
<sql-query>
select distinct p.name,
p.dept_name as org_name,
p.full_name as org_full_name,
p.full_sequence
from sa_oporg p,
sa_opperson s,
SA_OPOrg o,
SA_OPAuthorize a,
SA_OPRole r,
SA_OPRolePermission rp
where p.full_id like concat(o.full_id, '%')
and p.person_id = s.id
and ((case
when s.person_kind is null or s.person_kind='' then
'def'
else
s.person_kind
end) = (case
when r.role_person_kind is null or r.role_person_kind='' then
'def'
else
r.role_person_kind
end))
and o.id = a.org_id
and a.role_id = r.id
and r.id = rp.role_id
and o.status = 1
and r.status = 1
and p.status = 1
and rp.permission_id = :permissionId
</sql-query>
<condition column="name" name="keyword" symbol="like" alias="p"/>
</query>
<query name="queryRoleByAuthorize" label="查询角色授权信息">
<sql-query>
select o.name, o.full_name,o.full_sequence
from SA_OPOrg o, SA_OPAuthorize a
where o.id = a.org_id
and a.role_id = :roleId
and o.status = 1
</sql-query>
<condition column="name" name="keyword" symbol="like" alias="o">
(o.name like :keyword or o.full_name like :keyword)
</condition>
</query>
<query name="queryPersonAsRoleAuthorize" label="查询具有角色的用户">
<sql-query>
select p.name, p.full_name, o.name as org_name, o.full_name as org_full_name,p.full_sequence
from sa_oporg p, sa_opperson s, SA_OPOrg o, SA_OPAuthorize a, SA_OPRole r
where p.full_id like concat(o.full_id, '%')
and p.person_id = s.id
and ((case
when s.person_kind is null or s.person_kind='' then
'def'
else
s.person_kind
end) = (case
when r.role_person_kind is null or r.role_person_kind='' then
'def'
else
r.role_person_kind
end))
and o.id = a.org_id
and a.role_id = r.id
and p.status = 1
and o.status = 1
and r.id = :roleId
</sql-query>
<condition column="name" name="keyword" symbol="like" alias="p">
(p.name like :keyword or p.full_name like :keyword)
</condition>
</query>
<query name="querySinglePersonAsRoleAuthorize" label="查询具有角色的用户">
<sql-query>
select distinct p.name, p.dept_name as org_name,p.full_name as org_full_name, p.full_sequence
from sa_oporg p, sa_opperson s, SA_OPOrg o, SA_OPAuthorize a, SA_OPRole r
where p.full_id like concat(o.full_id, '%')
and p.person_id = s.id
and ((case
when s.person_kind is null or s.person_kind='' then
'def'
else
s.person_kind
end) = (case
when r.role_person_kind is null or r.role_person_kind='' then
'def'
else
r.role_person_kind
end))
and o.id = a.org_id
and a.role_id = r.id
and p.status = 1
and o.status = 1
and r.id = :roleId
</sql-query>
<condition column="name" name="keyword" symbol="like" alias="p"/>
</query>
</query-mappings>
\ No newline at end of file
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