|
|
|
|
<?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="cn.iocoder.yudao.module.product.dal.mysql.landjob.LandJobMapper">
|
|
|
|
|
|
|
|
|
|
<!--
|
|
|
|
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
|
|
|
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
|
|
|
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
|
|
|
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
|
|
|
|
-->
|
|
|
|
|
|
|
|
|
|
<select id="selectJobTypeById"
|
|
|
|
|
resultType="cn.iocoder.yudao.module.product.dal.dataobject.landjob.LandJobDO">
|
|
|
|
|
SELECT a.*,b.type_name job_type_name
|
|
|
|
|
FROM product_land_job a
|
|
|
|
|
LEFT JOIN product_land_job_type b on job_type = b.id
|
|
|
|
|
WHERE a.deleted = 0
|
|
|
|
|
<if test="landName != null and landName != ''"> and a.land_name LIKE CONCAT('%', #{landName}, '%') </if>
|
|
|
|
|
<if test="landId != null and landId != ''"> and a.land_id = #{landId} </if>
|
|
|
|
|
<if test="jobType != null and jobType != ''"> and b.id = #{jobType} </if>
|
|
|
|
|
<if test="belongBusinessName != null and belongBusinessName != ''"> and a.belong_business_name = #{belongBusinessName} </if>
|
|
|
|
|
ORDER BY a.id DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 根据id查询, 这里不管是否删除 -->
|
|
|
|
|
<select id="getLandJob" resultType="cn.iocoder.yudao.module.product.dal.dataobject.landjob.LandJobDO">
|
|
|
|
|
select * from product_land_job
|
|
|
|
|
<where>
|
|
|
|
|
<if test="id != null">id = #{id}</if>
|
|
|
|
|
<if test="landJobId != null">land_job_id = #{landJobId}</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<resultMap id="querySameTypeJobMaps" type="cn.iocoder.yudao.module.product.controller.admin.landjob.vo.LandJobRespVO">
|
|
|
|
|
<collection property="landJobInputs" column="land_job_id=land_job_id" select="queryJobInputs"></collection>
|
|
|
|
|
</resultMap>
|
|
|
|
|
<select id="getSameTypeJobByType" resultMap="querySameTypeJobMaps">
|
|
|
|
|
select plj.*, pljt.type_name jobTypeName
|
|
|
|
|
from
|
|
|
|
|
product_land_job plj
|
|
|
|
|
left join product_land_job_type pljt on plj.job_type = pljt.id
|
|
|
|
|
where plj.deleted = 0
|
|
|
|
|
AND plj.job_type = #{type}
|
|
|
|
|
AND plj.land_id = #{landId}
|
|
|
|
|
AND plj.job_date >= NOW() - INTERVAL #{day} DAY
|
|
|
|
|
order by plj.job_date desc
|
|
|
|
|
</select>
|
|
|
|
|
<select id="queryJobInputs" resultType="cn.iocoder.yudao.module.product.controller.admin.landjobinputs.vo.LandJobInputsRespVO">
|
|
|
|
|
select * from
|
|
|
|
|
product_land_job_inputs
|
|
|
|
|
where deleted = 0 and land_job_id = #{land_job_id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectLandJob10Records"
|
|
|
|
|
resultType="cn.iocoder.yudao.module.product.dal.dataobject.landjob.LandJobDO">
|
|
|
|
|
SELECT a.*,b.type_name job_type_name
|
|
|
|
|
FROM product_land_job a
|
|
|
|
|
LEFT JOIN product_land_job_type b on job_type = b.id
|
|
|
|
|
ORDER BY id DESC
|
|
|
|
|
LIMIT 10;
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
</mapper>
|