1.
<delete id="removeZtreeS" parameterType="String">
DELETE FROM sys_fun WHERE pids LIKE CONCAT('%',',',${value},',','%')
</delete>
2.从一张表中找到多条记录插入到另一张表中
<select id="getDataItem" parameterType="java.util.HashMap" resultMap="DataItemResult">
INSERT INTO data_item (itemid, sourceid, scount, stotalcount,
sdate, shour, sinterval, createdate)
SELECT itemid, sourceid, COUNT(1) AS scount, SUM(snum) AS stotalcount,
#{sdate}, #{shour} as shour, #{sinterval} as sinterval, UNIX_TIMESTAMP(NOW())*1000
FROM log_saledetail
WHERE <![CDATA[ddate >= #{startdate}]]> <![CDATA[AND ddate < #{enddate}]]>
GROUP BY itemid,sourceid
ORDER BY scount DESC
</select>
3.从另一张表中找到需要的字段赋值给当前表对应字段
<select id="getRoleList" parameterType="java.util.HashMap" resultMap="roleResult">
SELECT a.rid, a.sname, b.username as username, LEFT(FROM_UNIXTIME(a.createdate/1000),10) createdate, a.remarks, a.delflag
FROM sys_role a
LEFT JOIN info_user b on b.userid = a.createby
WHERE 1 = 1
<if test="sname != null">
AND sname LIKE CONCAT('%','${sname}','%')
</if>
</select>
4.
<![CDATA[ 转义的内容 ]]>
5.
<insert id="addCheckedNodes" parameterType="java.util.HashMap" useGeneratedKeys="true" keyProperty="seq">
INSERT INTO inter_fun_role (rid, fid)
VALUES (#{rid}, (SELECT fid as fid FROM sys_fun WHERE id = #{id}) )
</insert>