cus:
<select id="selectCustomerReport" resultType="java.util.HashMap">
select ${groupType} groupType,count(c.id) number from customer c
left join employee e on c.seller_id = e.id
<where>
c.status = 0
<if test="keyword!=null">
and e.name like concat('%',#{keyword},'%')
</if>
<if test="beginDate!=null">
and c.input_time >= #{beginDate}
</if>
<if test="endDate!=null">
and c.input_time <= #{endDate}
</if>
</where>
GROUP BY ${groupType}
</select>
employee:
<select id="selectByName" resultType="cn.wolfcode.domain.Employee">
select * from employee where name = #{name}
</select>
permission:
<select id="list" resultType="cn.wolfcode.domain.Permission">
select * from permission
</select>
<select id="selectExpressionByCurrentUserId" resultType="java.lang.String">
select p.expression
from employee_role er
left JOIN role_permission rp
ON er.role_id = rp.role_id
LEFT JOIN permission p
ON rp.permission_id = p.id
WHERE er.employee_id = #{id}
</select>
<select id="selectAllExpression" resultType="java.lang.String">
select expression from permission
</select>
role:
<select id="selectByEmployeeId" resultType="cn.wolfcode.domain.Role">
select r.*
FROM employee_role e
LEFT JOIN role r
ON e.role_id = r.id
WHERE e.employee_id = #{id}
</select>