@ -1,26 +0,0 @@ | |||
package com.ruoyi.applet.contoller; | |||
import com.ruoyi.common.core.controller.BaseController; | |||
import com.ruoyi.common.core.page.TableDataInfo; | |||
import com.ruoyi.model.service.IPetTypeService; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
@Api(description = "宠物类型管理") | |||
@RestController | |||
@RequestMapping("/applet/petType") | |||
public class AppletPetTypeController extends BaseController { | |||
@Autowired | |||
private IPetTypeService petTypeService; | |||
@ApiOperation("宠物类型列表") | |||
@GetMapping("/list") | |||
public TableDataInfo list(){ | |||
return getDataTable(petTypeService.getPetTypeList()); | |||
} | |||
} |
@ -1,104 +0,0 @@ | |||
package com.ruoyi.model.controller; | |||
import java.io.IOException; | |||
import java.util.List; | |||
import javax.servlet.http.HttpServletResponse; | |||
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.model.domain.PetType; | |||
import com.ruoyi.model.service.IPetTypeService; | |||
import com.ruoyi.common.utils.poi.ExcelUtil; | |||
import com.ruoyi.common.core.page.TableDataInfo; | |||
/** | |||
* 宠物类型Controller | |||
* | |||
* @author ruoyi | |||
* @date 2025-03-05 | |||
*/ | |||
@RestController | |||
@RequestMapping("/model/petType") | |||
public class PetTypeController extends BaseController | |||
{ | |||
@Autowired | |||
private IPetTypeService petTypeService; | |||
/** | |||
* 查询宠物类型列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('model:petType:list')") | |||
@GetMapping("/list") | |||
public TableDataInfo list(PetType petType) | |||
{ | |||
startPage(); | |||
List<PetType> list = petTypeService.selectPetTypeList(petType); | |||
return getDataTable(list); | |||
} | |||
/** | |||
* 导出宠物类型列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('model:petType:export')") | |||
@Log(title = "宠物类型", businessType = BusinessType.EXPORT) | |||
@PostMapping("/export") | |||
public void export(HttpServletResponse response, PetType petType) throws IOException { | |||
List<PetType> list = petTypeService.selectPetTypeList(petType); | |||
ExcelUtil<PetType> util = new ExcelUtil<PetType>(PetType.class); | |||
util.exportExcel(response, list, "宠物类型数据"); | |||
} | |||
/** | |||
* 获取宠物类型详细信息 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('model:petType:query')") | |||
@GetMapping(value = "/{petTypeId}") | |||
public AjaxResult getInfo(@PathVariable("petTypeId") Long petTypeId) | |||
{ | |||
return success(petTypeService.selectPetTypeByPetTypeId(petTypeId)); | |||
} | |||
/** | |||
* 新增宠物类型 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('model:petType:add')") | |||
@Log(title = "宠物类型", businessType = BusinessType.INSERT) | |||
@PostMapping | |||
public AjaxResult add(@RequestBody PetType petType) | |||
{ | |||
return toAjax(petTypeService.insertPetType(petType)); | |||
} | |||
/** | |||
* 修改宠物类型 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('model:petType:edit')") | |||
@Log(title = "宠物类型", businessType = BusinessType.UPDATE) | |||
@PutMapping | |||
public AjaxResult edit(@RequestBody PetType petType) | |||
{ | |||
return toAjax(petTypeService.updatePetType(petType)); | |||
} | |||
/** | |||
* 删除宠物类型 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('model:petType:remove')") | |||
@Log(title = "宠物类型", businessType = BusinessType.DELETE) | |||
@DeleteMapping("/{petTypeIds}") | |||
public AjaxResult remove(@PathVariable Long[] petTypeIds) | |||
{ | |||
return toAjax(petTypeService.deletePetTypeByPetTypeIds(petTypeIds)); | |||
} | |||
} |
@ -1,96 +0,0 @@ | |||
package com.ruoyi.model.domain; | |||
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; | |||
/** | |||
* 宠物类型对象 pet_type | |||
* | |||
* @author ruoyi | |||
* @date 2025-03-05 | |||
*/ | |||
public class PetType extends BaseEntity | |||
{ | |||
private static final long serialVersionUID = 1L; | |||
/** 宠物类型编号 */ | |||
private Long petTypeId; | |||
/** 宠物类型图片 */ | |||
@Excel(name = "宠物类型图片") | |||
private String petTypeImage; | |||
/** 宠物类型名 */ | |||
@Excel(name = "宠物类型名") | |||
private String petTypeName; | |||
/** 备注 */ | |||
@Excel(name = "备注") | |||
private String reamk; | |||
/** 删除标识 */ | |||
private Integer delFlag; | |||
public void setPetTypeId(Long petTypeId) | |||
{ | |||
this.petTypeId = petTypeId; | |||
} | |||
public Long getPetTypeId() | |||
{ | |||
return petTypeId; | |||
} | |||
public void setPetTypeImage(String petTypeImage) | |||
{ | |||
this.petTypeImage = petTypeImage; | |||
} | |||
public String getPetTypeImage() | |||
{ | |||
return petTypeImage; | |||
} | |||
public void setPetTypeName(String petTypeName) | |||
{ | |||
this.petTypeName = petTypeName; | |||
} | |||
public String getPetTypeName() | |||
{ | |||
return petTypeName; | |||
} | |||
public void setReamk(String reamk) | |||
{ | |||
this.reamk = reamk; | |||
} | |||
public String getReamk() | |||
{ | |||
return reamk; | |||
} | |||
public void setDelFlag(Integer delFlag) | |||
{ | |||
this.delFlag = delFlag; | |||
} | |||
public Integer getDelFlag() | |||
{ | |||
return delFlag; | |||
} | |||
@Override | |||
public String toString() { | |||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |||
.append("petTypeId", getPetTypeId()) | |||
.append("petTypeImage", getPetTypeImage()) | |||
.append("petTypeName", getPetTypeName()) | |||
.append("reamk", getReamk()) | |||
.append("createTime", getCreateTime()) | |||
.append("createBy", getCreateBy()) | |||
.append("updateTime", getUpdateTime()) | |||
.append("updateBy", getUpdateBy()) | |||
.append("delFlag", getDelFlag()) | |||
.toString(); | |||
} | |||
} |
@ -1,68 +0,0 @@ | |||
package com.ruoyi.model.mapper; | |||
import java.util.List; | |||
import com.ruoyi.model.domain.PetType; | |||
/** | |||
* 宠物类型Mapper接口 | |||
* | |||
* @author ruoyi | |||
* @date 2025-03-05 | |||
*/ | |||
public interface PetTypeMapper | |||
{ | |||
/** | |||
* 查询宠物类型 | |||
* | |||
* @param petTypeId 宠物类型主键 | |||
* @return 宠物类型 | |||
*/ | |||
public PetType selectPetTypeByPetTypeId(Long petTypeId); | |||
/** | |||
* 查询宠物类型列表 | |||
* | |||
* @param petType 宠物类型 | |||
* @return 宠物类型集合 | |||
*/ | |||
public List<PetType> selectPetTypeList(PetType petType); | |||
/** | |||
* 新增宠物类型 | |||
* | |||
* @param petType 宠物类型 | |||
* @return 结果 | |||
*/ | |||
public int insertPetType(PetType petType); | |||
/** | |||
* 修改宠物类型 | |||
* | |||
* @param petType 宠物类型 | |||
* @return 结果 | |||
*/ | |||
public int updatePetType(PetType petType); | |||
/** | |||
* 删除宠物类型 | |||
* | |||
* @param petTypeId 宠物类型主键 | |||
* @return 结果 | |||
*/ | |||
public int deletePetTypeByPetTypeId(Long petTypeId); | |||
/** | |||
* 批量删除宠物类型 | |||
* | |||
* @param petTypeIds 需要删除的数据主键集合 | |||
* @return 结果 | |||
*/ | |||
public int deletePetTypeByPetTypeIds(Long[] petTypeIds); | |||
/** | |||
* 查询宠物类型列表 | |||
* | |||
* @return 宠物类型集合 | |||
*/ | |||
List<PetType> getPetTypeList(); | |||
} |
@ -1,68 +0,0 @@ | |||
package com.ruoyi.model.service; | |||
import java.util.List; | |||
import com.ruoyi.model.domain.PetType; | |||
/** | |||
* 宠物类型Service接口 | |||
* | |||
* @author ruoyi | |||
* @date 2025-03-05 | |||
*/ | |||
public interface IPetTypeService | |||
{ | |||
/** | |||
* 查询宠物类型 | |||
* | |||
* @param petTypeId 宠物类型主键 | |||
* @return 宠物类型 | |||
*/ | |||
public PetType selectPetTypeByPetTypeId(Long petTypeId); | |||
/** | |||
* 查询宠物类型列表 | |||
* | |||
* @param petType 宠物类型 | |||
* @return 宠物类型集合 | |||
*/ | |||
public List<PetType> selectPetTypeList(PetType petType); | |||
/** | |||
* 新增宠物类型 | |||
* | |||
* @param petType 宠物类型 | |||
* @return 结果 | |||
*/ | |||
public int insertPetType(PetType petType); | |||
/** | |||
* 修改宠物类型 | |||
* | |||
* @param petType 宠物类型 | |||
* @return 结果 | |||
*/ | |||
public int updatePetType(PetType petType); | |||
/** | |||
* 批量删除宠物类型 | |||
* | |||
* @param petTypeIds 需要删除的宠物类型主键集合 | |||
* @return 结果 | |||
*/ | |||
public int deletePetTypeByPetTypeIds(Long[] petTypeIds); | |||
/** | |||
* 删除宠物类型信息 | |||
* | |||
* @param petTypeId 宠物类型主键 | |||
* @return 结果 | |||
*/ | |||
public int deletePetTypeByPetTypeId(Long petTypeId); | |||
/** | |||
* 查询宠物类型列表 | |||
* | |||
* @return 宠物类型集合 | |||
*/ | |||
public List<PetType> getPetTypeList(); | |||
} |
@ -1,106 +0,0 @@ | |||
package com.ruoyi.model.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.model.mapper.PetTypeMapper; | |||
import com.ruoyi.model.domain.PetType; | |||
import com.ruoyi.model.service.IPetTypeService; | |||
/** | |||
* 宠物类型Service业务层处理 | |||
* | |||
* @author ruoyi | |||
* @date 2025-03-05 | |||
*/ | |||
@Service | |||
public class PetTypeServiceImpl implements IPetTypeService | |||
{ | |||
@Autowired | |||
private PetTypeMapper petTypeMapper; | |||
/** | |||
* 查询宠物类型 | |||
* | |||
* @param petTypeId 宠物类型主键 | |||
* @return 宠物类型 | |||
*/ | |||
@Override | |||
public PetType selectPetTypeByPetTypeId(Long petTypeId) | |||
{ | |||
return petTypeMapper.selectPetTypeByPetTypeId(petTypeId); | |||
} | |||
/** | |||
* 查询宠物类型列表 | |||
* | |||
* @param petType 宠物类型 | |||
* @return 宠物类型 | |||
*/ | |||
@Override | |||
public List<PetType> selectPetTypeList(PetType petType) | |||
{ | |||
return petTypeMapper.selectPetTypeList(petType); | |||
} | |||
/** | |||
* 新增宠物类型 | |||
* | |||
* @param petType 宠物类型 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public int insertPetType(PetType petType) | |||
{ | |||
petType.setCreateTime(DateUtils.getNowDate()); | |||
return petTypeMapper.insertPetType(petType); | |||
} | |||
/** | |||
* 修改宠物类型 | |||
* | |||
* @param petType 宠物类型 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public int updatePetType(PetType petType) | |||
{ | |||
petType.setUpdateTime(DateUtils.getNowDate()); | |||
return petTypeMapper.updatePetType(petType); | |||
} | |||
/** | |||
* 批量删除宠物类型 | |||
* | |||
* @param petTypeIds 需要删除的宠物类型主键 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public int deletePetTypeByPetTypeIds(Long[] petTypeIds) | |||
{ | |||
return petTypeMapper.deletePetTypeByPetTypeIds(petTypeIds); | |||
} | |||
/** | |||
* 删除宠物类型信息 | |||
* | |||
* @param petTypeId 宠物类型主键 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public int deletePetTypeByPetTypeId(Long petTypeId) | |||
{ | |||
return petTypeMapper.deletePetTypeByPetTypeId(petTypeId); | |||
} | |||
/** | |||
* 查询宠物类型列表 | |||
* | |||
* @return 宠物类型集合 | |||
*/ | |||
@Override | |||
public List<PetType> getPetTypeList() { | |||
return petTypeMapper.getPetTypeList(); | |||
} | |||
} |
@ -1,91 +0,0 @@ | |||
<?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.model.mapper.PetTypeMapper"> | |||
<resultMap type="PetType" id="PetTypeResult"> | |||
<result property="petTypeId" column="pet_type_id" /> | |||
<result property="petTypeImage" column="pet_type_image" /> | |||
<result property="petTypeName" column="pet_type_name" /> | |||
<result property="reamk" column="reamk" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="createBy" column="create_by" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="updateBy" column="update_by" /> | |||
<result property="delFlag" column="del_flag" /> | |||
</resultMap> | |||
<sql id="selectPetTypeVo"> | |||
select pet_type_id, pet_type_image, pet_type_name, reamk, create_time, create_by, update_time, update_by, del_flag from pet_type | |||
</sql> | |||
<select id="selectPetTypeList" parameterType="PetType" resultMap="PetTypeResult"> | |||
<include refid="selectPetTypeVo"/> | |||
<where> | |||
<if test="petTypeImage != null and petTypeImage != ''"> and pet_type_image = #{petTypeImage}</if> | |||
<if test="petTypeName != null and petTypeName != ''"> and pet_type_name like concat('%', #{petTypeName}, '%')</if> | |||
<if test="reamk != null and reamk != ''"> and reamk = #{reamk}</if> | |||
</where> | |||
</select> | |||
<select id="selectPetTypeByPetTypeId" parameterType="Long" resultMap="PetTypeResult"> | |||
<include refid="selectPetTypeVo"/> | |||
where pet_type_id = #{petTypeId} | |||
</select> | |||
<select id="getPetTypeList" resultType="com.ruoyi.model.domain.PetType"> | |||
<include refid="selectPetTypeVo"/> | |||
</select> | |||
<insert id="insertPetType" parameterType="PetType"> | |||
insert into pet_type | |||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||
<if test="petTypeId != null">pet_type_id,</if> | |||
<if test="petTypeImage != null">pet_type_image,</if> | |||
<if test="petTypeName != null">pet_type_name,</if> | |||
<if test="reamk != null">reamk,</if> | |||
<if test="createTime != null">create_time,</if> | |||
<if test="createBy != null">create_by,</if> | |||
<if test="updateTime != null">update_time,</if> | |||
<if test="updateBy != null">update_by,</if> | |||
<if test="delFlag != null">del_flag,</if> | |||
</trim> | |||
<trim prefix="values (" suffix=")" suffixOverrides=","> | |||
<if test="petTypeId != null">#{petTypeId},</if> | |||
<if test="petTypeImage != null">#{petTypeImage},</if> | |||
<if test="petTypeName != null">#{petTypeName},</if> | |||
<if test="reamk != null">#{reamk},</if> | |||
<if test="createTime != null">#{createTime},</if> | |||
<if test="createBy != null">#{createBy},</if> | |||
<if test="updateTime != null">#{updateTime},</if> | |||
<if test="updateBy != null">#{updateBy},</if> | |||
<if test="delFlag != null">#{delFlag},</if> | |||
</trim> | |||
</insert> | |||
<update id="updatePetType" parameterType="PetType"> | |||
update pet_type | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="petTypeImage != null">pet_type_image = #{petTypeImage},</if> | |||
<if test="petTypeName != null">pet_type_name = #{petTypeName},</if> | |||
<if test="reamk != null">reamk = #{reamk},</if> | |||
<if test="createTime != null">create_time = #{createTime},</if> | |||
<if test="createBy != null">create_by = #{createBy},</if> | |||
<if test="updateTime != null">update_time = #{updateTime},</if> | |||
<if test="updateBy != null">update_by = #{updateBy},</if> | |||
<if test="delFlag != null">del_flag = #{delFlag},</if> | |||
</trim> | |||
where pet_type_id = #{petTypeId} | |||
</update> | |||
<delete id="deletePetTypeByPetTypeId" parameterType="Long"> | |||
delete from pet_type where pet_type_id = #{petTypeId} | |||
</delete> | |||
<delete id="deletePetTypeByPetTypeIds" parameterType="String"> | |||
delete from pet_type where pet_type_id in | |||
<foreach item="petTypeId" collection="array" open="(" separator="," close=")"> | |||
#{petTypeId} | |||
</foreach> | |||
</delete> | |||
</mapper> |