|
@@ -12,17 +12,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectTChapterTemplateVo">
|
|
|
- select id, code, name, dept_id, IF(INSTR(code, '.') > 0, SUBSTR(code, 1, INSTR(code, '.') - 1), code) as codeSubStr from t_chapter_template
|
|
|
+ select ct.id, ct.code, ct.name, ct.dept_id, IF(INSTR(ct.code, '.') > 0, SUBSTR(ct.code, 1, INSTR(ct.code, '.') - 1), ct.code) as codeSubStr from t_chapter_template ct
|
|
|
+ left join sys_dept d on d.dept_id = ct.dept_id
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectTChapterTemplateList" parameterType="TChapterTemplate" resultMap="TChapterTemplateResult">
|
|
|
<include refid="selectTChapterTemplateVo"/>
|
|
|
<where>
|
|
|
- <if test="code != null and code != ''"> and code = #{code}</if>
|
|
|
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
|
- <if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if>
|
|
|
+ <if test="code != null and code != ''"> and ct.code = #{code}</if>
|
|
|
+ <if test="name != null and name != ''"> and ct.name like concat('%', #{name}, '%')</if>
|
|
|
+ <if test="deptId != null and deptId != ''"> and ct.dept_id = #{deptId}</if>
|
|
|
+ ${params.dataScope}
|
|
|
</where>
|
|
|
- order by (IF(INSTR(code, '.') > 0, SUBSTR(code, 1, INSTR(code, '.') - 1), code) + 0) asc, code asc
|
|
|
+ order by (IF(INSTR(ct.code, '.') > 0, SUBSTR(ct.code, 1, INSTR(ct.code, '.') - 1), ct.code) + 0) asc, ct.code asc
|
|
|
</select>
|
|
|
|
|
|
<select id="selectNameByCode" parameterType="String" resultType="String">
|
|
@@ -31,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
<select id="selectTChapterTemplateById" parameterType="Long" resultMap="TChapterTemplateResult">
|
|
|
<include refid="selectTChapterTemplateVo"/>
|
|
|
- where id = #{id}
|
|
|
+ where ct.id = #{id}
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertTChapterTemplate" parameterType="TChapterTemplate" useGeneratedKeys="true" keyProperty="id">
|