Browse Source

商品详情、来源mapper

master
xyiege 4 years ago
parent
commit
d9bc9870b8
  1. 5
      conf/db.properties
  2. 1
      pom.xml
  3. 296
      src/main/java/cn/chjyj/szwh/bean/GoodsDetail.java
  4. 306
      src/main/java/cn/chjyj/szwh/bean/GoodsSource.java
  5. 4
      src/main/java/cn/chjyj/szwh/controller/admin/AdminGoodsController.java
  6. 10
      src/main/java/cn/chjyj/szwh/mapper/GoodsDetailMapper.java
  7. 10
      src/main/java/cn/chjyj/szwh/mapper/GoodsSourceMapper.java
  8. 105
      src/main/resources/mapper/szwh/GoodsDetailMapper.xml
  9. 103
      src/main/resources/mapper/szwh/GoodsSourceMapper.xml

5
conf/db.properties

@ -1,10 +1,11 @@
# 数据库服务器配置
type=com.alibaba.druid.pool.DruidDataSource
driver-class-name=com.mysql.cj.jdbc.Driver
#druid.url=jdbc:mysql://192.168.1.8:3306/szwhtrans?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
druid.url=jdbc:mysql://localhost:3306/szwhtrans?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
#druid.url=jdbc:mysql://192.168.1.8:3306/szwhtrans?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
#druid.username=szwhtrans
#druid.password=rRyPkT2XYW6mMRiX
druid.url=jdbc:mysql://localhost:3306/szwhtrans?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
druid.username=root
druid.password=xc1123
druid.initial-size=10

1
pom.xml

@ -36,6 +36,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.29</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

296
src/main/java/cn/chjyj/szwh/bean/GoodsDetail.java

@ -0,0 +1,296 @@
package cn.chjyj.szwh.bean;
import java.math.BigDecimal;
import java.util.Date;
/**
* 商品明细
*/
public class GoodsDetail {
/**
* goods_detail
* id,goods_name,goods_image,identifier,identifiers,stock,price,goods_ownership,goods_ownership_str,goods_type
* charges_type,goods_islicode,goods_entrust,contractual_period,earnest_money,transaction_class,contract
* otherIdentifiers,classification,source_islicode,source_islicode_name,source_url,source_status,data_json
* source_json,join_field,sourcedata_islicode,createtime,updatetime,is_deleted,is_join
*/
private Integer id;
private String goodsName; // 商品名称
private String goodsImage;//商品图片
private String identifier; //资源isli
private String identifiers; //合约ISLI标志码/商品ISLI编码
private Integer stock; //库存
private BigDecimal price; //单价
private Integer goodsOwnership;//商品类型;1:所有权;2:使用权
private String goodsOwnershipStr;//商品权属
private Integer goodsType; //商品类型;1:文化资源数据;2:文化数字内容
private Integer chargesType; //商品费用类型;1:免费;2:付费
private String goodsIslicode; //商品isli标识码
private Integer goodsEntrust; //商品委托类型;1:转让;2:许可
private Integer contractualPeriod; //委托周期;1:永久,2:单次,3:周期
private BigDecimal earnestMoney;//商品保证金
private Integer transactionClass; //交易种类;1:权属;2:商品
private String contract; //描述
private String otheridentifiers; //权属自有标识符(商品自有标识符)
private String classification; //标的商品的分类(交易种类为商品时候用的)
private String sourceIslicode; //资源isli标识码
private String sourceIslicodeName; //资源名称
private String sourceUrl; //资源下载链接
private Integer sourceStatus; //资源下载状态
private String dataJson; //数据;json格式
private String sourceJson; //数据;json格式
private String joinField;
private String sourcedataIslicode;//sourceData里的islicode
private Date createtime;//创建时间
private Date updatetime;//修改时间
private Integer isDeleted;//删除状态;0:未删除;1:已删除
private Boolean isJoin;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getGoodsName() {
return goodsName;
}
public void setGoodsName(String goodsName) {
this.goodsName = goodsName;
}
public String getGoodsImage() {
return goodsImage;
}
public void setGoodsImage(String goodsImage) {
this.goodsImage = goodsImage;
}
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public String getIdentifiers() {
return identifiers;
}
public void setIdentifiers(String identifiers) {
this.identifiers = identifiers;
}
public Integer getStock() {
return stock;
}
public void setStock(Integer stock) {
this.stock = stock;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public Integer getGoodsOwnership() {
return goodsOwnership;
}
public void setGoodsOwnership(Integer goodsOwnership) {
this.goodsOwnership = goodsOwnership;
}
public String getGoodsOwnershipStr() {
return goodsOwnershipStr;
}
public void setGoodsOwnershipStr(String goodsOwnershipStr) {
this.goodsOwnershipStr = goodsOwnershipStr;
}
public Integer getGoodsType() {
return goodsType;
}
public void setGoodsType(Integer goodsType) {
this.goodsType = goodsType;
}
public Integer getChargesType() {
return chargesType;
}
public void setChargesType(Integer chargesType) {
this.chargesType = chargesType;
}
public String getGoodsIslicode() {
return goodsIslicode;
}
public void setGoodsIslicode(String goodsIslicode) {
this.goodsIslicode = goodsIslicode;
}
public Integer getGoodsEntrust() {
return goodsEntrust;
}
public void setGoodsEntrust(Integer goodsEntrust) {
this.goodsEntrust = goodsEntrust;
}
public Integer getContractualPeriod() {
return contractualPeriod;
}
public void setContractualPeriod(Integer contractualPeriod) {
this.contractualPeriod = contractualPeriod;
}
public BigDecimal getEarnestMoney() {
return earnestMoney;
}
public void setEarnestMoney(BigDecimal earnestMoney) {
this.earnestMoney = earnestMoney;
}
public Integer getTransactionClass() {
return transactionClass;
}
public void setTransactionClass(Integer transactionClass) {
this.transactionClass = transactionClass;
}
public String getContract() {
return contract;
}
public void setContract(String contract) {
this.contract = contract;
}
public String getOtheridentifiers() {
return otheridentifiers;
}
public void setOtheridentifiers(String otheridentifiers) {
this.otheridentifiers = otheridentifiers;
}
public String getClassification() {
return classification;
}
public void setClassification(String classification) {
this.classification = classification;
}
public String getSourceIslicode() {
return sourceIslicode;
}
public void setSourceIslicode(String sourceIslicode) {
this.sourceIslicode = sourceIslicode;
}
public String getSourceIslicodeName() {
return sourceIslicodeName;
}
public void setSourceIslicodeName(String sourceIslicodeName) {
this.sourceIslicodeName = sourceIslicodeName;
}
public String getSourceUrl() {
return sourceUrl;
}
public void setSourceUrl(String sourceUrl) {
this.sourceUrl = sourceUrl;
}
public Integer getSourceStatus() {
return sourceStatus;
}
public void setSourceStatus(Integer sourceStatus) {
this.sourceStatus = sourceStatus;
}
public String getDataJson() {
return dataJson;
}
public void setDataJson(String dataJson) {
this.dataJson = dataJson;
}
public String getSourceJson() {
return sourceJson;
}
public void setSourceJson(String sourceJson) {
this.sourceJson = sourceJson;
}
public String getJoinField() {
return joinField;
}
public void setJoinField(String joinField) {
this.joinField = joinField;
}
public String getSourcedataIslicode() {
return sourcedataIslicode;
}
public void setSourcedataIslicode(String sourcedataIslicode) {
this.sourcedataIslicode = sourcedataIslicode;
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
public Date getUpdatetime() {
return updatetime;
}
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
}
public Integer getIsDeleted() {
return isDeleted;
}
public void setIsDeleted(Integer isDeleted) {
this.isDeleted = isDeleted;
}
public Boolean getJoin() {
return isJoin;
}
public void setJoin(Boolean join) {
isJoin = join;
}
}

306
src/main/java/cn/chjyj/szwh/bean/GoodsSource.java

@ -0,0 +1,306 @@
package cn.chjyj.szwh.bean;
import java.io.Serializable;
import java.util.Date;
/**
* 商品资源
*/
public class GoodsSource {
/**
* goods_source
* id,goods_isli_code,servicecode,linkcode,publisherid,registrant,resolution_url,source_type,source_name_type,
* source_name,sourceIdentify,source_fragment,target_name,target_name_type,targetIdentify,target_fragment,targetFormat,
* source_data,target_data,metadataXml,cancellation_reason,cancellationtime,allocationtime,datatype,is_deleted
*
*/
private Integer id;
private String goodsIsliCode;//商品isli标识码
private String servicecode;//服务编码
private String linkcode;//isli编码
private Integer publisherid;//文化单位ID
private String registrant;//编码登记者(文化单位)
private String resolutionUrl;//解析地址-关联的目标资源地址URL
private String sourceType;//源类型;1图书/2:期刊/3:报纸/4:音像/5:音频/6:视频/7:其他文献/8:图片/9:文化产品
private String sourceNameType;//源名称类型-->源标识符类型:ISBN/ISLI/CN
/**
* 源名称
*/
private String sourceName;
/**
* 源标识符源标识符类型 + 源标识符ISBN000000XXXXXX
*/
private String sourceidentify;
/**
* 源片段
*/
private String sourceFragment;
/**
* 目标名称-->整体目标作品名称
*/
private String targetName;
/**
* 目标名称类型-->目标标识符类型ISBN/ISLI
*/
private String targetNameType;
/**
* 目标标识符-->整体目标标识符目标标识符类型 + 目标标识符ISBN000000XXXXXX
*/
private String targetidentify;
/**
* 目标片段
*/
private String targetFragment;
/**
* 目标类型服务关联创建的实体1其他文献/2音频/3视频/4图片/5文化产品
*/
private String targetformat;
/**
* isli元数据其他文献实体/音频实体/视频实体/ json格式
*/
private String sourceData;
/**
* isli元数据其他文献实体/音频实体/视频实体/ json格式
*/
private String targetData;
/**
* isli元数据其他文献实体/音频实体/视频实体/ json格式
*/
private String metadataxml;
/**
* 注销说明
*/
private String cancellationReason;
/**
* 注销时间
*/
private Date cancellationtime;
/**
* 分配日期
*/
private Date allocationtime;
/**
* 数据类型
*/
private Integer datatype;
/**
* 删除状态0未删除1已删除
*/
private Integer isDeleted;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getGoodsIsliCode() {
return goodsIsliCode;
}
public void setGoodsIsliCode(String goodsIsliCode) {
this.goodsIsliCode = goodsIsliCode;
}
public String getServicecode() {
return servicecode;
}
public void setServicecode(String servicecode) {
this.servicecode = servicecode;
}
public String getLinkcode() {
return linkcode;
}
public void setLinkcode(String linkcode) {
this.linkcode = linkcode;
}
public Integer getPublisherid() {
return publisherid;
}
public void setPublisherid(Integer publisherid) {
this.publisherid = publisherid;
}
public String getRegistrant() {
return registrant;
}
public void setRegistrant(String registrant) {
this.registrant = registrant;
}
public String getResolutionUrl() {
return resolutionUrl;
}
public void setResolutionUrl(String resolutionUrl) {
this.resolutionUrl = resolutionUrl;
}
public String getSourceType() {
return sourceType;
}
public void setSourceType(String sourceType) {
this.sourceType = sourceType;
}
public String getSourceNameType() {
return sourceNameType;
}
public void setSourceNameType(String sourceNameType) {
this.sourceNameType = sourceNameType;
}
public String getSourceName() {
return sourceName;
}
public void setSourceName(String sourceName) {
this.sourceName = sourceName;
}
public String getSourceidentify() {
return sourceidentify;
}
public void setSourceidentify(String sourceidentify) {
this.sourceidentify = sourceidentify;
}
public String getSourceFragment() {
return sourceFragment;
}
public void setSourceFragment(String sourceFragment) {
this.sourceFragment = sourceFragment;
}
public String getTargetName() {
return targetName;
}
public void setTargetName(String targetName) {
this.targetName = targetName;
}
public String getTargetNameType() {
return targetNameType;
}
public void setTargetNameType(String targetNameType) {
this.targetNameType = targetNameType;
}
public String getTargetidentify() {
return targetidentify;
}
public void setTargetidentify(String targetidentify) {
this.targetidentify = targetidentify;
}
public String getTargetFragment() {
return targetFragment;
}
public void setTargetFragment(String targetFragment) {
this.targetFragment = targetFragment;
}
public String getTargetformat() {
return targetformat;
}
public void setTargetformat(String targetformat) {
this.targetformat = targetformat;
}
public String getSourceData() {
return sourceData;
}
public void setSourceData(String sourceData) {
this.sourceData = sourceData;
}
public String getTargetData() {
return targetData;
}
public void setTargetData(String targetData) {
this.targetData = targetData;
}
public String getMetadataxml() {
return metadataxml;
}
public void setMetadataxml(String metadataxml) {
this.metadataxml = metadataxml;
}
public String getCancellationReason() {
return cancellationReason;
}
public void setCancellationReason(String cancellationReason) {
this.cancellationReason = cancellationReason;
}
public Date getCancellationtime() {
return cancellationtime;
}
public void setCancellationtime(Date cancellationtime) {
this.cancellationtime = cancellationtime;
}
public Date getAllocationtime() {
return allocationtime;
}
public void setAllocationtime(Date allocationtime) {
this.allocationtime = allocationtime;
}
public Integer getDatatype() {
return datatype;
}
public void setDatatype(Integer datatype) {
this.datatype = datatype;
}
public Integer getIsDeleted() {
return isDeleted;
}
public void setIsDeleted(Integer isDeleted) {
this.isDeleted = isDeleted;
}
}

4
src/main/java/cn/chjyj/szwh/controller/admin/AdminGoodsController.java

@ -13,7 +13,7 @@ import java.util.List;
@Controller
@RequestMapping(value = "/admin/goods.Goods",method = {RequestMethod.GET,RequestMethod.POST})
@RequestMapping(value = "/admin/Goods",method = {RequestMethod.GET,RequestMethod.POST})
public class AdminGoodsController {
@Autowired
private GoodsService goodsService;
@ -23,7 +23,7 @@ public class AdminGoodsController {
* @return
*/
@RequestMapping("/list")
public String list(String page){
public String list(@RequestParam(name = "page",defaultValue = "1") String page){
int ipage=Integer.parseInt(page);
List<Goods> goodsList = goodsService.getGoodsList(ipage);
// convert to json

10
src/main/java/cn/chjyj/szwh/mapper/GoodsDetailMapper.java

@ -0,0 +1,10 @@
package cn.chjyj.szwh.mapper;
import org.springframework.stereotype.Component;
/**
* 商品详情
*/
@Component
public interface GoodsDetailMapper {
}

10
src/main/java/cn/chjyj/szwh/mapper/GoodsSourceMapper.java

@ -0,0 +1,10 @@
package cn.chjyj.szwh.mapper;
import org.springframework.stereotype.Component;
/**
* 商品来源
*/
@Component
public interface GoodsSourceMapper {
}

105
src/main/resources/mapper/szwh/GoodsDetailMapper.xml

@ -0,0 +1,105 @@
<?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="cn.chjyj.szwh.mapper.GoodsDetailMapper">
<sql id="column">
id,goods_name as goodsName,goods_image as goodsImage,identifier,identifiers,stock,price,goods_ownership as goodsOwnership,
goods_ownership_str as goodsOwnershipStr,goods_type as goodsType,
charges_type as chargesType,goods_islicode as goodsIslicode,goods_entrust as goodsEntrust,
contractual_period as contractualPeriod,earnest_money as earnestMoney ,transaction_class as transactionClass,contract,
otherIdentifiers,classification,source_islicode as sourceIslicode,
source_islicode_name as sourceIslicodeName,source_url as sourceUrl,source_status as sourceStatus,
data_json as dataJson,source_json as sourceJson,join_field as joinField,
sourcedata_islicode as sourcedataIslicode,createtime,updatetime,is_deleted as isDeleted,is_join as isJoin
</sql>
<sql id="tbName">goods_detail</sql>
<!--查询记录列表-->
<select id="getGoodsList" parameterType="java.lang.Integer" resultType="cn.chjyj.szwh.bean.Goods">
WITH mm as (select * from
<include refid="tbName"/>
where id>#{startRs} limit #{pageSize}
)SELECT * FROM mm ORDER BY id DESC;
</select>
<!--根据uid查询用户-->
<select id="getUserByUid" parameterType="java.lang.Integer" resultType="cn.chjyj.szwh.bean.Goods">
select <include refid="column"/>
from <include refid="tbName"/>
where uid=#{uid}
</select>
<!--查询用户名,加上密码-->
<select id="getUserByUname" parameterType="java.lang.String" resultType="cn.chjyj.szwh.bean.Goods">
select <include refid="column"/>,password
from <include refid="tbName"/>
where uname=#{uname} limit 1;
</select>
<!--查询用户-->
<select id="getSingleUserByOpenid" parameterType="java.lang.String" resultType="cn.chjyj.szwh.bean.Goods">
select <include refid="column"/> from
<include refid="tbName"/>
where openid=#{openid};
</select>
<!--新增用户-->
<insert id="addUser" parameterType="cn.chjyj.szwh.bean.Goods" useGeneratedKeys="true" keyColumn="uid">
insert into <include refid="tbName"/>
(uname,password,gender,urealname,ubirth,nickname,avatarurl,platfrom,sessionkey,openid)
values (
#{uname},
#{password},
#{gender},
#{urealname},
#{ubirth},
#{nickname},
#{avatarurl},
#{platfrom},
#{sessionkey},
#{openid}
)
</insert>
<update id="upUser" parameterType="cn.chjyj.szwh.bean.Goods">
update <include refid="tbName"/>
set
<if test="password!=null">
password=#{password},
</if>
<if test="urealname!=null">
urealname=#{urealname},
</if>
<if test="ubirth!=null">
ubirth =#{ubirth},
</if>
<if test="gender!=null">
gender=#{gender},
</if>
<if test="nickName!=null">
nickname=#{nickName},
</if>
<if test="avatarurl!=null">
avatarurl=#{avatarurl},
</if>
<if test="nickname!=null">
nickname=#{nickname},
</if>
<if test="platfrom!=null">
platfrom=#{platfrom},
</if>
<if test="sessionkey!=null">
sessionkey=#{sessionkey},
</if>
<if test="openid!=null">
openid=#{openid},
</if>
uname=#{uname}
where uid=#{uid};
</update>
</mapper>

103
src/main/resources/mapper/szwh/GoodsSourceMapper.xml

@ -0,0 +1,103 @@
<?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="cn.chjyj.szwh.mapper.GoodsSourceMapper">
<sql id="column">
id,goods_isli_code as goodsIsliCode,servicecode,linkcode,publisherid,registrant,
resolution_url as resolutionUrl,source_type as sourceType,source_name_type as sourceNameType,
source_name as sourceName,sourceIdentify,source_fragment as sourceFragment,
target_name as targetName,target_name_type as targetNameType,targetIdentify,
target_fragment as targetFragment,targetFormat,source_data as sourceData,
target_data as targetData,metadataXml,cancellation_reason as cancellationReason,
cancellationtime,allocationtime,datatype,is_deleted as isDeleted
</sql>
<sql id="tbName">goods_source</sql>
<!--查询记录列表-->
<select id="getGoodsList" parameterType="java.lang.Integer" resultType="cn.chjyj.szwh.bean.Goods">
WITH mm as (select * from
<include refid="tbName"/>
where id>#{startRs} limit #{pageSize}
)SELECT * FROM mm ORDER BY id DESC;
</select>
<!--根据uid查询用户-->
<select id="getUserByUid" parameterType="java.lang.Integer" resultType="cn.chjyj.szwh.bean.Goods">
select <include refid="column"/>
from <include refid="tbName"/>
where uid=#{uid}
</select>
<!--查询用户名,加上密码-->
<select id="getUserByUname" parameterType="java.lang.String" resultType="cn.chjyj.szwh.bean.Goods">
select <include refid="column"/>,password
from <include refid="tbName"/>
where uname=#{uname} limit 1;
</select>
<!--查询用户-->
<select id="getSingleUserByOpenid" parameterType="java.lang.String" resultType="cn.chjyj.szwh.bean.Goods">
select <include refid="column"/> from
<include refid="tbName"/>
where openid=#{openid};
</select>
<!--新增用户-->
<insert id="addUser" parameterType="cn.chjyj.szwh.bean.Goods" useGeneratedKeys="true" keyColumn="uid">
insert into <include refid="tbName"/>
(uname,password,gender,urealname,ubirth,nickname,avatarurl,platfrom,sessionkey,openid)
values (
#{uname},
#{password},
#{gender},
#{urealname},
#{ubirth},
#{nickname},
#{avatarurl},
#{platfrom},
#{sessionkey},
#{openid}
)
</insert>
<update id="upUser" parameterType="cn.chjyj.szwh.bean.Goods">
update <include refid="tbName"/>
set
<if test="password!=null">
password=#{password},
</if>
<if test="urealname!=null">
urealname=#{urealname},
</if>
<if test="ubirth!=null">
ubirth =#{ubirth},
</if>
<if test="gender!=null">
gender=#{gender},
</if>
<if test="nickName!=null">
nickname=#{nickName},
</if>
<if test="avatarurl!=null">
avatarurl=#{avatarurl},
</if>
<if test="nickname!=null">
nickname=#{nickname},
</if>
<if test="platfrom!=null">
platfrom=#{platfrom},
</if>
<if test="sessionkey!=null">
sessionkey=#{sessionkey},
</if>
<if test="openid!=null">
openid=#{openid},
</if>
uname=#{uname}
where uid=#{uid};
</update>
</mapper>
Loading…
Cancel
Save