<resultMap id="articleAndUserAndTypeAndDeptMap" type="cn.hcnet2006.blog.hcnetwebsite.bean.SysArticle" extends="BaseResultMap">
<collection property="userList"
fetchType="lazy"
column="{articleId=id}"
select="cn.hcnet2006.blog.hcnetwebsite.mapper.SysUserMapper.selectByArticleId"/>
<collection property="typeList"
fetchType="lazy"
column="{typeId=id}"
select="cn.hcnet2006.blog.hcnetwebsite.mapper.SysTypeMapper.selectTypeByArticleId"
/>
<collection property="deptList"
column="id"
fetchType="lazy"
select="cn.hcnet2006.blog.hcnetwebsite.mapper.SysDeptMapper.selectDeptByArticleId"/>
</resultMap>
<select id="selectAll" parameterType="cn.hcnet2006.blog.hcnetwebsite.bean.SysArticle" resultMap="BaseResultMap">
select sa.id, sa.article_name, sa.article_img_url, sa.article_intro_url, sa.article_content_url, sa.create_by, sa.create_time, sa.last_update_by, sa.last_update_time, sa.del_flag
from sys_article sa
<if test=" deptId != null and deptId != ''">
inner join sys_dept_article sda
on sda.dept_id = #{deptId} and sa.id = sda.article_id
</if>
<if test=" typeId != null and typeId != ''">
inner join sys_type_article sta
on sta.type_id = #{typeId} and sa.id = sta.article_id
</if>
<if test="userId != null and userId != ''">
inner join sys_user_article sua
on sua.user_id = #{userId} and sua.article_id = sa.id
</if>
where 1 = 1
<if test="id != null and id != ''">
and sa.id = #{id}
</if>
<if test="articleName != null and articleName != ''">
and sa.article_name LIKE CONCAT('%',#{articleName},'%')
</if>
<if test="delFlag != null">
and sa.del_flag = #{delFlag}
</if>
</select>
{
"code": 200,
"msg": null,
"data": {
"id": 34,
"articleName": "n",
"articleImgUrl": "21",
"articleIntroUrl": "21",
"articleContentUrl": "112",
"createBy": "liubei",
"createTime": "2020-03-15T11:36:23.730+0000",
"lastUpdateBy": "liubei",
"lastUpdateTime": "2020-03-15T11:36:23.730+0000",
"delFlag": 0,
"deptId": null,
"userId": null,
"typeId": null,
"deptList": [
{
"id": 1,
"name": "12",
"deptLogo": "http://hcnet2006-file-apk.oss-cn-shenzhen.aliyuncs.com/12.jpg",
"parentId": 2,
"createBy": "1",
"createTime": "2020-03-03",
"lastUpdateTime": "2020-03-06",
"lastUpdateBy": "1",
"delFlag": -1,
"userList": null
}
],
"typeList": [],
"userList": [
{
"id": 1,
"name": "1223456",
"password": "23456",
"avator": "http://hcnet2006-file-apk.oss-cn-shenzhen.aliyuncs.com/27505428-25dc-4244-92b3-8f7cd6f7855d.jpg",
"grade": "2121",
"email": "212",
"mobile": "123456",
"deptId": 1,
"deptZh": null,
"createBy": "1",
"createTime": "2020-03-02",
"lastUpdateTime": "2020-03-06",
"lastUpdateBy": "ldyff",
"delFlag": -1,
"roleList": null
},
{
"id": 2,
"name": "21",
"password": "2",
"avator": "http://hcnet2006-file-apk.oss-cn-shenzhen.aliyuncs.com/21.jpg",
"grade": "1",
"email": "1",
"mobile": "1",
"deptId": 1,
"deptZh": null,
"createBy": "1",
"createTime": "2020-03-02",
"lastUpdateTime": "2020-03-02",
"lastUpdateBy": "1",
"delFlag": 0,
"roleList": null
}
]
}
}