mybatis 一对多查询方式二:

<resultMap type="com.demo.company.domain.Company" id="CompanyResult">
        <result property="comId" column="com_id"/>
        <result property="comName" column="com_name"/>
        <result property="createTime" column="create_time"/>
        <result property="comArea" column="com_area"/>
        <collection property="tagList" column="com_uscc"  ofType="com.demo.company.company.domain.CompanyTag" select="getPrincipalById"/>
    </resultMap>

3

<resultMap type="com.demo.business.company.domain.CompanyTag" id="CompanyTagResult">
    <result property="id" column="id"/>
    <result property="comId" column="scom_id"/>
    <result property="firsttagId" column="firsttag_id"/>
    <result property="tagId" column="tag_id"/>
    <result property="tagName" column="tag_name"/>
    <result property="tagStr" column="tagid_list"/>

</resultMap>

<select id="queryAndTagList" resultMap="CompanyResult">

     select c.* from company c
    ${ew.getCustomSqlSegment}
</select>

3

<select id="getPrincipalById"  resultMap="CompanyTagResult">
        select t.tag_id, label.label_name tag_name,label.parent_id firsttag_id
        from  company_tag t
        left join label_manage label on  t.tag_id=label.label_id
        where t.uscc = #{com_uscc}

</select>

单表本表更新

update dr_goods g set g.shop_numbering=sys_user.user_name from sys_user where g.shopid=sys_user.user_id

方法一:
update 表A set 表A.编号=表B.编号 from 表B where 表A.id=表B.id

方法二:
update 表A set 表A.编号=表B.编号 from 表A,表B where 表A.id=表B.

标签: none

相关阅读

  • 测试信息
  • 开发商:阿里巴巴
  • 版本号:1.0
  • 配色:(企业家)” 推选活动结果
  • 测试信息
  • 测试信息
  • 测试信息