40 lines
1.7 KiB
XML
40 lines
1.7 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.bonus.material.contract.mapper.BmContractMapper">
|
|
<insert id="add" useGeneratedKeys="true" keyProperty="id">
|
|
insert into bm_contract(contract_code, contract_name, status, create_time, owner_id, owner_com)
|
|
values(#{contractCode}, #{contractName}, #{status}, now(), #{ownerId}, #{ownerCom})
|
|
</insert>
|
|
<update id="edit">
|
|
update bm_contract set
|
|
contract_name = #{contractName},
|
|
owner_id = #{ownerId},
|
|
owner_com = #{ownerCom},
|
|
update_time = now()
|
|
where id = #{id}
|
|
</update>
|
|
<delete id="del">
|
|
delete from bm_contract where id = #{id}
|
|
</delete>
|
|
|
|
<select id="list" resultType="com.bonus.material.contract.domain.BmContract">
|
|
select id, contract_code as contractCode, contract_name as contractName, status, create_time as createTime, update_time as updateTime, owner_id as ownerId, owner_com as ownerCom from bm_contract
|
|
<where>
|
|
owner_com = #{ownerCom}
|
|
<if test="contractCode != null and contractCode != ''">
|
|
and contract_code like concat('%', #{contractCode}, '%')
|
|
</if>
|
|
<if test="contractName != null and contractName != ''">
|
|
and contract_name like concat('%', #{contractName}, '%')
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="selectTaskNumByMonth" resultType="java.lang.String">
|
|
SELECT SUBSTRING(contract_code, - 4) as code
|
|
FROM bm_contract
|
|
WHERE DATE_FORMAT(create_time, '%y%m') = DATE_FORMAT(#{date}, '%y%m')
|
|
ORDER BY create_time DESC LIMIT 1
|
|
</select>
|
|
</mapper> |