CustomerReport.xml
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.intput_time <=#{endDate}
</if>
</where>
group by ${groupType}
EmployeeMapper
<select id="selectByName" resultMap="BaseResultMap">
select * from employee where name = #{name}
</select>
PermissionMapper
<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>
RoleMapper
<select id="selectByEmployeeId" resultType="cn.wolfcode.domain.Role">
select r.*
from employee_role er
left join role r
on er.employee_id = r.id
where er.employee_id = #{id}
</select>
Read More:
- Solve the problem caused by: java.sql.SQLRecoverableException : IO error: connection reset related problems
- Implementation of Python switch / case statements
- Continue Long Statements on Multiple Lines Matlab
- Mapped Statements collection does not contain value for XXXX
- Related configuration of mybatis project
- Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the
- RPC principle and related technologies used
- SAP SQL error “SQL code: -10692“ occurred while accessing table “ZTXXXX“.
- Spring data JAP SQL error:17059 SQL State:99999
- R language error messages and related solutions
- [solution] install L2TP and related settings in Ubuntu 18.04
- Eclipse package explorer related problems and Solutions
- POI related problem help report error recordformatexception
- Dataframe to numpy.ndarray Related issues of
- About writing [if] and [else] statements in JSP, Syntax error on token “else”, delete this token
- Oracle 12C installation process related errors and Solutions
- Analysis of [error code [942], ora-00942 in synchronization of DDL statements in ogg
- GPU hardware acceleration related problems, solve flash screen
- This function has none of deterministic, no SQL, or reads SQL data in its error records
- DB2 SQL ERROR: SQLCODE=-803, SQLSTATE=23505, SQL