xml里直接返回所属文件列表

@PostMapping("/detail")
    public AjaxResult  detail(Long id,HttpServletRequest request) {
        String url = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
        SgChildcare sgConvenientService = sgChildcareService.selectSgChildcareApiById(id,url);
        return AjaxResult.success(sgConvenientService);
    }
 @Override
    public SgChildcare selectSgChildcareApiById(Long id, String url)
    {
        return sgChildcareMapper.selectSgChildcareApiById(id,url,"sg_childcare");
    }
public SgChildcare selectSgChildcareApiById(@Param("id") Long id,@Param("url") String url, @Param("tablename") String tablename);
<resultMap type="SgChildcare" id="SgChildcareApiResult">
        <result property="id"    column="id"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="name"    column="name"    />
        <result property="childcareTime"    column="childcare_time"    />
        <result property="address"    column="address"    />
        <result property="phone" column="phone"/>
        <result property="des"    column="des"    />
        <result property="sort"    column="sort"    />
        <collection property="attachmentIdList"  select="getAttachemntUrl"  column="{id=id,url=url,tablename=tablename}" ofType="string" javaType="list" >
            <result column="attachment_url"/>
        </collection>
    </resultMap>
    <select id="getAttachemntUrl" resultType="string">
        SELECT concat(#{url},attachment_url) attachment_url
            FROM sys_attachment
            where attachment_category = #{tablename}
            and business_id = #{id}
            and is_delete_opt = 0
    </select>
    <select id="selectSgChildcareApiList" resultMap="SgChildcareApiResult">
        select a.id, a.create_time, a.create_by, a.update_time, a.update_by, a.del_flag, a.name, a.childcare_time, a.address, a.des, a.sort,a.phone,#{url} url,#{tablename} tablename from sg_childcare a
        <if test="deptId != null and deptId != ''">
            LEFT JOIN SYS_USER su on a.CREATE_BY = su.USER_ID inner JOIN (
            select
            DEPT_ID
            from
            SYS_DEPT where DEPT_ID in (100,#{deptId})
            ) c on c.DEPT_ID = su.DEPT_ID
        </if>
        <where>
            <if test="sgChildcare.name != null  and sgChildcare.name != ''"> and a.name like concat('%', #{sgChildcare.name}, '%')</if>
            and a.del_flag = '0'
        </where>
        order by a.sort=0, a.sort asc, a.create_time desc
    </select>

    <select id="selectSgChildcareApiById" resultMap="SgChildcareApiResult">
        select id, create_time, create_by, update_time, update_by, del_flag, name, childcare_time, address, des, sort,#{url} url,#{tablename} tablename,phone from sg_childcare
        where id = #{id}
        and del_flag = '0'
    </select>

domin实体类添加冗余数组

private List<String> attachmentIdList;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值