前后端分离之后端service及mapper

<?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.lpz.zonghezsgc.mapper.CustomMapper">

<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lpz.zonghezsgc.entity.Custom">
<id column="cid" property="cid" />
<result column="cname" property="cname" />
<result column="csex" property="csex" />
<result column="birthday" property="birthday" />
<result column="pic" property="pic" />
<result column="bname" property="bname" />
<result column="bids" property="bids" />
</resultMap>

<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
cid, cname, csex, birthday, pic
</sql>

<select id="selectCustom" resultMap="BaseResultMap">
select custom.*,GROUP_CONCAT(bank.bname) bname,GROUP_CONCAT(bank.bid) bids from custom
LEFT JOIN cb on custom.cid = cb.cid
LEFT JOIN bank on bank.bid = cb.bid
<where>
<if test="custom.cname!=null and custom.cname!=''">
and custom.cname like concat('%',#{custom.cname},'%')
</if>
<if test="custom.bir1!=null">
and custom.birthday &gt;= #{custom.bir1}
</if>
<if test="custom.bir2!=null">
and custom.birthday &lt;= #{custom.bir2}
</if>
</where>
GROUP BY custom.cid
</select>

 

</mapper>

posted @ 2020-06-09 20:46  瓜叽叽  阅读(69)  评论(0)    收藏  举报