记录工作中的分析(菜鸟向)

因为是快要走了,所以把项目中遇到的一些问题和自己的分析记录 抄下来,以便参考。

硬盘类型选择
int hardDisk; //硬盘类型 1:纯硬盘 2:纯乐橙 3: 纯分销

<if test = "hardDisk == 1">AND B.SECOND_LN_NAME = '纯硬盘' </if> --添加纯硬盘搜索
<if test = "hardDisk == 2">AND (B.SECOND_LN_NAME LIKE '消费类%' OR B.SECOND_LN_NAME LIKE '智能锁%' OR B.SECOND_LN_NAME LIKE '公有云%')</if>
<if test = "hardDisk == 3">AND ((B.SECOND_LN_NAME &lt;&gt; '硬盘'  AND B.SECOND_LN_NAME NOT LIKE '消费类%' AND B.SECOND_LN_NAME NOT LIKE '智能锁%' AND B.SECOND_LN_NAME NOT LIKE '公有云%') OR B.SECOND_LN_NAME IS NULL )
</if>

搜索日期处理

<if test = "fdealTime != null and fdealTime !='' ">AND TO_CHAR(T5.FDEALTIME,'YYYY-MM-DD') = #{fdealTime}</if>--处理时间--因为页面传过来的是字符串
<if test = "fdealTimeB != null and fdealTimeB !='' ">AND T5.FDEALTIME &gt; = TO_DATE(#{fdealtimeB}||' 00:00:00','yyyy-MM-dd hh24:mi:ss')</if>--00前面有空格
<if test = "fdealTimeE != null and fdealTimeE !='' ">AND T5.FDEALTIME &lt; = TO_DATE(#{fdealtimeE}||' 23:59:59','yyyy-MM-dd hh24:mi:ss')</if>--23前面有空格

或者,就不用起始日期,直接用原始的
<if test = "created != null and created != '' ">AND (T1.CREATED + 1/3) &gt;= TO_DATE(#{created}||' 00:00:00','yyyy-MM-dd hh24:mi:ss')</if>
<if test = "createdE != null and createdE != '' ">AND (T1.CREATED + 1/3) &gt;= TO_DATE(#{createdE}||' 23:59:59','yyyy-MM-dd hh24:mi:ss')</if>

搜索金额处理

<if test = "amount != null and amount !='' ">AND T5.AMOUNT = #{amount} </if> --签约金额(字符串类型)
<if test = "amountB != null and amountB !='' ">AND T5.AMOUNT &gt;=  #{amountB} </if> --搜索的开始签约金额(字符串类型)
<if test = "amountE != null and amountE !='' ">AND T5.AMOUNT &lt;=  #{amountE} </if> --搜索的结束签约金额(字符串类型)

循环处理 这个我很懵。双层循环

<if test = "industry != null ">
		<foreach item="value" index = "key" collection = "industry" open = "AND ("  separator = "OR" close = ")">
			(B.X_IND_ONE_CATG = #{key}
					<foreach collection = "value" index="index" item = "item" open = "AND B.X_IND_ONE_CATG IN ( " separator="," close=")">
							#{item}
					</foreach>
			)
</if>

上面的结果,我想了下,结构是这样的:
open + 标签内容体+separator
+ 标签内容体+separator
+ 标签内容体+separator
+ close
那么上面的解析完后就是:

AND (   (B.X_IND_ONE_CATG = #{key}
					<foreach collection = "value" index="index" item = "item" open = "AND B.X_IND_ONE_CATG IN ( " separator="," close=")">
							#{item}
					</foreach>  )  OR
			 (B.X_IND_ONE_CATG = #{key}
					<foreach collection = "value" index="index" item = "item" open = "AND B.X_IND_ONE_CATG IN ( " separator="," close=")">
							#{item}
					</foreach>  )  OR
			(B.X_IND_ONE_CATG = #{key}
					<foreach collection = "value" index="index" item = "item" open = "AND B.X_IND_ONE_CATG IN ( " separator="," close=")">
							#{item}
					</foreach>  )  OR
		)					   

这只是第一层循环。第二层循环的话,类似。就是在里面执行那种格式。

如下:

AND (  
			 (  B.X_IND_ONE_CATG = #{key}  AND B.X_IND_ONE_CATG IN ( #{item} ,#{item} ,#{item} ) )
				OR	
			 (  B.X_IND_ONE_CATG = #{key}  AND B.X_IND_ONE_CATG IN ( #{item} ,#{item} ,#{item} ) )				
							
		)

pickList做法

/**pick塞值--往表list中塞值
*/
@Override
public Map<String,String> getPickListList(QuoteRDCModel model)throws Exception{
	Map<String,String>  retMap = new LinkedHashMap<String,String>();//创建map,用来装数据。
		//map的key都是BC字段。
		retMap.put("Applicant Full Name",model.getFullNameId());//放Id,可以带出来其他数据。走到Siebel那边的BC。--申请人
		retMap.put("In Depot",model.getDepot());  ----调入仓库pick
		retMap.put("Account",model.getAccountId());  --客户pick
	return retMap;
}
/**pick取值--根据指定列 取值.Applicant Full Name  这个申请人BC字段做pick,下面有很多信息,比如 名字[Last Name],号码[Phone Number]等等。
*/
@Override
public Map<String,String> getPickListCols(QuoteRDCModel model)throws Exception{
	Map<String,String>  retMap = new LinkedHashMap<String,String>();
	
	 if(StringUtils.isNotNullOrEmptyStr(model.getFullName()))
			retMap.put("Applicant Full Name","[Last Name] like '"+model.getFullName()+"*'");  --like ‘王*'
	 else
			retMap.put("Applicant Full Name",""); //申请人
	
	 if(StringUtils.isNotNullOrEmptyStr(model.getDepot()))
			retMap.put("In Depot","[Location Decription] ='DH_INV国内营销' and [Iventory Sub Desc] like’"+model.getDepot()+"*'"); 
	 else
			retMap.put("In Depot","[Location Decription] ='DH_INV国内营销' "); //调入仓库--这个else这里就相当于pick搜索的默认条件。
	//。。。。。客户省略
}


基本服务做法
因为我之前出错了,报错:不支持的服务。见AbstractController.

@Override
public BaseService<FrameAgreementModel> getBaseService(){
	return service;
}
@Override
public BaseMapper<FrameAgreementModel> getBaseMapper(){
	return mapper;
}

统计接口
http://localhost:8080/xxxxxcrm/crm/demand/export/selectExportList.do?sum=true
详情接口
一般走的是BC,方法是

@ReuqestMapping("/selectDetailByBc.do")
@Responsebody
public String asynDetail(BidProcessModel model,HttpServletRequest request,HttpServletResponse response)throws Exception{
		if(StringUtils.isBlank(model.getRowId())){
			throws new ExceptionWithCode("0008");
		}
	BidProcessModel 	model = getBaseService().getInfo(model);
	return StringUtils.resultSuccessToJson(model);
}

列表接口

@RequestMapping("/selectOrderList.do")
@ResponseBody
public  String selectOrderList(OrderListModel model ,HttpServletRequest request ,HttpServletResponse response)throws Exception{
		model.setLoginId(SystemUtils.getUserModel().getRowId());
		List<OrderListModel> list = orderEntryMapper.selectOrderList(model);
		return StringUtils.resultSuccessToJson(list);
}//如果想抛异常,可以try  catch 一下。

忽略大小写
AND T5.AGREE_NUM like ‘%’||upper(#{agreeNum})||’%’
这种情况要求 数据库中默认的合同编号 是首字母大写的。一般也是的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值