|
|
<?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.gaotao.modules.toolman.dao.ToolHeaderMapper"> <resultMap id="BaseResultMap" type="com.gaotao.modules.toolman.entity.ToolHeader"> <!--@mbg.generated--> <!--@Table ToolHeader--> <id column="ToolID" jdbcType="VARCHAR" property="toolId" /> <id column="Site" jdbcType="VARCHAR" property="site" /> <result column="ToolDescription" jdbcType="VARCHAR" property="toolDescription" /> <result column="Spec" jdbcType="VARCHAR" property="spec" /> <result column="FamilyID" jdbcType="VARCHAR" property="familyId" /> <result column="Active" jdbcType="CHAR" property="active" /> <result column="Remark" jdbcType="VARCHAR" property="remark" /> <result column="StandardCost" jdbcType="FLOAT" property="standardCost" /> <result column="CodeNo" jdbcType="VARCHAR" property="codeNo" /> <result column="CreateDate" jdbcType="TIMESTAMP" property="createDate" /> <result column="CreatedBy" jdbcType="VARCHAR" property="createdBy" /> <result column="UMID" jdbcType="VARCHAR" property="umid" /> <result column="DefaultWarehouseID" jdbcType="VARCHAR" property="defaultWarehouseId" /> <result column="LastUpdateBy" jdbcType="VARCHAR" property="lastUpdateBy" /> <result column="DefaultLocationID" jdbcType="VARCHAR" property="defaultLocationId" /> <result column="PartCreatedFlag" jdbcType="CHAR" property="partCreatedFlag" /> <result column="PartNo" jdbcType="VARCHAR" property="partNo" /> <result column="FamilyName" jdbcType="VARCHAR" property="familyName" /> <result column="strActive" jdbcType="VARCHAR" property="strActive" /> <result column="strPartCreated" jdbcType="VARCHAR" property="strPartCreated" /> </resultMap> <sql id="Base_Column_List"> <!--@mbg.generated--> ToolID, Site, ToolDescription, Spec, FamilyID, Active, Remark, StandardCost, CodeNo, CreateDate, CreatedBy, UMID, DefaultWarehouseID, LastUpdateBy, DefaultLocationID, PartCreatedFlag, PartNo </sql> <select id="getToolHeaderCount" resultType="Integer"> <!--@mbg.generated--> select isnull(count(ToolID) ,0) from ToolHeader <where> <if test="site != null"> and Site=#{site,jdbcType=VARCHAR} </if> <if test="toolId != null and toolId != ''"> and ToolID = #{toolId,jdbcType=VARCHAR} </if> </where> </select> <select id="getToolHeaderList" resultMap="BaseResultMap"> <!--@mbg.generated--> select <include refid="Base_Column_List"/> from ToolHeader <where> <if test="site != null"> and Site=#{site,jdbcType=VARCHAR} </if> <if test="toolId != null and toolId != ''"> and ToolID like '%' + #{toolId,jdbcType=VARCHAR} + '%' </if> <if test="toolDescription != null and toolDescription != ''"> and ToolDescription like '%' + #{toolDescription,jdbcType=VARCHAR} + '%' </if> </where> </select> <delete id="deleteBySiteAndToolid"> <!--@mbg.generated--> delete from ToolHeader <where> <if test="site != null"> and Site=#{site,jdbcType=VARCHAR} </if> <if test="toolId != null and toolId != ''"> and ToolID=#{toolId,jdbcType=VARCHAR} </if> </where> </delete> <insert id="insertList"> <!--@mbg.generated--> INSERT INTO ToolHeader( ToolID, Site, ToolDescription, Spec, FamilyID, Active, Remark, StandardCost, CodeNo, CreateDate, CreatedBy, UMID, DefaultWarehouseID, LastUpdateBy, DefaultLocationID, PartCreatedFlag, PartNo )VALUES <foreach collection="list" item="element" index="index" separator=","> ( #{element.toolId,jdbcType=VARCHAR}, #{element.site,jdbcType=VARCHAR}, #{element.toolDescription,jdbcType=VARCHAR}, #{element.spec,jdbcType=VARCHAR}, #{element.familyId,jdbcType=VARCHAR}, #{element.active,jdbcType=CHAR}, #{element.remark,jdbcType=VARCHAR}, #{element.standardCost,jdbcType=DOUBLE}, #{element.codeNo,jdbcType=VARCHAR}, #{element.createDate,jdbcType=TIMESTAMP}, #{element.createdBy,jdbcType=VARCHAR}, #{element.umid,jdbcType=VARCHAR}, #{element.defaultWarehouseId,jdbcType=VARCHAR}, #{element.lastUpdateBy,jdbcType=VARCHAR}, #{element.defaultLocationId,jdbcType=VARCHAR}, #{element.partCreatedFlag,jdbcType=VARCHAR}, #{element.partNo,jdbcType=VARCHAR} ) </foreach> </insert> <insert id="insertSelective"> <!--@mbg.generated--> INSERT INTO ToolHeader <trim prefix="(" suffix=")" suffixOverrides=","> <if test="toolId != null and toolId != ''">ToolID,</if> <if test="site != null and site != ''">Site,</if> <if test="toolDescription != null and toolDescription != ''">ToolDescription,</if> <if test="spec != null and spec != ''">Spec,</if> <if test="familyId != null and familyId != ''">FamilyID,</if> <if test="active != null and active != ''">Active,</if> <if test="remark != null and remark != ''">Remark,</if> <if test="standardCost != null">StandardCost,</if> <if test="codeNo != null and codeNo != ''">CodeNo,</if> <if test="createDate != null">CreateDate,</if> <if test="createdBy != null and createdBy != ''">CreatedBy,</if> <if test="umid != null and umid != ''">UMID,</if> <if test="defaultWarehouseId != null and defaultWarehouseId != ''">DefaultWarehouseID,</if> <if test="lastUpdateBy != null and lastUpdateBy != ''">LastUpdateBy,</if> <if test="defaultLocationId != null and defaultLocationId != ''">DefaultLocationID,</if> <if test="partCreatedFlag != null and partCreatedFlag != ''">PartCreatedFlag,</if> <if test="partNo != null and partNo != ''">PartNo</if> </trim> VALUES <trim prefix="(" suffix=")" suffixOverrides=","> <if test="toolId != null and toolId != ''">#{toolId,jdbcType=VARCHAR},</if> <if test="site != null and site != ''">#{site,jdbcType=VARCHAR},</if> <if test="toolDescription != null and toolDescription != ''">#{toolDescription,jdbcType=VARCHAR},</if> <if test="spec != null and spec != ''">#{spec,jdbcType=VARCHAR},</if> <if test="familyId != null and familyId != ''">#{familyId,jdbcType=VARCHAR},</if> <if test="active != null and active != ''">#{active,jdbcType=CHAR},</if> <if test="remark != null and remark != ''">#{remark,jdbcType=VARCHAR},</if> <if test="standardCost != null">#{standardCost,jdbcType=DOUBLE},</if> <if test="codeNo != null and codeNo != ''">#{codeNo,jdbcType=VARCHAR},</if> <if test="createDate != null">#{createDate,jdbcType=TIMESTAMP},</if> <if test="createdBy != null and createdBy != ''">#{createdBy,jdbcType=VARCHAR},</if> <if test="umid != null and umid != ''">#{umid,jdbcType=VARCHAR},</if> <if test="defaultWarehouseId != null and defaultWarehouseId != ''">#{defaultWarehouseId,jdbcType=VARCHAR},</if> <if test="lastUpdateBy != null and lastUpdateBy != ''">#{lastUpdateBy,jdbcType=VARCHAR},</if> <if test="defaultLocationId != null and defaultLocationId != ''">#{defaultLocationId,jdbcType=VARCHAR},</if> <if test="partCreatedFlag != null and partCreatedFlag != ''">#{partCreatedFlag,jdbcType=VARCHAR},</if> <if test="partNo != null and partNo != ''">#{partNo,jdbcType=VARCHAR}</if> </trim> </insert> <update id="updateBySiteAndToolid"> <!--@mbg.generated--> update ToolHeader <set> <if test="toolId != null and toolId != ''"> ToolID = #{toolId,jdbcType=VARCHAR}, </if> <if test="site != null and site != ''"> Site = #{site,jdbcType=VARCHAR}, </if> <if test="toolDescription != null and toolDescription != ''"> ToolDescription = #{toolDescription,jdbcType=VARCHAR}, </if> <if test="spec != null and spec != ''"> Spec = #{spec,jdbcType=VARCHAR}, </if> <if test="familyId != null and familyId != ''"> FamilyID = #{familyId,jdbcType=VARCHAR}, </if> <if test="active != null and active != ''"> Active = #{active,jdbcType=CHAR}, </if> <if test="remark != null and remark != ''"> Remark = #{remark,jdbcType=VARCHAR}, </if> <if test="standardCost != null"> StandardCost = #{standardCost,jdbcType=DOUBLE}, </if> <if test="codeNo != null and codeNo != ''"> CodeNo = #{codeNo,jdbcType=VARCHAR}, </if> <if test="createDate != null"> CreateDate = #{createDate,jdbcType=TIMESTAMP}, </if> <if test="createdBy != null and createdBy != ''"> CreatedBy = #{createdBy,jdbcType=VARCHAR}, </if> <if test="umid != null and umid != ''"> UMID = #{umid,jdbcType=VARCHAR}, </if> <if test="defaultWarehouseId != null and defaultWarehouseId != ''"> DefaultWarehouseID = #{defaultWarehouseId,jdbcType=VARCHAR}, </if> <if test="lastUpdateBy != null and lastUpdateBy != ''"> LastUpdateBy = #{lastUpdateBy,jdbcType=VARCHAR}, </if> <if test="defaultLocationId != null and defaultLocationId != ''"> DefaultLocationID = #{defaultLocationId,jdbcType=VARCHAR}, </if> <if test="partCreatedFlag != null and partCreatedFlag != ''"> PartCreatedFlag = #{partCreatedFlag,jdbcType=VARCHAR}, </if> <if test="partNo != null and partNo != ''"> PartNo = #{partNo,jdbcType=VARCHAR}, </if> </set> <where> <if test="site != null"> and Site=#{site,jdbcType=VARCHAR} </if> <if test="toolId != null and toolId != ''"> and ToolID=#{toolId,jdbcType=VARCHAR} </if> </where> </update> <select id="getToolHeaderData" resultMap="BaseResultMap"> select top 1 A.ToolID,A.Site,A.ToolDescription,A.Spec,A.FamilyID,A.Active,A.Remark,A.StandardCost,A.CodeNo ,A.CreateDate,A.CreatedBy,A.UMID,A.DefaultWarehouseID,A.LastUpdateBy,A.DefaultLocationID,A.PartCreatedFlag ,A.PartNo ,convert(varchar(100) ,A.CreateDate ,23) as strCreateDate ,(case A.Active when 'Y' then '是' else '否' end) as strActive ,(case A.PartCreatedFlag when 'Y' then '是' else '否' end) as strPartCreated ,B.FamilyName from ToolHeader A left join PartFamily B on A.site = B.site and A.FamilyID = B.FamilyID <where> <if test="site != null and site != ''"> and A.Site = #{site,jdbcType=VARCHAR} </if> <if test="toolId != null and toolId != ''"> and A.ToolID = #{toolId,jdbcType=VARCHAR} </if> <if test="toolDescription != null and toolDescription != ''"> and A.ToolDescription = #{toolDescription,jdbcType=VARCHAR} </if> </where> order by A.ToolID </select></mapper>
|