开发合同功能

This commit is contained in:
huangdeliang
2020-10-24 01:03:24 +08:00
parent d69e56371b
commit ca26281832
14 changed files with 1046 additions and 107 deletions

View File

@ -0,0 +1,114 @@
package com.ruoyi.custom.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 合同对象 sys_contract
*
* @author wonder
* @date 2020-10-23
*/
public class SysContract extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 合同编号 */
@Excel(name = "合同编号")
private Long id;
/** 客户姓名 */
@Excel(name = "客户姓名")
private String name;
/** 电话 */
@Excel(name = "电话")
private String phone;
/** 服务时间 */
@Excel(name = "服务时间")
private Integer serveTime;
/** 金额 */
@Excel(name = "金额")
private BigDecimal amount;
/** 文件路径 */
@Excel(name = "文件路径")
private String path;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setServeTime(Integer serveTime)
{
this.serveTime = serveTime;
}
public Integer getServeTime()
{
return serveTime;
}
public void setAmount(BigDecimal amount)
{
this.amount = amount;
}
public BigDecimal getAmount()
{
return amount;
}
public void setPath(String path)
{
this.path = path;
}
public String getPath()
{
return path;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("phone", getPhone())
.append("serveTime", getServeTime())
.append("amount", getAmount())
.append("path", getPath())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.custom.mapper;
import java.util.List;
import com.ruoyi.custom.domain.SysContract;
/**
* 合同Mapper接口
*
* @author wonder
* @date 2020-10-23
*/
public interface SysContractMapper
{
/**
* 查询合同
*
* @param id 合同ID
* @return 合同
*/
public SysContract selectSysContractById(Long id);
/**
* 查询合同列表
*
* @param sysContract 合同
* @return 合同集合
*/
public List<SysContract> selectSysContractList(SysContract sysContract);
/**
* 新增合同
*
* @param sysContract 合同
* @return 结果
*/
public int insertSysContract(SysContract sysContract);
/**
* 修改合同
*
* @param sysContract 合同
* @return 结果
*/
public int updateSysContract(SysContract sysContract);
/**
* 删除合同
*
* @param id 合同ID
* @return 结果
*/
public int deleteSysContractById(Long id);
/**
* 批量删除合同
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysContractByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.custom.service;
import java.util.List;
import com.ruoyi.custom.domain.SysContract;
/**
* 合同Service接口
*
* @author wonder
* @date 2020-10-23
*/
public interface ISysContractService
{
/**
* 查询合同
*
* @param id 合同ID
* @return 合同
*/
public SysContract selectSysContractById(Long id);
/**
* 查询合同列表
*
* @param sysContract 合同
* @return 合同集合
*/
public List<SysContract> selectSysContractList(SysContract sysContract);
/**
* 新增合同
*
* @param sysContract 合同
* @return 结果
*/
public int insertSysContract(SysContract sysContract);
/**
* 修改合同
*
* @param sysContract 合同
* @return 结果
*/
public int updateSysContract(SysContract sysContract);
/**
* 批量删除合同
*
* @param ids 需要删除的合同ID
* @return 结果
*/
public int deleteSysContractByIds(Long[] ids);
/**
* 删除合同信息
*
* @param id 合同ID
* @return 结果
*/
public int deleteSysContractById(Long id);
}

View File

@ -0,0 +1,96 @@
package com.ruoyi.custom.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.custom.mapper.SysContractMapper;
import com.ruoyi.custom.domain.SysContract;
import com.ruoyi.custom.service.ISysContractService;
/**
* 合同Service业务层处理
*
* @author wonder
* @date 2020-10-23
*/
@Service
public class SysContractServiceImpl implements ISysContractService
{
@Autowired
private SysContractMapper sysContractMapper;
/**
* 查询合同
*
* @param id 合同ID
* @return 合同
*/
@Override
public SysContract selectSysContractById(Long id)
{
return sysContractMapper.selectSysContractById(id);
}
/**
* 查询合同列表
*
* @param sysContract 合同
* @return 合同
*/
@Override
public List<SysContract> selectSysContractList(SysContract sysContract)
{
return sysContractMapper.selectSysContractList(sysContract);
}
/**
* 新增合同
*
* @param sysContract 合同
* @return 结果
*/
@Override
public int insertSysContract(SysContract sysContract)
{
sysContract.setCreateTime(DateUtils.getNowDate());
return sysContractMapper.insertSysContract(sysContract);
}
/**
* 修改合同
*
* @param sysContract 合同
* @return 结果
*/
@Override
public int updateSysContract(SysContract sysContract)
{
sysContract.setUpdateTime(DateUtils.getNowDate());
return sysContractMapper.updateSysContract(sysContract);
}
/**
* 批量删除合同
*
* @param ids 需要删除的合同ID
* @return 结果
*/
@Override
public int deleteSysContractByIds(Long[] ids)
{
return sysContractMapper.deleteSysContractByIds(ids);
}
/**
* 删除合同信息
*
* @param id 合同ID
* @return 结果
*/
@Override
public int deleteSysContractById(Long id)
{
return sysContractMapper.deleteSysContractById(id);
}
}

View File

@ -0,0 +1,95 @@
<?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.ruoyi.custom.mapper.SysContractMapper">
<resultMap type="SysContract" id="SysContractResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="phone" column="phone" />
<result property="serveTime" column="serve_time" />
<result property="amount" column="amount" />
<result property="path" column="path" />
<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="remark" column="remark" />
</resultMap>
<sql id="selectSysContractVo">
select id, name, phone, serve_time, amount, path, create_by, create_time, update_by, update_time, remark from sys_contract
</sql>
<select id="selectSysContractList" parameterType="SysContract" resultMap="SysContractResult">
<include refid="selectSysContractVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
</where>
</select>
<select id="selectSysContractById" parameterType="Long" resultMap="SysContractResult">
<include refid="selectSysContractVo"/>
where id = #{id}
</select>
<insert id="insertSysContract" parameterType="SysContract" useGeneratedKeys="true" keyProperty="id">
insert into sys_contract
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="phone != null">phone,</if>
<if test="serveTime != null">serve_time,</if>
<if test="amount != null">amount,</if>
<if test="path != null">path,</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>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="phone != null">#{phone},</if>
<if test="serveTime != null">#{serveTime},</if>
<if test="amount != null">#{amount},</if>
<if test="path != null">#{path},</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>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSysContract" parameterType="SysContract">
update sys_contract
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="serveTime != null">serve_time = #{serveTime},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="path != null">path = #{path},</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>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysContractById" parameterType="Long">
delete from sys_contract where id = #{id}
</delete>
<delete id="deleteSysContractByIds" parameterType="String">
delete from sys_contract where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>