Commit 85449e9a by 宋祥

1.fixBug:增加get主键查询

parent 1e3cdecd
......@@ -631,7 +631,9 @@ public class HGSqlConstant {
* @date:2024/5/8,10:55
*/
public class HgXsUser {
// 查询
public static final String GET_BY_LOGIN = "HGXSUser.getByLogin";
// 查询
public static final String QUERY = "HGXSUser.query";
// 查询
......
......@@ -14,6 +14,8 @@ public class HgScSqlConstant {
*/
public static class HgSc001 {
// 获取
public static final String GET_BY_CODE = "HGSC001.get";
// 德诚修改
public static final String UPDATE_FOR_DC = "HGSC001.updateForDc";
// 修改项目名称
......
......@@ -147,7 +147,7 @@ public class ServiceHGSC101 extends ServiceEPBase {
String prefix = dbPz009.getLoginPrefix();
for (DcContractList zbContract : zbContracts) {
String projCode = prefix + zbContract.getOrd();
HGSC001 dbSc001 = HGSCTools.Hgsc001.queryByCode(projCode);
HGSC001 dbSc001 = HGSCTools.Hgsc001.getByCode(projCode);
if (dbSc001 == null) {
dbSc001 = new HGSC001();
dbSc001.setAccountCode(accountCode);
......
......@@ -2,6 +2,37 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGSC001">
<sql id="column">
id as "id",
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
subcontract_code as "subcontractCode", <!-- 分包商编码 -->
subcontract_name as "subcontractName", <!-- 分包商名称 -->
genral_contract_code as "genralContractCode", <!-- 总包商编码 -->
genral_contract_name as "genralContractName", <!-- 总包商名称 -->
party_pm_name as "partyPmName", <!-- 甲方项目经理名称 -->
party_pm_hpone as "partyPmHpone", <!-- 甲方项目经理联系电话 -->
contract_name as "contractName", <!-- 合同名称 -->
contract_work_txt as "contractWorkTxt", <!-- 合同工作量 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
proj_type as "projType", <!-- 项目性质 -->
proj_status as "projStatus", <!-- 项目状态 0:在建;1:完工 -->
approval_status as "approvalStatus", <!-- 审批状态 0:待审;1:审核中;2:已审 -->
permiss_start_date as "permissStartDate", <!-- 准许开工日期 -->
start_date as "startDate", <!-- 开工日期 -->
end_date as "endDate", <!-- 完工日期 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
</sql>
<sql id="condition">
<include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="id">
......@@ -98,47 +129,27 @@
</isNotEmpty>
</sql>
<select id="get" resultClass="com.baosight.hggp.hg.sc.domain.HGSC001">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGSC001
WHERE PROJ_CODE = #projCode
</select>
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC001">
SELECT
id as "id",
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
subcontract_code as "subcontractCode", <!-- 分包商编码 -->
subcontract_name as "subcontractName", <!-- 分包商名称 -->
genral_contract_code as "genralContractCode", <!-- 总包商编码 -->
genral_contract_name as "genralContractName", <!-- 总包商名称 -->
party_pm_name as "partyPmName", <!-- 甲方项目经理名称 -->
party_pm_hpone as "partyPmHpone", <!-- 甲方项目经理联系电话 -->
contract_name as "contractName", <!-- 合同名称 -->
contract_work_txt as "contractWorkTxt", <!-- 合同工作量 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
proj_type as "projType", <!-- 项目性质 -->
proj_status as "projStatus", <!-- 项目状态 0:在建;1:完工 -->
approval_status as "approvalStatus", <!-- 审批状态 0:待审;1:审核中;2:已审 -->
permiss_start_date as "permissStartDate", <!-- 准许开工日期 -->
start_date as "startDate", <!-- 开工日期 -->
end_date as "endDate", <!-- 完工日期 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
FROM ${hggpSchema}.HGSC001 WHERE 1=1
<include refid="customCondition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
id desc
</isEmpty>
</dynamic>
</select>
<include refid="column"/>
FROM ${hggpSchema}.HGSC001 WHERE 1=1
<include refid="customCondition"/>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
id desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC001 WHERE 1=1
......
package com.baosight.hggp.hg.sc.tools;
import cn.hutool.core.bean.BeanUtil;
import com.baosight.hggp.common.*;
import com.baosight.hggp.common.AssignStatusEnum;
import com.baosight.hggp.common.CheckStatusEnum;
import com.baosight.hggp.common.ComputeTypeEnum;
import com.baosight.hggp.common.HandleStatusEnum;
import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
......@@ -13,18 +16,37 @@ import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.domain.HGPZ005A;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.*;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.hg.sc.domain.HGSC003;
import com.baosight.hggp.hg.sc.domain.HGSC004;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.domain.HGSC004B;
import com.baosight.hggp.hg.sc.domain.HGSC005;
import com.baosight.hggp.hg.sc.domain.HGSC005A;
import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.domain.HGSC009;
import com.baosight.hggp.hg.sc.domain.HGSC009A;
import com.baosight.hggp.hg.sc.domain.HGSC099;
import com.baosight.hggp.hg.sj.domain.HGSJ001;
import com.baosight.hggp.hg.sj.tools.HGSJTools;
import com.baosight.hggp.hg.zl.domain.HGZL002;
import com.baosight.hggp.hg.zl.domain.HGZL004;
import com.baosight.hggp.hg.zl.tools.HGZLTools;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.DateUtil;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.FileUtils;
import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
......@@ -33,12 +55,24 @@ import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.baosight.hggp.common.AssignStatusEnum.*;
import cn.hutool.core.bean.BeanUtil;
import static com.baosight.hggp.common.AssignStatusEnum.ASSIGNED;
import static com.baosight.hggp.common.AssignStatusEnum.PARTIAL_ASSIGN;
import static com.baosight.hggp.common.AssignStatusEnum.UNASSIGN;
import static java.math.BigDecimal.ROUND_DOWN;
/**
......@@ -196,18 +230,34 @@ public class HGSCTools {
*/
public static class Hgsc001 {
/**
*
* @param code
* @return
*/
public static HGSC001 queryByCode(String code) {
AssertUtils.isNull(code, "项目Code不能为空!");
List<HGSC001> results = DaoBase.getInstance().query(HGSC001.QUERY, new HashMap<String,Object>(){
{put("projCode",code);}
});
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
public static HGSC001 getByCode(String code) {
AssertUtils.isNull(code, "项目Code不能为空!");
Map queryMap = new HashMap();
queryMap.put(HGSC001.FIELD_proj_code, code);
List<HGSC001> results = DaoBase.getInstance().query(HgScSqlConstant.HgSc001.GET_BY_CODE, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
*
* @param code
* @return
*/
public static HGSC001 queryByCode(String code) {
AssertUtils.isNull(code, "项目Code不能为空!");
List<HGSC001> results = DaoBase.getInstance().query(HGSC001.QUERY, new HashMap<String, Object>() {
{
put("projCode", code);
}
});
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* @param projCodes
......
......@@ -281,7 +281,7 @@ public class ServiceHGXSUser extends ServiceBase {
}
String userId = dbPz009.getLoginPrefix() + ord;
// 判断用户是否存在
User dbUser = HGXSTools.XsUser.get(userId);
User dbUser = HGXSTools.XsUser.getByLogin(userId);
if (dbUser == null) {
this.syncDcSingleUserAdd(zbUser, dbPz009, userId);
} else {
......@@ -297,8 +297,7 @@ public class ServiceHGXSUser extends ServiceBase {
* @param userId
* @throws Exception
*/
private void syncDcSingleUserAdd(DcUser zbUser, HGPZ009 dbPz009, String userId)
throws Exception {
private void syncDcSingleUserAdd(DcUser zbUser, HGPZ009 dbPz009, String userId) throws Exception {
// 新增用户
HGXSTools.XsUser.addUser(dbPz009.getAccountCode(), userId, zbUser.getName(), zbUser.getSex(), zbUser.getEmail(),
zbUser.getCardid());
......
......@@ -57,8 +57,7 @@
SELECT
<include refid="column"/>
FROM ${platSchema}.TXSOG01
WHERE 1=1
AND ORG_ID = #orgId#
WHERE ORG_ID = #orgId#
</select>
<!-- 查询组织信息 -->
......
......@@ -2,6 +2,16 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGXSUser">
<sql id="column">
USER_ID as "userId", <!-- 用户id -->
USER_NAME as "userName", <!-- 用户名 -->
LOGIN_NAME as "loginName", <!-- 登录id -->
GENDER as "gender", <!-- 性别 -->
MOBILE as "mobile", <!-- 手机号 -->
EMAIL as "email", <!-- 邮箱 -->
ACCOUNT_CODE as "accountCode" <!-- 企业编码 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="loginName">
LOGIN_NAME = #loginName#
......@@ -21,15 +31,17 @@
</sql>
<!-- 查询用户信息 -->
<select id="getByLogin" resultClass="com.baosight.hggp.hg.xs.domain.User">
SELECT
<include refid="column"/>
FROM ${platSchema}.XS_USER
WHERE LOGIN_NAME = #loginName#
</select>
<!-- 查询用户信息 -->
<select id="query" resultClass="com.baosight.hggp.hg.xs.domain.User">
SELECT
USER_ID as "userId", <!-- 用户id -->
USER_NAME as "userName", <!-- 用户名 -->
LOGIN_NAME as "loginName", <!-- 登录id -->
GENDER as "gender", <!-- 性别 -->
MOBILE as "mobile", <!-- 手机号 -->
EMAIL as "email", <!-- 邮箱 -->
ACCOUNT_CODE as "accountCode" <!-- 企业编码 -->
<include refid="column"/>
FROM ${platSchema}.XS_USER
WHERE 1=1
<include refid="condition"/>
......
......@@ -121,11 +121,11 @@ public class HGXSTools {
*
* @return
*/
public static User get(String loginName) {
public static User getByLogin(String loginName) {
AssertUtils.isEmpty(loginName, "用户登录名不能为空");
Map paramMap = new HashMap();
paramMap.put("loginName", loginName);
List<User> results = DaoBase.getInstance().query(HGSqlConstant.HgXsUser.QUERY, paramMap);
List<User> results = DaoBase.getInstance().query(HGSqlConstant.HgXsUser.GET_BY_LOGIN, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
......
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