Commit 6fce343a by huangshunlin

sql拼接调整为占位符(日期类型不能直接与date_format字符串比较)

parent 9cec67a6
......@@ -55,4 +55,6 @@ public interface CurMapper {
Cur selectByCod(Cur record);
List<Cur> getValidCurrenciesList(Cur record);
}
\ No newline at end of file
......@@ -445,6 +445,24 @@
where COD = #{cod}
</select>
<select id="getValidCurrenciesList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from cur
<where>
<if test="etgextkey != null and etgextkey != ''">
etgextkey = #{etgextkey}
</if>
<if test="begdat != null ">
and (begdat is NULL or BEGDAT <![CDATA[ <= ]]> #{begdat} )
</if>
<if test="enddat != null">
and (enddat is NULL or ENDDAT <![CDATA[ > ]]> #{enddat} )
</if>
</where>
</select>
</mapper>
......@@ -270,11 +270,16 @@ public class XrtmodServiceImpl implements XrtmodService {
private List<String> getValidCurrenciesList(Date date) {
Date begDate = date;
Date endDate = date;
String argSql = "WHERE (BEGDAT is NULL or BEGDAT <= " + Utils.dbSqlDate(begDate) + " ) and ( ENDDAT is NULL or ENDDAT > " + Utils.dbSqlDate(endDate) +")";
/*String argSql = "WHERE (BEGDAT is NULL or BEGDAT <= " + Utils.dbSqlDate(begDate) + " ) and ( ENDDAT is NULL or ENDDAT > " + Utils.dbSqlDate(endDate) +")";
String sql = "select cod from cur " + Utils.sdbEtyGenSql("CUR", argSql);
Map<String, Object> dyncMap = new HashMap<>();
dyncMap.put("sql", sql);
List<Cur> curList = curMapper.dyncRead(dyncMap);
List<Cur> curList = curMapper.dyncRead(dyncMap);*/
Cur queryCur=new Cur();
queryCur.setBegdat(begDate);
queryCur.setEnddat(endDate);
queryCur.setEtgextkey(SettleContext.getUserEtg().getExtkey());
List<Cur> curList = curMapper.getValidCurrenciesList(queryCur);
if (curList != null) {
List<String> list = new ArrayList<>();
curList.forEach(cur -> list.add(cur.getCod()));
......
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