Commit 8ac9d293 authored by 盖献康's avatar 盖献康

车企信息 - 代码初始化

parent 3aba3bb5
package com.ruoyi.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
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;
/**
* 车企信息对象 t_automobile_enterprise
*
* @author gxk
* @date 2024-01-05
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TAutomobileEnterprise extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 企业名称 */
@Excel(name = "企业名称")
private String enterpriseName;
/** 地址 */
@Excel(name = "地址")
private String address;
/** 邮编 */
@Excel(name = "邮编")
private String postcode;
/** 企业联系人 */
@Excel(name = "企业联系人")
private String enterpriseContact;
/** 联系电话 */
@Excel(name = "联系电话")
private String contactNumber;
}
package com.ruoyi.mapper;
import java.util.List;
import com.ruoyi.domain.TAutomobileEnterprise;
/**
* 车企信息Mapper接口
*
* @author gxk
* @date 2024-01-05
*/
public interface TAutomobileEnterpriseMapper
{
/**
* 查询车企信息
*
* @param id 车企信息主键
* @return 车企信息
*/
public TAutomobileEnterprise selectTAutomobileEnterpriseById(Long id);
/**
* 查询车企信息列表
*
* @param tAutomobileEnterprise 车企信息
* @return 车企信息集合
*/
public List<TAutomobileEnterprise> selectTAutomobileEnterpriseList(TAutomobileEnterprise tAutomobileEnterprise);
/**
* 新增车企信息
*
* @param tAutomobileEnterprise 车企信息
* @return 结果
*/
public int insertTAutomobileEnterprise(TAutomobileEnterprise tAutomobileEnterprise);
/**
* 修改车企信息
*
* @param tAutomobileEnterprise 车企信息
* @return 结果
*/
public int updateTAutomobileEnterprise(TAutomobileEnterprise tAutomobileEnterprise);
/**
* 删除车企信息
*
* @param id 车企信息主键
* @return 结果
*/
public int deleteTAutomobileEnterpriseById(Long id);
/**
* 批量删除车企信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteTAutomobileEnterpriseByIds(Long[] ids);
}
package com.ruoyi.service;
import java.util.List;
import com.ruoyi.domain.TAutomobileEnterprise;
/**
* 车企信息Service接口
*
* @author gxk
* @date 2024-01-05
*/
public interface ITAutomobileEnterpriseService
{
/**
* 查询车企信息
*
* @param id 车企信息主键
* @return 车企信息
*/
public TAutomobileEnterprise selectTAutomobileEnterpriseById(Long id);
/**
* 查询车企信息列表
*
* @param tAutomobileEnterprise 车企信息
* @return 车企信息集合
*/
public List<TAutomobileEnterprise> selectTAutomobileEnterpriseList(TAutomobileEnterprise tAutomobileEnterprise);
/**
* 新增车企信息
*
* @param tAutomobileEnterprise 车企信息
* @return 结果
*/
public int insertTAutomobileEnterprise(TAutomobileEnterprise tAutomobileEnterprise);
/**
* 修改车企信息
*
* @param tAutomobileEnterprise 车企信息
* @return 结果
*/
public int updateTAutomobileEnterprise(TAutomobileEnterprise tAutomobileEnterprise);
/**
* 批量删除车企信息
*
* @param ids 需要删除的车企信息主键集合
* @return 结果
*/
public int deleteTAutomobileEnterpriseByIds(Long[] ids);
/**
* 删除车企信息信息
*
* @param id 车企信息主键
* @return 结果
*/
public int deleteTAutomobileEnterpriseById(Long id);
}
package com.ruoyi.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mapper.TAutomobileEnterpriseMapper;
import com.ruoyi.domain.TAutomobileEnterprise;
import com.ruoyi.service.ITAutomobileEnterpriseService;
/**
* 车企信息Service业务层处理
*
* @author gxk
* @date 2024-01-05
*/
@Service
public class TAutomobileEnterpriseServiceImpl implements ITAutomobileEnterpriseService
{
@Autowired
private TAutomobileEnterpriseMapper tAutomobileEnterpriseMapper;
/**
* 查询车企信息
*
* @param id 车企信息主键
* @return 车企信息
*/
@Override
public TAutomobileEnterprise selectTAutomobileEnterpriseById(Long id)
{
return tAutomobileEnterpriseMapper.selectTAutomobileEnterpriseById(id);
}
/**
* 查询车企信息列表
*
* @param tAutomobileEnterprise 车企信息
* @return 车企信息
*/
@Override
public List<TAutomobileEnterprise> selectTAutomobileEnterpriseList(TAutomobileEnterprise tAutomobileEnterprise)
{
return tAutomobileEnterpriseMapper.selectTAutomobileEnterpriseList(tAutomobileEnterprise);
}
/**
* 新增车企信息
*
* @param tAutomobileEnterprise 车企信息
* @return 结果
*/
@Override
public int insertTAutomobileEnterprise(TAutomobileEnterprise tAutomobileEnterprise)
{
tAutomobileEnterprise.setCreateTime(DateUtils.getNowDate());
tAutomobileEnterprise.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
return tAutomobileEnterpriseMapper.insertTAutomobileEnterprise(tAutomobileEnterprise);
}
/**
* 修改车企信息
*
* @param tAutomobileEnterprise 车企信息
* @return 结果
*/
@Override
public int updateTAutomobileEnterprise(TAutomobileEnterprise tAutomobileEnterprise)
{
tAutomobileEnterprise.setUpdateTime(DateUtils.getNowDate());
tAutomobileEnterprise.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
return tAutomobileEnterpriseMapper.updateTAutomobileEnterprise(tAutomobileEnterprise);
}
/**
* 批量删除车企信息
*
* @param ids 需要删除的车企信息主键
* @return 结果
*/
@Override
public int deleteTAutomobileEnterpriseByIds(Long[] ids)
{
return tAutomobileEnterpriseMapper.deleteTAutomobileEnterpriseByIds(ids);
}
/**
* 删除车企信息信息
*
* @param id 车企信息主键
* @return 结果
*/
@Override
public int deleteTAutomobileEnterpriseById(Long id)
{
return tAutomobileEnterpriseMapper.deleteTAutomobileEnterpriseById(id);
}
}
package com.ruoyi.web;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.annotation.Anonymous;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.TAutomobileEnterprise;
import com.ruoyi.service.ITAutomobileEnterpriseService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 车企信息Controller
*
* @author gxk
* @date 2024-01-05
*/
@RestController
@RequestMapping("/system/enterprise")
public class TAutomobileEnterpriseController extends BaseController
{
@Autowired
private ITAutomobileEnterpriseService tAutomobileEnterpriseService;
/**
* 查询车企信息列表
*/
@Anonymous
@GetMapping("/list")
public TableDataInfo list(TAutomobileEnterprise tAutomobileEnterprise)
{
startPage();
List<TAutomobileEnterprise> list = tAutomobileEnterpriseService.selectTAutomobileEnterpriseList(tAutomobileEnterprise);
return getDataTable(list);
}
/**
* 导出车企信息列表
*/
@Log(title = "车企信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TAutomobileEnterprise tAutomobileEnterprise)
{
List<TAutomobileEnterprise> list = tAutomobileEnterpriseService.selectTAutomobileEnterpriseList(tAutomobileEnterprise);
ExcelUtil<TAutomobileEnterprise> util = new ExcelUtil<TAutomobileEnterprise>(TAutomobileEnterprise.class);
util.exportExcel(response, list, "车企信息数据");
}
/**
* 获取车企信息详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(tAutomobileEnterpriseService.selectTAutomobileEnterpriseById(id));
}
/**
* 新增车企信息
*/
@Anonymous
@Log(title = "车企信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TAutomobileEnterprise tAutomobileEnterprise)
{
return toAjax(tAutomobileEnterpriseService.insertTAutomobileEnterprise(tAutomobileEnterprise));
}
/**
* 修改车企信息
*/
@Log(title = "车企信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TAutomobileEnterprise tAutomobileEnterprise)
{
return toAjax(tAutomobileEnterpriseService.updateTAutomobileEnterprise(tAutomobileEnterprise));
}
/**
* 删除车企信息
*/
@Log(title = "车企信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tAutomobileEnterpriseService.deleteTAutomobileEnterpriseByIds(ids));
}
}
<?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.mapper.TAutomobileEnterpriseMapper">
<resultMap type="com.ruoyi.domain.TAutomobileEnterprise" id="TAutomobileEnterpriseResult">
<result property="id" column="id"/>
<result property="enterpriseName" column="enterprise_name"/>
<result property="address" column="address"/>
<result property="postcode" column="postcode"/>
<result property="enterpriseContact" column="enterprise_contact"/>
<result property="contactNumber" column="contact_number"/>
<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="selectTAutomobileEnterpriseVo">
select id,
enterprise_name,
address,
postcode,
enterprise_contact,
contact_number,
create_by,
create_time,
update_by,
update_time
from t_automobile_enterprise
</sql>
<select id="selectTAutomobileEnterpriseList" parameterType="TAutomobileEnterprise"
resultMap="TAutomobileEnterpriseResult">
<include refid="selectTAutomobileEnterpriseVo"/>
<where>
<if test="enterpriseName != null and enterpriseName != ''">and enterprise_name like concat('%',
#{enterpriseName}, '%')
</if>
<if test="address != null and address != ''">and address = #{address}</if>
<if test="postcode != null and postcode != ''">and postcode = #{postcode}</if>
<if test="enterpriseContact != null and enterpriseContact != ''">and enterprise_contact =
#{enterpriseContact}
</if>
<if test="contactNumber != null and contactNumber != ''">and contact_number = #{contactNumber}</if>
</where>
</select>
<select id="selectTAutomobileEnterpriseById" parameterType="Long" resultMap="TAutomobileEnterpriseResult">
<include refid="selectTAutomobileEnterpriseVo"/>
where id = #{id}
</select>
<insert id="insertTAutomobileEnterprise" parameterType="TAutomobileEnterprise">
insert into t_automobile_enterprise
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="enterpriseName != null">enterprise_name,</if>
<if test="address != null">address,</if>
<if test="postcode != null">postcode,</if>
<if test="enterpriseContact != null">enterprise_contact,</if>
<if test="contactNumber != null">contact_number,</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="id != null">#{id},</if>
<if test="enterpriseName != null">#{enterpriseName},</if>
<if test="address != null">#{address},</if>
<if test="postcode != null">#{postcode},</if>
<if test="enterpriseContact != null">#{enterpriseContact},</if>
<if test="contactNumber != null">#{contactNumber},</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="updateTAutomobileEnterprise" parameterType="TAutomobileEnterprise">
update t_automobile_enterprise
<trim prefix="SET" suffixOverrides=",">
<if test="enterpriseName != null">enterprise_name = #{enterpriseName},</if>
<if test="address != null">address = #{address},</if>
<if test="postcode != null">postcode = #{postcode},</if>
<if test="enterpriseContact != null">enterprise_contact = #{enterpriseContact},</if>
<if test="contactNumber != null">contact_number = #{contactNumber},</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="deleteTAutomobileEnterpriseById" parameterType="Long">
delete
from t_automobile_enterprise
where id = #{id}
</delete>
<delete id="deleteTAutomobileEnterpriseByIds" parameterType="String">
delete from t_automobile_enterprise where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment