아래처럼 개발을 했는데, 제 머릿속에서 나올 수 있는 최선입니다...
그런데 아무리 봐도 성능이나 구문 등이 마음에 들지 않아서
혹시 더 간략하게 또는 간결하게 할 수 있는 방법이 있을까요?
<mapper namespace="sw.production.TwistYarnOrderMapper">
<select id="selectList" resultType="sw.production.TwistYarnOrder" parameterType="atech.common.Paging">
SELECT SQL_CALC_FOUND_ROWS * FROM VIEW_TWIST_ORD_APPROVAL
<where>
<if test="sear != null and sear != ''">
AND (
LOT_NO LIKE CONCAT('%',#{sear},'%') OR
TWIST_CD LIKE CONCAT('%',#{sear},'%') OR
COLOR LIKE CONCAT('%',#{sear},'%') OR
COLOR_NM LIKE CONCAT('%',#{sear},'%') OR
CARD_WORK_MAC LIKE CONCAT('%',#{sear},'%') OR
WORK_MAC_NM LIKE CONCAT('%',#{sear},'%') OR
BEON_CNT LIKE CONCAT('%',#{sear},'%') OR
YORI LIKE CONCAT('%',#{sear},'%') OR
WRITER LIKE CONCAT('%',#{sear},'%') OR
WRITE_DT LIKE CONCAT('%',#{sear},'%')
)
</if>
<if test="sState != null and sState != ''">
AND STATUS = #{sState}
</if>
<if test="sType != null and sType != ''">
AND TYPE = #{sType}
</if>
</where>
ORDER BY
<choose>
<when test="s_order_field != null and s_order_field != ''">
${s_order_field} ${s_order_method}
</when>
<otherwise>
WRITE_DT desc
</otherwise>
</choose>
LIMIT #{offSet}, #{recordsPerPage}