mobilebroken/nflg-mobilebroken-repository/src/main/resources/mapper/DictionaryItemTranslateMapp...

38 lines
1.8 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nflg.mobilebroken.repository.mapper.DictionaryItemTranslateMapper">
<select id="getListByDictionaryItemId"
resultType="com.nflg.mobilebroken.common.pojo.vo.DictionaryItemTranslateVO">
SELECT t.id,l.`code`,l.`name`,t.`value`
FROM dictionary_item_translate t
LEFT JOIN language l ON t.language_code=l.`code`
WHERE t.dictionary_item_id=#{id}
</select>
<select id="getTitles" resultType="com.nflg.mobilebroken.common.pojo.vo.TitleVO">
SELECT
di.id,di.`name`,dit.`value`
FROM
dictionary d
INNER JOIN dictionary_item di ON d.id = di.dictionary_id
LEFT JOIN dictionary_item_translate dit ON di.id=dit.dictionary_item_id
WHERE d.`code`=#{Constant.DICTIONARY_TYPE_TITLE} AND dit.language_code=#{language}
</select>
<select id="getErrorMsg" resultType="java.lang.String">
SELECT IFNULL(dit.`value`,di.`name`) message
FROM dictionary_item di
LEFT JOIN dictionary_item_translate dit ON dit.dictionary_item_id=di.id AND dit.language_code=#{language}
WHERE di.`code`=#{errorCode}
</select>
<select id="getListByDictionaryCode" resultType="com.nflg.mobilebroken.common.pojo.vo.TicketEvaluateItemVO">
SELECT di.`code`,IFNULL(dit.`value`,di.`name`) AS 'desc'
FROM dictionary d
INNER JOIN dictionary_item di ON d.id=di.dictionary_id
LEFT JOIN dictionary_item_translate dit ON di.id=dit.dictionary_item_id AND dit.language_code=#{language}
WHERE d.`code`=#{dictionaryCode}
</select>
</mapper>