118 lines
6.0 KiB
XML
118 lines
6.0 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.yanzhu.manage.mapper.GreenCarbonItemMapper">
|
|
|
|
<resultMap type="GreenCarbonItem" id="GreenCarbonItemResult">
|
|
<result property="id" column="id" />
|
|
<result property="comId" column="com_id" />
|
|
<result property="projectId" column="project_id" />
|
|
<result property="carbonFactorType" column="carbon_factor_type" />
|
|
<result property="carbonName" column="carbon_name" />
|
|
<result property="unit" column="unit" />
|
|
<result property="carbonFactor" column="carbon_factor" />
|
|
<result property="state" column="state" />
|
|
<result property="remark" column="remark" />
|
|
<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" />
|
|
<result property="compName" column="comp_name"/>
|
|
<result property="projectName" column="project_name"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectGreenCarbonItemVo">
|
|
select g.id, g.com_id, g.project_id, g.carbon_factor_type, g.carbon_name, g.unit,
|
|
g.carbon_factor, g.state, g.remark, g.is_del, g.create_by, g.create_time, g.update_by, g.update_time,
|
|
dp.`dept_name` comp_name,pi.`project_name`
|
|
from green_carbon_item g
|
|
LEFT JOIN sys_dept dp ON g.`com_id`=dp.`dept_id`
|
|
LEFT JOIN pro_project_info pi ON g.`project_id`=pi.`id`
|
|
</sql>
|
|
|
|
<select id="selectGreenCarbonItemList" parameterType="GreenCarbonItem" resultMap="GreenCarbonItemResult">
|
|
<include refid="selectGreenCarbonItemVo"/>
|
|
<where>
|
|
<if test="comId != null "> and g.com_id = #{comId}</if>
|
|
<if test="projectId != null "> and g.project_id = #{projectId}</if>
|
|
<if test="carbonFactorType != null "> and g.carbon_factor_type = #{carbonFactorType}</if>
|
|
<if test="carbonName != null and carbonName != ''"> and g.carbon_name like concat('%', #{carbonName}, '%')</if>
|
|
<if test="unit != null and unit != ''"> and g.unit = #{unit}</if>
|
|
<if test="carbonFactor != null "> and g.carbon_factor = #{carbonFactor}</if>
|
|
<if test="state != null "> and g.state = #{state}</if>
|
|
<if test="isDel != null "> and g.is_del = #{isDel}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectGreenCarbonItemById" parameterType="Long" resultMap="GreenCarbonItemResult">
|
|
<include refid="selectGreenCarbonItemVo"/>
|
|
where g.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertGreenCarbonItem" parameterType="GreenCarbonItem">
|
|
insert into green_carbon_item
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="comId != null">com_id,</if>
|
|
<if test="projectId != null">project_id,</if>
|
|
<if test="carbonFactorType != null">carbon_factor_type,</if>
|
|
<if test="carbonName != null">carbon_name,</if>
|
|
<if test="unit != null">unit,</if>
|
|
<if test="carbonFactor != null">carbon_factor,</if>
|
|
<if test="state != null">state,</if>
|
|
<if test="remark != null">remark,</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="comId != null">#{comId},</if>
|
|
<if test="projectId != null">#{projectId},</if>
|
|
<if test="carbonFactorType != null">#{carbonFactorType},</if>
|
|
<if test="carbonName != null">#{carbonName},</if>
|
|
<if test="unit != null">#{unit},</if>
|
|
<if test="carbonFactor != null">#{carbonFactor},</if>
|
|
<if test="state != null">#{state},</if>
|
|
<if test="remark != null">#{remark},</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="updateGreenCarbonItem" parameterType="GreenCarbonItem">
|
|
update green_carbon_item
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="comId != null">com_id = #{comId},</if>
|
|
<if test="projectId != null">project_id = #{projectId},</if>
|
|
<if test="carbonFactorType != null">carbon_factor_type = #{carbonFactorType},</if>
|
|
<if test="carbonName != null">carbon_name = #{carbonName},</if>
|
|
<if test="unit != null">unit = #{unit},</if>
|
|
<if test="carbonFactor != null">carbon_factor = #{carbonFactor},</if>
|
|
<if test="state != null">state = #{state},</if>
|
|
<if test="remark != null">remark = #{remark},</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="deleteGreenCarbonItemById" parameterType="Long">
|
|
delete from green_carbon_item where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteGreenCarbonItemByIds" parameterType="String">
|
|
delete from green_carbon_item where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |