<?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.example.server.major.dao.SysMajorDao">
|
|
|
<select id="page" resultType="com.example.server.major.model.SysMajor">
|
select
|
a.id,
|
a.product_id,
|
p.name AS modelName
|
from DJ_SYS_MAJOR a
|
left join view_zt_boat_tree p ON p.product_id=concat(a.product_id)
|
where a.is_delete = 0
|
GROUP BY modelName
|
order by p.sort, a.sort asc
|
<!-- select a.id,-->
|
<!-- a.product_id,-->
|
<!-- a.name,-->
|
<!-- a.short_name,-->
|
<!-- a.comment,-->
|
<!-- a.sort,-->
|
<!-- p.name AS modelName-->
|
<!-- from DJ_SYS_MAJOR a-->
|
<!-- left join view_zt_boat_tree p ON p.product_id=concat(a.product_id)-->
|
<!-- where a.is_delete = 0-->
|
<!-- order by p.sort, a.sort asc-->
|
</select>
|
<select id="selectMaxSort" resultType="java.lang.Integer">
|
select CASE WHEN max(sort) IS NULL THEN 0 ELSE max(sort) end AS aa
|
from DJ_SYS_MAJOR
|
where is_delete = 0
|
</select>
|
<select id="exitsSameMajorByProductId" resultType="java.lang.Integer">
|
SELECT count(1)
|
FROM DJ_SYS_MAJOR a
|
WHERE #{name} IN (
|
SELECT b.name
|
FROM DJ_SYS_MAJOR b
|
WHERE b.product_id = #{productId}
|
<if test=" id != null">
|
and b.id != #{id}
|
</if>
|
)
|
AND a.product_id = #{productId} and a.is_delete=0
|
</select>
|
<select id="getList" resultType="com.example.server.major.model.SysMajor">
|
select a.id,
|
a.product_id,
|
a.name,
|
a.comment,
|
a.sort
|
from dj_sys_major a
|
where a.is_delete = 0
|
<if test=" modelId != null and modelId != '' ">
|
and a.product_id = #{modelId}
|
</if>
|
<if test=" shipId != null and shipId != ''">
|
and a.product_id in (select CONNECT_ID from zt_boat_tree where INFO_ID = #{shipId})
|
</if>
|
<if test=" projectId != null and projectId != ''">
|
and a.product_id in (select CONNECT_ID from zt_boat_tree where INFO_ID in (select product_id from dj_wx_project where id=#{projectId})
|
or INFO_ID in (select product_id from dj_bz_project where id=#{projectId}))
|
</if>
|
order by a.product_id,a.sort asc
|
</select>
|
|
<select id="sysMajorChildren" resultType="com.example.server.major.model.SysMajor">
|
select a.id,
|
a.name,
|
a.short_name,
|
a.comment,
|
a.sort
|
from DJ_SYS_MAJOR a
|
where a.is_delete = 0
|
<if test="productId != null">
|
and a.product_id = #{productId}
|
</if>
|
order by a.sort asc
|
</select>
|
|
<select id="getIdByMajorName" resultType="java.lang.Long">
|
select
|
a.id
|
from DJ_SYS_MAJOR a
|
where a.is_delete = 0
|
and code is not null
|
and name = #{majorName}
|
limit 1
|
</select>
|
|
<select id="isMajorNameExistsSysh" resultType="java.lang.Integer">
|
SELECT count(1)
|
FROM DJ_SYS_MAJOR a
|
WHERE a.product_id=10000 and a.is_delete=0
|
AND a.name=#{name}
|
</select>
|
|
<select id="getMajorByNameSysh" resultType="com.example.server.major.model.SysMajor">
|
select a.*
|
from dj_sys_major a
|
where a.product_id=10000 and a.is_delete=0
|
AND a.name=#{name}
|
limit 1
|
</select>
|
|
<select id="getSyshMajorSelect" resultType="com.example.server.major.model.SysMajor">
|
select a.id,a.name
|
from dj_sys_major a
|
where a.product_id=10000 and a.is_delete=0
|
</select>
|
</mapper>
|