jhprjv2/yanzhu-jh/src/main/resources/mapper/project/SurProjectStandardMapper.xml

146 lines
7.3 KiB
XML
Raw Normal View History

2023-09-20 23:37:11 +08:00
<?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.yanzhu.jh.project.mapper.SurProjectStandardMapper">
<resultMap type="SurProjectStandard" id="SurProjectStandardResult">
<result property="id" column="id" />
<result property="projectId" column="project_id" />
<result property="deptId" column="dept_id" />
<result property="imageFile" column="image_file" />
<result property="standardDesc" column="standard_desc" />
<result property="ord" column="ord" />
<result property="standardType" column="standard_type" />
<result property="isDel" column="is_del" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSurProjectStandardVo">
select id, project_id, dept_id, image_file, standard_desc, ord, standard_type, is_del, create_by, create_time, update_by, update_time from sur_project_standard
</sql>
<select id="selectSurProjectStandardList" parameterType="SurProjectStandard" resultMap="SurProjectStandardResult">
<include refid="selectSurProjectStandardVo"/>
<where>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="imageFile != null and imageFile != ''"> and image_file = #{imageFile}</if>
<if test="standardDesc != null and standardDesc != ''"> and standard_desc = #{standardDesc}</if>
<if test="ord != null "> and ord = #{ord}</if>
<if test="standardType != null and standardType != ''"> and standard_type = #{standardType}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
</where>
order by standard_type,ord
</select>
<select id="selectSurProjectStandardById" parameterType="Long" resultMap="SurProjectStandardResult">
<include refid="selectSurProjectStandardVo"/>
where id = #{id}
</select>
<insert id="insertSurProjectStandard" parameterType="SurProjectStandard" useGeneratedKeys="true" keyProperty="id">
insert into sur_project_standard
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="projectId != null">project_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="imageFile != null">image_file,</if>
<if test="standardDesc != null">standard_desc,</if>
<if test="ord != null">ord,</if>
<if test="standardType != null">standard_type,</if>
<if test="isDel != null">is_del,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectId != null">#{projectId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="imageFile != null">#{imageFile},</if>
<if test="standardDesc != null">#{standardDesc},</if>
<if test="ord != null">#{ord},</if>
<if test="standardType != null">#{standardType},</if>
<if test="isDel != null">#{isDel},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateSurProjectStandard" parameterType="SurProjectStandard">
update sur_project_standard
<trim prefix="SET" suffixOverrides=",">
<if test="projectId != null">project_id = #{projectId},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="imageFile != null">image_file = #{imageFile},</if>
<if test="standardDesc != null">standard_desc = #{standardDesc},</if>
<if test="ord != null">ord = #{ord},</if>
<if test="standardType != null">standard_type = #{standardType},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSurProjectStandardById" parameterType="Long">
delete from sur_project_standard where id = #{id}
</delete>
<delete id="deleteSurProjectStandardByIds" parameterType="String">
delete from sur_project_standard where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
2023-10-22 23:45:32 +08:00
<select id="groupByType" parameterType="SurProjectStandard" resultMap="com.ruoyi.system.mapper.SysDictDataMapper.SysDictDataResult">
select b.dict_value,b.dict_label,a.cnt STATUS from (select * from sys_dict_data where dict_type='prj_standard_type') b left join (
select a.standard_type,count(1) cnt
from sur_project_standard a
where a.is_del =0
<if test="projectId!=null and projectId>0"> and a.project_id=#{projectId}</if>
<if test="deptId!=null and deptId>0">
and a.project_id in (SELECT id FROM sur_project WHERE deptid= #{deptId})
</if>
<if test="prjIds !=null and prjIds.size()>0">
and a.project_id in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
group by a.standard_type ) a on b.dict_value=a.standard_type
order by b.dict_value
</select>
<select id="groupByProject" resultMap="SurProjectStandardResult">
select a.project_id,a.cnt dept_id,b.projectName standard_desc from (
select a.project_id,count(1) cnt
from sur_project_standard a where a.is_del=0
group by a.project_id )a,
sur_project b where a.project_id=b.id
order by a.cnt desc
</select>
2023-11-06 00:02:19 +08:00
<select id="selectList" parameterType="SurProjectStandard" resultMap="SurProjectStandardResult">
<include refid="selectSurProjectStandardVo"/>
where is_del =0
<if test="projectId!=null and projectId>0"> and project_id=#{projectId}</if>
<if test="deptId!=null and deptId>0">
and project_id in (SELECT id FROM sur_project WHERE deptid= #{deptId})
</if>
<if test="prjIds !=null and prjIds.size()>0">
and project_id in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="standardType!=null and standardType>0"> and standard_type=#{standardType}</if>
</select>
2023-09-20 23:37:11 +08:00
</mapper>