Files
ks/ruoyi-bussiness/src/main/resources/mapper/app/CompanyCollectionMapper.xml

39 lines
1.8 KiB
XML

<?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.ruoyi.cms.mapper.CompanyCollectionMapper">
<resultMap type="CompanyCollection" id="CompanyCollectionResult">
<result property="id" column="id" />
<result property="companyId" column="company_id" />
<result property="userId" column="user_id" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectCompanyCollectionVo">
select id, company_id, user_id, del_flag, create_by, create_time, update_by, update_time, remark from company_collection
</sql>
<select id="selectCompanyCollectionList" parameterType="CompanyCollection" resultMap="CompanyCollectionResult">
<include refid="selectCompanyCollectionVo"/>
<where> del_flag = '0'
<if test="companyId != null "> and company_id = #{companyId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
</where>
</select>
<select id="collectionJob" resultType="com.ruoyi.common.core.domain.entity.Company">
select *
from company
where del_flag = '0'
and company_id in (SELECT DISTINCT (company_id)
FROM company_collection
where del_flag = '0' and user_id = #{userId}
order by create_time desc)
</select>
</mapper>