Commit 89cd022b authored by 张永's avatar 张永

select 走读库

parent fecc57b5
...@@ -6,6 +6,7 @@ import java.util.Map; ...@@ -6,6 +6,7 @@ import java.util.Map;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.aliyuncs.utils.StringUtils; import com.aliyuncs.utils.StringUtils;
...@@ -21,6 +22,11 @@ public class ActivityServiceImpl implements ActivityService { ...@@ -21,6 +22,11 @@ public class ActivityServiceImpl implements ActivityService {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
@Qualifier("readonly")
private JdbcTemplate readJdbcTemplate;
/** /**
* 众筹项目列表 * 众筹项目列表
* <p>Title: </p> * <p>Title: </p>
...@@ -31,11 +37,11 @@ public class ActivityServiceImpl implements ActivityService { ...@@ -31,11 +37,11 @@ public class ActivityServiceImpl implements ActivityService {
*/ */
public List<Map<String, Object>> crowdFundingsProjectList(Map<String, Object> params, Page page) { public List<Map<String, Object>> crowdFundingsProjectList(Map<String, Object> params, Page page) {
String orgNo = params.get("orgNO")+""; String orgNo = params.get("orgNO")+"";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
String sql = projectSql(orgNo, ""); String sql = projectSql(orgNo, "");
List<Map<String,Object>> list = jdbcTemplate.limit(sql, page); List<Map<String,Object>> list = readJdbcTemplate.limit(sql, page);
// if(list != null && list.size()>0) { // if(list != null && list.size()>0) {
// for(Map<String,Object> map:list) { // for(Map<String,Object> map:list) {
// String projectId = map.get("ProjectID")+""; // String projectId = map.get("ProjectID")+"";
...@@ -62,10 +68,10 @@ public class ActivityServiceImpl implements ActivityService { ...@@ -62,10 +68,10 @@ public class ActivityServiceImpl implements ActivityService {
public Map<String, Object> crowdFundingsProjectDetail(Map<String, Object> params) { public Map<String, Object> crowdFundingsProjectDetail(Map<String, Object> params) {
String projectId = params.get("projectId")+""; String projectId = params.get("projectId")+"";
String orgNo = params.get("orgNo")+""; String orgNo = params.get("orgNo")+"";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
String projectSql = projectSql(orgNo, projectId); String projectSql = projectSql(orgNo, projectId);
Map<String,Object> projectMap = jdbcTemplate.queryForMap(projectSql); Map<String,Object> projectMap = readJdbcTemplate.queryForMap(projectSql);
String sql = "SELECT PlanID = a.nPlanID,ProjectID = a.nProjectID,PlanName = a.sPlanName, PlanSummary = a.sPlanSummary,PlanUrl = a.sUrl,AgentContractNO = a.sAgentContractNO, " String sql = "SELECT PlanID = a.nPlanID,ProjectID = a.nProjectID,PlanName = a.sPlanName, PlanSummary = a.sPlanSummary,PlanUrl = a.sUrl,AgentContractNO = a.sAgentContractNO, "
+ " GoodsID = a.nGoodsID, GoodsNO = acg.sGoodsNO,GoodsDesc = acg.sGoodsDesc,PlanStock = a.nPlanStock, PlanPrice = a.nPrice,LimitQty = a.nLimitQty, " + " GoodsID = a.nGoodsID, GoodsNO = acg.sGoodsNO,GoodsDesc = acg.sGoodsDesc,PlanStock = a.nPlanStock, PlanPrice = a.nPrice,LimitQty = a.nLimitQty, "
+ " PlanReturnDays = (select datediff(dd, dEndDate, dReturnDate) from tZHCProject p where p.nProjectID = a.nProjectID), LastUpdateTime = a.dLastUpdateTime ,SaleCount = 0 " + " PlanReturnDays = (select datediff(dd, dEndDate, dReturnDate) from tZHCProject p where p.nProjectID = a.nProjectID), LastUpdateTime = a.dLastUpdateTime ,SaleCount = 0 "
...@@ -73,9 +79,9 @@ public class ActivityServiceImpl implements ActivityService { ...@@ -73,9 +79,9 @@ public class ActivityServiceImpl implements ActivityService {
+ " WHERE a.nProjectID = ? "; + " WHERE a.nProjectID = ? ";
String sql0 = "select so.nPlanID, sum(so.nTotalSaleQty) nSaleQty from tSalesOrder so, tZHCPlan p where so.sB2BOrderTypeID = '3' and so.nPlanID = p.nPlanID and p.nProjectID = " + projectId + " group by so.nPlanID"; String sql0 = "select so.nPlanID, sum(so.nTotalSaleQty) nSaleQty from tSalesOrder so, tZHCPlan p where so.sB2BOrderTypeID = '3' and so.nPlanID = p.nPlanID and p.nProjectID = " + projectId + " group by so.nPlanID";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql0); List<Map<String, Object>> list = readJdbcTemplate.queryForList(sql0);
Map<String, Map<String, Object>> mm = Util.listToMM(list, "nPlanID"); Map<String, Map<String, Object>> mm = Util.listToMM(list, "nPlanID");
List<Map<String,Object>> goodsList = jdbcTemplate.queryForList(sql,projectId); List<Map<String,Object>> goodsList = readJdbcTemplate.queryForList(sql,projectId);
for(Map<String, Object> map : goodsList) { for(Map<String, Object> map : goodsList) {
Object PlanID = map.get("PlanID"); Object PlanID = map.get("PlanID");
Map<String, Object> mmm = mm.get("" + PlanID); Map<String, Object> mmm = mm.get("" + PlanID);
......
...@@ -9,6 +9,7 @@ import java.util.Map; ...@@ -9,6 +9,7 @@ import java.util.Map;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.egolm.common.bean.Rjx; import com.egolm.common.bean.Rjx;
...@@ -27,6 +28,12 @@ public class BrandServiceImpl implements BrandService { ...@@ -27,6 +28,12 @@ public class BrandServiceImpl implements BrandService {
private static final Log logger = LogFactory.getLog(BrandServiceImpl.class); private static final Log logger = LogFactory.getLog(BrandServiceImpl.class);
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
@Qualifier("readonly")
private JdbcTemplate readJdbcTemplate;
@Autowired @Autowired
private UserService userService; private UserService userService;
/* /*
...@@ -46,8 +53,8 @@ public class BrandServiceImpl implements BrandService { ...@@ -46,8 +53,8 @@ public class BrandServiceImpl implements BrandService {
}else { }else {
sql +=" AND sOrgList like '%"+orgNO+"%' "; sql +=" AND sOrgList like '%"+orgNO+"%' ";
} }
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
return jdbcTemplate.limit(sql, page); return readJdbcTemplate.limit(sql, page);
} }
@Override @Override
...@@ -69,8 +76,8 @@ public class BrandServiceImpl implements BrandService { ...@@ -69,8 +76,8 @@ public class BrandServiceImpl implements BrandService {
+ "b.sBrandName, " + "b.sBrandName, "
+ "b.sLogoUrl "; + "b.sLogoUrl ";
String orgNo=(String) map.get("orgNo"); String orgNo=(String) map.get("orgNo");
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
return jdbcTemplate.limit(sql, page,orgNo); return readJdbcTemplate.limit(sql, page,orgNo);
} }
@Override @Override
...@@ -98,7 +105,7 @@ public class BrandServiceImpl implements BrandService { ...@@ -98,7 +105,7 @@ public class BrandServiceImpl implements BrandService {
+ "ORDER BY " + "ORDER BY "
+ "b.nSort desc, " + "b.nSort desc, "
+ "b.sPinyinCode "; + "b.sPinyinCode ";
return jdbcTemplate.queryForList(sql, orgNo); return readJdbcTemplate.queryForList(sql, orgNo);
} }
......
...@@ -6,6 +6,7 @@ import java.util.List; ...@@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
...@@ -23,6 +24,12 @@ public class CartServiceImpl implements CartService { ...@@ -23,6 +24,12 @@ public class CartServiceImpl implements CartService {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
@Qualifier("readonly")
private JdbcTemplate readJdbcTemplate;
@Autowired @Autowired
private CartQueryService cartRedisService; private CartQueryService cartRedisService;
...@@ -117,7 +124,7 @@ public class CartServiceImpl implements CartService { ...@@ -117,7 +124,7 @@ public class CartServiceImpl implements CartService {
* @throws * @throws
*/ */
public Map<String, Object> count(String orgNo, String shopNO) { public Map<String, Object> count(String orgNo, String shopNO) {
return jdbcTemplate.queryForMap("select count(nSaleQty) totalCount , isnull(sum(nSaleQty), 0) totalSaleQty from V_Cart where sOrgNO = '" + orgNo + "' and sShopNO = '" + shopNO + "'"); return readJdbcTemplate.queryForMap("select count(nSaleQty) totalCount , isnull(sum(nSaleQty), 0) totalSaleQty from V_Cart where sOrgNO = '" + orgNo + "' and sShopNO = '" + shopNO + "'");
} }
......
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.egolm.common.jdbc.JdbcTemplate; import com.egolm.common.jdbc.JdbcTemplate;
...@@ -15,18 +16,22 @@ public class CategoryServiceImpl implements CategoryService { ...@@ -15,18 +16,22 @@ public class CategoryServiceImpl implements CategoryService {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
@Qualifier("readonly")
private JdbcTemplate readJdbcTemplate;
public List<Map<String, Object>> queryCategoryByLevel(String orgNO, String scopeTypeID, Integer level) { public List<Map<String, Object>> queryCategoryByLevel(String orgNO, String scopeTypeID, Integer level) {
if(level == null) { if(level == null) {
level = jdbcTemplate.queryForInt("select GoodsCategoryLevel = isnull((select Convert(int,sValue1) from tSystemCtrl where sCode = 'GoodsCategoryLevel'),0)"); level = readJdbcTemplate.queryForInt("select GoodsCategoryLevel = isnull((select Convert(int,sValue1) from tSystemCtrl where sCode = 'GoodsCategoryLevel'),0)");
} }
String three="select sCategoryNO, sCategoryDesc, sUpCategoryNO from tOrgCategory where sOrgNO = ? and nCategoryLevel = ? and nTag&1 = 0 order by nSort desc"; String three="select sCategoryNO, sCategoryDesc, sUpCategoryNO from tOrgCategory where sOrgNO = ? and nCategoryLevel = ? and nTag&1 = 0 order by nSort desc";
List<Map<String,Object>> list3=jdbcTemplate.queryForList(three, orgNO, level); List<Map<String,Object>> list3=readJdbcTemplate.queryForList(three, orgNO, level);
return list3; return list3;
} }
public List<Map<String, Object>> queryCategory(String orgNO, String scopeTypeID, String upCategoryNo) { public List<Map<String, Object>> queryCategory(String orgNO, String scopeTypeID, String upCategoryNo) {
String three="select sCategoryNO, sCategoryDesc, sUpCategoryNO from tOrgCategory where sOrgNO = ? and sUpCategoryNO = ? and nTag&1 = 0 order by nSort desc"; String three="select sCategoryNO, sCategoryDesc, sUpCategoryNO from tOrgCategory where sOrgNO = ? and sUpCategoryNO = ? and nTag&1 = 0 order by nSort desc";
List<Map<String,Object>> list3=jdbcTemplate.queryForList(three, orgNO, upCategoryNo); List<Map<String,Object>> list3=readJdbcTemplate.queryForList(three, orgNO, upCategoryNo);
return list3; return list3;
} }
......
...@@ -178,7 +178,7 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -178,7 +178,7 @@ public class GoodsServiceImpl implements GoodsService {
" and a.nAgentID = ? " + " and a.nAgentID = ? " +
" and a.nGoodsID = ?"; " and a.nGoodsID = ?";
int mCount = jdbcTemplate.queryForInt(mSql,agentID,goodsId); int mCount = readJdbcTemplate.queryForInt(mSql,agentID,goodsId);
if(mCount >0 ) { if(mCount >0 ) {
IsGoodsUnit = 1; IsGoodsUnit = 1;
} }
...@@ -192,10 +192,10 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -192,10 +192,10 @@ public class GoodsServiceImpl implements GoodsService {
try { try {
if(isCheckAgentID) { if(isCheckAgentID) {
gSql += " and t.nAgentID = ? "; gSql += " and t.nAgentID = ? ";
detail = jdbcTemplate.queryForMap(gSql, custTypeId, orgNo, contractNo, goodsId,agentID); detail = readJdbcTemplate.queryForMap(gSql, custTypeId, orgNo, contractNo, goodsId,agentID);
}else { }else {
detail = jdbcTemplate.queryForMap(gSql, custTypeId, orgNo, contractNo, goodsId); detail = readJdbcTemplate.queryForMap(gSql, custTypeId, orgNo, contractNo, goodsId);
} }
BigDecimal nApSalePrice = (BigDecimal) detail.get("nApSalePrice"); BigDecimal nApSalePrice = (BigDecimal) detail.get("nApSalePrice");
...@@ -210,9 +210,9 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -210,9 +210,9 @@ public class GoodsServiceImpl implements GoodsService {
List<Map<String, Object>> specList = new ArrayList<Map<String,Object>>(); List<Map<String, Object>> specList = new ArrayList<Map<String,Object>>();
if(isCheckAgentID) { if(isCheckAgentID) {
sql += " and og.nAgentID = ? "; sql += " and og.nAgentID = ? ";
specList = jdbcTemplate.queryForList(sql, orgNo, contractNo, custTypeId, goodsId,agentID); specList = readJdbcTemplate.queryForList(sql, orgNo, contractNo, custTypeId, goodsId,agentID);
}else { }else {
specList = jdbcTemplate.queryForList(sql, orgNo, contractNo, custTypeId, goodsId); specList = readJdbcTemplate.queryForList(sql, orgNo, contractNo, custTypeId, goodsId);
} }
...@@ -264,7 +264,7 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -264,7 +264,7 @@ public class GoodsServiceImpl implements GoodsService {
}else { }else {
args = new Object[] {custTypeId, orgNo, contractNo, goodsId}; args = new Object[] {custTypeId, orgNo, contractNo, goodsId};
} }
List<Map<String, Object>> promoList = jdbcTemplate.queryForList(promoSql, args); List<Map<String, Object>> promoList = readJdbcTemplate.queryForList(promoSql, args);
detail.put("promoList", promoList); detail.put("promoList", promoList);
...@@ -292,7 +292,7 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -292,7 +292,7 @@ public class GoodsServiceImpl implements GoodsService {
" and t.nAgentID = ? " + " and t.nAgentID = ? " +
" order by nConvertRate"; " order by nConvertRate";
List<Map<String,Object>> goodsUnitList = jdbcTemplate.queryForList(GoodsUnitSql,orgNo,contractNo,goodsId,agentID,orgNo,contractNo,goodsId,agentID); List<Map<String,Object>> goodsUnitList = readJdbcTemplate.queryForList(GoodsUnitSql,orgNo,contractNo,goodsId,agentID,orgNo,contractNo,goodsId,agentID);
rjx.set("goodsUnitList", goodsUnitList); rjx.set("goodsUnitList", goodsUnitList);
}else { }else {
rjx.set("goodsUnitList", null); rjx.set("goodsUnitList", null);
...@@ -334,7 +334,7 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -334,7 +334,7 @@ public class GoodsServiceImpl implements GoodsService {
" and a.nGoodsID = ? " + " and a.nGoodsID = ? " +
"order by sPicTypeID, nIdx " + "order by sPicTypeID, nIdx " +
" "; " ";
List<Map<String, Object>> picList1 = jdbcTemplate.queryForList(sql1, agentContractNO, goodsID, agentContractNO, goodsID); List<Map<String, Object>> picList1 = readJdbcTemplate.queryForList(sql1, agentContractNO, goodsID, agentContractNO, goodsID);
Map<String, List<Map<String,Object>>> picML1 = Util.listToML(picList1, "sPicTypeID"); Map<String, List<Map<String,Object>>> picML1 = Util.listToML(picList1, "sPicTypeID");
Map<String, List<Map<String, Object>>> pics = new HashMap<String, List<Map<String, Object>>>(); Map<String, List<Map<String, Object>>> pics = new HashMap<String, List<Map<String, Object>>>();
for(String sPicTypeID : new String[] {"1", "2", "3", "4","5"}) { for(String sPicTypeID : new String[] {"1", "2", "3", "4","5"}) {
......
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.egolm.common.StringUtil; import com.egolm.common.StringUtil;
...@@ -17,6 +18,11 @@ public class PageServiceImpl implements PageService { ...@@ -17,6 +18,11 @@ public class PageServiceImpl implements PageService {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
@Qualifier("readonly")
private JdbcTemplate readJdbcTemplate;
/** /**
* 查询首页配置 * 查询首页配置
* <p>Title: query</p> * <p>Title: query</p>
...@@ -29,8 +35,8 @@ public class PageServiceImpl implements PageService { ...@@ -29,8 +35,8 @@ public class PageServiceImpl implements PageService {
public List<Map<String, Object>> query(Map<String, Object> params) { public List<Map<String, Object>> query(Map<String, Object> params) {
String sql = "SELECT sPlatformNO platformNO,sPlatformName platformName,sLogoPath1 logoPath1 ,sLogoPath2 logoPath2,sLogoPath3 logoPath3,sThemeNO themeNO,sThemeJson themeJson,sMemo memo,dLastUpdateTime lastUpdateTime " String sql = "SELECT sPlatformNO platformNO,sPlatformName platformName,sLogoPath1 logoPath1 ,sLogoPath2 logoPath2,sLogoPath3 logoPath3,sThemeNO themeNO,sThemeJson themeJson,sMemo memo,dLastUpdateTime lastUpdateTime "
+ " FROM tPlatformLayout " + "WHERE nTag &1=0 ORDER BY dLastUpdateTime DESC "; + " FROM tPlatformLayout " + "WHERE nTag &1=0 ORDER BY dLastUpdateTime DESC ";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
return jdbcTemplate.queryForList(sql); return readJdbcTemplate.queryForList(sql);
} }
/** /**
...@@ -45,11 +51,11 @@ public class PageServiceImpl implements PageService { ...@@ -45,11 +51,11 @@ public class PageServiceImpl implements PageService {
@Override @Override
public List<Map<String, Object>> queryIcon(Map<String, Object> params, Page page) { public List<Map<String, Object>> queryIcon(Map<String, Object> params, Page page) {
String iconGroupNO = params.get("iconGroupNO")+""; String iconGroupNO = params.get("iconGroupNO")+"";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
String sql = " SELECT IconNO = i.sIconNO ,IconPath=i.sIconPath,DefaultTxt=i.sDefaultTxt,DefaultLinkType=i.sDefaultLinkType,DefaultLink=i.sDefaultLink " String sql = " SELECT IconNO = i.sIconNO ,IconPath=i.sIconPath,DefaultTxt=i.sDefaultTxt,DefaultLinkType=i.sDefaultLinkType,DefaultLink=i.sDefaultLink "
+ " FROM tIcon i ,tIconGroup ig" + " FROM tIcon i ,tIconGroup ig"
+ " WHERE i.sGroupNO = ig.sGroupNO AND ig.nTag&1=0 and ig.sGroupNO = ? "; + " WHERE i.sGroupNO = ig.sGroupNO AND ig.nTag&1=0 and ig.sGroupNO = ? ";
return jdbcTemplate.limit(sql, page, iconGroupNO); return readJdbcTemplate.limit(sql, page, iconGroupNO);
} }
/** /**
...@@ -67,7 +73,7 @@ public class PageServiceImpl implements PageService { ...@@ -67,7 +73,7 @@ public class PageServiceImpl implements PageService {
String adTypeID = params.get("adTypeID")+""; String adTypeID = params.get("adTypeID")+"";
String custNo = params.get("custNo")+""; String custNo = params.get("custNo")+"";
String AgentID = params.get("AgentID")+""; String AgentID = params.get("AgentID")+"";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
String sql = "SELECT BannerAdNO = b.sBannerAdNO, BannerAdTitle = b.sBannerAdTitle,OrgNO = b.sOrgNO,AdPostionTypeID = b.sAdPositionTypeID,AdPostionType = b.sAdPositionType," String sql = "SELECT BannerAdNO = b.sBannerAdNO, BannerAdTitle = b.sBannerAdTitle,OrgNO = b.sOrgNO,AdPostionTypeID = b.sAdPositionTypeID,AdPostionType = b.sAdPositionType,"
+ " LayoutTypeID = b.sLayoutTypeID,LayoutType = b.sLayoutType,JumpTypeID = b.sJumpTypeID,JumpType = b.sJumpType,JumpList = b.sJumpList,Idx = b.nIdx,ImagePath = b.sImagePath," + " LayoutTypeID = b.sLayoutTypeID,LayoutType = b.sLayoutType,JumpTypeID = b.sJumpTypeID,JumpType = b.sJumpType,JumpList = b.sJumpList,Idx = b.nIdx,ImagePath = b.sImagePath,"
...@@ -75,7 +81,7 @@ public class PageServiceImpl implements PageService { ...@@ -75,7 +81,7 @@ public class PageServiceImpl implements PageService {
+ " from tBannerAd b " + " from tBannerAd b "
+ " WHERE b.sOrgNO = ? AND sAdPositionTypeID = ? AND b.dStartTime <=getdate() AND b.dEndTime >= getdate() AND b.nTag&2 = 2 and b.nAgentID = ? "; + " WHERE b.sOrgNO = ? AND sAdPositionTypeID = ? AND b.dStartTime <=getdate() AND b.dEndTime >= getdate() AND b.nTag&2 = 2 and b.nAgentID = ? ";
return jdbcTemplate.limit(sql, page, orgNO, adTypeID,AgentID); return readJdbcTemplate.limit(sql, page, orgNO, adTypeID,AgentID);
} }
...@@ -93,16 +99,16 @@ public class PageServiceImpl implements PageService { ...@@ -93,16 +99,16 @@ public class PageServiceImpl implements PageService {
String orgNO = params.get("orgNO")+""; String orgNO = params.get("orgNO")+"";
String msgTypeID = params.get("msgTypeID")+""; String msgTypeID = params.get("msgTypeID")+"";
String agentID = params.get("agentID")+""; String agentID = params.get("agentID")+"";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
String sql = "SELECT BillBoardID = b.nBillboardID, MsgTypeID = b.sMsgTypeID,MsgType = b.sMsgType,Title = b.sTitle,Content = b.sText,Sort = b.nSort,TradeDate = b.dTradeDate" String sql = "SELECT BillBoardID = b.nBillboardID, MsgTypeID = b.sMsgTypeID,MsgType = b.sMsgType,Title = b.sTitle,Content = b.sText,Sort = b.nSort,TradeDate = b.dTradeDate"
+ " FROM tBillboard b " + " FROM tBillboard b "
+ " WHERE b.nTag&2=2 AND b.sMsgTypeID = ? and b.sOrgNO = ? "; + " WHERE b.nTag&2=2 AND b.sMsgTypeID = ? and b.sOrgNO = ? ";
if(StringUtil.isNotBlank(agentID)) { if(StringUtil.isNotBlank(agentID)) {
sql += " and b.nAgentID = ? "; sql += " and b.nAgentID = ? ";
return jdbcTemplate.limit(sql, page, msgTypeID, orgNO,agentID); return readJdbcTemplate.limit(sql, page, msgTypeID, orgNO,agentID);
}else { }else {
return jdbcTemplate.limit(sql, page, msgTypeID, orgNO); return readJdbcTemplate.limit(sql, page, msgTypeID, orgNO);
} }
} }
...@@ -118,18 +124,18 @@ public class PageServiceImpl implements PageService { ...@@ -118,18 +124,18 @@ public class PageServiceImpl implements PageService {
*/ */
public List<Map<String, Object>> queryFinanceProd(Map<String, Object> params, Page page) { public List<Map<String, Object>> queryFinanceProd(Map<String, Object> params, Page page) {
String orgNO = params.get("orgNO")+""; String orgNO = params.get("orgNO")+"";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
String sql = "select FinanceID = a.nFinanceID, OrgNO = a.sOrgNO, FinanceName = a.sFinanceName,AgentContractNO = a.sAgentContractNO,BannerUrl = a.sBannerUrl,LogoUrl = a.sLogoUrl," String sql = "select FinanceID = a.nFinanceID, OrgNO = a.sOrgNO, FinanceName = a.sFinanceName,AgentContractNO = a.sAgentContractNO,BannerUrl = a.sBannerUrl,LogoUrl = a.sLogoUrl,"
+ " AddressUrl = a.sAddressUrl, Introduce = a.sMemo, LastUpdateTime = a.dLastUpdateTime " + " AddressUrl = a.sAddressUrl, Introduce = a.sMemo, LastUpdateTime = a.dLastUpdateTime "
+ " from tFinanceProd a where a.nTag&2 = 2 and a.sOrgNO = ? "; + " from tFinanceProd a where a.nTag&2 = 2 and a.sOrgNO = ? ";
List<Map<String,Object>> list = jdbcTemplate.limit(sql, page, orgNO); List<Map<String,Object>> list = readJdbcTemplate.limit(sql, page, orgNO);
if(list != null && list.size() >0) { if(list != null && list.size() >0) {
for(Map<String,Object> map:list) { for(Map<String,Object> map:list) {
String FinanceID = map.get("FinanceID")+""; String FinanceID = map.get("FinanceID")+"";
String picSql = "select FinanceID = nFinanceID,Item = nItem, PicDesc = sPicDesc,URL = sURL from tFinanceProdPic where nFinanceID = ?"; String picSql = "select FinanceID = nFinanceID,Item = nItem, PicDesc = sPicDesc,URL = sURL from tFinanceProdPic where nFinanceID = ?";
List<Map<String,Object>> picList = jdbcTemplate.queryForList(picSql,FinanceID); List<Map<String,Object>> picList = readJdbcTemplate.queryForList(picSql,FinanceID);
map.put("picList", picList); map.put("picList", picList);
} }
} }
......
...@@ -85,16 +85,16 @@ public class UserServiceImpl implements UserService { ...@@ -85,16 +85,16 @@ public class UserServiceImpl implements UserService {
} }
try { try {
String sql = "SELECT * FROM tCustomer WHERE sCustNO = ? AND nTag&1=0"; String sql = "SELECT * FROM tCustomer WHERE sCustNO = ? AND nTag&1=0";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
TCustomer tcustomer = jdbcTemplate.queryForBean(sql, TCustomer.class, custNO); TCustomer tcustomer = readJdbcTemplate.queryForBean(sql, TCustomer.class, custNO);
List<TShop> shops = null; List<TShop> shops = null;
String shopSql = "SELECT * FROM tShop WHERE nTag&1=0 and sCustNO =? "; String shopSql = "SELECT * FROM tShop WHERE nTag&1=0 and sCustNO =? ";
if(StringUtil.isNotEmpty(shopNO)) { if(StringUtil.isNotEmpty(shopNO)) {
shopSql += " AND sShopNO = ? "; shopSql += " AND sShopNO = ? ";
shops = jdbcTemplate.queryForBeans(shopSql, TShop.class, custNO.trim(),shopNO.trim()); shops = readJdbcTemplate.queryForBeans(shopSql, TShop.class, custNO.trim(),shopNO.trim());
}else { }else {
shops = jdbcTemplate.queryForBeans(shopSql, TShop.class, custNO.trim()); shops = readJdbcTemplate.queryForBeans(shopSql, TShop.class, custNO.trim());
} }
tcustomer.settShops(shops); tcustomer.settShops(shops);
...@@ -118,7 +118,7 @@ public class UserServiceImpl implements UserService { ...@@ -118,7 +118,7 @@ public class UserServiceImpl implements UserService {
public boolean checkShopExists(String custNO,String shopNO) { public boolean checkShopExists(String custNO,String shopNO) {
try { try {
String sql = "SELECT count(1) FROM tShop WHERE sCustNO = ? AND sShopNO = ? AND nTag&1=0"; String sql = "SELECT count(1) FROM tShop WHERE sCustNO = ? AND sShopNO = ? AND nTag&1=0";
int i = jdbcTemplate.queryForInt(sql,custNO,shopNO); int i = readJdbcTemplate.queryForInt(sql,custNO,shopNO);
if(i >0) { if(i >0) {
return true; return true;
} }
...@@ -132,7 +132,7 @@ public class UserServiceImpl implements UserService { ...@@ -132,7 +132,7 @@ public class UserServiceImpl implements UserService {
public TCustomer getCustomer(String mobile) { public TCustomer getCustomer(String mobile) {
try { try {
String sql = "SELECT * FROM tCustomer WHERE sMobile = ? AND nTag&1=0"; String sql = "SELECT * FROM tCustomer WHERE sMobile = ? AND nTag&1=0";
return jdbcTemplate.queryForBean(sql, TCustomer.class, mobile); return readJdbcTemplate.queryForBean(sql, TCustomer.class, mobile);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -144,8 +144,8 @@ public class UserServiceImpl implements UserService { ...@@ -144,8 +144,8 @@ public class UserServiceImpl implements UserService {
return new TShop(); return new TShop();
} }
String sql = "SELECT * FROM tShop WHERE sShopNO = ? AND nTag&1=0"; String sql = "SELECT * FROM tShop WHERE sShopNO = ? AND nTag&1=0";
jdbcTemplate.setDialect(new SqlServerDialect()); readJdbcTemplate.setDialect(new SqlServerDialect());
return jdbcTemplate.queryForBean(sql, TShop.class, shopNO); return readJdbcTemplate.queryForBean(sql, TShop.class, shopNO);
} }
/** /**
...@@ -660,7 +660,7 @@ public class UserServiceImpl implements UserService { ...@@ -660,7 +660,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
public Map<String, Object> queryCustomerByOpenId(String openId) { public Map<String, Object> queryCustomerByOpenId(String openId) {
String sql = "select c.*, m.sMobile sSalesmanMobile from tCustomer c left join tSalesman m on m.sSalesmanNO = c.sSalesmanNO1, tB2BUser u where c.sCustNO = u.sCustNO and u.sOpenID = ? and c.nTag&1 = 0 and u.nTag&1 = 0"; String sql = "select c.*, m.sMobile sSalesmanMobile from tCustomer c left join tSalesman m on m.sSalesmanNO = c.sSalesmanNO1, tB2BUser u where c.sCustNO = u.sCustNO and u.sOpenID = ? and c.nTag&1 = 0 and u.nTag&1 = 0";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, openId); List<Map<String, Object>> list = readJdbcTemplate.queryForList(sql, openId);
if(list.size() > 1) { if(list.size() > 1) {
throw new XException("OpenID绑定异常"); throw new XException("OpenID绑定异常");
} }
...@@ -669,7 +669,7 @@ public class UserServiceImpl implements UserService { ...@@ -669,7 +669,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
public Map<String, Object> queryCustomerByMobile(String mobile) { public Map<String, Object> queryCustomerByMobile(String mobile) {
List<Map<String, Object>> list = jdbcTemplate.queryForList("select * from tCustomer where sMobile = ? or sCustNO = ? and nTag&1 = 0", mobile, mobile); List<Map<String, Object>> list = readJdbcTemplate.queryForList("select * from tCustomer where sMobile = ? or sCustNO = ? and nTag&1 = 0", mobile, mobile);
return list.size() == 0 ? null : list.get(0); return list.size() == 0 ? null : list.get(0);
} }
...@@ -677,7 +677,7 @@ public class UserServiceImpl implements UserService { ...@@ -677,7 +677,7 @@ public class UserServiceImpl implements UserService {
public Map<String, Object> createCustomer(String orgNo, String openId, String mobile) { public Map<String, Object> createCustomer(String orgNo, String openId, String mobile) {
String sSalesmanNO1 = null; String sSalesmanNO1 = null;
try { try {
sSalesmanNO1 = jdbcTemplate.queryForString("select sSalesmanNO from tOrg where sOrgNO = ?", orgNo); sSalesmanNO1 = readJdbcTemplate.queryForString("select sSalesmanNO from tOrg where sOrgNO = ?", orgNo);
} catch (EmptyResultDataAccessException e) { } catch (EmptyResultDataAccessException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -707,7 +707,7 @@ public class UserServiceImpl implements UserService { ...@@ -707,7 +707,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
public List<Map<String, Object>> queryShopList(String orgNo, String custNo) { public List<Map<String, Object>> queryShopList(String orgNo, String custNo) {
List<Map<String, Object>> shopList = jdbcTemplate.queryForList("select s.*, m.sSalesmanName, m.sMobile sSalesmanMobile from tShop s left join tSalesman m on m.sSalesmanNO = s.sSalesmanNO1 where s.sCustNO = ? and s.sOrgNO = ? and s.nTag&1 = 0", custNo, orgNo); List<Map<String, Object>> shopList = readJdbcTemplate.queryForList("select s.*, m.sSalesmanName, m.sMobile sSalesmanMobile from tShop s left join tSalesman m on m.sSalesmanNO = s.sSalesmanNO1 where s.sCustNO = ? and s.sOrgNO = ? and s.nTag&1 = 0", custNo, orgNo);
return shopList; return shopList;
} }
...@@ -763,7 +763,7 @@ public class UserServiceImpl implements UserService { ...@@ -763,7 +763,7 @@ public class UserServiceImpl implements UserService {
}, keyHolder); }, keyHolder);
Object key = keyHolder.getKey(); Object key = keyHolder.getKey();
jdbcTemplate.update("update tShop set sShopNO = RIGHT('00000000'+ CAST(nShopID as varchar(8)), 8) where nShopID = ?", key); jdbcTemplate.update("update tShop set sShopNO = RIGHT('00000000'+ CAST(nShopID as varchar(8)), 8) where nShopID = ?", key);
String sShopNO = jdbcTemplate.queryForString("select sShopNO from tShop where nShopID = ?", key); String sShopNO = readJdbcTemplate.queryForString("select sShopNO from tShop where nShopID = ?", key);
map.put("sShopNO", sShopNO); map.put("sShopNO", sShopNO);
return map; return map;
} }
...@@ -838,13 +838,13 @@ public class UserServiceImpl implements UserService { ...@@ -838,13 +838,13 @@ public class UserServiceImpl implements UserService {
+ "left join tOrg o on o.sOrgNO = s.sOrgNO " + "left join tOrg o on o.sOrgNO = s.sOrgNO "
+ "where " + "where "
+ "sm.sSalesmanNO = s.sSalesmanNO1 and s.sShopNO = ?"; + "sm.sSalesmanNO = s.sSalesmanNO1 and s.sShopNO = ?";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, shopNo); List<Map<String, Object>> list = readJdbcTemplate.queryForList(sql, shopNo);
return list != null && list.size() > 0 ? list.get(0) : null; return list != null && list.size() > 0 ? list.get(0) : null;
} }
@Override @Override
public Map<String, Object> getCustomerByNO(String custNo) { public Map<String, Object> getCustomerByNO(String custNo) {
return jdbcTemplate.queryForMap("select * from tCustomer where sCustNO = ?", custNo); return readJdbcTemplate.queryForMap("select * from tCustomer where sCustNO = ?", custNo);
} }
@Override @Override
...@@ -857,7 +857,7 @@ public class UserServiceImpl implements UserService { ...@@ -857,7 +857,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
public List<Map<String, Object>> queryBankList(String sCustNO) { public List<Map<String, Object>> queryBankList(String sCustNO) {
String sql = "SELECT * FROM tCustBank where sCustNO = ? and nTag&1 = 0 order by dLastUpdateTime desc"; String sql = "SELECT * FROM tCustBank where sCustNO = ? and nTag&1 = 0 order by dLastUpdateTime desc";
return jdbcTemplate.queryForList(sql, sCustNO); return readJdbcTemplate.queryForList(sql, sCustNO);
} }
@Override @Override
......
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